query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7a9d4e38d366123bfab85c96b93ff5ba
DELETE /facts/1 DELETE /facts/1.xml
[ { "docid": "de58440547f69126f011c58add922f95", "score": "0.64691776", "text": "def destroy\n @fact = Fact.find(params[:id])\n @informable = @fact.informable\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(@informable) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "80f1b33d12efeb0e91eb1d91c649e41b", "score": "0.7116206", "text": "def destroy\n @fact = Fact.find(params[:id])\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(facts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a152c1677cd427622d99c6b92d3595b0", "score": "0.7063063", "text": "def destroy\r\n @fact = Fact.find(params[:id])\r\n @fact.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(facts_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "e95b93f24aa800f57cbd76c0d1115fdf", "score": "0.6810842", "text": "def destroy\n @factoid = Factoid.find(params[:id])\n @factoid.destroy\n\n respond_to do |format|\n format.html { redirect_to(factoids_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "822ddea2e45bf78350003645efcbdb54", "score": "0.6631175", "text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end", "title": "" }, { "docid": "df26116eb86dbadafed7137f9e3c2f9e", "score": "0.66020525", "text": "def delete!\r\n return nil unless exists? \r\n xml = xml_at_top\r\n par = xml.instance_variable_get(:@parent) \r\n par['delete'] = 'delete'\r\n xml_on_delete( xml )\r\n rsp = write_xml_config!( xml.doc.root )\r\n @has[:_exist] = false\r\n true # rsp ... don't return XML, but let's hear from the community...\r\n end", "title": "" }, { "docid": "4ad4c906fb253cc802beb540be8f62b1", "score": "0.65502304", "text": "def destroy\n @inventory_fact = InventoryFact.find(params[:id])\n @inventory_fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_facts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "50daad814ad6a8b91ed71eff393d3a97", "score": "0.65265477", "text": "def destroy\n @factlect = Factlect.find(params[:id])\n @factlect.destroy\n\n respond_to do |format|\n format.html { redirect_to(factlects_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "bc50676408811af0fad90f3eed7f40fe", "score": "0.6515507", "text": "def destroy\n @quick_fact = QuickFact.find(params[:id])\n @quick_fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(quick_facts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a429d7925c78f8d889edeb2b0e26da6a", "score": "0.6498557", "text": "def delete(id)\r\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n \r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "title": "" }, { "docid": "d7afde97336b9ea717078334fe2216e8", "score": "0.64683586", "text": "def destroy\n @fact = Fact.find(params[:id])\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to facts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3feaeabdf61312a33502b61af2c19927", "score": "0.6429805", "text": "def destroy\n @assertion = Assertion.find(params[:id])\n @assertion.destroy\n\n respond_to do |format|\n format.html { redirect_to(assertions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "404f1ce1244d407e57a94b6867c217e3", "score": "0.63860345", "text": "def destroy\n @site_factoid = SiteFactoid.find(params[:id])\n @site_factoid.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_factoids_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a1f3697acf1583bd58e082634c34456b", "score": "0.63621897", "text": "def delete(id)\r\n\t\trequest = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\r\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\r\n\t\tresponse = http.request(request)\r\n\r\n\t\t# no response body will be returned\r\n\t\tcase response\r\n\t\twhen Net::HTTPSuccess\r\n\t\t\treturn \"#{response.code} OK\"\r\n\t\telse\r\n\t\t\treturn \"#{response.code} ERROR\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "6d3d5c2903da04e5086694ef9dd1249d", "score": "0.6343835", "text": "def delete\n api_xml(category(target),:delete) if options.data or options.category\n if options.itemdef\n parse_itemdef\n uid=find_definition_uid_by_name(itemdef.name)\n response=admin_xml(\"/itemDefinitions/#{uid}\")\n verbose \"About to delete: #{REXML::XPath.first(response,'//Name/text()').value} item definition.\\n\"\n admin_xml(\"/itemDefinitions/#{uid}\",\n :delete) if itemdef.name\n end\n end", "title": "" }, { "docid": "fdb5222e60f67418931a74e6eb7c9a1d", "score": "0.6343194", "text": "def delete\n GoodData.delete(uri)\n end", "title": "" }, { "docid": "61777f0c9a0fdffe17d07a9ae6242d1f", "score": "0.63250357", "text": "def destroy\r\n @conf = Conf.find(params[:id])\r\n @conf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(confs_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "ab2fb483750fb051f33b1d25205172ce", "score": "0.6320544", "text": "def delete(namespace, id)\n if result = do_request(\"#{namespace}/delete/#{id}.xml\", \"POST\")\n return result\n end\n end", "title": "" }, { "docid": "155853a1a6730711865e1549930e51f2", "score": "0.63185376", "text": "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "title": "" }, { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.6308016", "text": "def delete(path);end", "title": "" }, { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.6308016", "text": "def delete(path);end", "title": "" }, { "docid": "63f979910c34aff7c4dc66372d125815", "score": "0.6302705", "text": "def destroy\n @factura = Factura.find(params[:id])\n @factura.destroy\n\n respond_to do |format|\n format.html { redirect_to(facturas_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a7a293210242a1290afb3c986e1c2211", "score": "0.62739617", "text": "def delete!\n CouchDB.delete( uri )\n end", "title": "" }, { "docid": "a7a293210242a1290afb3c986e1c2211", "score": "0.62739617", "text": "def delete!\n CouchDB.delete( uri )\n end", "title": "" }, { "docid": "1f22eda8d1cf2c8310a44e41c5484c09", "score": "0.6272735", "text": "def destroy\n @facture = Facture.find(params[:id])\n @depenses = Depense.find(:all, :conditions=>[\"facture_id = ?\", @facture.id])\n @depenses.each do |depense|\n depense.destroy\n end\n @facture.destroy\n\n respond_to do |format|\n format.html { redirect_to(factures_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f05c1b82ebfa2c096efa78bca347a8ee", "score": "0.62727344", "text": "def destroy\n @fact.destroy\n head :no_content\n end", "title": "" }, { "docid": "2675aa0e2ced04fc9c7de6fc57be6a59", "score": "0.6265186", "text": "def delete(path)\r\n fetch(:path => path, :method => 'DELETE')\r\n end", "title": "" }, { "docid": "6590f617b71e84f910190401ab0eb319", "score": "0.626427", "text": "def test_delete\n\n put_toto_doc\n\n doc = @s.get('errors', 'toto')\n\n r = @s.delete(doc)\n\n assert_equal nil, r\n\n doc = @s.get('errors', 'toto')\n\n assert_equal nil, doc\n end", "title": "" }, { "docid": "b48964cea92fc9b8949055d047b4126d", "score": "0.62610954", "text": "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "1691790ee2ee34cc8e6be6f7bb8d7f8d", "score": "0.6249953", "text": "def delete\n client.delete uri\n end", "title": "" }, { "docid": "1691790ee2ee34cc8e6be6f7bb8d7f8d", "score": "0.6249953", "text": "def delete\n client.delete uri\n end", "title": "" }, { "docid": "6e150acbc462afde89bb1069e35aacba", "score": "0.62346303", "text": "def destroy1\n @rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5656c42ea5899e1095a6ffdd837bee37", "score": "0.6234511", "text": "def destroy\n @resource = RDFS::Resource.find(params[:id])\n type = @resource ? @resource.classes.first.uri : nil\n @resource.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "51e124cc65aee5ae7a48babea43389aa", "score": "0.6226318", "text": "def delete_document(xml_document)\n ead_id = xml_document.xpath(\"//eadid\").first.text.strip.tr(\".\", \"-\")\n blacklight_connection.delete_by_id(ead_id)\n end", "title": "" }, { "docid": "153e58976fdbfa7383392757fbb2a4ab", "score": "0.6210574", "text": "def destroy\n name, type = resource[:name].split('/')\n nameserver = resource[:nameserver]\n nsupdate(\"server #{nameserver}\n update delete #{name}. #{type}\n send\")\n end", "title": "" }, { "docid": "61842d4ab71b8659134e54a4e8b04538", "score": "0.61774576", "text": "def destroy\n @inventory_transaction_fact = InventoryTransactionFact.find(params[:id])\n @inventory_transaction_fact.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_transaction_facts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "de5aa18790b5c61c056808a592af197b", "score": "0.6176295", "text": "def delete(id:)\n connection.http.delete(fedora_identifier(id: id))\n end", "title": "" }, { "docid": "db759fd35b037f18b7347c9f4d9f3ce0", "score": "0.6174492", "text": "def delete(id); end", "title": "" }, { "docid": "718fd485f95a30a8c897e2403defb29f", "score": "0.617079", "text": "def delete(path, params={}); make_request(:delete, host, port, path, params); end", "title": "" }, { "docid": "b9d1a5dc5c944dfdef016c342183e812", "score": "0.6168555", "text": "def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7ca7e8ba9bdfdf617b6cbfda6d8cca1d", "score": "0.6153857", "text": "def delete\n ruta = \"/actions/#{id}\"\n client.delete(ruta)\n end", "title": "" }, { "docid": "b965aa2e76649b84623ed925811f4794", "score": "0.6151522", "text": "def delete(_path)\n end", "title": "" }, { "docid": "3565175fef31cfa3920002f7b8616257", "score": "0.61374474", "text": "def destroy\n @google_factoid = GoogleFactoid.find(params[:id])\n @google_factoid.destroy\n\n respond_to do |format|\n format.html { redirect_to(google_factoids_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "48079a2a0e81f5b230cbcab10eeec67e", "score": "0.61288714", "text": "def del\n @status1 = Status1.find(params[:id])\n @status1.destroy\n\n respond_to do |format|\n format.html { redirect_to(status1s_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "19e691854ddd35d393895971a92ec956", "score": "0.6128645", "text": "def destroy\n @attraction = Attraction.find(params[:id])\n @attraction.destroy\n\n respond_to do |format|\n format.html { redirect_to(attractions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.61271596", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "37f62cd96c09179de43ca3dcf6cebadf", "score": "0.6122888", "text": "def destroy\n @xaction = Xaction.find(params[:id])\n @xaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(xactions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fdfa5f023a5b91de7150a7231284ceb6", "score": "0.611938", "text": "def delete(name)\n validate_path_elements(name)\n\n client.request(\n method: :delete,\n path: name,\n expected: 204\n )\n end", "title": "" }, { "docid": "485d6cafe2f84f5aa6ce531a8b453d6c", "score": "0.6118049", "text": "def destroy\n @factype = Factype.find(params[:id])\n @factype.destroy\n\n respond_to do |format|\n format.html { redirect_to(factypes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "36887f2b24d31f98fbb51687409e73f6", "score": "0.61170167", "text": "def delete; end", "title": "" }, { "docid": "49c01c257849f6c3ca7815de2c19df18", "score": "0.6107814", "text": "def destroy\n @cake = Cake.find(params[:id])\n @cake.destroy\n\n respond_to do |format|\n format.html { redirect_to(cakes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3ade1421115cd609150a92309d3ff553", "score": "0.6094244", "text": "def destroy\n @factbonificacion = Factbonificacion.find(params[:id])\n @factbonificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(factbonificacions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d643bff03487e0964063b0d70301f1ed", "score": "0.60860854", "text": "def destroy\n @facture = Charge.find(params[:id])\n @facture.destroy\n\n respond_to do |format|\n format.html { redirect_to(factures_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9dca02cc9b0305417b85e7ed8eba48c3", "score": "0.60825896", "text": "def destroy\n\t\tif params[:format] != 'xml'\n\t\t\trender_error(\"Must call this through the web service\", :forbidden)\n\t\telse\n\t\t\tfederation = Federation.find_by({ name: params[:federation] })\n\t\t\tip = request.headers['REMOTE_ADDR']\n\t\t\tif federation && ip == federation.ip\n\t\t\t\tbegin\n\t\t\t\t\tcommit = params[:commit] == 'immediate'\n\t\t\t\t\tid = params[:id]\n\t\t\t\t\turi = QueryFormat.id_to_uri(id).gsub(\"$[FEDERATION_SITE]$\", federation.site).gsub(':', '\\\\:').gsub('/', '\\\\/')\n\n\t\t\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t\t\tsolr.remove_exhibit(uri, commit)\n\n\t\t\t\t\t#node = Archive.find_by_handle(archive)\n\t\t\t\t\t#node.destroy if !node.blank?\n\t\t\t\t\t\t\n\t\t\t\t\trespond_to do |format|\n\t\t\t\t\t\tformat.xml { render :template => '/exhibits/destroy' }\n\t\t\t\t\tend\n\t\t\t\trescue ArgumentError => e\n\t\t\t\t\trender_error(e.to_s)\n\t\t\t\trescue SolrException => e\n\t\t\t\t\trender_error(e.to_s, e.status())\n\t\t\t\trescue Exception => e\n\t\t\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trender_error(\"You do not have permission to do this.\", :unauthorized)\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "43353b591a37f1226e477947a1c8af8e", "score": "0.607529", "text": "def delete(uri, opts = T.unsafe(nil)); end", "title": "" }, { "docid": "43353b591a37f1226e477947a1c8af8e", "score": "0.607529", "text": "def delete(uri, opts = T.unsafe(nil)); end", "title": "" }, { "docid": "43353b591a37f1226e477947a1c8af8e", "score": "0.607529", "text": "def delete(uri, opts = T.unsafe(nil)); end", "title": "" }, { "docid": "fcf0fa86db2cf222b4b7017c7a2d0a1a", "score": "0.6074303", "text": "def folder_delete(path)\n make_request(:delete,\"#{folders_url(path)}.xml\")\n end", "title": "" }, { "docid": "8547df5d60a70eee6fc0a29aa7cc6146", "score": "0.6070757", "text": "def delete\n response = service.send(:\"#{delete_method_prefix}_delete\", {:\"#{ac_obj_type}_id\" => self.id})\n response.at_xpath('//status').attr('code') == 'ok'\n end", "title": "" }, { "docid": "5885d3342f608cc836f15a31e687624d", "score": "0.60688096", "text": "def delete\n begin \n CouchDB.delete( uri )\n rescue CouchDB::ResourceNotFound\n nil\n end \n end", "title": "" }, { "docid": "5885d3342f608cc836f15a31e687624d", "score": "0.60688096", "text": "def delete\n begin \n CouchDB.delete( uri )\n rescue CouchDB::ResourceNotFound\n nil\n end \n end", "title": "" }, { "docid": "a662b5723f25d42eba50b7a90c37b883", "score": "0.6067688", "text": "def delete(path, arguments = {})\n Mavenlink.logger.note \"Started DELETE /#{path} with #{arguments.inspect}\"\n parse_request(connection.delete(path, arguments))\n end", "title": "" }, { "docid": "64584a414b87eb462b5502ae3de1f4ec", "score": "0.60671085", "text": "def delete\n # TODO: impl\n collection = Occi::Collection.new\n respond_with(collection, status: 501)\n end", "title": "" }, { "docid": "64584a414b87eb462b5502ae3de1f4ec", "score": "0.60671085", "text": "def delete\n # TODO: impl\n collection = Occi::Collection.new\n respond_with(collection, status: 501)\n end", "title": "" }, { "docid": "8b63e16bc60ccec1b50bb4b2894582fa", "score": "0.60554", "text": "def destroy\n @folk = Folk.find(params[:id])\n @folk.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3450323766bd24371b0a0b3d18568dd4", "score": "0.6053411", "text": "def delete\n spec[DELETE]\n end", "title": "" }, { "docid": "d4e16513428f377ff6c06785a95d5469", "score": "0.6043027", "text": "def destroy\n @nodeconfiguration = Nodeconfiguration.find(params[:id])\n @nodeconfiguration.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodeconfigurations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a92ef2395fc5f2a9bd6b22445136f543", "score": "0.6032597", "text": "def destroy\n @cite = Cite.find(params[:id])\n @cite.destroy\n\n respond_to do |format|\n format.html { redirect_to(cites_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "13456b1f5035e090dc1be715005184b2", "score": "0.60321826", "text": "def destroy\n @fabric_collection = FabricCollection.find(params[:id])\n @fabric_collection.destroy\n\n respond_to do |format|\n format.html { redirect_to(fabric_collections_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "642b4bd4b513d285f22799eb616d786c", "score": "0.6029925", "text": "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "title": "" }, { "docid": "22a265dbc9aff7dbb270d3305c4126bf", "score": "0.6026992", "text": "def destroy\n @f = f.find(params[:id])\n @f.destroy\n\n respond_to do |format|\n format.html { redirect_to(fs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8e36417662c96c13a32fe55b3cd5c5f3", "score": "0.6026473", "text": "def del\n @office1 = Office1.find(params[:id])\n @office1.destroy\n\n respond_to do |format|\n format.html { redirect_to(office1s_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4d73b952a4dca1cb69d7e08e21dc7b94", "score": "0.60250986", "text": "def destroy\n @feed_spec = FeedSpec.find(params[:id])\n @feed_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_specs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d98bbd29d4a2726f37922f6ea3a74ed8", "score": "0.60184026", "text": "def destroy\n @node = Node.find_by_name(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0aaf8872e1ad0c835dd282116f94b6fa", "score": "0.6008215", "text": "def destroy\n @cfop = Cfop.find(params[:id])\n @cfop.destroy\n\n respond_to do |format|\n format.html { redirect_to(cfops_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5daa1caf078fdadded3616903451257a", "score": "0.60060024", "text": "def destroy\n @factlineaedesal = Factlineaedesal.find(params[:id])\n @factlineaedesal.destroy\n\n respond_to do |format|\n format.html { redirect_to(factlineaedesals_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "25b73618d591b9b3bdeed6986f23142f", "score": "0.6005786", "text": "def destroy\n Comment.delete_all(\"article_id = #{params[:id]}\")\n Article.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "61eb7539af5090afbcaca4040f3a33f8", "score": "0.60049695", "text": "def destroy\n @fun_fact = FunFact.find(params[:id])\n @fun_fact.destroy\n\n respond_to do |format|\n format.html { redirect_to fun_facts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "40c19081824a1c044d25696f6ae3fee4", "score": "0.6001406", "text": "def destroy\n @transaction_xml = Transaction::Xml.find(params[:id])\n @transaction_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_xmls_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a16b20cfba28a29ec6fc003a1d2fc660", "score": "0.6000108", "text": "def destroy\n @rel = Rel.find(params[:id])\n @rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(rels_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2d1afabf58f7a6b28626675363612afc", "score": "0.59996516", "text": "def destroy\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to food_url(@food) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fb120d958d14d9910177dc70117dc9ed", "score": "0.59984547", "text": "def destroy\n @collectionnode = Collectionnode.find(params[:id])\n @collectionnode.destroy\n\n respond_to do |format|\n format.html { redirect_to(collectionnodes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b2054c2f0ae637b7093c36386c3dfbe3", "score": "0.59934574", "text": "def destroy\n @fact.destroy\n respond_to do |format|\n format.html { redirect_to facts_url, notice: 'Fato apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a49db061722fbfea9d603f70a67dc0ab", "score": "0.5989169", "text": "def test_delete_not_exist_metric\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/metrics/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 5: delete not existing metric - FAILED\"\n end", "title": "" }, { "docid": "e5399a2cb826177e41dc3b9d16f562e1", "score": "0.5988677", "text": "def destroy\n @xpath = Xpath.find(params[:id])\n @xpath.destroy\n set_site\n respond_to do |format|\n flash[:notice]=\"Field has been removed.\"\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "15acbf2772c6d64de478836058f2298c", "score": "0.598489", "text": "def destroy\n @incidente = Incidente.find(params[:id])\n @incidente.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidentes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "977e0c2cec5eaa37d4f932d607fb4195", "score": "0.5984472", "text": "def destroy\n @attraction.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "eccc8860fd297628b2a95547c273073c", "score": "0.598383", "text": "def delete() #DELETE ticket1.delete (removes 1 ticket)\n sql = \"DELETE FROM tickets WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "title": "" }, { "docid": "77c742322d16bbccac07ab52cc2f42db", "score": "0.59797007", "text": "def delete\n # TODO\n end", "title": "" }, { "docid": "40827d9989726c98b35adb0368089c9a", "score": "0.59732276", "text": "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "title": "" }, { "docid": "2f0df61f9fb4ef9b10bea9b7f0160b0b", "score": "0.5973131", "text": "def delete\n end", "title": "" }, { "docid": "2f0df61f9fb4ef9b10bea9b7f0160b0b", "score": "0.5973131", "text": "def delete\n end", "title": "" }, { "docid": "172c5ccdef856efc8d5b8a28bfc7c909", "score": "0.5972195", "text": "def delete()\n sql = \"DELETE * FROM films where id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "title": "" }, { "docid": "c0e8ae2457d612e3fdac0d66ad79bad4", "score": "0.5971139", "text": "def destroy\n @sitedatum = Sitedatum.find(params[:id])\n @sitedatum.destroy\n\n respond_to do |format|\n format.html { redirect_to(sitedata_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4c49d6eb83f3c2758233599efca6c9b0", "score": "0.5969035", "text": "def destroy\n @tst1 = Tst1.find(params[:id])\n @tst1.destroy\n\n respond_to do |format|\n format.html { redirect_to(tst1s_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
f9b3e35d301c0179bd8601de922f368b
Called when a resource has no converge actions, e.g., it was already correct.
[ { "docid": "fb78ae71c56a747157691eb5e721e144", "score": "0.48798084", "text": "def resource_up_to_date(resource, action)\n # Output should be green\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)\", :green)\n end", "title": "" } ]
[ { "docid": "a7ef0f7eec8429f12ec1ed66380a3c63", "score": "0.676137", "text": "def converge_complete\n detect_unprocessed_resources\n end", "title": "" }, { "docid": "026651ed3b6abd81d1d7b403e766547a", "score": "0.64952666", "text": "def converge_complete\n end", "title": "" }, { "docid": "b056a14c934e8827954897c9f96915c0", "score": "0.6426518", "text": "def converge_failed(exception)\n detect_unprocessed_resources\n end", "title": "" }, { "docid": "a3916d2414bed04b959787201c69f49f", "score": "0.6139453", "text": "def converge_actions\n @converge_actions ||= ConvergeActions.new(@new_resource, run_context, @action)\n end", "title": "" }, { "docid": "0eaca4be401151af42f62f1f6caede30", "score": "0.59647775", "text": "def converge\n transition_to(:converge)\n end", "title": "" }, { "docid": "0eaca4be401151af42f62f1f6caede30", "score": "0.59647775", "text": "def converge\n transition_to(:converge)\n end", "title": "" }, { "docid": "e56ba87f7fdeae9ce5179acc4e7db65c", "score": "0.5788039", "text": "def action_nothing\n logger.trace(\"Doing nothing for #{@new_resource}\")\n true\n end", "title": "" }, { "docid": "ee1d5dba06aebce331716ad83a8fa123", "score": "0.5716552", "text": "def converge(state) ; end", "title": "" }, { "docid": "2bac65643db03b44cd28ed785b71d277", "score": "0.5652431", "text": "def converge_it(msg, &_block)\n converge_by(msg) do\n Chef::Log.info msg\n yield\n new_resource.updated_by_last_action true\n end\n end", "title": "" }, { "docid": "9a376e2d9b71494c3ce29c14be72cf96", "score": "0.5563303", "text": "def setup_convergence(action_handler, machine)\n raise \"setup_convergence not overridden on #{self.class}\"\n end", "title": "" }, { "docid": "f3de53b719c29a6213194adbd353c0f4", "score": "0.5447396", "text": "def performed?; end", "title": "" }, { "docid": "f3de53b719c29a6213194adbd353c0f4", "score": "0.5447396", "text": "def performed?; end", "title": "" }, { "docid": "1d5a1c06d1753a18708a745e7f5fd2d8", "score": "0.54263115", "text": "def converge_start(run_context)\n puts \"converging #{run_context.resource_collection.all_resources.size} resources\"\n end", "title": "" }, { "docid": "c66fbe99776cd887f308eff13893a46c", "score": "0.5262435", "text": "def failure_has_not_occurred!\r\n @failure_has_occurred = false\r\n end", "title": "" }, { "docid": "032abb4974e897bd3217d0d85aa38357", "score": "0.52197236", "text": "def resource_skipped(resource, action, conditional)\n end", "title": "" }, { "docid": "04bc11acd2b8d53e5f454afa6a555dd5", "score": "0.5152008", "text": "def unsuccessful\n end", "title": "" }, { "docid": "9b9e7fef0ded4103779406d535ad93b6", "score": "0.5128483", "text": "def resource_changed?\n (@new_resource.subsystem_synonym && @current_resource.subsystem_synonym != @new_resource.subsystem_synonym) ||\n (@new_resource.arguments && @current_resource.arguments != @new_resource.arguments) ||\n (@new_resource.program && @current_resource.program != @new_resource.program) ||\n (@new_resource.user && @current_resource.user != @new_resource.user) ||\n (@new_resource.standard_input && @current_resource.standard_input != @new_resource.standard_input) ||\n (@new_resource.standard_output && @current_resource.standard_output != @new_resource.standard_output) ||\n (@new_resource.standard_error && @current_resource.standard_error != @new_resource.standard_error) ||\n (@new_resource.auto_restart && @current_resource.auto_restart != @new_resource.auto_restart) ||\n (@new_resource.multiple_instances && @current_resource.multiple_instances != @new_resource.multiple_instances) ||\n (@new_resource.use_signals && @current_resource.use_signals != @new_resource.use_signals) ||\n (@new_resource.use_sockets && @current_resource.use_sockets != @new_resource.use_sockets) ||\n (@new_resource.message_queue_key && @current_resource.message_queue_key != @new_resource.message_queue_key) ||\n (@new_resource.message_type && @current_resource.message_type != @new_resource.message_type) ||\n (@new_resource.priority && @current_resource.priority != @new_resource.priority) ||\n (@new_resource.normal_stop_signal && @current_resource.normal_stop_signal != @new_resource.normal_stop_signal) ||\n (@new_resource.force_stop_signal && @current_resource.force_stop_signal != @new_resource.force_stop_signal) ||\n (@new_resource.show_inactive && @current_resource.show_inactive != @new_resource.show_inactive) ||\n (@new_resource.wait_time && @current_resource.wait_time != @new_resource.wait_time) ||\n (@new_resource.subsystem_group && @current_resource.subsystem_group != @new_resource.subsystem_group)\nend", "title": "" }, { "docid": "37b124825f7194111ecd06a95db78c49", "score": "0.51072395", "text": "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", "title": "" }, { "docid": "1d348dba283af8a70be86ce751a0c891", "score": "0.510463", "text": "def succeed\n # no-op\n end", "title": "" }, { "docid": "d4d9f992c09db2a3706da0998081dc69", "score": "0.51041883", "text": "def calculate_report_corrective_change\n @corrective_change = resource_statuses.any? do |name, status|\n status.corrective_change\n end\n end", "title": "" }, { "docid": "595fc1cdb2d93adb3f4aeaaea6fb4e5b", "score": "0.5077302", "text": "def perform_initial_transition?\n !current_state\n end", "title": "" }, { "docid": "32987dbdb97973f818f02fed42a10483", "score": "0.50638604", "text": "def converge_if_changed(*properties, &converge_block)\n unless converge_block\n raise ArgumentError, \"converge_if_changed must be passed a block!\"\n end\n\n properties =\n if properties.empty?\n new_resource.class.state_properties\n else\n properties.map { |property| new_resource.class.properties[property] }\n end\n\n if current_resource\n # Collect the list of modified properties\n specified_properties = properties.select { |property| property.is_set?(new_resource) || property.has_default? }\n specified_properties = specified_properties.map(&:name).map(&:to_sym)\n modified = specified_properties.select { |p| new_resource.send(p) != current_resource.send(p) }\n if modified.empty?\n properties_str = if new_resource.sensitive\n specified_properties.join(\", \")\n else\n specified_properties.map do |property|\n \"#{property}=\" << if new_resource.class.properties[property].sensitive?\n \"(suppressed sensitive property)\"\n else\n new_resource.send(property).inspect\n end\n end.join(\", \")\n end\n logger.debug(\"Skipping update of #{new_resource}: has not changed any of the specified properties #{properties_str}.\")\n return false\n end\n\n # Print the pretty green text and run the block\n property_size = modified.map(&:size).max\n modified.map! do |p|\n properties_str = if new_resource.sensitive || new_resource.class.properties[p].sensitive?\n \"(suppressed sensitive property)\"\n else\n \"#{new_resource.send(p).inspect} (was #{current_resource.send(p).inspect})\"\n end\n \" set #{p.to_s.ljust(property_size)} to #{properties_str}\"\n end\n converge_by([ \"update #{current_resource.identity}\" ] + modified, &converge_block)\n\n else\n # The resource doesn't exist. Mark that we are *creating* this, and\n # write down any properties we are setting.\n property_size = properties.map(&:name).map(&:to_sym).map(&:size).max\n created = properties.map do |property|\n default = \" (default value)\" unless property.is_set?(new_resource)\n properties_str = if new_resource.sensitive || property.sensitive?\n \"(suppressed sensitive property)\"\n else\n new_resource.send(property.name.to_sym).inspect\n end\n \" set #{property.name.to_sym.to_s.ljust(property_size)} to #{properties_str}#{default}\"\n end\n\n converge_by([ \"create #{new_resource.identity}\" ] + created, &converge_block)\n end\n true\n end", "title": "" }, { "docid": "271b72ae5370a8708e4a48453c415c77", "score": "0.5057328", "text": "def ridicule_faultfully_prerevision()\n end", "title": "" }, { "docid": "cabcaa26e0e896c69585e23a818207c7", "score": "0.5052261", "text": "def algorithm_not_finished_yet!\n if @algorithm.finished_wizard?\n flash[:notice] = \"The algorithm '#{@algorithm.name}' is already finished! The wizard can only be accessed during creation. Use the edit routes to update an exising algorithm.\"\n redirect_to algorithms_path\n end\n end", "title": "" }, { "docid": "c621a59a21acfaa3c95ef828fc298820", "score": "0.4989805", "text": "def transition_from_pending\n if requires_transcoding?\n enter_transcoding\n elsif requires_post_processing?\n enter_post_processing\n else\n enter_conformance_checking\n end\n end", "title": "" }, { "docid": "528485b76075abb1605b805a28104894", "score": "0.4983287", "text": "def prepare_result\n\t\t\tsuper\n\t\t\t@lowest_old = MM.get_lowest_old(@current_point, @start_vector, @hd_config, false, @tuning_range)\n if @lowest_old[0] == nil\n\t\t\t\t@initial_run = true\n\t\t\t\tthrow :jump_back\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "a5b315b661640aa78c93820c1c9dcfdf", "score": "0.49085364", "text": "def action_complete() self.finished = true; end", "title": "" }, { "docid": "c0c5f03376d3024744dc2ac5262de182", "score": "0.48848513", "text": "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "title": "" }, { "docid": "629ddbc444440e668210d64d029ffea6", "score": "0.48701185", "text": "def failure_has_occurred!\r\n @failure_has_occurred = true\r\n end", "title": "" }, { "docid": "9fe8cad3a97989b6e21e05c234993ccf", "score": "0.48688385", "text": "def complete\n raise NotImplementedError\n end", "title": "" }, { "docid": "f80fa4471190641f8ec25889755467b9", "score": "0.48684835", "text": "def complete!\n raise NotImplementedError\n end", "title": "" }, { "docid": "c603d6c3ab691f9183a7a24fb30088eb", "score": "0.48609713", "text": "def performed\n design.clear_version_cache\n end", "title": "" }, { "docid": "65c253cbdc22ce38e64712263a669c89", "score": "0.48606277", "text": "def correct\n self.gain_or_loss_percent = nil if gain_or_loss_percent != nil and prediction == 'fail'\n puts \"T*!*!*!*!*!*\"\n \n end", "title": "" }, { "docid": "b43c5be0ee6014a6b4103d9527ef5111", "score": "0.48525763", "text": "def setup_convergence(action_handler)\n Chef::Log.debug('PXE machine setup convergence')\n @convergence_strategy.setup_convergence(action_handler, self)\n end", "title": "" }, { "docid": "f6ccc0520a6ee1f3dc11a9b992998bbc", "score": "0.4844658", "text": "def changes_pending!\n self.lifecycle.changes_pending! nil\n end", "title": "" }, { "docid": "52f6ef3ea7b6871fbbb5254acfdaec5b", "score": "0.48421532", "text": "def done\n raise NotImplementedError\n end", "title": "" }, { "docid": "475297ea60d96b12d32ee33c35bf46c0", "score": "0.4836323", "text": "def revert_complete\n QcInspection.transaction do\n self.set_status STATUS_IN_PROGRESS\n end\n end", "title": "" }, { "docid": "405deb397665bdc543102e7de1fd0e10", "score": "0.48041758", "text": "def completed?(resource)\n raise CompletionCriteriaMissingError.new\n end", "title": "" }, { "docid": "7cc7716f1744642365dd32b09f3fcdca", "score": "0.48022255", "text": "def available_actions\n fail NotImplementedError\n end", "title": "" }, { "docid": "f10a3ba65a014894117764966508bcbf", "score": "0.4800913", "text": "def resource_updated(new_resource, action)\n initialize_resource_report_if_needed(new_resource, action)\n current_resource_report.updated unless nested_resource?(new_resource)\n end", "title": "" }, { "docid": "c00a2c66e44fb4071cf1efd76758000a", "score": "0.4800015", "text": "def perform\n # Do nothing\n false\n end", "title": "" }, { "docid": "7b31e8205666e925b991e2aa312f8fb2", "score": "0.4795187", "text": "def failed?\n not @ok\n end", "title": "" }, { "docid": "0825edb9c113e0cd55c20382626b20f8", "score": "0.47947177", "text": "def initialize\n super('succeed')\n end", "title": "" }, { "docid": "455f2002b9ca11597631146288e76b50", "score": "0.4782077", "text": "def resource_completed(new_resource)\n if current_resource_report && !nested_resource?(new_resource)\n current_resource_report.finish\n add_resource_report(current_resource_report)\n clear_current_resource_report\n end\n end", "title": "" }, { "docid": "fa47e101a8d8f503d04c99fcdd8db167", "score": "0.47820315", "text": "def finished?\n !@operations or @operations.empty?\n end", "title": "" }, { "docid": "968f98ee680c55c8227aa54bef832132", "score": "0.4773308", "text": "def resource_up_to_date(resource, action)\n end", "title": "" }, { "docid": "b35fd3cb6ab99fa5a71b528683a4745a", "score": "0.47715092", "text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[failureReason failedChange]\n end", "title": "" }, { "docid": "199dc0123fe556b381553a3f1fb90179", "score": "0.4767454", "text": "def done\n # Do nothing.\n end", "title": "" }, { "docid": "c80286ecd778a60c0242a52387079cb2", "score": "0.47620323", "text": "def resource_current_state_loaded(new_resource, action, current_resource)\n return if nested_resource?(new_resource)\n initialize_resource_report_if_needed(new_resource, action, current_resource)\n end", "title": "" }, { "docid": "577da47c61e241e41887cb993180feb9", "score": "0.47579345", "text": "def check_status\n return if @stash_identifier.nil? || @resource.nil?\n state = @resource.current_resource_state.try(:resource_state)\n return if state == 'in_progress'\n return_error(messages: 'Your dataset cannot be updated now', status: 403) { yield } if state != 'submitted'\n duplicate_resource # because we're starting a new version\n end", "title": "" }, { "docid": "aae7254d155d04f5ec16e60cff83397d", "score": "0.47552195", "text": "def fail_if_unavailable\n all_available = node[\"dism_features_cache\"][\"enabled\"] +\n node[\"dism_features_cache\"][\"disabled\"] +\n node[\"dism_features_cache\"][\"removed\"]\n\n # the difference of desired features to install to all features is what's not available\n unavailable = (new_resource.feature_name - all_available)\n raise \"The Windows feature#{\"s\" if unavailable.count > 1} #{unavailable.join(\",\")} #{unavailable.count > 1 ? \"are\" : \"is\"} not available on this version of Windows. Run 'dism /online /Get-Features' to see the list of available feature names.\" unless unavailable.empty?\n end", "title": "" }, { "docid": "cc95299b35866c74e41307768102cc63", "score": "0.47542813", "text": "def failed?; failed_to_start? || (@success == false) end", "title": "" }, { "docid": "9577794ff31390c2e711aa88fb01ca44", "score": "0.47521067", "text": "def no_changes_once_finished\n if changed? && finished_was == true\n errors.add(:base, \"cannot change a finished record.\")\n end\n end", "title": "" }, { "docid": "24d68f86d597e97e82c073de26f654ac", "score": "0.47467425", "text": "def resource_up_to_date(new_resource, action)\n initialize_resource_report_if_needed(new_resource, action)\n current_resource_report.up_to_date unless nested_resource?(new_resource)\n end", "title": "" }, { "docid": "5aaea2d43efe4ccf2908567a0f833bb6", "score": "0.47367042", "text": "def fail_on_unevaluated\n fail_on_unevaluated_overrides\n fail_on_unevaluated_resource_collections\n end", "title": "" }, { "docid": "ed60a4dd373413cf4562c742fc769381", "score": "0.4732301", "text": "def cookbook_clean_complete\n end", "title": "" }, { "docid": "4eec656981a73bb1d65e2e0366a7d851", "score": "0.47318372", "text": "def cookbook_resolution_complete(cookbook_collection)\n end", "title": "" }, { "docid": "2afbf2e90fad337b3465c066db617b6f", "score": "0.4731041", "text": "def remaining\n cleanup\n return false if count >= max_operations\n increment\n max_operations - count\n end", "title": "" }, { "docid": "0989153e37b853e662bca2bbaad9928e", "score": "0.4730416", "text": "def initialize\n super\n# reset this functionality is now in CompletenessCorrectnessDiffs\n @descript = []\n @transDescript = []\n @totalmops = CompletenessCorrectnessDiffs.new\n end", "title": "" }, { "docid": "b9f091c1c18be6c52b08056c3a7c3c4b", "score": "0.47302204", "text": "def failed?\n complete? && !all_nodes_succeeded?\n end", "title": "" }, { "docid": "b9f091c1c18be6c52b08056c3a7c3c4b", "score": "0.47302204", "text": "def failed?\n complete? && !all_nodes_succeeded?\n end", "title": "" }, { "docid": "a2140625290f127379c8d5a1795fa35d", "score": "0.4726493", "text": "def action_update\n if @current_resource.installed\n converge_by \"Updated #{new_resource.id}\" do\n imcl :install, new_resource.id,\n update_by(new_resource.service_repository).join(' '),\n base_options\n end\n new_resource.updated_by_last_action(true)\n else\n Chef::Log.info \"#{new_resource.id_ver} not installed - nothing to do\"\n end\n load_new_resource_state\n new_resource.installed(true)\n end", "title": "" }, { "docid": "f7917f44729c2d21acea9b0424deeec0", "score": "0.4721861", "text": "def done!\n # Do nothing\n end", "title": "" }, { "docid": "f7917f44729c2d21acea9b0424deeec0", "score": "0.4721861", "text": "def done!\n # Do nothing\n end", "title": "" }, { "docid": "882d416f315efe5af2e2b81e18c8f239", "score": "0.47176406", "text": "def failed_resource?\n @failed_resource ||= false\n end", "title": "" }, { "docid": "994ef4341564e008e6a45b1a097e4ee7", "score": "0.47025928", "text": "def execution_attempted! #:nodoc:\n @execution_attempted = true\n end", "title": "" }, { "docid": "ffa62c4eb7a167cc3451d2881d901f21", "score": "0.47018015", "text": "def reset!\n raise if working?\n @is_complete = false\n end", "title": "" }, { "docid": "9f1cc182a2dbbb7343f4c9d5680d72de", "score": "0.46953693", "text": "def revert_conflicts\r\n self.update_conflicts(-1)\r\n #@tile.hit()\r\n end", "title": "" }, { "docid": "d49a9090c126703f30d4a26a32d4f295", "score": "0.46934748", "text": "def check_call_validity\n if (error = super) && !error.kind_of?(UnreachableEvent)\n return refine_call_exception(error)\n end\n\n if task.failed_to_start?\n CommandRejected.new(self).exception(\n \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} \"\\\n \"but the task has failed to start: #{task.failure_reason}\"\n )\n elsif task.event(:stop).emitted?\n CommandRejected.new(self).exception(\n \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} \"\\\n \"but the task has finished. Task has been terminated by \"\\\n \"#{task.event(:stop).history.first.sources.to_a}.\"\n )\n elsif task.finished? && !terminal?\n CommandRejected.new(self).exception(\n \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} \"\\\n \"but the task has finished. Task has been terminated by \"\\\n \"#{task.event(:stop).history.first.sources.to_a}.\"\n )\n elsif task.pending? && symbol != :start\n CommandRejected.new(self).exception(\n \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} \"\\\n \"but the task has never been started\"\n )\n elsif task.running? && symbol == :start\n CommandRejected.new(self).exception(\n \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} \"\\\n \"but the task is already running. Task has been started by \"\\\n \"#{task.event(:start).history.first.sources.to_a}.\"\n )\n else\n error\n end\n end", "title": "" }, { "docid": "bdd6076a76157a2d5eafed1a1e18806e", "score": "0.46908212", "text": "def checkRetraitFail\n\n end", "title": "" }, { "docid": "3a71068bc9889b01dfdc0cc09d0348d7", "score": "0.46822098", "text": "def done\n return if DEFAULTS.keys.sort == @converted.sort\n\n bads = DEFAULTS.transform_values { 0 }.merge(\n @converted.group_by(&:itself).transform_values(&:count)\n ).select { |k, v| v != 1 }\n\n raise \"Options were not converted exactly once! #{bads}\"\n end", "title": "" }, { "docid": "81b49896541b4d8296176cb546e2b840", "score": "0.46732742", "text": "def failed!\n @success = false\n end", "title": "" }, { "docid": "88792aaf86aafe02cc0b27b696c3b0a2", "score": "0.4666418", "text": "def default_handle_resource(resource, resource_type, resource_desc_str, action)\n question = \"#{action}?\".to_sym\n output_method = action.to_s.upcase\n\n b_ok = false\n\n if resource.send(question)\n outputs output_method, \"#{resource_desc_str} is already #{action}.\", :ok2\n b_ok = true\n else\n resource.send(action)\n\n if resource.send(question)\n outputs output_method, \"#{resource_desc_str} is #{action}.\", :ok\n b_ok = true\n else\n outputs output_method, \"#{resource_desc_str} could not be brought #{action}.\", :err\n end\n end\n\n state.update(resource_type, resource.name, action) if b_ok\n b_ok\n end", "title": "" }, { "docid": "8a95750a77f58814d1a604a5b99f1b94", "score": "0.4660433", "text": "def rescind!\n Decision.transaction do\n if initial\n paper.rescind_initial_decision!\n else\n paper.rescind_decision!\n end\n update! rescinded: true\n end\n end", "title": "" }, { "docid": "ed97e4fe68739883ccf0959f4018465c", "score": "0.4658617", "text": "def finished?\n @turns_allowed < 0\n end", "title": "" }, { "docid": "d8a206dc6c9595494066cf4846c13ddf", "score": "0.4654286", "text": "def check_not_applied\n LOCK.synchronize do\n ( hooks.keys - applied ).each do |rkey|\n calls = hooks[ rkey ].map { |blk, clr| clr }\n yield( rkey, calls )\n end\n end\n end", "title": "" }, { "docid": "91bd4ac30adb2868d9e9d35cd934d55b", "score": "0.46512955", "text": "def resource_skipped(new_resource, action, conditional)\n return if nested_resource?(new_resource)\n\n initialize_resource_report_if_needed(new_resource, action)\n current_resource_report.skipped(conditional)\n end", "title": "" }, { "docid": "a547e49a5b0fbf5435a91a7a531d33df", "score": "0.46394688", "text": "def resource_updated(resource, action)\n # Output should be yellow (changes are applied)\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)\", :yellow)\n end", "title": "" }, { "docid": "e72ed2c5d9866288f52c8f60ba972b2a", "score": "0.46342927", "text": "def rejected!\n # pending => rejected\n if !pending?\n errors.add(:state, :invalid_transition)\n return false\n end\n\n super\n end", "title": "" }, { "docid": "cc8ebda3ce7814d2e707e7d60b8c2416", "score": "0.46306044", "text": "def op_is_done\n return if @op_notifier.nil?\n @op_notifier.notify(self)\n end", "title": "" }, { "docid": "2b315ea3bf2fcf2b16515c23ac3709f2", "score": "0.46289027", "text": "def resource_skipped(resource, action, conditional)\n # Output should be blue (Skipped)\n resource_exec_time = Time.now.to_f - @resource_start_time\n puts(\" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)\", :blue)\n end", "title": "" }, { "docid": "0c9e5e3bc3d2f26509b0440a25bbc48c", "score": "0.46274543", "text": "def compute_changes\n properties = @new_resource.class.state_properties.map(&:name)\n properties = properties.map(&:to_sym)\n if current_resource\n compute_changes_for_existing_resource properties\n else\n compute_changes_for_new_resource properties\n end\n end", "title": "" }, { "docid": "0c9e5e3bc3d2f26509b0440a25bbc48c", "score": "0.46274543", "text": "def compute_changes\n properties = @new_resource.class.state_properties.map(&:name)\n properties = properties.map(&:to_sym)\n if current_resource\n compute_changes_for_existing_resource properties\n else\n compute_changes_for_new_resource properties\n end\n end", "title": "" }, { "docid": "92602978033d05a6a990b4d5a7993e11", "score": "0.4621746", "text": "def failure!\n @count += 1\n end", "title": "" }, { "docid": "4921c3ae6d0b2f27c4c76ade5f2985ee", "score": "0.46096042", "text": "def before_validate\n self.outputs<< output(0) if self.outputs.empty?\n super\n end", "title": "" }, { "docid": "88b1f36ff776f1bbb3d090037ef624a4", "score": "0.46094495", "text": "def post_processing\n @opts.each do |opt|\n if opt.required? && !@results.key?(opt.to_sym)\n fail \"The option #{opt.to_sym} is required\"\n end\n end\n end", "title": "" }, { "docid": "58e069e2944e8338ab2598a8721054d9", "score": "0.4599333", "text": "def ensure_full_data!\n reload! unless resource_full?\n end", "title": "" }, { "docid": "0a50d1e031b3b08b4188c81f9cd2d53c", "score": "0.45956695", "text": "def complete?; end", "title": "" }, { "docid": "f1c490012928e8d4bb90d911b90565af", "score": "0.45923805", "text": "def check\n super\n info \"Working in branch '#{Hg.current_branch}'\"\n uncommitted = Hg.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n fail \"You are releasing from a local branch that does not track a remote!\" if Hg.remote.empty?\n end", "title": "" }, { "docid": "576522ee19f38f6fc5bb4d4c56dbf443", "score": "0.4591933", "text": "def evaluate_next_step_on_change?\n false\n end", "title": "" }, { "docid": "6fb324eded8417a35d803b1f5724589b", "score": "0.45905954", "text": "def correct!\n if @failures.any?\n unless @failures.all? {|matcher| @scenarios[:failed].any? {|s| matcher.match? s}}\n missing_failures = @failures.reject {|matcher| @scenarios[:failed].any? {|s| matcher.match? s}}\n missing_failures = missing_failures.collect{|f| \" - #{f.to_s}\"}.join(\"\\n\")\n mods = self.desc || \"(None)\"\n mods = \" - #{mods}\"\n raise IncorrectAnswer, \"The following scenarios passed incorrectly (should have failed):\\n#{missing_failures}\\nwith the following modifications:\\n#{mods}\"\n end\n else\n unless @scenarios[:failed].empty? or @scenarios[:steps][:total] != @scenarios[:steps][:passed]\n raise IncorrectAnswer, \"Feature should have passed, but had the following failures:\\n#{@scenarios[:failed].collect {|f| \" #{f}\"}}\"\n end\n end\n true\n end", "title": "" }, { "docid": "166682819e02db5f3797dd1f9a08f782", "score": "0.45897523", "text": "def succeed(*args)\n super(*args)\n end", "title": "" }, { "docid": "6cd3e1cee395a4de81a1c20f7465db55", "score": "0.45818186", "text": "def check\n super\n uncommitted = Perforce.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n end", "title": "" }, { "docid": "5c3ae42e1e10c1afc6fc9ccb255f23e6", "score": "0.45566756", "text": "def force_final_state\r\n @final_state = true\r\n end", "title": "" }, { "docid": "35d26e2c99b6162d03a1d9412647afc9", "score": "0.45538583", "text": "def solved?\n unknown_count == 0\n end", "title": "" }, { "docid": "6911aa7d87fb0b3dfc1d5a5caa5ca4bb", "score": "0.4542681", "text": "def munge\n add_status_to_resource_status\n add_missing_metrics\n recalculate_report_status\n self\n end", "title": "" }, { "docid": "33aed8ff60bbd20934e11a2eb959ac6c", "score": "0.4539838", "text": "def check\n super\n uncommitted = Git.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n fail \"You are releasing from a local branch that does not track a remote!\" unless Git.remote\n end", "title": "" }, { "docid": "98f4bc2fcc894f5a45bef36efd37e6ee", "score": "0.4535329", "text": "def check\n super\n uncommitted = Git.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n # fail \"You are releasing from a local branch that does not track a remote!\" unless Git.remote\n end", "title": "" }, { "docid": "3b6c4f310a9d1717cee00697f912daf9", "score": "0.4534937", "text": "def action_run\n status = @recipe_helper.run(@new_resource.name, @new_resource.tags, @new_resource.attributes, @new_resource.match_all)\n Chef::Log.info \"Recipe executed '#{new_resource.name}' status:#{status}\"\n new_resource.updated_by_last_action(true)\n end", "title": "" }, { "docid": "dbdb554ce1686cc52ad09de89ea0beb4", "score": "0.4532167", "text": "def run_completed(node)\n super\n Chef::Log.warn(\"<< END >>\")\n end", "title": "" } ]
8c7042b2f4e6282f9590482571704484
and the same integer values in the same exact order
[ { "docid": "c5424c2252c3fc34a2e7b6b471c2c13e", "score": "0.0", "text": "def array_equals(array1, array2)\n if array1 == nil && array2 == nil # if both are nil\n return true # two nil arrays have the same length and elements\n elsif array1 == nil || array2 == nil # if just one is nil\n return false\n elsif array1.length != array2.length # if not nil but lengths not equal\n return false\n else # if lengths are equal, compare element by element\n array1.each_with_index do |array1_element, i|\n # return false if any elements at the same index are not equal\n return false if array1_element != array2[i]\n end\n end\n return true # lengths are equal and all elements at each index are equal\nend", "title": "" } ]
[ { "docid": "88870e9992037187ecfa9429a6f09388", "score": "0.6013414", "text": "def unique(integers)\r\n\r\n end", "title": "" }, { "docid": "1715dc8be28d342ba2d4d377bd2731b9", "score": "0.58626604", "text": "def same_values?(x,y)\n\t\t@bt[x,y] == @bt[x+1,y] and @bt[x,y] == @bt[x,y+1] and @bt[x,y]== @bt[x+1,y+1]\n\tend", "title": "" }, { "docid": "a14d7de36cfa36b7933e72c7afa889a8", "score": "0.5781437", "text": "def | other_int\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "0361c8ad7df0a5a77795d87549e4a2d3", "score": "0.5725706", "text": "def find_non_duplicate_integer_3(array)\n result = 0\n array.each {|element| result ^= element}\n result\nend", "title": "" }, { "docid": "4da27f5f57e5e00b5e505b707fcc0214", "score": "0.5718322", "text": "def lonelyinteger(a)\n res = Set.new\n\n a.each do |num|\n res.include?(num) ? res.delete(num) : res.add(num)\n end\n\n res.first\nend", "title": "" }, { "docid": "a80569e0ee01b77cef74c9dcc107db2f", "score": "0.5666249", "text": "def test_small_integers_have_fixed_ids\n assert_equal 1, 0.object_id\n assert_equal 3, 1.object_id\n assert_equal 5, 2.object_id\n assert_equal 201, 100.object_id\n\n # THINK ABOUT IT:\n # What pattern do the object IDs for small integers follow?\n #\n # num.object_id = 2*num + 1\n end", "title": "" }, { "docid": "f97b49359f2e154e8c7521af61534e85", "score": "0.5585406", "text": "def duplicate_and_add(arr)\n add_to_all_in_arr(arr, \"0\") + add_to_all_in_arr(arr, \"1\")\nend", "title": "" }, { "docid": "eb61270efcdc8e28a80fb03a35050d05", "score": "0.55714786", "text": "def commonInteger(arrayX, arrayY)\n coommon = []\n common = arrayX & arrayY\nend", "title": "" }, { "docid": "0c9841a0fdf192e0b9cd68161add301f", "score": "0.5564096", "text": "def find_duplicates(ary)\n raise ArgumentError unless ary\n result = []\n bf = Ch9::BitField.new(32000)\n ary.each do |num|\n actual_num = num - 1\n if bf[actual_num]\n result << num\n else\n bf[actual_num] = 1\n end\n end\n result\n end", "title": "" }, { "docid": "dd2566854d09836c7b0d579664c34f78", "score": "0.5527277", "text": "def equal_ids(ids, objects)\n return (ids.map {|x| x.to_i}).sort == (objects.map {|x| x.id}).sort\n end", "title": "" }, { "docid": "1fd79adb18edfbf9f726bd0a08f15306", "score": "0.5523638", "text": "def union(p, q) # p becomes q's values\n #changed values[q] to values[p]\n #change all values of that to it, look then?\n pValue = @values[p]\n qValue = @values[q]\n # puts\n # puts \"union called\"\n @values.length.times do |x|\n # puts \"Comparing here: index: #{x}, values[x]: #{values[x]}, values[p]: #{values[p]}, values[q]: #{values[q]}\"\n if values[x] == pValue\n # puts \"changing values\"\n values[x] = qValue\n end\n end\n end", "title": "" }, { "docid": "fe08607b682a84880a886f973f2db6b9", "score": "0.5502544", "text": "def dups\n inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys\n end", "title": "" }, { "docid": "4e76bcb05dd57471b8618d3304073760", "score": "0.5495872", "text": "def test_repeat_and_no_repeat_values\n # no repeat values in result set\n rs1 = 15.random_in(1,16,false)\n assert_nil(rs1.uniq!)\n\n # repeat values exists in rs\n rs2 = 6.random_in(1,5,true)\n assert_operator(rs2.uniq!.length, :<=, rs2.length)\n end", "title": "" }, { "docid": "b51a2e01ba29ab42dc7466a9bb79e2d6", "score": "0.5494517", "text": "def ordered_values; end", "title": "" }, { "docid": "992f0228644fa06ba60f93be11496216", "score": "0.5457398", "text": "def possible_values\n Set['1','2','3','4','5','6','7','8','9'] - values\n end", "title": "" }, { "docid": "6997d8f85cd7b381b73d42b081431245", "score": "0.54397035", "text": "def sequential?; @before.values.map(&:count).uniq.count == count end", "title": "" }, { "docid": "cff2b7539e2e34dc2e767431b7c84ae4", "score": "0.5388745", "text": "def lonelyinteger(a)\n start = 0\n a.each do |num|\n start = start ^ num\n end\n start\nend", "title": "" }, { "docid": "2e239fb9addeb819dba1fc47aad7e500", "score": "0.5377521", "text": "def arrange_brute\n ai = @a[@i]\n a_lower = []\n a_upper = []\n a_equal = []\n @a.each do |aa|\n if aa < ai then a_lower << aa\n elsif aa == ai then a_equal << aa\n else a_upper << aa\n end\n end\n a_lower + a_equal + a_upper\n end", "title": "" }, { "docid": "457283b553a238688dc947624226126c", "score": "0.53596145", "text": "def model_answer(arr, want_value)\n int_to_int = {}\n result = []\n arr.each do |e|\n if int_to_int.key?(want_value - e)\n result << [e, want_value - e]\n end\n int_to_int[e] = true\n end\n return result\nend", "title": "" }, { "docid": "98739cc84547f0f6a8c6f9e2661546ef", "score": "0.5354552", "text": "def ^ other_int\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "8a9efcbb299906e318a3b90ff6a02ed1", "score": "0.5342249", "text": "def addSame(pairs)\n toAdd = []\n pairs.each_pair{|pair, value|\n if (SAME_IDS.include?(pair[0]))\n minId = [pair[1], SAME_IDS[pair[0]]].min()\n maxId = [pair[1], SAME_IDS[pair[0]]].max()\n toAdd << [[minId, maxId], value]\n end\n\n if (SAME_IDS.include?(pair[1]))\n minId = [pair[0], SAME_IDS[pair[1]]].min()\n maxId = [pair[0], SAME_IDS[pair[1]]].max()\n toAdd << [[minId, maxId], value]\n end\n }\n\n toAdd.each{|val|\n # Don't add self references.\n if (val[0][0] == val[0][1])\n next\n end\n\n pairs[val[0]] = val[1]\n }\nend", "title": "" }, { "docid": "8e4f93e43e400e84345eeb516a1c7fb2", "score": "0.53316015", "text": "def amicable_number?(num1, amicables)\n num1_divs = proper_divs(num1)\n num2 = num1_divs.inject(:+)\n num2_divs = proper_divs(num2)\n num_compare = num2_divs.inject(:+)\n\n if (num1 == num_compare && num1!=num2)\n if !amicables.include?(num1) && !amicables.include?(num2)\n amicables << num1\n amicables << num2\n end\n end\n\n return\nend", "title": "" }, { "docid": "dae53297ce4f37c7cf69a9dd1b0660ce", "score": "0.5329389", "text": "def predictable?(number)\n number.object_id == ( (number << 1) + 1 )\nend", "title": "" }, { "docid": "d252adaf1df714e1cd159ddf6f9021a1", "score": "0.53179157", "text": "def finder(first_array, second_array)\n return \"No missing numbers\" if first_array.size == second_array.size\n\n xOr = 0\n\n first_array.each { |num| xOr ^= num }\n\n second_array.each { |num| xOr ^= num }\n\n xOr\nend", "title": "" }, { "docid": "662df739ee1d71e133bf511a30228987", "score": "0.5311439", "text": "def intcount_unique(a, b, c)\n\tx=a[0]\n\tj=0\n\t1.step(a.length-1){|i|\n\t\tif x!=a[i] then\n\t\t\tb[j]=x\n\t\t\tc[j]+=1\n\t\t\tx=a[i]\n\t\t\tj+=1\n\t\telse\n\t\t\tc[j]+=1\n\t\tend\n\t}\n\tb[j]=x\n\tc[j]+=1\nend", "title": "" }, { "docid": "54b154a8e6bb8688cba54fbe8df93dd3", "score": "0.531052", "text": "def equal_binary_sort(array)\n equals = []\n unequals = []\n ones = []\n zeros = []\n while array.any?\n left, right = array.shift, array.shift\n if left > right\n ones << left\n zeros << right\n elsif left == right\n equals << [left, right]\n else\n ones << right\n zeros << left\n end\n end\n equals.each do |item|\n if item[0] == 0\n zeros += item\n else\n ones += item\n end\n end\n zeros + ones\nend", "title": "" }, { "docid": "cbe2ad5118eaa8e1f59cf29abebc02d6", "score": "0.5309122", "text": "def integerize_keys\n\t\treturn self.inject({}) { |memo,(k,v)| memo[k.to_i] = v; memo } \n\tend", "title": "" }, { "docid": "9c98ec84e4084676f06af0e1ea3e099a", "score": "0.5308555", "text": "def find_unique_id(ids)\n i = 0\n ids.each do |id|\n i ^= id\n end\n return i\nend", "title": "" }, { "docid": "c14b5ad5cc40bc21e2bc7cbaf9cfd86b", "score": "0.53024805", "text": "def update_int_possibilities(int_enum)\n @int_possibilities -= int_enum\n if @int_possibilities.count == 1\n @int = @int_possibilities.first\n @int_possibilities = Set.new\n elsif @int_possibilities.count.zero? && !@int\n raise 'zero possible integers for tile'\n end\n end", "title": "" }, { "docid": "4b0c5209f955742c43e98a5b76832235", "score": "0.5293821", "text": "def reorder(ints)\n array = Array.new(256,[])\n level = 2^24\n ints.each do |t|\n array[(t/level)%256] = t\n end\n array.each do |t|\n if t.length > 1\n reorder_helper(t,level/(2^8))\n t = []\n end\n end\n array.flatten\nend", "title": "" }, { "docid": "a3d2bf0a18e0cace5c85d93ce4737b72", "score": "0.52874005", "text": "def ana_array(arr_1, arr_2)\n\n hash_1 = Hash.new(0)\n hash_2 = Hash.new(0)\n\n arr_1.each do |ele|\n hash_1[ele] += 1\n end\n\n arr_2.each do |ele|\n hash_2[ele] += 1\n end\n\n hash_1 == hash_2\nend", "title": "" }, { "docid": "2f3df149ba8af53395eea876bd77137c", "score": "0.527747", "text": "def assignable_values\n (1..9)\n end", "title": "" }, { "docid": "fc057c3d51441fe32725aabad4169b8c", "score": "0.52754873", "text": "def skip_triple_equal_on=(_arg0); end", "title": "" }, { "docid": "2e599959174c97636578f29843ee8041", "score": "0.52748686", "text": "def sequence(int1, int2)\n arr = []\n (1..int1).each do\n arr[-1] ? arr << int2 + arr[-1] : arr << int2\n end\n arr\nend", "title": "" }, { "docid": "d847de323e4fd3db5f359223cd9e7b8c", "score": "0.5270718", "text": "def pairs()\n g1 = generator(512, 16807, 4) # 65 / 512\n g2 = generator(191, 48271, 8) # 8921 / 191\n \n total = 0\n 5e6.to_i.times do\n v1 = g1.next.to_s(2).rjust(16,'0')\n v2 = g2.next.to_s(2).rjust(16,'0')\n \n total += 1 if v1[-16,16] == v2[-16,16]\n end\n \n total\nend", "title": "" }, { "docid": "87ff44db96838597ed1a819f49b12246", "score": "0.5268718", "text": "def find_uncoupled2\n all = 0\n self.each { |e| all ^= e }\n\n puts all.inspect\n end", "title": "" }, { "docid": "c7dd1a01a3943a4f833da3bf5ece9ef1", "score": "0.52594626", "text": "def &(other)\n raise \"Wrong sizes\" if self.bitfield.size != other.bitfield.size\n same = 0\n #self.bitfield.size.times do |pos|\n # same += 1 if self.bitfield[pos] & other.bitfield[pos] == 1\n #end\n self.bitfield.total_set.to_s + \"--\" + other.bitfield.total_set.to_s\n end", "title": "" }, { "docid": "b1bc24c88e42b990965843d0512775b4", "score": "0.5255805", "text": "def compare_and_set(i, old_value, new_value); end", "title": "" }, { "docid": "b1bc24c88e42b990965843d0512775b4", "score": "0.5255805", "text": "def compare_and_set(i, old_value, new_value); end", "title": "" }, { "docid": "646a19fb8002465d180d6c0bcdbf793d", "score": "0.52550244", "text": "def find_duplicates_4(a)\n len = a.length\n n = len-2\n xor = 0\n x,y = 0,0 #variables to store duplicates\n\n #xor of all numbers from 1 to n\n for i in 1..n\n xor ^= i\n end\n #xor of all array elements\n for i in 0...len\n xor ^= a[i]\n end\n #Rightmost set bit\n set_bit_pos = xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x ^= a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y ^= a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n\n for i in 0..n\n if (i & set_bit_pos == 0)\n x ^= i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y ^= i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n return\nend", "title": "" }, { "docid": "5b305f111bd96cec635ec2d8854e8961", "score": "0.52527535", "text": "def eqshifts\n return [0, 1, 2]\nend", "title": "" }, { "docid": "242c8e611b75a7507970bc7983210984", "score": "0.5250071", "text": "def favor_integer_sorting(a, b)\n if self.class.is_integer?(a) && self.class.is_integer?(b)\n a.to_i <=> b.to_i\n else\n a <=> b\n end\n end", "title": "" }, { "docid": "8ccbd38d9cd5b974f46b0052313241ce", "score": "0.5249935", "text": "def non_duplicated_values(values)\nend", "title": "" }, { "docid": "90ba361b01ae9c95b2afa755049f1852", "score": "0.52471745", "text": "def three_sum(integers)\n result = Set.new\n\n # Add indexes so we cen tell if we're reusing a number\n # O(n)\n integers = integers.each_with_index.to_a\n\n # Create hash to tell when a value exists\n # O(n)\n hash = integers.to_h\n\n integers.combination(2) do |(a, i), (b, j)|\n c = 0 - a - b\n\n # O(1)\n k = hash[c]\n\n result << [a, b, c].sort unless k.nil? || k == i || k == j\n end\n\n result.to_a\nend", "title": "" }, { "docid": "adb20ba3e97dbc8fed8854eaf219be16", "score": "0.52422345", "text": "def unique_id a,c\n\n\ta.each do |s|\n\t\tc[s]+=1\n\tend\nend", "title": "" }, { "docid": "0453690f6563b7d4f4309b7ccc9b8e39", "score": "0.52351946", "text": "def unique(num)\n num & num\nend", "title": "" }, { "docid": "2e4edfc96db8e6bedd8db857b9e1214c", "score": "0.52288675", "text": "def test_loop_each_number_with_two_same_numbers\n result = loop_each_number([\"4\",\"4\"])\n assert_equal([\"2\",\"4\"],result)\n end", "title": "" }, { "docid": "91c8235b321cef0b69fe093b635a4267", "score": "0.5216057", "text": "def bitseq\n return 0 if 0 == self \n\n smallest = self & -self\n ripple = self + smallest\n newsmall = ripple & -ripple\n ones = ((newsmall / smallest) >> 1) - 1\n \n ripple | ones\n end", "title": "" }, { "docid": "40e3f8b600ab07e0f728d44fef44a7be", "score": "0.52063805", "text": "def test\n if @a.to_i != 0 && @b.to_i != 0 && @c.to_i != 0\n if @a == @b && @a == @c\n return 1\n elsif @a**2 == @b**2 + @c**2 || @b**2 == @a**2 + @c**2 || @c**2 == @b**2 + @a**2\n return 4\n elsif (@a == @b && @a != @c) || (@b == @c && @a != @c) || (@a == @c && @b != @c)\n return 2\n elsif @a != @b && @a != @c && @c != @b\n return 3\n end\n else\n return 5\n end\n end", "title": "" }, { "docid": "19bb58a1ba254a886ec20686fb724ca5", "score": "0.5204321", "text": "def skip_triple_equal_on; end", "title": "" }, { "docid": "177b6eed85a82cc1c6073bdccb7826f9", "score": "0.5201995", "text": "def sum_pairs(ints, s)\n results = []\n low_index = ints.length\n \n ints.each_with_index do |num, i|\n target_num = s - num\n clone_arr = ints.map(&:clone)\n clone_arr.delete_at(i)\n num_index = clone_arr.index(target_num)\n \n if results.include?([num, target_num].reverse) && num == target_num\n results.shift\n end \n\n if clone_arr.include?(target_num) && num_index < low_index && !results.include?([num, target_num])\n results << [num, target_num]\n low_index = num_index\n end\n end \n \n results.length == 0 ? nil : results.first\nend", "title": "" }, { "docid": "1741da78137a4359da704ee09699f663", "score": "0.51993", "text": "def int_pair_for(pair)\n pair.map{|n| n || 0}\n end", "title": "" }, { "docid": "b7b2e9762e01ffb631de9c70a1d35047", "score": "0.51826394", "text": "def validator(integer_array)\n # none of these can occur more than once\n [4, 40, 400, 9, 90, 900].each {|n| return false if integer_array.count(n) > 1}\n\n # no key can be followed by its value\n {4 => 1, 40 => 10, 400 => 100}.each do |x, y|\n next if integer_array.index(x) == nil || integer_array.index(y) == nil\n return false if integer_array.index(x) < integer_array.index(y)\n end\n\n # integers must be in descending order\n return integer_array == integer_array.sort.reverse\nend", "title": "" }, { "docid": "073deb43a813580c68617cee838b6eb8", "score": "0.51816374", "text": "def integerize_keys!\n\t\tself.keys.each do |key|\n\t\t\tself[key.to_i] = self[key]\n\t\t\tself.delete key\n\t\tend\n\t\tself\n\tend", "title": "" }, { "docid": "552acd0944218aa0a139b848f0eda8d8", "score": "0.5181353", "text": "def test_can_set_3_values_and_get_out_of_order_1\n @b.set :a, 1\n @b.set :b, 2\n @b.set :c, 3\n assert_eq [@b.get(:b), @b.get(:c), @b.get(:a)], [2, 3, 1]\n end", "title": "" }, { "docid": "c7938030603b10ebe569bcdb638a410f", "score": "0.5175887", "text": "def duplicate_values(array)\n duplicate = 0\n hash = {}\n array.each do |int|\n hash[int] = \"number\"\n end\n array.each do |int|\n if hash.include?(int)\n hash.delete(int)\n else\n duplicate = int\n end\n end\n return duplicate\nend", "title": "" }, { "docid": "8b868021218146aecccf60b3e2452689", "score": "0.5172282", "text": "def solution(a)\n observed_ints = {}\n a.each do |int|\n observed_ints[int] ? observed_ints.delete(int) : observed_ints[int] = true\n end\n observed_ints.keys[0]\nend", "title": "" }, { "docid": "5ef8a512d4ded639a08345b85ac0323c", "score": "0.51619303", "text": "def one_pair?\n return hash_of_rank_count.values.sort == [1,1,1,2]\n end", "title": "" }, { "docid": "b9a812848c8f40dc61f3d3071ab3adea", "score": "0.5161109", "text": "def sync(list1, list2)\n hash_map = Hash.new(0)\n\n result= []\n list1.each{|ele| hash_map[ele]+=1}\n list2.each do |ele|\n if !hash_map.has_key?(ele)\n result << ele\n else\n hash_map[ele] += 1\n end\n end\n first_list = []\n hash_map.each_key do |k| \n if hash_map[k] == 1\n first_list << k\n end\n end \n return first_list + result \nend", "title": "" }, { "docid": "598c11adeb16cb4197ba35db490fff25", "score": "0.5151291", "text": "def test_multiple_string_number_2\n # x2-g8 < x2-y7 < x2-y08 < x8-y8\n assert_equal %w(x02-g8 x2-y7 x02-y08 x8-y8), %w(x02-y08 x8-y8 x2-y7 x02-g8).natural_sort\n end", "title": "" }, { "docid": "f9411bbf1566445391ad7d749b858c1c", "score": "0.5145909", "text": "def intersect(arr1, arr2)\r\n result = []\r\n\r\n hash = Hash.new(0)\r\n\r\n arr2.each { |num| hash[num] += 1 }\r\n\r\n arr1.each do |num|\r\n if hash.has_key?(num)\r\n result << num if hash[num] >= 1\r\n hash[num] -= 1\r\n \r\n end\r\n end\r\n\r\n result\r\nend", "title": "" }, { "docid": "3261d4ca569539a5543b39265dffd5cc", "score": "0.5129506", "text": "def *(other)\n return nil unless other.class == BigNumber\n result = BigNumber.new [0]\n tmp_number = BigNumber.new @array\n other.array.each do |e|\n result += tmp_number if e != 0\n tmp_number = BigNumber.new tmp_number.array.clone.unshift(0) # aliased left push for array\n end\n result\n end", "title": "" }, { "docid": "f51570e53ffb2606d5e0a7551f6c0529", "score": "0.51280546", "text": "def uniq_common_num (a1, a2)\n hash = {}\n a1.each do |el|\n hash[el] = 0\n end\n a2.each do |el|\n hash[el] += 1 if hash[el]\n end\n return hash.select {|k, v| v > 0}.keys\nend", "title": "" }, { "docid": "222b9ab52cbee367fb044f82762b2952", "score": "0.51247865", "text": "def check_repeating_values\n hand.each_with_object(Hash.new(0)) do |card, hash|\n hash[card.value] += 1\n end\n end", "title": "" }, { "docid": "288961efa8bcc366de56e5ff9a51b0d1", "score": "0.5121299", "text": "def test_map_int\n assert_equal [4, 3, 10], @triple.map { |e| e + 1 }\n end", "title": "" }, { "docid": "96d5142c92b9de3f81f6a6e1855d478a", "score": "0.51212704", "text": "def test_eql\n hsh = {}\n 0.upto(9){|n| hsh[n] = PowerOfThree.new(n)}\n assert(hsh.include?(5))\n assert(hsh.has_key?(5))\n assert(hsh.has_value?(PowerOfThree.new(5)))\n hsh = {}\n 0.upto(9){|n| hsh[PowerOfThree.new(n)] = n}\n assert(hsh.include?(PowerOfThree.new(5)))\n assert(hsh.has_key?(PowerOfThree.new(5)))\n assert(hsh.has_value?(5))\n\n end", "title": "" }, { "docid": "c8670a5763aca6716e2724627201bc25", "score": "0.5120728", "text": "def addIdentity(pairs)\n SAME_IDS.each_pair{|id1, id2|\n minId = [id1, id2].min()\n maxId = [id1, id2].max()\n\n pairs[[minId, maxId]] = MAX_SIM\n }\nend", "title": "" }, { "docid": "2b2e7ac3547012d76fcf303b97b28a58", "score": "0.51161987", "text": "def to_int_ary\n [x.to_i, y.to_i]\n end", "title": "" }, { "docid": "fcaf67875807a0cc4fe4d71a94416a27", "score": "0.51153207", "text": "def mix(a,b)\n c = a + b\n c = c.sort\n return c\nend", "title": "" }, { "docid": "904c14656ce4bafb507d745b354c9159", "score": "0.5114972", "text": "def find_dupe_by_sorting\n self.sort!\n\n comparison = 0\n dupe = 0\n\n self.map { |n| n == comparison ? dupe = n : comparison = n }\n\n return dupe\n end", "title": "" }, { "docid": "ef2945ebff9b069962437a8a74e96b56", "score": "0.51145786", "text": "def reverse_pairs(nums)\n rank = {}\n Set.new((nums+nums.map { |n| n*2+1 }).sort).each_with_index { |n, i| rank[n] = i }\n bit = BIT.new(rank.size)\n r = 0\n nums.reverse_each do |n|\n r += bit.sum(rank[n])\n bit.update(rank[n*2+1], 1)\n end\n r\nend", "title": "" }, { "docid": "8f4cc240c7e8e4c794d6349471d23112", "score": "0.51067805", "text": "def union(a,b)\n @grid.union(a+1, b+1)\n end", "title": "" }, { "docid": "390adbc1693314fc182134b8fc81e35e", "score": "0.5104289", "text": "def find_amicable_numbers(limit)\n result = []\n (1...limit).each do |a|\n b = d(a)\n res = d(b)\n result.push(a) if (a == res) && (a != b)\n end\n result\nend", "title": "" }, { "docid": "ff1ee6217c66d9e46f979b2967e9cc4d", "score": "0.5103936", "text": "def intersect(nums1, nums2)\n map = {}\n result = []\n\n nums1.each do |n|\n map[n] ? map[n] +=1 : map[n] =1\n end\n\n nums2.each do |n|\n if map[n]\n if map[n] > 0\n result << n\n map[n] -= 1\n end\n end\n end\n result\nend", "title": "" }, { "docid": "7a8dfd4323cafcadb156e5a366b5ddcf", "score": "0.51025134", "text": "def instance_variables\n size = GENERIC_ORDER.size\n super.sort do |a, b|\n v = (GENERIC_ORDER.index(a) || size) <=> (GENERIC_ORDER.index(b) || size)\n next v unless v == 0\n\n a <=> b\n end\n end", "title": "" }, { "docid": "1115e0022bf960315865d5e317c30c00", "score": "0.5100844", "text": "def test_equal\n ary = []\n 0.upto(9){|n| ary << PowerOfThree.new(n)}\n assert(ary.include?(PowerOfThree.new(5)))\n assert_equal(PowerOfThree.new(5), (PowerOfThree.new(5)))\n assert_equal(nil, PowerOfThree.new(-1)<=> Rational(1,3))\n assert_equal(0,PowerOfThree.new(5)<=>(PowerOfThree.new(5)))\n refute(PowerOfThree.new(5).equal?(PowerOfThree.new(5)))\n end", "title": "" }, { "docid": "c2326c46c8a5653d7f7faade2afd119a", "score": "0.5098303", "text": "def test_fill_in_values\n # changed assert_equal __, 1 + 1, to, assert_equal 2, 1 + 1\n assert_equal 2, 1 + 1\n end", "title": "" }, { "docid": "21f54a57f6b9c08681ae89f922208fc5", "score": "0.50978965", "text": "def duplicate_values(array)\n duplicate = []\n hash = {}\n array.each do |int|\n hash[int] = \"number\"\n end\n array.each do |int|\n if hash.include?(int)\n hash.delete(int)\n else\n duplicate << int\n end\n end\n return duplicate\nend", "title": "" }, { "docid": "34743b02284ccdbda31dc15700954b45", "score": "0.50890553", "text": "def dups(nodes)\n nodes.each_with_object({}) { |v, h| h[v] = h[v].to_i + 1 }.reject { |_k, v| v == 1 }.keys\n end", "title": "" }, { "docid": "913b91f05b3ca19890b99a8536d2ab84", "score": "0.5086869", "text": "def compareTriplets(a, b)\n al = 0\n bo = 0\n\n 3.times do |i|\n next if a[i] == b[i]\n\n a[i] > b[i] ? al += 1 : bo += 1\n end\n [al, bo]\nend", "title": "" }, { "docid": "0a40e36c21fadca9f91ffd51334ef3e3", "score": "0.5083782", "text": "def test_add_many\n s = IntegerSet.new\n\n (1..100).each do |value|\n x = value * 2\n s.add(x, x)\n end\n assert_equal(100, s.size)\n\n (1..100).each do |value|\n x = value * 2 + 1\n s.add(x, x)\n end\n assert_equal(1, s.size)\n end", "title": "" }, { "docid": "edcb58e0ce51fa36acf3959e8771c9e4", "score": "0.5078964", "text": "def add_bits(array1, array2)\n #return if the array is not the same size\n return nil if array1.size != array2.size\n destination_array = []\n array1.each_with_index do |item, index|\n destination_array[index] ||= 0\n if (item + array2[index] + destination_array[index] > 1)\n destination_array[index + 1] = 1\n elsif (item + array2[index] + destination_array[index] == 1)\n destination_array[index] = 1\n end\n end\n destination_array.push(0).reverse\nend", "title": "" }, { "docid": "52a0240746a3d5ed7e9a9f5db01aacd9", "score": "0.50783545", "text": "def ana_array(arr1, arr2)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n \n # DRY - make this separate function \n arr1.each do |el|\n hash[el] += 1\n end\n\n\n arr2.each do |el|\n hash2[el] += 1\n end\n\n hash == hash2\nend", "title": "" }, { "docid": "6277d1c11efb9403da39ca8b6d6b9c3f", "score": "0.5078053", "text": "def stray(numbers)\n hsh = Hash.new(0)\n numbers.each { |num| hsh[num] += 1 }\n arr = []\n hsh.select { |k, v| arr << k if v == 1 }\n p arr.first\nend", "title": "" }, { "docid": "a65770bca631ec46a208d1b6d054fce5", "score": "0.5069287", "text": "def add_values v # first dispatch\n v.addInt self\n end", "title": "" }, { "docid": "4764fc7342b5692b92b15e2c69431db6", "score": "0.50689197", "text": "def solution(a)\n missing = 0\n a.each { |v|\n missing ^= v\n }\n missing\nend", "title": "" }, { "docid": "7bb8a270b62baaad8ab2bad7c4c96ba7", "score": "0.5067674", "text": "def left_parity_map\n [:odd, :odd, :odd, :odd]\n end", "title": "" }, { "docid": "1170a84c8eb4a7ffb0ebcd082f182375", "score": "0.50654566", "text": "def pair_zeros(numbers)\n\n # Couldn't find anything better, i feel bad looking at this :-(\n lock = false\n numbers.map do |n|\n\n if n == 0 && lock == false\n lock = true\n n\n elsif n == 0\n lock = false\n nil\n else\n n\n end\n\n end.compact\n\nend", "title": "" }, { "docid": "186b0775b0c9712b435f0e4e6c0d86b3", "score": "0.5061116", "text": "def ==(other)\n self.map(&:id).sort == other.map(&:id).sort\n end", "title": "" }, { "docid": "c3b518afd879b24274de9adb212c985e", "score": "0.5060501", "text": "def put_int64(*ints)\n ints.each { |i| @request << [i].pack('q').reverse }#[i >> 32, i & ((1 << 32) - 1)].pack('NN') }\n end", "title": "" }, { "docid": "c1abcb96ad637a0de1c6335939c5f924", "score": "0.50581753", "text": "def put_int64(*ints)\n ints.each { |i| request << [i].pack('q').reverse }#[i >> 32, i & ((1 << 32) - 1)].pack('NN') }\n end", "title": "" }, { "docid": "1fffd2a09e632e4e93fbd213b241eee2", "score": "0.50576437", "text": "def initialize(items)\n initialize__bit_set()\n i = 0\n while i < items.size\n v = items.get(i)\n add(v.int_value)\n i += 1\n end\n end", "title": "" }, { "docid": "9f363f1508bce9c10c330cd85a5f2294", "score": "0.50558627", "text": "def merge_arr(int_arr1, int_arr2)\r\n m_arr = []\r\n m_arr = int_arr1 + int_arr2\r\n m_arr = m_arr.sort \r\n return m_arr\r\nend", "title": "" }, { "docid": "9453ec70feb21eb4934d5b4885c093f3", "score": "0.5053999", "text": "def check_pair(hand)\n hand.numbers.size != hand.numbers.uniq.size\n end", "title": "" }, { "docid": "845ef561fa5efda5243b4f62b146bbf8", "score": "0.5052626", "text": "def set_from_integers(integer_array)\n integer_array.each_with_index do |integer,index|\n @digits[index] = Digit.new.set_from_integer(integer);\n end\n set_checksum_valid\n set_legible\n end", "title": "" }, { "docid": "9a29d8f0e7509e57e73e695ef0dd1f73", "score": "0.5047556", "text": "def find_duplicate(nums)\n result = 0\n nums.each_with_index do |num, index|\n result ^= num ^ index\n end\n result\nend", "title": "" }, { "docid": "b3d4ce45f87192ebd701383b1eb30572", "score": "0.5046745", "text": "def single_number_2(nums)\n res = 0\n\n nums.each do |num|\n res ^= num\n end\n\n res\nend", "title": "" }, { "docid": "0fb9e0d2596be8fc87e0946745fd0d2c", "score": "0.50462097", "text": "def method5(array1, array2)\n\tnew_array = array1 | array2\n\tnew_array2 = array1 & array2\n\tnew_array3 = array1 - array2\n\t# puts new_array\n\t# puts new_array2\n\t#puts new_array3\n\n\tone_array = array1.zip(array2).flatten.uniq #merges side by side with zip and then .flatten puts into one array\n\n\tnon_duplicate_hash = {}\n\tone_array.each_with_index do |k,v|\n\t\tnon_duplicate_hash[k] = v\n\tend\n\tputs non_duplicate_hash\nend", "title": "" }, { "docid": "fa982bab9cc87727a0f6f80bb3a6953f", "score": "0.5044917", "text": "def test_assert_multiple_comparisons_returns_as_array_of_one_offs\n\t \tassert_equal([\"1113\", \"1114\"], check_for_match_arr([\"1113\", \"6666\", \"1114\"], \"1112\"))\n\tend", "title": "" }, { "docid": "2e386040b798800e2a12e711d9e14f7b", "score": "0.5043681", "text": "def solution_one(array_one, array_two)\n combined = (array_one << array_two).flatten\n combined = combined.sort\n result = 0\n\n if combined[-1] != combined[-2]\n result = combined[-1]\n elsif combined[0] != combined[1]\n result = combined[0]\n else\n combined.each_with_index do |element, index|\n if ((combined[index] != combined[index - 1]) || (combined[index] != combined[index + 1]))\n result = element\n end\n end\n end\n result\nend", "title": "" }, { "docid": "e849f7670add2d5448464f86bac4d964", "score": "0.5040751", "text": "def solved_set?(tiles)\r\n nums = []\r\n tiles.each do |tile|\r\n nums << tile.value.to_i\r\n end\r\n\r\n nums.sort == (1..9).to_a\r\n end", "title": "" } ]
8875ccba81ed1c6dacf6daa9a15797d1
the func titleize is usable with rails below is a manual version
[ { "docid": "14b276e5a6277e99738b1ff85dbaf74c", "score": "0.0", "text": "def titleize(my_string)\n stop_list = ['and', 'the', 'or', 'with', 'of', 'from', 'in', 'on', 'by', 'out']\n return my_string.split(\" \").each_with_index.map{|x, i|\n if i == 0\n x.capitalize\n elsif stop_list.include?(x)\n x\n else\n x.capitalize\n end\n }.join(\" \")\nend", "title": "" } ]
[ { "docid": "8410bc8e61384f2eae3332615425c389", "score": "0.88944966", "text": "def titleize!\n replace(titleize)\n end", "title": "" }, { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.8717768", "text": "def titleize(title)\nend", "title": "" }, { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.8717768", "text": "def titleize(title)\nend", "title": "" }, { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.8717768", "text": "def titleize(title)\nend", "title": "" }, { "docid": "a27dfdd4d863f3c515d06496fb563cd5", "score": "0.8717768", "text": "def titleize(title)\nend", "title": "" }, { "docid": "9ef4ce2402620ac7338dcdc9172da88a", "score": "0.8637241", "text": "def titleize(title)\n \nend", "title": "" }, { "docid": "9ef4ce2402620ac7338dcdc9172da88a", "score": "0.8637241", "text": "def titleize(title)\n \nend", "title": "" }, { "docid": "6b1ff9a59fc1e24121a2308627864859", "score": "0.8513204", "text": "def titleize(str)\n str.titleize\n end", "title": "" }, { "docid": "06e15a995be4b9f91ce83f8249c6435e", "score": "0.8506586", "text": "def titleize(word) \n\nend", "title": "" }, { "docid": "705d7104d0320373078f3d1de0e20fc6", "score": "0.84921974", "text": "def titleize_a_string(string)\nend", "title": "" }, { "docid": "705d7104d0320373078f3d1de0e20fc6", "score": "0.84921974", "text": "def titleize_a_string(string)\nend", "title": "" }, { "docid": "02ecb972c5549ac304dae18fa492cc59", "score": "0.84689945", "text": "def titleize\n downcase.gsub(/\\b\\S/u).each { _1.upcase }\n end", "title": "" }, { "docid": "d09f96ec4da4fc9c239cac57e4da2a73", "score": "0.8451953", "text": "def title \n titleize(@title)\n end", "title": "" }, { "docid": "1d68410b449ca58e798916bbfafdba60", "score": "0.82667", "text": "def titleize(w)\n w.split.map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "1a87b516edb8e42dad6d1218bbe9e7e3", "score": "0.82625544", "text": "def titleize_title\n self.title = title.titleize\n end", "title": "" }, { "docid": "253ebc0a05107de955a70fccb20f0f4e", "score": "0.82326835", "text": "def titleize(input)\n input&.titleize\n end", "title": "" }, { "docid": "088119ba6c2e26d815cb0df97ef21bb7", "score": "0.81407887", "text": "def titleize(text)\n text.split.each{|i| i.capitalize!}.join(' ')\nend", "title": "" }, { "docid": "90ae4c29f2881947269e8412f3c31813", "score": "0.81259537", "text": "def titleize(x)\n\tx.split.map(&:capitalize).join(' ').tr('A', 'a').gsub('The R', 'the R')\nend", "title": "" }, { "docid": "7a05f284315951d61147f8e51bdf8571", "score": "0.81160665", "text": "def titleize(title)\n\t\tleave_lower = [\"the\", \"a\", \"an\", \"and\", \"but\", \"or\", \"at\", \"of\", \"on\", \"in\", \"to\", \"with\"]\n\n\t\ttitle.capitalize!\n\n\t\ttitle.split.each do |word|\n\t\t\tword.capitalize! unless leave_lower.include?(word)\n\t\tend.join(\" \")\n\tend", "title": "" }, { "docid": "2b7d1811abeb912b6b7d75a109b4811a", "score": "0.81054103", "text": "def titleize\n Inflections.titleize(self)\n end", "title": "" }, { "docid": "2dde8ad38fbf6cfe53d90e4a86de5d02", "score": "0.8101309", "text": "def titleize(title)\n\twords = title.split.map do |word|\n\t\tno_caps = %w{and the over}\n\t\tif no_caps.include?(word)\n\t\t\tword\n\t\telse\n\t\t\tword.capitalize\n\t\tend\n\tend\n\t# Always capitalize first word\n\twords[0].capitalize!\n\twords.join(' ')\nend", "title": "" }, { "docid": "0cd886d3f02604f31c7c945694432454", "score": "0.8075296", "text": "def titleize(s)\n s.split.map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "3c33a86ccf4f0f1e79b335cb3c01164a", "score": "0.7981614", "text": "def titlecase_title\n self.title=(title().titlecase())\n end", "title": "" }, { "docid": "7be1d9cff3c95119c5f932813a0eb46b", "score": "0.7977502", "text": "def titleize(title)\n title = title.split\n new_title = \"\"\n lowercase = [\"over\", \"and\", \"the\"]\n #iterate over each string\n \"#{title.capitalize}\"\nend", "title": "" }, { "docid": "5a884dbc55b98df57a829062241d8cda", "score": "0.7932116", "text": "def titleize_name\n name.split.map(&:capitalize).join(' ')\n end", "title": "" }, { "docid": "d2becd17666cd08dbe06d4885d2a196f", "score": "0.7930119", "text": "def title() \n\n\t\t@title = @title.split(\" \").each_with_index.map {|word, i| \n\t\t\t\n\t\t\tif(@nonCapWords.include?(word) && i != 0) \n\t\t\t\tword\n\t\t\telse\n\t\t\t\tword.capitalize\n\t\t\tend\n\n\t\t\t}.join(\" \")\n\tend", "title": "" }, { "docid": "f6653cc7119bfabe52131c600e7236ab", "score": "0.79296166", "text": "def titleize(title)\n titleized_array = []\n title.split(\" \").each {|word| titleized_array << word.capitalize}\n titleized_array.join(\" \")\nend", "title": "" }, { "docid": "1a96a5a91b3a8962da9a547a334a956c", "score": "0.7929208", "text": "def titleize(str)\n str.split.map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "dd3ee644f403ca4cf692b014d162ad0e", "score": "0.79257894", "text": "def capitalize_title\n title.gsub(/\\w+/, &:capitalize)\n end", "title": "" }, { "docid": "fda38d85ee174fb6827d546f9712b38f", "score": "0.79254055", "text": "def titleize(s)\n first_char = s.lstrip[0,1]\n s.sub( first_char, first_char.upcase )\n end", "title": "" }, { "docid": "9ee0f36b986d3d805e90fab74b066a3a", "score": "0.79197985", "text": "def title\n little_words = [\"a\", \"an\", \"the\", \"or\", \"and\", \"in\", \"of\"]\n words = [@title]\n words = @title.split(\" \")\n $i = 0\n\n while $i < words.length\n words[$i] = words[$i].capitalize() unless little_words.include? words[$i]\n $i += 1\n end\n words[0] = words[0].capitalize\n @title = words.join(\" \")\n return @title\n end", "title": "" }, { "docid": "ade08d702a81c54046cf4ae856265745", "score": "0.7906059", "text": "def titleize(title)\n sm_words = ['a', 'and', 'of', 'over', 'the']\n title.capitalize.split(\" \").map{ |wrd| sm_words.include?(wrd) ? wrd : wrd.capitalize }.join(\" \")\nend", "title": "" }, { "docid": "6ac80b8229726d4f714181f7c19305e2", "score": "0.790594", "text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\nend", "title": "" }, { "docid": "201dd1b8202d1f2e8cf24f09d2ac9e85", "score": "0.79032946", "text": "def titleize\n Inflector.titleize(self)\n end", "title": "" }, { "docid": "c04014fe7466c489a5ffc3f548eedf72", "score": "0.7901761", "text": "def titleize(str)\n str.split(\" \").map(&:capitalize).join(\" \")\nend", "title": "" }, { "docid": "9951fb851e23adbd5e5f89cfe68b339e", "score": "0.7900153", "text": "def titleize\n arr = ['a', 'an', 'the', 'by', 'to']\n upcase_arr = ['DX', 'EDA', 'AEDG', 'LPD', 'COP', 'GHLEP', 'ZEDG', 'QAQC', 'PV']\n r = tr('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n # fix a couple known camelcase versions\n r.gsub!('Energyplus', 'EnergyPlus')\n r.gsub!('Openstudio', 'OpenStudio')\n r\n end", "title": "" }, { "docid": "9951fb851e23adbd5e5f89cfe68b339e", "score": "0.7900153", "text": "def titleize\n arr = ['a', 'an', 'the', 'by', 'to']\n upcase_arr = ['DX', 'EDA', 'AEDG', 'LPD', 'COP', 'GHLEP', 'ZEDG', 'QAQC', 'PV']\n r = tr('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n # fix a couple known camelcase versions\n r.gsub!('Energyplus', 'EnergyPlus')\n r.gsub!('Openstudio', 'OpenStudio')\n r\n end", "title": "" }, { "docid": "c49f9dfd9e78ea0616d3f088821c2c87", "score": "0.78931075", "text": "def titleize(str)\n str.split.map(&:capitalize)*' '\nend", "title": "" }, { "docid": "b678be400682366218f05baa4cf7b594", "score": "0.78870547", "text": "def title(text)\n text.gsub(/\\b\\w/){$&.upcase}\n end", "title": "" }, { "docid": "ebe562e4e6d1603e399ccf51c3bfac15", "score": "0.7883558", "text": "def titlize_name\n self.name = name.titleize\n end", "title": "" }, { "docid": "6d82bd5d782edc0592b35cdce896f451", "score": "0.7882027", "text": "def titleize\n ActiveSupport::Inflector.titleize(self)\n end", "title": "" }, { "docid": "c57797ed5571735d9cba3d885e254f0e", "score": "0.7879691", "text": "def titleize(input)\n\treturn input.capitalize.split.map{|i| i.length > 3 ? i.capitalize : i} .join(\" \") \nend", "title": "" }, { "docid": "25f9661f7e4610f24efd1930aa002238", "score": "0.78785384", "text": "def titleize(string)\n title = string.split.each do |word|\n word.capitalize!\n end\n title.join(' ')\nend", "title": "" }, { "docid": "653f3900aadc5b4887df42b6f0cc17a7", "score": "0.7855911", "text": "def titleize(string)\n string.split(' ').map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "937136ab0a5972c3d88c4e2aace82bbf", "score": "0.7855662", "text": "def titleize(text)\n text.split(/ |\\_/).map(&:capitalize).join(\" \")\nend", "title": "" }, { "docid": "3470cb61ce3ff35edd3a35a6d010accb", "score": "0.78442097", "text": "def _titleize(word)\n _humanize(_underscore(word)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n end", "title": "" }, { "docid": "c9c06c81e682ee5de355a18c57098ea7", "score": "0.78392774", "text": "def titler\n str_list = self.title.split\n \n self.title = str_list.map { |word| word.capitalize\n word.split(\"-\").map{|w| w.capitalize }.join(\"-\")\n }.join(\" \")\n end", "title": "" }, { "docid": "186abe58ed070381258d4c9958919ed8", "score": "0.7836014", "text": "def my_titleize(words)\n words.split.map { |word| word.capitalize! }.join(' ')\nend", "title": "" }, { "docid": "9499521a531a659e9e856a972cc86127", "score": "0.7827934", "text": "def titlecase_title\n self.name=(name().titlecase())\n end", "title": "" }, { "docid": "f93c755a2b21399d06a91f84a224962f", "score": "0.7822192", "text": "def titleize string\n string.gsub(/\\w+/) do |word|\n word.capitalize\n end\n end", "title": "" }, { "docid": "02c2576754971fe1f953afafc4d48b16", "score": "0.78103435", "text": "def fix_titlecase(title)\n\t\t\ttitle.downcase.titleize if (title.upcase == title)\n\t\t\ttitle.titleize if (title.downcase == title)\n\t\t\treturn title\n\t\tend", "title": "" }, { "docid": "013acf6b87d9ea739543268e7bc86f08", "score": "0.78044295", "text": "def titleize(phrase)\n mot = phrase.split.map(&:capitalize).join(' ')\n end", "title": "" }, { "docid": "70c6dff30da8f13054a5b08a118efc34", "score": "0.77929085", "text": "def titleize(up)\n\n sw = %w[and in the of a an]\n\n up.capitalize.gsub( /\\S+/ ) { |w| sw.include?(w) ? w : w.capitalize }\nend", "title": "" }, { "docid": "ebe1b2884e72de4becef00d765068ef3", "score": "0.7790728", "text": "def titleize(str)\n str.split.each{ |word| word.capitalize! }.join(' ')\nend", "title": "" }, { "docid": "c9abc4048d3608901dc19f06d64075a9", "score": "0.7789276", "text": "def titleize(sentence)\n sentence.split.each { |word| word.capitalize! }.join(\" \")\nend", "title": "" }, { "docid": "179c0c59baa7207fef26469a9a7400b6", "score": "0.778793", "text": "def clever_title! args = {} # :args: :max_downcase_conversion, :capitalize_first_letter\n @title = self\n @max_downcase_conversion = 4\n @max_downcase_conversion = args[:max_downcase_conversion] if args[:max_downcase_conversion]\n @capitalize_first_letter = true unless args[:capitalize_first_letter] == false\n @capitalize_after_period = true unless args[:capitalize_after_period ] == false\n self.run\n\t\tself.replace(@title)\n @title\n end", "title": "" }, { "docid": "64e6dffebf89241ba360a46d1678fac2", "score": "0.7786228", "text": "def make_title_case\n self.title = self.title.titlecase\n end", "title": "" }, { "docid": "f5341ae5db791a48333034562405d221", "score": "0.778284", "text": "def titleize(title)\n specical = %w(a and of over or the)\n\n words_arr = title.split(\" \").map do |word|\n !specical.include?(word) ? word.capitalize : word\n end\n\n words_arr[0].capitalize! if specical.include?(words_arr[0])\n words_arr.join(' ')\nend", "title": "" }, { "docid": "ee7baf1de585de53867e0d04122564c8", "score": "0.77820677", "text": "def titleize\n self.to_s.titleize.to_sym\n end", "title": "" }, { "docid": "ee7baf1de585de53867e0d04122564c8", "score": "0.77820677", "text": "def titleize\n self.to_s.titleize.to_sym\n end", "title": "" }, { "docid": "2f1ce9b88e367a44668d21f3b0a63d89", "score": "0.7765602", "text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\n end", "title": "" }, { "docid": "b62005ce01490146e9a09248e44da637", "score": "0.7760547", "text": "def titleize(name)\n lowercase_words = %w{a an the and but or for nor of over}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "title": "" }, { "docid": "46666578a9a9b062734e211f9b818a50", "score": "0.7753757", "text": "def titleize(words)\n words.split.map {|word| word.capitalize }.join(\" \") # use of split, map, capitalize and join\n end", "title": "" }, { "docid": "77645171633fd73cacd0ade6a4d64ac7", "score": "0.77449787", "text": "def titleize_name \n self.name = name.titleize\n end", "title": "" }, { "docid": "f85a3542db6772743710d7748d0fe9cf", "score": "0.77432656", "text": "def to_title\n tr('.', ' ').tr('_', ' ').titleize\n end", "title": "" }, { "docid": "0a12b8d02dc35ae17e1f8cdc2caea335", "score": "0.77419114", "text": "def titleize(title)\n words = title.split\n little_words = ['the', 'and', 'of', 'over']\n newTitle = \"\"\n words.each_with_index do |word, index|\n if little_words.include?(word) \n if index == 0\n word = word.capitalize\n end\n else\n word = word.capitalize\n end\n newTitle += word \n if index != words.length - 1\n newTitle += \" \" \n end\n end\n return newTitle\nend", "title": "" }, { "docid": "a9ceb08fcaa966b02c6760afeda0d390", "score": "0.77350783", "text": "def titleize(str)\n formatted_string = str.split.map { |word| word.capitalize }.join(\" \") \n return formatted_string\nend", "title": "" }, { "docid": "b1ff50e56757a64682ef5c2f9fb5cb27", "score": "0.77229434", "text": "def make_title page_title=nil\n \n if page_title.nil? || page_title.match(/^\\s*$/)\n\n page_title = controller.action_name.titleize\n\n end\n \n page_title + \": \" + BASE_TITLE\n \n end", "title": "" }, { "docid": "45682380189f3b54676b1d71c7261f7f", "score": "0.77226645", "text": "def titleize(title)\n capitalized_title = []\n uncapitalized_words = %w[a and of over the]\n title.split(' ').each.with_index do |word, idx|\n if uncapitalized_words.include?(word)\n if idx == 0\n capitalized_title.push(word[0].upcase + word[1..-1])\n else\n capitalized_title.push(word)\n end\n else\n capitalized_title.push(word[0].upcase + word[1..-1])\n end\n end\n capitalized_title.join(' ')\nend", "title": "" }, { "docid": "fad6ce2db9417ebb5d8618d4d9baf6ab", "score": "0.7722175", "text": "def titleize(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "fad6ce2db9417ebb5d8618d4d9baf6ab", "score": "0.7722175", "text": "def titleize(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "afd1dfa9e275bac19502aa6e76cf8c09", "score": "0.7720909", "text": "def titleize(input)\n input.strip.split(/[[:space:]]/).map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "4b1f347053d44554d4c1c7fca1caacff", "score": "0.77172333", "text": "def titleize(sentence)\n words = sentence.split\n titleized = words.map { |word| word.capitalize }.join(' ')\n\n titleized\nend", "title": "" }, { "docid": "95921ef011e648b927eb16ee456da5d0", "score": "0.77163565", "text": "def titleize(string)\n\nstring.split(' ').each {|i| i.capitalize!}.join(\" \")\n\nend", "title": "" }, { "docid": "965a7e8b248a710f9f938b345b03f62e", "score": "0.76942605", "text": "def form_title(title)\n title.gsub!(/\\Atitle: /, '')\n title.tr!(' ', '_')\n title.tr!('\"', '')\n title = title.gsub('/', '_')\n title = title.gsub(\"\\r\", '')\n title = title.gsub('\\\\', '')\n title = title.gsub('.', '')\n title = title.gsub('?', '')\n title = title.gsub(',', '')\n title = title.gsub('-', '_')\n title = title.gsub(/_+/, '_')\nend", "title": "" }, { "docid": "e7d7f637edbf62df9635ef018c00ca05", "score": "0.7681733", "text": "def titleize (lause)\nsanat = lause.split \" \"\n\tsanat.length.times do |i|\n\t\tif (sanat[i].length>4 || i==0 || i==sanat.length-1)\n\t\t\tsanat[i].capitalize!\n\t\tend\n\nend\nsanat.join(\" \")\nend", "title": "" }, { "docid": "c04996ea73fd9356cb0a2afd6369faab", "score": "0.7679705", "text": "def titleize(string)\n string.split(' ').map { |s| s.capitalize }.join(' ')\nend", "title": "" }, { "docid": "9985d288c0e256bda378b3a58b0469b8", "score": "0.767843", "text": "def titleize(string)\n string.split.map {|string| string.capitalize}.join(' ')\nend", "title": "" }, { "docid": "c9c79324984e7551400a925879ab8523", "score": "0.76760876", "text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "c9c79324984e7551400a925879ab8523", "score": "0.76760876", "text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "c9c79324984e7551400a925879ab8523", "score": "0.76760876", "text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "e2d4c6c5eb59eafb4dad021e8c27fe5b", "score": "0.7674906", "text": "def titleize(string)\n words = string.split\n words.each{|word| word.capitalize!}\n words.join(' ')\nend", "title": "" }, { "docid": "5618086189092dfd08e84efb87472019", "score": "0.76747036", "text": "def titleize(s)\n words = s.split\n caps = []\n words.each do |word|\n caps << word.capitalize\n end\n caps.join \" \"\nend", "title": "" }, { "docid": "f894d98dfbc3b66ce33dc9648978b5e1", "score": "0.76739705", "text": "def pretty_title\n self.title.gsub('-', ' ').titlecase\n end", "title": "" }, { "docid": "04dd00f020cff6c5218cbeb9016a6d5f", "score": "0.76597923", "text": "def titleize(str)\n str.split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "title": "" }, { "docid": "d075ff45cfc2acb085e0cc1ac0bc444f", "score": "0.7653412", "text": "def titleize!(string)\n temp = string.split\n temp.each do |word|\n word.capitalize!\n end\n string = temp.join(\" \")\nend", "title": "" }, { "docid": "1e6c6c7dd26e7add04bb568b652cb615", "score": "0.7646104", "text": "def titleize(str)\n str = str.slice(0, 1).capitalize + str.slice(1..-1)\n end", "title": "" }, { "docid": "c79aaf14d801b8f3d22f4fbcce65e0d4", "score": "0.76449656", "text": "def make_title(str)\n str.split(' ').map(&:capitalize).join(' ')\nend", "title": "" }, { "docid": "fcd06d4caa6ee843563d26db82b60b8d", "score": "0.7643846", "text": "def titleize(s)\n #get array of words in the s\n words_in_s = s.split \" \"\n\n #make a string with all the words capitalized\n titlized_s = \"\"\n words_in_s.each do |w|\n titlized_s << w.capitalize\n titlized_s << \" \"\n end \n\n #remove the last space\n titlized_s.chop!\n\n return titlized_s\nend", "title": "" }, { "docid": "2010cd7a78c9768f6a362a2fe5016468", "score": "0.764362", "text": "def title(words)\nwords.split.map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "fd5861acbc320d74eb56d8a7205abdb4", "score": "0.76388025", "text": "def title\n @title = @title.capitalize.split(' ').map { |x| ([\"the\", \"a\", \"an\", \"and\", \"in\", \"of\"].include? x) ? x : x.capitalize }.join(' ')\nend", "title": "" }, { "docid": "b5d7f0a32602b419cacb71f5f493cea7", "score": "0.76353765", "text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\n end", "title": "" }, { "docid": "56f8a2b9a8811b79d2041eae022f0dc1", "score": "0.76322305", "text": "def titleize\n arr = ['a', 'an', 'the', 'by', 'to']\n upcase_arr = ['DX', 'EDA', 'AEDG', 'LPD', 'COP']\n r = tr('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n r\n end", "title": "" }, { "docid": "107cb6c10e800c135c85e96352fb51e6", "score": "0.76238286", "text": "def titleize(string)\n string.split.map { |word| word.downcase.capitalize }.join(' ')\nend", "title": "" }, { "docid": "768a174587fa7818ea0314e1a35eda5a", "score": "0.76168674", "text": "def titleize(string)\n string.split.map {|word| word.capitalize!}.join(' ')\nend", "title": "" }, { "docid": "cea9cb131c84fb46c1873eba9640f709", "score": "0.7608724", "text": "def titleize(sentence)\n sentence.split(' ').map { |word| word.capitalize }.join(' ')\nend", "title": "" }, { "docid": "96f5d8f5de9ced0b520d16f4765dfd9e", "score": "0.7602356", "text": "def title\n neverCap = ['a', 'the', 'and', 'an', 'in', 'of', 'on']\n if @title.index(' ') != nil\n @title = @title.split(' ')\n @title.each do |word|\n if neverCap.index(word) != nil && word != @title[0]\n word.downcase!\n else\n word.capitalize!\n end\n end\n @title.join(' ')\n else\n @title.capitalize\n end\n end", "title": "" }, { "docid": "8412175d538b56c7323149a84757134a", "score": "0.7598763", "text": "def titlecase!\n replace(titlecase)\n end", "title": "" }, { "docid": "659f0798942fd3c4e01e708f20e8d75f", "score": "0.7598318", "text": "def upcased_title\n title.upcase\n end", "title": "" }, { "docid": "7ba43db8b9f2450aa47d96e60ebcb1bb", "score": "0.7597974", "text": "def titleize(str)\n words = str.split('')\n words.map! do |word|\n word.capitalize\n end\n str = words.join(' ')\n \nend", "title": "" }, { "docid": "d7c9f6fa27452db210e3bfdaa1efae91", "score": "0.7594006", "text": "def titleize_name(character)\n names_array = character.split(\" \")\n names_array.collect { |name| name[0] = name[0].upcase}\n capital_name = names_array.join(\" \")\n if capital_name.include?(\"-\")\n capital_name.gsub(/-[a-z]/) {|letter| letter.upcase}\n else\n capital_name\n end\n # binding.pry\nend", "title": "" } ]
2aa1b37479784b9727aa38aa97c5c8dd
DELETE /paragraph_ratings/1 DELETE /paragraph_ratings/1.json
[ { "docid": "475b3a1d7e374cd232a67ab913b31677", "score": "0.77042425", "text": "def destroy\n @paragraph_rating = ParagraphRating.find(params[:id])\n @paragraph_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to paragraph_ratings_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "7a9ef9cf9c1bb6f0dc1d92d5884cf002", "score": "0.67461467", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "05add13afb323f23de9735ba453188e7", "score": "0.6719796", "text": "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "72f3a699af8f1046711bb23ed673c610", "score": "0.66958296", "text": "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "22d6971ad79ceb9b75777a7b90cff0ed", "score": "0.66787946", "text": "def destroy\n @rating_alt = Rating.find(params[:id])\n @rating_alt.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_alts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e5be41838e2760c70431801cf140aeb", "score": "0.664086", "text": "def destroy\n @idea_rating.destroy\n respond_to do |format|\n format.html { redirect_to idea_ratings_url, notice: (I18n.t :act_delete) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "619765279a66f5bc21c21fb01a37a686", "score": "0.6624018", "text": "def destroy\n @participant_rating = ParticipantRating.find(params[:id])\n @participant_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_ratings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "63f1849a8a566236c37607605aefb507", "score": "0.65075296", "text": "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratings_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "321ed4fc864e2f0e3d1e93aafa7bff67", "score": "0.6439028", "text": "def destroy\n @content_rating.destroy\n respond_to do |format|\n format.html { redirect_to content_ratings_url, notice: \"Content rating was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17fe67de1acb0f84a23e1fa1640846ee", "score": "0.64385825", "text": "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17fe67de1acb0f84a23e1fa1640846ee", "score": "0.64384496", "text": "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa80548cd2863543e72c46050aa5a497", "score": "0.64184546", "text": "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "title": "" }, { "docid": "835c46035f10a367f7e177a0a34f5992", "score": "0.64140457", "text": "def delete\n render json: Like.delete(params[\"id\"])\n end", "title": "" }, { "docid": "ca86019eca12d2a38eb090a50b3fc213", "score": "0.6400026", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ca86019eca12d2a38eb090a50b3fc213", "score": "0.6400026", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "96ef802a93076579eb442e944e92d7a0", "score": "0.63906455", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc0ccd1a1ebc827705c8573bc912017f", "score": "0.63892", "text": "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c8aca480f4047cf4198356a93aeaccdb", "score": "0.635391", "text": "def destroy\n @m_rating = MRating.find(params[:id])\n @m_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_ratings_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c3c4376da9103020106dafec9ae284c4", "score": "0.6347953", "text": "def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "title": "" }, { "docid": "9dbb366f07ff2d536c19ecf1b33507b6", "score": "0.6339265", "text": "def destroy\n @confidence_rating.destroy\n respond_to do |format|\n format.html { redirect_to confidence_ratings_url, notice: 'Confidence rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a0d38fa6cbef07ac42639dee8f25ab7d", "score": "0.63367", "text": "def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42fe8275fc1e4f4fb2651a4a5132c27e", "score": "0.63090616", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html {redirect_to ratings_url, notice: 'Payment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "title": "" }, { "docid": "1db87909cd5749275fba46980e24d80c", "score": "0.62977046", "text": "def destroy\n @rating = @skate_spot.ratings.find(params[:id])\n if @rating.destroy\n flash[:success] = \"Rating has been successfully deleted!\"\n redirect_to skate_spot_path(@skate_spot)\n else\n flash[:danger] = \"Deletion unsuccessful. Please try again.\"\n redirect_to skate_spot_path(@skate_spot)\n end\n end", "title": "" }, { "docid": "90695ce1b62b5e26b5a84ed2d5cdea3e", "score": "0.62691766", "text": "def destroy\n @recommended.destroy\n respond_to do |format|\n format.html { redirect_to recommendeds_url, notice: 'Recommended was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "34d7ef1a58637d67326841185e6ddd4d", "score": "0.6264322", "text": "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f627e6733ba475cb35a15bfa5ec42cb5", "score": "0.6224981", "text": "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "811351d78317593ebc3e070b8d133ff8", "score": "0.6217967", "text": "def destroy\n @recommendation.destroy\n respond_to do |format|\n format.html { redirect_to recommendations_url, notice: \"Recommendation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a91d2e1a9e7b4036c4c338098a10511e", "score": "0.62101823", "text": "def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c0fdd975e789242e4aa4b4d8e095ea6", "score": "0.6201587", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c0fdd975e789242e4aa4b4d8e095ea6", "score": "0.6201587", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c0fdd975e789242e4aa4b4d8e095ea6", "score": "0.6201587", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c0fdd975e789242e4aa4b4d8e095ea6", "score": "0.6201587", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0c0fdd975e789242e4aa4b4d8e095ea6", "score": "0.6201587", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "11b1787a9319772657508ff7291b02e0", "score": "0.6201331", "text": "def destroy\n @create_rating = CreateRating.find(params[:id])\n @create_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(create_ratings_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d044cfff30e6e60dd9e038d1a52045c3", "score": "0.6196923", "text": "def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end", "title": "" }, { "docid": "de58f83ca11aabc92b4d38b05e2ccfd2", "score": "0.6190576", "text": "def destroy\n @review.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "de58f83ca11aabc92b4d38b05e2ccfd2", "score": "0.6190576", "text": "def destroy\n @review.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "de58f83ca11aabc92b4d38b05e2ccfd2", "score": "0.6190576", "text": "def destroy\n @review.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "070c283b552303465f954a5ba5e85ed0", "score": "0.6190423", "text": "def destroy\n @intention = Intention.find(params[:id])\n @intention.destroy\n\n respond_to do |format|\n format.html { redirect_to intentions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "391ba3f8832cbb1b5ebf923357b285c7", "score": "0.61850035", "text": "def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5ba0dedae2c3b9d3a8a58b468d3d130c", "score": "0.61718214", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "841f80fe4ab54e7f152518db2d41a92c", "score": "0.61702883", "text": "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "title": "" }, { "docid": "9e8b05f2257bdea137c8d2abce6025a5", "score": "0.61655813", "text": "def destroy\n @effort_rating.destroy\n respond_to do |format|\n format.html { redirect_to effort_ratings_url, notice: 'Effort rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e5768f98469ac5f0d0ce7db23e8780e0", "score": "0.6163498", "text": "def delete\n @client.delete_document(@path)\n end", "title": "" }, { "docid": "dbc812af3a50a9c59fde6255be67a4c3", "score": "0.61512375", "text": "def destroy\n @rating_answer.destroy\n respond_to do |format|\n format.html { redirect_to rating_answers_url, notice: 'Rating answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f4282be7c68aae0b890df74b7bf26cd", "score": "0.6142071", "text": "def destroy\n @reputation.destroy\n respond_to do |format|\n format.html { redirect_to reputations_url, notice: 'Reputation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "589f1f27c68fc5befad67deeff62f0a9", "score": "0.61369586", "text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to ratings_url, notice: 'Rating was successfully destroyed.' }\n\n end\n end", "title": "" }, { "docid": "349db52007f251f9d59ce565fdf20f80", "score": "0.6135988", "text": "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "99f3dbc3298b98baefcfd585b796f044", "score": "0.6133497", "text": "def destroy\n @team_rating = TeamRating.find(params[:id])\n @team_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to team_ratings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d2938d0d96fc4adb30b185ea6e647cdf", "score": "0.6122693", "text": "def delete\n render json: Post.delete(params[\"id\"])\n end", "title": "" }, { "docid": "1fd7dc0e91f151ed3e5049a52c30472f", "score": "0.61199236", "text": "def delete\n \n end", "title": "" }, { "docid": "5910297bcaa9620765717b719cbc5c9b", "score": "0.6118575", "text": "def destroy\n @rating_reason.destroy\n respond_to do |format|\n format.html { redirect_to rating_reasons_url, notice: 'Rating reason was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5fb60eb995fa5c6c7b35a2f623bf3b5e", "score": "0.6101652", "text": "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommendations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5fb60eb995fa5c6c7b35a2f623bf3b5e", "score": "0.6101652", "text": "def destroy\n @recommendation = Recommendation.find(params[:id])\n @recommendation.destroy\n\n respond_to do |format|\n format.html { redirect_to(recommendations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fceb69af66d317a04770e406f84db1bb", "score": "0.60937005", "text": "def destroy\n @item_review.destroy\n respond_to do |format|\n format.html { redirect_to item_reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6a7b8ca4ec46b395c7cd92cd7f3ac335", "score": "0.60878855", "text": "def destroy\n @fourth_review.destroy\n respond_to do |format|\n format.html { redirect_to fourth_reviews_url, notice: 'Fourth review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0cbf2af0c2d7558d11cc96bd45a56ce7", "score": "0.6081266", "text": "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f59c5c98e2fd169d9427b6d891bca9e8", "score": "0.6080405", "text": "def destroy\n @admin_nature_of_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_nature_of_reviews_url, notice: 'Nature of review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "860816772250d3e9c8e70389ad5edb10", "score": "0.6078205", "text": "def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15d018ff0743671b3363e09f00967826", "score": "0.6075549", "text": "def destroy\n @recommend = Recommend.find(params[:id])\n @recommend.destroy\n\n respond_to do |format|\n format.html { render :text=>\"删除成功\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7af03ab3b77a7b3c1cc7937434da9427", "score": "0.607363", "text": "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @review.lecture, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a35bced7fe092f8a4603af37e6222216", "score": "0.6062061", "text": "def destroy\n @movie_user_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to movie_user_recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b73db7fa791d32bac3204c38c57ed551", "score": "0.60578424", "text": "def destroy\n @mode = params[:deleteMode]\n type = params[:type] || \"\"\n concept = params[:concept] || \"\"\n type.strip!\n concept.strip!\n\n Document.transaction do \n if @mode == \"batch\"\n @ids = params[:ids]\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"concept\"\n if @assign.present?\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE assign_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @assign.id, @annotation.version, @annotation.concept, @annotation.a_type)\n elsif @project.manager?(current_user) || @project.collaborate_round\n targets = Annotation.execute_sql(\"\n SELECT id FROM annotations \n WHERE document_id = ? AND version = ? AND concept = ? AND a_type = ?\n \", @document.id, @annotation.version, @annotation.concept, @annotation.a_type)\n end\n @ids = targets.map{|e| e[0]}\n if @document.has_reference_relation?(@ids)\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n ret = Annotation.execute_sql(\"DELETE FROM annotations WHERE id in (?)\", @ids)\n elsif @mode == \"mention\"\n if @document.has_reference_relation?([@annotation.id])\n return render json: 'Cannot delete annotation because there is a relation that refers to this node' , status: 422 \n end\n @ids = [@annotation.id]\n @annotation.destroy\n end\n @document.touch\n end\n @document.create_audit(current_user, \"Delete annotation\", params.to_json, @ids.join(\",\"))\n\n # @annotation.destroy\n respond_to do |format|\n format.html { redirect_to @document, notice: 'The annotation was successfully deleted.' }\n format.json { render json: @ids, status: :ok }\n end\n end", "title": "" }, { "docid": "b6ec46ab1869e9c2c086f9d76da6d6d0", "score": "0.60542214", "text": "def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5493e4c3336f5852e228690be271606c", "score": "0.6053054", "text": "def destroy\n @interview = Interview.find_by_slug(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "99ef7314c871b45ab37bac2936b54003", "score": "0.60505813", "text": "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "99ef7314c871b45ab37bac2936b54003", "score": "0.60505813", "text": "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "99ef7314c871b45ab37bac2936b54003", "score": "0.60505813", "text": "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b025268474d63082caf1158aed433b8", "score": "0.6050246", "text": "def destroy\n @finale_rating.destroy\n respond_to do |format|\n format.html { redirect_to finale_ratings_url, notice: 'Finale rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d37dcf3a50b858e9be7ee2f0ca59d8af", "score": "0.6049227", "text": "def destroy\n @admin_interview = Interview.find(params[:id])\n @admin_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_interviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c3fb71b877fd552f8bc708a7bbcea3c9", "score": "0.60423464", "text": "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "title": "" }, { "docid": "cc32998f6071ac6e2460b0dd299c1e67", "score": "0.6041513", "text": "def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f6db9b8447e6f341d9a2d56aa9f50dd0", "score": "0.6039886", "text": "def destroy\n @meal_rating.destroy\n respond_to do |format|\n format.html { redirect_to meal_ratings_url }#, notice: 'Meal rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "295960e13159007e4b077cab5ce40a8a", "score": "0.60325277", "text": "def destroy\n @comentrating.destroy\n respond_to do |format|\n format.html { redirect_to comentratings_url, notice: 'Comentrating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bacd279aad48d93dc56e7eb92c594235", "score": "0.603038", "text": "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json do\n render :json => { :notice => \"Snippet deleted\" }\n end\n end\n end", "title": "" }, { "docid": "97e646bdc85a9fcc8afa5822f7408346", "score": "0.6016287", "text": "def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "8a31a4261a7d00d32c945640abc366bd", "score": "0.60148275", "text": "def destroy\n request.format = \"json\"\n\n @annotation = Annotation.where(\"annotation_id like ? \", \"%#{params['id']}\").first\n\n if @annotation.nil?\n format.json { render json: nil, status: :ok }\n else\n\n unless check_anno_auth(request, @annotation)\n return render_forbidden(\"There was an error deleting the annotation\")\n end\n\n if @annotation.version.nil? || @annotation.version < 1\n @annotation.version = 1\n end\n if !version_annotation @annotation\n errMsg = \"Annotation could not be versioned: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotation.destroy\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "12064000328bc956cef9dc3fda9f458c", "score": "0.6009514", "text": "def destroy\n @engine_rating.destroy\n respond_to do |format|\n format.html { redirect_to engine_ratings_url, notice: 'Engine rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.60092336", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" }, { "docid": "797366bacb7e075de7c5d4bb234b9b2a", "score": "0.6006878", "text": "def destroy\n @blog_recommendation.destroy\n respond_to do |format|\n format.html { redirect_to blog_recommendations_url, notice: 'Recommendation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2c74ea3306cc27f189364cb4e39723b8", "score": "0.6002235", "text": "def destroy\n @recommend_recommend_other = Recommend::RecommendOther.find(params[:id])\n @recommend_recommend_other.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_others_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "620dc9a3bf556a55db616c5677b7daff", "score": "0.5997946", "text": "def destroy\n if current_user.admin\n @psp_diagrams_to_ps_perimeter.destroy\n respond_to do |format|\n format.html { redirect_to psp_diagrams_to_ps_perimeters_url, notice: 'Psp diagrams to ps perimeter was successfully destroyed.' }\n format.json { head :no_content }\n end\n else \n redirect_to \"/ps_perimeters\", notice: 'Cannot delete uploaded document.'\n end\n end", "title": "" }, { "docid": "40bf1f2987e62deb3d87435d29e1a69e", "score": "0.59946245", "text": "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "title": "" }, { "docid": "1a1ed7b5d99b569a05cbb459476b7d96", "score": "0.5991277", "text": "def destroy\n @recommendation = Recommendation.find(params[:id])\n authorize @recommendation\n if @recommendation.destroy\n ArticleRankingWorker.perform_async(@recommendation.article_id)\n end\n\n head :no_content\n end", "title": "" }, { "docid": "1d390c1e122a11844cc38bb7e11953d9", "score": "0.59887725", "text": "def destroy\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t@recommendation.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to recommendations_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "7e099ed08bd52a850d0b2e4ef1352bbe", "score": "0.5988526", "text": "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e099ed08bd52a850d0b2e4ef1352bbe", "score": "0.5988526", "text": "def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "86faa8c555419d7144a0c7003f760dff", "score": "0.5987364", "text": "def delete\n render json: Item.delete(params[\"id\"])\n end", "title": "" }, { "docid": "037ee644bea0b9b125daadd4ef21ac42", "score": "0.5986794", "text": "def delete_article(db, name, article_name) #=> deletes review from user but does not delete article entirely\n db.execute(\"DELETE FROM review WHERE article_id=(?) AND user_id = (?)\",\n [find_article_id(db, article_name), find_user_id(db, name)])\nend", "title": "" }, { "docid": "c287dcc88a1bfa97e3f13ffc528abd6c", "score": "0.59838253", "text": "def destroy\n @reminder_phrase = ReminderPhrase.find(params[:id])\n @reminder_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to reminder_phrases_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d42d524667fe775a6fd2f8ed58ac62b5", "score": "0.5983335", "text": "def delete(*rest) end", "title": "" }, { "docid": "79f6c1dc625b7028742c1da69decc7cf", "score": "0.59816015", "text": "def delete\n \n end", "title": "" }, { "docid": "fdaef2ef7a3a7389503665c4fff17223", "score": "0.59756", "text": "def destroy\n @game_rating.destroy\n respond_to do |format|\n format.html { redirect_to game_ratings_url, notice: 'Game rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7472ada0652a6e265c01e669b84cd3cd", "score": "0.59754914", "text": "def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6b340ece9c0fef6e9c52b162a4099a54", "score": "0.5969042", "text": "def destroy\n current_user.rating_for(parent_object).destroy\n respond_to do |format|\n format.js { render :template => \"movie_ratings/destroy.rjs\" }\n end\n \n end", "title": "" }, { "docid": "429748ed749fc53b630986d0ccadddf2", "score": "0.5967863", "text": "def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cefd4c93643842e0b63b9a06d0ab60e7", "score": "0.5958233", "text": "def destroy\n @album_rating.destroy\n respond_to do |format|\n format.html { redirect_to album_ratings_url, notice: 'Album rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c659b954a0f0ff19a3c959a44af4cadc", "score": "0.59574026", "text": "def destroy\n @credibility_rating.destroy\n respond_to do |format|\n format.html { redirect_to credibility_ratings_url, notice: 'Credibility rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f1d4842399116750052ed32ae35bfdd", "score": "0.59550494", "text": "def destroy\n if user_signed_in? && current_user.admin?\n @new_review = NewReview.find(params[:id])\n @new_review.destroy\n\n respond_to do |format|\n format.html { redirect_to new_reviews_url }\n format.json { head :no_content }\n end\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "89268a6ec13a5a681962b227c3d9fb42", "score": "0.59548336", "text": "def delete\n\n end", "title": "" }, { "docid": "4b0e100226d6472ef0a2f9dfc8cf2789", "score": "0.59547466", "text": "def destroy\n @ocs_rating_factor = OcsRatingFactor.find(params[:id])\n @ocs_rating_factor.destroy\n\n respond_to do |format|\n format.html { redirect_to(ocs_rating_factors_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
8004ce6ade8f6698cd6db9fc4be21c4a
:type other: List a :rtype: Boolean
[ { "docid": "0b309b4524a47d2026eb67b7e4983a2b", "score": "0.0", "text": "def ==(other)\n match.(\n -> a {\n other.match.(-> a { true }, -> a { false }),\n }\n -> a {\n other.match.(\n -> b { false },\n -> (b) { a == b }\n )\n }\n )\n end", "title": "" } ]
[ { "docid": "a4536cb52ed520ba6a6b385e05c08030", "score": "0.71393216", "text": "def is_included_by? other\n return false if self.count > other.count\n return true if self.eql? other\n return other.drop(other.count - self.count).to_a.eql? self.to_a\n end", "title": "" }, { "docid": "55e14a3addc37282f835a8836c7c113f", "score": "0.7107001", "text": "def equal_squadronstructs_list?(list1, list2)\n if list1.size != list2.size\n false\n else\n list1.each{|x|\n list2.include?(x)\n }\n end\n end", "title": "" }, { "docid": "4453f4597f74900b1ee47b0daff0d624", "score": "0.70688176", "text": "def does_include? other\n return false if other.count > self.count\n return true if self.eql? other\n return self.drop(self.count - other.count).to_a.eql? other.to_a\n end", "title": "" }, { "docid": "d4b443e89b0f2a4a31de36b6722a48c4", "score": "0.70586926", "text": "def disjoint?(other)\n if size < other.size\n each { |item| return false if other.include?(item) }\n else\n other.each { |item| return false if include?(item) }\n end\n true\n end", "title": "" }, { "docid": "2e2d97196a9fe13a4137a30f4edad23e", "score": "0.70353144", "text": "def eql?(other)\n other = RDF::N3::List[*other] if other.is_a?(Array)\n return false if !other.is_a?(RDF::List) || count != other.count\n @values.each_with_index do |li, ndx|\n case li\n when RDF::Query::Pattern, RDF::N3::List\n return false unless li.eql?(other.at(ndx))\n else\n return false unless li == other.at(ndx)\n end\n end\n true\n end", "title": "" }, { "docid": "efb8968474c287c5dd27500a2f191a71", "score": "0.70141697", "text": "def ==(other_list)\n other_list.is_a?(self.class) && self.id == other_list.id\n end", "title": "" }, { "docid": "975c80b6fc9a549f5ae0fd9a2722350d", "score": "0.69682634", "text": "def proper_subset?(other)\n return false if other.size <= size\n all? { |item| other.include?(item) }\n end", "title": "" }, { "docid": "0242e3efa7020e49ba477eb7c30f6221", "score": "0.6928688", "text": "def ==(other)\n return false unless other.is_a? self.class\n return false unless other.count == count\n\n other_items = other.each_item\n each_item.all? { |item| item == other_items.next }\n end", "title": "" }, { "docid": "5709a04a4029b780171014aa7d902287", "score": "0.69146115", "text": "def eql?(other)\n list = self\n loop do\n return true if other.equal?(list)\n return false unless other.is_a?(List)\n return other.empty? if list.empty?\n return false if other.empty?\n return false unless other.head.eql?(list.head)\n list = list.tail\n other = other.tail\n end\n end", "title": "" }, { "docid": "cb9ae264fd0a00a1844a757a12943953", "score": "0.68910575", "text": "def subset? other\n return false if self.count > other.count@list.each do |nd|\n return false unless other.contains(nd.value)\n end\n true\nend", "title": "" }, { "docid": "1e4909535a69f1332fb9f832b4df9f03", "score": "0.6884933", "text": "def subset?(other)\n return false if other.size < size\n all? { |item| other.include?(item) }\n end", "title": "" }, { "docid": "bf66acb3843349654f3430089f8684ab", "score": "0.68532896", "text": "def ==(other)\n Java::JavaUtil::List === other ? other == self : equal__base(other)\n end", "title": "" }, { "docid": "235a77e9b22af6e68299148e35200fec", "score": "0.68200755", "text": "def include? other\n each do |e|\n return true if e == other\n end\n return false\n end", "title": "" }, { "docid": "16dd7b1b4cf55d3b17a2d52901a5e960", "score": "0.67497873", "text": "def eql?(other)\n other.is_a? self.class or return false\n size == other.size or return false\n to_a.zip(other.to_a) { |x, y| x == y or return false }\n true\n end", "title": "" }, { "docid": "936a5a566f2d713b30731148ca08d450", "score": "0.66956127", "text": "def compare_instance_lists(listA, listB)\n listA = objects_to_instance_ids(listA)\n listB = objects_to_instance_ids(listB)\n return false if listA.empty? || listB.empty?\n return false unless listA.size == listB.size\n (listA - listB).empty? && (listB - listA).empty? \n end", "title": "" }, { "docid": "c7d567e85d6a339530bf6735670c1e15", "score": "0.6681113", "text": "def ==(other)\n to_a == Array(other) &&\n !(other.is_a?(RDF::Value) && other.list?)\n end", "title": "" }, { "docid": "c7d567e85d6a339530bf6735670c1e15", "score": "0.6681113", "text": "def ==(other)\n to_a == Array(other) &&\n !(other.is_a?(RDF::Value) && other.list?)\n end", "title": "" }, { "docid": "19208f54adc4f66ade09dbc5f22a89ea", "score": "0.66772777", "text": "def ==(other)\n return false if @count != other.size\n each_with_index { |e, i| return false unless e == other[i] }\n return true\n end", "title": "" }, { "docid": "09a2d5f304cd7f6743a9be710de06665", "score": "0.6676541", "text": "def include?(other); end", "title": "" }, { "docid": "aa5cce5277a289d70ef0e92f6b6f77ab", "score": "0.66080314", "text": "def is_subset_of?(other)\r\n\t\tif (\r\n\t\t\tlist_subjects.collect{|list_subject| list_subject.subject.id}.to_set == other.list_subjects.collect{|list_subject| list_subject.subject.id}.to_set && # check subjects\r\n\t\t\tlist_columns.collect(&:id).to_set.subset?(other.list_columns.collect(&:id).to_set)\r\n\t\t) then\r\n\t\t\tlist_subjects.each do |list_subject|\r\n\t\t\t\tother_list_subject = other.list_subjects.select{|item| item.subject.id == list_subject.subject.id}.first\r\n\t\t\t\tif (!(list_subject.data_filters.to_set == other_list_subject.data_filters.to_set))\r\n\t\t\t\t\treturn false\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend", "title": "" }, { "docid": "f7ec92dc73a9f53c25408b1d2e39caf8", "score": "0.6606689", "text": "def ==(other)\n return true if self.object_id == other.object_id\n\n unless other.kind_of? Array then\n return false unless other.respond_to? :to_ary\n return other == self\n end\n\n return false unless other.length == self.length\n\n self.each_with_index do |item, i|\n return false unless item == other.at(i)\n end\n \n return true\n end", "title": "" }, { "docid": "8cbc66d15d9e030425fccd9513925cb4", "score": "0.660343", "text": "def eql?(other)\n return true if equal?(other)\n return false unless instance_of?(other.class) && size == other.size\n each do |entry|\n return false unless other.include?(entry[0], entry[1])\n end\n true\n end", "title": "" }, { "docid": "c936e1cc7bde767bc667e2081186b9bb", "score": "0.6557471", "text": "def eql?(other)\n return true if self.object_id == other.object_id\n return false unless other.kind_of? Array\n return false unless self.length == other.length\n self.each_with_index do |item, i|\n return false unless item.eql? other.at(i)\n end\n return true\n end", "title": "" }, { "docid": "29350e0bb51bd6aaaa5eb219e5930125", "score": "0.6536295", "text": "def contains?( other )\n ( other - self ).blank?\n end", "title": "" }, { "docid": "28b55aaf2ed22ddaf31731107531e950", "score": "0.64138204", "text": "def include?(other)\n other.to_set.subset?(self.to_set)\n end", "title": "" }, { "docid": "52d1564a72dc79ea8d3d21ee8d5986df", "score": "0.6403015", "text": "def eql?(other)\n return true if equal? other\n return false unless other.kind_of?(Array)\n return false if @total != other.size\n\n Thread.detect_recursion self, other do\n i = 0\n each do |x|\n return false unless x.eql? other[i]\n i += 1\n end\n end\n\n true\n end", "title": "" }, { "docid": "fa7b65b54c81e170a0ae1e1489276617", "score": "0.6395214", "text": "def subset?(other)\r\n !(self - other).accepting?\r\n end", "title": "" }, { "docid": "1e58ba71691b96942a3821b0d081f037", "score": "0.6386685", "text": "def disjoint?(other)\n if other.size <= size\n other.each { |item| return false if include?(item) }\n else\n # See comment on #subset?\n if other.size >= 150 && @trie.size >= 190 && !(other.is_a?(Immutable::Set) || other.is_a?(::Set))\n other = ::Set.new(other)\n end\n each { |item| return false if other.include?(item) }\n end\n true\n end", "title": "" }, { "docid": "d8525f6ed09be1ba938eab7e3298add2", "score": "0.63754314", "text": "def ==(other)\n other.is_a?(Array) ? other.include?(@value) : (@value == other)\n end", "title": "" }, { "docid": "e9bbfbff79f5acb7198048ee3034b865", "score": "0.63666284", "text": "def == other_collection\n one = []\n two = []\n each { |node| one << node }\n other_collection.each { |node| two << node }\n one == two\n end", "title": "" }, { "docid": "e2a1d657a3a2320106c0368186767c15", "score": "0.6305602", "text": "def eql?(other)\n @elements == other.elements\n end", "title": "" }, { "docid": "b6d7bb5bf19c68c968d7805f6272edf7", "score": "0.6301092", "text": "def intersect?(other); end", "title": "" }, { "docid": "b6d7bb5bf19c68c968d7805f6272edf7", "score": "0.6301092", "text": "def intersect?(other); end", "title": "" }, { "docid": "74e5e8093b3f7a28fa8f679742422f2c", "score": "0.6297095", "text": "def ==(other)\n\t return @elements == other if other.is_a?(Array)\n\t super other\n\tend", "title": "" }, { "docid": "74e5e8093b3f7a28fa8f679742422f2c", "score": "0.6297095", "text": "def ==(other)\n\t return @elements == other if other.is_a?(Array)\n\t super other\n\tend", "title": "" }, { "docid": "1847d183749c699000907e3271492c42", "score": "0.6295912", "text": "def contain_same_objects(array1, array2)\n ok = true\n if array1.size != array2.size\n ok = false\n else\n array1.each {|obj| ok = false if array2.include?(obj) == false }\n end\n\n return ok\n end", "title": "" }, { "docid": "706d049ba134ded21cdb274ad463e857", "score": "0.62841016", "text": "def ==(other)\n unless other.kind_of? Array\n return false unless other.respond_to? :to_ary\n other = other.to_ary\n end\n\n return false unless size == other.size\n\n size.times { |i| return false unless at(i) == other.at(i) }\n\n true\n end", "title": "" }, { "docid": "192c2f41df5cef42a5833ebd411ba251", "score": "0.6278476", "text": "def contains?(other); end", "title": "" }, { "docid": "7d6fe45d25b2474d4f8e585d96ba4cda", "score": "0.6274769", "text": "def contain_all(other)\n bool_op(CONTAIN_ALL, wrap_input_array(other))\n end", "title": "" }, { "docid": "7d6fe45d25b2474d4f8e585d96ba4cda", "score": "0.6274769", "text": "def contain_all(other)\n bool_op(CONTAIN_ALL, wrap_input_array(other))\n end", "title": "" }, { "docid": "95d0f1e26c1c4bf13f0857f3e474cc7f", "score": "0.6259222", "text": "def in_chain?(other)\n return false unless other.is_a? Listable\n chain_head.equal? other.chain_head\n end", "title": "" }, { "docid": "fab1e860e391f0be2505501e6c6906f5", "score": "0.62524116", "text": "def ==(other)\n\t\t\treturn false unless other.is_a? self.class\n\t\t\t\n\t\t\ta = [other.l, other.b, other.r, other.t]\n\t\t\tb = [self.l, self.b, self.r, self.t]\n\t\t\ta.zip(b).all?{|a,b| a == b}\n\t\tend", "title": "" }, { "docid": "1518f53f0adc09a1b0436537486d6cee", "score": "0.62493443", "text": "def intersect?(other)\n Rangops::Set.intersect(self, other)\n end", "title": "" }, { "docid": "8a0f9e8d417d5a93111b1ba2109e9459", "score": "0.6248043", "text": "def joinable?(other)\n super && size.eql?(other.size)\n end", "title": "" }, { "docid": "08f6f22dc368b82cb33d96065da97951", "score": "0.6247795", "text": "def commensurate?(other)\n s = self.to_base.unit.map{ |u| u.class }.uniq\n o = other.to_base.unit.map{ |u| u.class }.uniq\n (s - o).empty? && (o - s).empty?\n end", "title": "" }, { "docid": "3cecc400864afcefae991185aaddd56b", "score": "0.6244269", "text": "def check_list_contains\n primary_list = list \"primary\"\n secondary_list = list \"secondary\"\n\n if is_sublist? primary_list, secondary_list\n puts \"Yes, the secondary list is already in the primary list\"\n else\n puts \"Nu, the primary list does not contains the secondary list\"\n end\nend", "title": "" }, { "docid": "3f829a43e35b751a8216ad94d803a7b2", "score": "0.6235034", "text": "def sameAs(otherSources)\n\n # early exit if possible\n if (self.sourceHash.length != otherSources.sourceHash.length)\n if $VERBOSE then puts \"diferent lengths\" end\n return false\n end\n\n # order them first to make sure the ordering logic is identical\n mineOrdered = self.getOrdered\n theirsOrdered = otherSources.getOrdered\n\n # check each one, in order, for equality\n for i in 0...[mineOrdered.length, theirsOrdered.length].max do\n mine = mineOrdered[i]\n theirs = theirsOrdered[i]\n\n # if missing in one of them\n if !mine\n if $VERBOSE then puts \"missing the source for #{theirs.title} in my list\" end\n return false\n elsif !theirs\n if $VERBOSE then puts \"missing the source for #{mine.title} in their list\" end\n return false\n elsif !mine.equals?(theirs)\n if $VERBOSE then puts \"##{i} is different\" end\n pp mine\n pp theirs\n return false\n end\n end\n\n return true\n end", "title": "" }, { "docid": "00ef5b3c989d8530b4ae71af63a52346", "score": "0.6231123", "text": "def ==(other)\n field_list == other.field_list\n end", "title": "" }, { "docid": "9f7fda2bbe25508c69faa00f552e8ca9", "score": "0.62260365", "text": "def eql?(other)\n return true if equal? other\n return false unless other.kind_of?(Array)\n return false if size != other.size\n\n each_with_index { |o, i| return false unless o.eql?(other[i]) }\n\n true\n end", "title": "" }, { "docid": "ff261366ac77775a9b41283ec068bdc2", "score": "0.62254834", "text": "def subset?(other)\n return false if other.size < size\n\n # This method has the potential to be very slow if 'other' is a large Array, so to avoid that,\n # we convert those Arrays to Sets before checking presence of items\n # Time to convert Array -> Set is linear in array.size\n # Time to check for presence of all items in an Array is proportional to set.size * array.size\n # Note that both sides of that equation have array.size -- hence those terms cancel out,\n # and the break-even point is solely dependent on the size of this collection\n # After doing some benchmarking to estimate the constants, it appears break-even is at ~190 items\n # We also check other.size, to avoid the more expensive #is_a? checks in cases where it doesn't matter\n #\n if other.size >= 150 && @trie.size >= 190 && !(other.is_a?(Immutable::Set) || other.is_a?(::Set))\n other = ::Set.new(other)\n end\n all? { |item| other.include?(item) }\n end", "title": "" }, { "docid": "3b3166eb8f87210a9a290293e475ac5d", "score": "0.62240654", "text": "def match_enumerable(from_self, from_other)\n return false if from_self.length < from_other.length\n combined = from_self.zip(from_other)\n combined.reduce(true) do |acc, (self_item, other_item)|\n acc && match_item(self_item, other_item)\n end\n end", "title": "" }, { "docid": "7bb374f46890693609753d94008f88cd", "score": "0.6217592", "text": "def ==(other)\n current = self\n while !current.empty? && !other.empty?\n return false if current.head != other.head\n current = current.tail\n other = other.tail\n end\n current.empty? && other.empty?\n end", "title": "" }, { "docid": "1195d461b9eccc49ac7f42e45e6acc17", "score": "0.6207159", "text": "def ==(list)\r\n self.to_a==list.to_a\r\n end", "title": "" }, { "docid": "4e8d527f4d098e9ab150380e4bf3f3c8", "score": "0.6192787", "text": "def in_ot_list?\n OtList.include?(self)\n end", "title": "" }, { "docid": "ab98922e4b7ec68fc8163037fd0723d8", "score": "0.6191659", "text": "def includes?(*others)\n others.each do |other|\n return true if self.include?(other)\n end\n return false\n end", "title": "" }, { "docid": "0c3e07be392ced8ed595b0b6ce2e4024", "score": "0.61868274", "text": "def overlap?(other)\n (self - other).size < self.size\n end", "title": "" }, { "docid": "c2f86645bc641fff55a4061a7b55e74f", "score": "0.61766636", "text": "def within?(other)\n if (self.substract(other, :ignore_attributes => true)).empty?\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "08128f1a77a968c2aa58c1603e225097", "score": "0.61713773", "text": "def equal? other\n return false if self.count != other.count\n subset? other\nend", "title": "" }, { "docid": "b40c48ff69107eba586eca47445945d6", "score": "0.6165642", "text": "def overlaps?(other); end", "title": "" }, { "docid": "b40c48ff69107eba586eca47445945d6", "score": "0.6165642", "text": "def overlaps?(other); end", "title": "" }, { "docid": "7204e6e9abab44bfd0aac1f05e9f99cc", "score": "0.6162724", "text": "def contains_any?(_other)\n false\n end", "title": "" }, { "docid": "8e4cdcaad40d77a8fd0967c1fae3c80c", "score": "0.616015", "text": "def ==(other)\n other == self.to_a\n end", "title": "" }, { "docid": "6005bc7bc1d15a519295dc4f3c495150", "score": "0.6153863", "text": "def same_kind_as?(other)\n other.kind_of?(TypesafeList) && other.klass == klass\n end", "title": "" }, { "docid": "07904b6f871a88ea2d9329f58526faaa", "score": "0.61507267", "text": "def contains_lt?(_other)\n false\n end", "title": "" }, { "docid": "40488ca2ba74b0e87773fff882c89a0a", "score": "0.614998", "text": "def zip?(other)\n tail.equal? other.tail\n end", "title": "" }, { "docid": "75d0e9abcbeae3570dc40b106185c709", "score": "0.61332977", "text": "def contained?(other); end", "title": "" }, { "docid": "f0845b1555d359e5a1ced6e052d0b0f3", "score": "0.61280483", "text": "def eql?(other)\n return true if self._equal?(other)\n return false unless other._isArray\n lim = self.size\n return false unless lim._equal?(other.size)\n ts = Thread.__recursion_guard_set\n added = ts.__add_if_absent(self)\n begin\n i = 0\n limi = lim\n while i < limi\n v = self.__at(i)\n ov = other[i]\n if v._equal?(ov)\n # ok\n elsif ts.include?(v) || ts.include?(ov)\n if v._equal?(self) && ov._equal?(other)\n # ok\n elsif v._equal?(other) && ov._equal?(self)\n # ok\n else\n raise ArgumentError, 'recursion too complex for Array#=='\n end\n elsif v.eql?(ov)\n # ok\n else\n return false\n end\n i += 1\n end\n ensure\n if added\n ts.remove(self)\n end\n end\n true\n end", "title": "" }, { "docid": "e76bd478f8878d7bce2efdc0ed1a2337", "score": "0.61135715", "text": "def ==(other)\n # If objects are of different type or the linked lists of different length,\n # they cannot be the same then.\n return false unless self.class == other.class && self.length == other.length\n\n # Otherwise, each key / value pair should match and should be in the right\n # order.\n curr = @head\n other.each do |key, value|\n return false unless curr.key == key && curr.value == value\n curr = curr.next\n end\n\n true\n end", "title": "" }, { "docid": "9c931df8ef6962f8c8596f6acd1a539c", "score": "0.61106896", "text": "def intersect?(other)\n !((self & other).empty?) || (empty? && other.empty?)\n end", "title": "" }, { "docid": "b1b4378372adabe9d6a5688e2a3e066d", "score": "0.61049896", "text": "def in?(list)\n\t\t\tlist.any? do |i|\n\t\t\t\tself.===(i)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "ab668b89f9352cd31a94befb72550cfd", "score": "0.61028713", "text": "def eql?(other)\n return true if super # `Object#eql?` wins if `true`.\n return false if length != other.length\n\n to_a.eql? other.to_a\n end", "title": "" }, { "docid": "0513d315fcfff375038d07921bc9ddeb", "score": "0.60914546", "text": "def originating?(other)\n originating.include?(other)\n end", "title": "" }, { "docid": "f545820e195f4f7426b1e8e6bb2650dd", "score": "0.6088944", "text": "def ==(other)\n return true if equal?(other)\n unless other.kind_of? Array\n return false unless other.respond_to? :to_ary\n return other == self\n end\n\n return false unless size == other.size\n\n Thread.detect_recursion self, other do\n md = @tuple\n od = other.tuple\n\n i = @start\n j = other.start\n\n total = i + @total\n\n while i < total\n return false unless md[i] == od[j]\n i += 1\n j += 1\n end\n end\n\n true\n end", "title": "" }, { "docid": "fe40486b5edcf97c5df9ae7c2f3fcb5b", "score": "0.60873467", "text": "def include?(other) \n end", "title": "" }, { "docid": "4379221f8cf2fef86fede70b17f9d91d", "score": "0.60872203", "text": "def =~(other)\n upver = other.bump(:last)\n if other.size > 1\n upver = other.bump(-2)\n else\n\n end\n self >= other and self < upver\n end", "title": "" }, { "docid": "0db71fc546e2d9392efd68d869ac520d", "score": "0.6077704", "text": "def proper_subset?(other)\n return false if other.size <= size\n # See comments above\n if other.size >= 150 && @trie.size >= 190 && !(other.is_a?(Immutable::Set) || other.is_a?(::Set))\n other = ::Set.new(other)\n end\n all? { |item| other.include?(item) }\n end", "title": "" }, { "docid": "3131b44e2b1ac34b7ce1b6c8a6a52fb1", "score": "0.6055676", "text": "def proper_subset?(other)\n other.size > size and subset?(other)\n end", "title": "" }, { "docid": "f410324db25d6378fe11a8779b7db7c1", "score": "0.6054812", "text": "def ==(other)\n include?(other) and other.include?(self)\n end", "title": "" }, { "docid": "b48784c907bc4ca2a1672b12c77e72be", "score": "0.605142", "text": "def contains_eq?(_other)\n false\n end", "title": "" }, { "docid": "9de05d7e86e64bb6be89bf0235e6cec0", "score": "0.60454065", "text": "def ==(other)\n if (other.class != self.class)\n false\n elsif length != other.length\n false\n else\n index = 0\n while index < length\n return false if self[index] != other[index]\n index += 1\n end\n true\n end\n end", "title": "" }, { "docid": "f35214d233345c99d85ebbb0abf57544", "score": "0.6044661", "text": "def included?(list)\n\nend", "title": "" }, { "docid": "8b10c008ce9dbe25bac58cbf959f3497", "score": "0.6033225", "text": "def ==(other)\n return true if self._equal?(other)\n return false unless other._isArray\n lim = self.size\n unless lim._equal?(other.size)\n return false\n end\n ts = Thread.__recursion_guard_set\n added = ts.__add_if_absent(self)\n begin\n i = 0\n limi = lim\n while i < limi\n v = self.__at(i)\n ov = other[i]\n if v._equal?(ov)\n # ok\n elsif ts.include?(v) || ts.include?(ov)\n if v._equal?(self) && ov._equal?(other)\n # ok\n elsif v._equal?(other) && ov._equal?(self)\n # ok\n else\n raise ArgumentError, 'recursion too complex for Array#=='\n end\n elsif v == ov\n # ok\n else\n return false\n end\n i += 1\n end\n ensure\n if added\n ts.remove(self)\n end\n end\n true\n end", "title": "" }, { "docid": "c915a62ee76594d7abc2538ccff026ba", "score": "0.6026752", "text": "def <=>(other)\n a = head\n b = other.head\n while a && b && a.data == b.data\n a = a.next\n b = b.next\n end\n compare_list_elements(a, b)\n end", "title": "" }, { "docid": "8b820935fe9684d188981696afe45896", "score": "0.6016062", "text": "def eql?(o); @items == o.items end", "title": "" }, { "docid": "03e3f6df26bd7bff96595e9bc9d183af", "score": "0.6015475", "text": "def out_of?(other_ary)\n other_ary.is_a?(Array) or raise ArgumentError, \"Other array in argument must be an Array\"\n super || not_subset?(other_ary)\n end", "title": "" }, { "docid": "a8df81fcb6af9f7b6fe8d69e3e5330ce", "score": "0.60004616", "text": "def ==(other)\n if other.is_a? OSX::NSArray\n isEqualToArray?(other)\n elsif other.respond_to? :to_ary\n to_a == other.to_ary\n else\n false\n end\n end", "title": "" }, { "docid": "661fdb9cedf056b28c90aaec3f2f2b50", "score": "0.59992987", "text": "def ==(other)\n return false unless Triplet===other\n other.respond_to?(:list) && self.list==other.list \n end", "title": "" }, { "docid": "48b2cb0feb20d57cde67c9122fa98695", "score": "0.59978485", "text": "def we_were_fucking_MADE_for_each_other?(first, second)\n\tfirst == second\nend", "title": "" }, { "docid": "a5d0a5111e78b58d24a5abfc0584485d", "score": "0.5997764", "text": "def ==(other)\n return false if not other.is_a? ParseNodeSet\n return false if not other.size == self.size\n \n @set.each { |id| \n return false if not other.include? id\n }\n return true\n end", "title": "" }, { "docid": "7d5444063c1c060eb0742bb7ce2b9e60", "score": "0.59956217", "text": "def <=(other); other.contains(self); end", "title": "" }, { "docid": "e28cc0a92f723e39baa425f5e47a1f56", "score": "0.59942144", "text": "def following?(other)\n following.include?(other)\n\n end", "title": "" }, { "docid": "f262fc924e0b9ddd67fafef3d35db263", "score": "0.59940284", "text": "def eql?(other_array)\n return true if (self.object_id == other_array.object_id)\n return false if !other_array.kind_of?(Array)\n return false if self.length != other_array.length\n\n i = 0\n l = self.length\n while i < l\n # FIXME: Recursion\n return false if self[i] != other_array[i]\n i += 1\n end\n\n return true\n end", "title": "" }, { "docid": "9356814986a7c77a3aa926705e941840", "score": "0.5993994", "text": "def proper_subset?(other)\n !eql_set?(other) && subset?(other)\n end", "title": "" }, { "docid": "12cc5e27b12c6b8ed02aa22bd92b5a5e", "score": "0.59864426", "text": "def like?(other); end", "title": "" }, { "docid": "e9ed445070e8c9fd33eea86a45f71943", "score": "0.59857684", "text": "def eql?(other)\n super && entries.eql?(other.entries)\n end", "title": "" }, { "docid": "b1f80e7a88bc5ffb024fe71fd6508d64", "score": "0.59835464", "text": "def following?(other)\n following.include?(other)\n end", "title": "" }, { "docid": "7d62e7aadb0da61b738ee6a9b0303265", "score": "0.5969645", "text": "def ==(other)\n\t\tto_a() == other.to_a\n\tend", "title": "" }, { "docid": "bdd299d5e9ca2cf4e960370371267231", "score": "0.59682286", "text": "def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end", "title": "" }, { "docid": "75af6ffda39f0ed5f0f063f1b11ec0d2", "score": "0.59672225", "text": "def check_carts(products_basket1, products_basket2)\n if products_basket1.size == 0 || products_basket2.size == 0\n return false\n end\n if products_basket1.first != products_basket2.first\n return false\n end\n if products_basket1.last != products_basket2.last\n return false\n end\n return true\nend", "title": "" }, { "docid": "9a5658bbb4edbfdc704840d3d6b215e8", "score": "0.59656054", "text": "def ==(other)\n if other.is_a? self.class\n collect(&:id).sort == other.collect(&:id).sort\n else\n false\n end\n end", "title": "" }, { "docid": "3fb8b2e7806721c2e001c401b153e487", "score": "0.5957223", "text": "def following?(other)\n \tfollowing.include?(other)\n end", "title": "" } ]
1d90ba5e6477784b89db92627d2d1dd6
This should return the minimal set of attributes required to create a valid Comment. As you add validations to Comment, be sure to update the return value of this method accordingly.
[ { "docid": "d1ce5958bb8a2a27b15ce0400625ae5c", "score": "0.6234679", "text": "def valid_attributes\n { comment: \"hi\"}\n end", "title": "" } ]
[ { "docid": "2063a4e6a5a7ad9bfcbc4a10f51e9b74", "score": "0.6655565", "text": "def valid_attributes\n { :title => 'title',\n :comment => 'some comments',\n :commentable_id => 1\n }\n end", "title": "" }, { "docid": "e62720e6062b80b81c8b64d93a5a2088", "score": "0.66519445", "text": "def valid_attributes\n {body: \"I'm a comment!\"}\n end", "title": "" }, { "docid": "a1ded874d093b8567d4ba36694fc9452", "score": "0.64683825", "text": "def mandatory_attributes\n @mandatory_attributes ||= self.class.mandatory_attributes\n end", "title": "" }, { "docid": "94edea92e6730f5c263b1951c6a9e07b", "score": "0.6358913", "text": "def mandatory_attributes\n @mandatory_attributes ||= {}\n end", "title": "" }, { "docid": "244c19aa0f232271edf2d0831c8f7ce0", "score": "0.6313432", "text": "def required_attributes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "77eede78a7b27271ced37b0baa90adc5", "score": "0.62555206", "text": "def attributes\n {\n 'id' => id,\n 'description' => description,\n 'forum_id' => forum_id,\n 'parent_comment_id' => parent_comment_id\n }\n end", "title": "" }, { "docid": "d808852060388c8cf336197aa0f2580c", "score": "0.6232431", "text": "def conmment_params\n params.require(:comment).permit(Elements::Comment::ATTRIBUTES)\n end", "title": "" }, { "docid": "025759c0c94cdd18df917a289da21500", "score": "0.61729825", "text": "def get_required_attrs; end", "title": "" }, { "docid": "77ffced4f5aa4009b41a65b7a4bf47d7", "score": "0.6168461", "text": "def required_attributes\n self.attributes.select {|a| a.required?}\n end", "title": "" }, { "docid": "791353d82e1da3c44aa6223c20932c2f", "score": "0.61601603", "text": "def required_attributes\n required_schema_attributes.keys\n end", "title": "" }, { "docid": "913592c7ee01b93d9c85471a033b0a85", "score": "0.6137412", "text": "def comment_params\n permitted_attributes(@comment || Comment.new)\n end", "title": "" }, { "docid": "898de8e3ea8d43e67368026021a71cd1", "score": "0.61318", "text": "def to_hash\n attributes.merge(comments: comments).delete_if { |_, value| value.nil? }\n end", "title": "" }, { "docid": "6666be0fe0fca54f39e5c8f4dadcfd16", "score": "0.6079677", "text": "def required_attributes\n self.class.attributes_set.select { |_, options| options[:required] }.keys\n end", "title": "" }, { "docid": "d27fcf1de810f01ec54dff0370cd7336", "score": "0.6076711", "text": "def comments\n find_comments.map { |c| Comment.new c.attributes }\n end", "title": "" }, { "docid": "2f82a4a576c1e7c08ab0432ef1fa4157", "score": "0.6052232", "text": "def mandatory_attributes\n @mnd_flt ||= collect_mandatory_attributes\n end", "title": "" }, { "docid": "f1767ca86f744402effb378002fb1d11", "score": "0.6028844", "text": "def create_comment(attributes={})\n c = build_comment(attributes)\n c.save\n end", "title": "" }, { "docid": "f1a0d1e82415279c0787fe78f0396e7b", "score": "0.60095656", "text": "def required_attrs\n []\n end", "title": "" }, { "docid": "9ac92b280e6048c108daefea09c3d1c0", "score": "0.6006451", "text": "def expected_attributes\n required_attributes + recommended_attributes\n end", "title": "" }, { "docid": "ac5de46f2b253e38bda521907b30ad69", "score": "0.59722835", "text": "def required_attributes\n metadata.select { |_k, meta| meta['require'] }.keys\n end", "title": "" }, { "docid": "3d710528acc8c53b8ab45e915e313f56", "score": "0.59238", "text": "def comment_params\n permitted = %i(comment commentable_type commentable_id return)\n params.require(:comment).permit(*permitted)\n end", "title": "" }, { "docid": "2a02cbb9abd2f50c86886123e106237f", "score": "0.59230816", "text": "def comment_params\n params.require(:data).require(:attributes).\n permit(:content) ||\n ActionController::Parameters.new\n end", "title": "" }, { "docid": "06b26c53de066e7eb23d0c3c3784ef99", "score": "0.5904855", "text": "def comment_params\n return {} unless params.key?(:comment)\n\n params.require(:comment).permit(:body)\n end", "title": "" }, { "docid": "67b1f673c6aec6c06e1de7038c549994", "score": "0.5872476", "text": "def comment_params\n params.permit(Comment.column_names - ['created_at', 'updated_at'])\n end", "title": "" }, { "docid": "8934fdf8e5dfdfd880dc3a947d79dfd3", "score": "0.58692515", "text": "def build_comment(attributes={})\n c = Comment.new(attributes)\n c.post_id = self.id\n c\n end", "title": "" }, { "docid": "f843d523079bc48c2d75671e43772842", "score": "0.58654547", "text": "def version_attributes\n comments_option = vestal_versions_options[:update_comments]\n # :none or not present\n if comments_option.blank? || comments_option == :none\n return super \n end\n if comments_option == :required && reason_for_update.blank?\n raise CommentForUpdateRequired.new(\"Need a comment or reason for updating record.\")\n end\n super.merge(:reason_for_update => reason_for_update)\n end", "title": "" }, { "docid": "9273be09d618e6a9730b2ba3fa9f4c90", "score": "0.585387", "text": "def validate\n validates_presence(:comment)\n\n # Comments can either have user ID or a custom name. The user ID is only set\n # when the user is logged in.\n unless self.user_id\n validates_presence(:username)\n end\n end", "title": "" }, { "docid": "b472e5a7d124f4774e2bcef590acee83", "score": "0.5852589", "text": "def comment_params\n params\n .require(:comment)\n .permit(*policy(@comment || Comment.new).permitted_attributes)\n end", "title": "" }, { "docid": "10b31dfedf4d7a4923e601983ca0cbe0", "score": "0.5849385", "text": "def required_attributes\r\n validators.map{ |v| v.attributes if v.is_a?(Mongoid::Validatable::PresenceValidator) }.flatten.compact\r\n end", "title": "" }, { "docid": "962b47c6002540aaf0a227ad135a85e0", "score": "0.58446914", "text": "def comment_params\n params.require(:comment).permit(*policy(@comment || Comment).permitted_attributes)\n end", "title": "" }, { "docid": "962b47c6002540aaf0a227ad135a85e0", "score": "0.58446914", "text": "def comment_params\n params.require(:comment).permit(*policy(@comment || Comment).permitted_attributes)\n end", "title": "" }, { "docid": "716e584084f2501619967c9cf0b646d6", "score": "0.58162546", "text": "def create_comment_params\n params.require(:create_comment).permit(:name, :comment)\n end", "title": "" }, { "docid": "c1a16b2251e97e9f39fc0b62c01d6642", "score": "0.57978296", "text": "def comment_params\n\t\t\t# Params is always sent through with rails\n\t\t\t# make sure there's a comment in it \n\t\t\t# and only allow the body field in case of hackers\n\t\t\tparams.require(:comment).permit(:body)\n\t\tend", "title": "" }, { "docid": "01763de0c6fe483b74f619bd1c0e8c7d", "score": "0.57895094", "text": "def comment_params\n enc_require(:comment).permit(:body, :user, :created_at, :modified_at, :comments, :parent_comment_id, :all)\n end", "title": "" }, { "docid": "140e22d1f3a010c10fc1a4a8c18143c2", "score": "0.5786977", "text": "def comment_params\n params.fetch(:comment).permit()\n end", "title": "" }, { "docid": "c7e0710a4e81b01e01a0c8cd20b8ba62", "score": "0.57853794", "text": "def get_required_attrs\n @requested_attributes.inject([]) {|required, (type_uri, attribute)|\n if attribute.required\n required << type_uri\n else\n required\n end\n }\n end", "title": "" }, { "docid": "0564f5de4e5becdd5cf5687c141bb6d8", "score": "0.5778678", "text": "def comment_params #nuestro modelo comment. Lo otro son los campos deo formulario\n\t\t\tparams.require(:comment).permit(:comment)\n\t\tend", "title": "" }, { "docid": "54f45a4bafab417508be7f632f987ed5", "score": "0.5774641", "text": "def create_params\n params.require(:comment).permit(:text) \n # validates_presence_of\n end", "title": "" }, { "docid": "6476bb04f2e3f3ac45f5d2eef2b3944e", "score": "0.57744676", "text": "def comment\n @attributes[:comment]\n end", "title": "" }, { "docid": "ee698a04e40c31036f0466d6d5af2027", "score": "0.57731277", "text": "def comment_attraction_params\n params.require(:comment_attraction).permit(:comment, :evaluationdate, :mobile_user_id, :attraction_id)\n end", "title": "" }, { "docid": "4e9f2416c5f1c3a8f3349601e7d8d16c", "score": "0.57637405", "text": "def one_line_description ; attributes['comments'] ; end", "title": "" }, { "docid": "8321dd2c73c34a8ef0c8f57800dbfe84", "score": "0.57605815", "text": "def client_comment_params\n params.permit(*ClientComment.create_params)\n end", "title": "" }, { "docid": "85d19c1271dc3515926b14c536711218", "score": "0.5756662", "text": "def comment_params\n params.require(:comment).\n permit(:author, :body, :commentable_id, :commentable_type)\n end", "title": "" }, { "docid": "1ac57ca954723ee784077bf5220b95b1", "score": "0.574969", "text": "def comment_params\n params.require(:comment).permit!\n end", "title": "" }, { "docid": "1ac57ca954723ee784077bf5220b95b1", "score": "0.574969", "text": "def comment_params\n params.require(:comment).permit!\n end", "title": "" }, { "docid": "1ac57ca954723ee784077bf5220b95b1", "score": "0.574969", "text": "def comment_params\n params.require(:comment).permit!\n end", "title": "" }, { "docid": "2da419961dfb6e3e7e627bbc8e148469", "score": "0.5746964", "text": "def comment_params\n params.require(:comment).permit(Comment.allowable_params)\n end", "title": "" }, { "docid": "2e710cb86253f81c6047b3e8d18aab98", "score": "0.573442", "text": "def comment_params\n\t\t\tparams[:comment].each { |key, value| value.strip! }\n params[:comment][:resource_id] = params[:resource_id] if params[:resource_id]\n params[:comment][:resource_type] = params[:resource_type] if params[:resource_type]\n\t\t\tparams.require(:comment).permit!\n\t\tend", "title": "" }, { "docid": "a52c19e8663505bc307396dcd629aecf", "score": "0.5729708", "text": "def create_comment(attrs={})\n Comment.build_from(scheduling, employee, attrs).tap(&:save!)\n end", "title": "" }, { "docid": "f44bd62e8e7811b2e965d31b2150686b", "score": "0.572432", "text": "def create_comment\n comment = Comment.new\n comment.summary = \"Comment Summary\"\n comment.detail = \"This is the details of the comment.\"\n comment.rating = 5\n comment.active = true\n comment.product_id = products(:whiskey).id\n comment.user_id = users(:user).id\n comment.save\n return comment\n end", "title": "" }, { "docid": "4dede35cc2f60c62bce42f5bee000528", "score": "0.57236123", "text": "def valid_attributes\n { name: \"John Smith\",\n email: \"john@tw.com\",\n reviewing_group_id: @rgm.id,\n notes: \"This is a dev\",\n coach_id: @coach.id\n }\n end", "title": "" }, { "docid": "f8a07ddfd8f78c1e31844da56c70aa33", "score": "0.57119715", "text": "def comment_params\n prepare_params\n end", "title": "" }, { "docid": "16d3c23bcc6b5c38a12d13e26b5a6a75", "score": "0.57105553", "text": "def comments_attributes=(attributes)\n model.comments_attributes = attributes\n end", "title": "" }, { "docid": "2c82fcbe69fc5c63347c043671d7a539", "score": "0.570638", "text": "def comment_params\n\t\t#params is always sent through with rails\n\t\t#make sure there is a comment and stop hackers\n\t\tparams.require(:comment).permit(:body)\n\n\tend", "title": "" }, { "docid": "4865e43aa6686147c4198903319945ab", "score": "0.57005346", "text": "def comment_params\n\t\t# params is always sent through with rails\n\t\t# make sure here's a omeent in it\n\t\t# and only allow the body field in case of hackers\n\t\tparams.require(:comment).permit(:body)\n\t\t\n\tend", "title": "" }, { "docid": "0ab8e73dec8b40218c7826b61dfc1de2", "score": "0.56918037", "text": "def validate_comment()\n\t\tif comment.blank?\n\t\t\terrors.add(:comment, \"cannot be blank.\")\n\t\tend\n\tend", "title": "" }, { "docid": "5e27df13c7b69438b1d1d2d7fb8ce838", "score": "0.56802493", "text": "def comment_params\n params.require(:comment).permit(:content, :html_content, :creator_name, :creator_email, :creator_site, :parent_id)\n end", "title": "" }, { "docid": "9979e2fc7169c217075e0fdafe38cc7d", "score": "0.56766534", "text": "def valid_attributes\n { vote: 'agree',\n comment: ''}\n end", "title": "" }, { "docid": "3176b25c3dfef1e934a33a42cd3a4c43", "score": "0.5667599", "text": "def comment_params\n\t\t# ensure that the body field is filled in case of hackers\n\t\tparams.require(:comment).permit(:body)\n\n\t\t\n\tend", "title": "" }, { "docid": "ada5c39164118d45abd1aa35c494b7d6", "score": "0.5666838", "text": "def mandatory_set_attributes(context)\n context.type.attributes.select { |_attribute, properties| properties[:mandatory_for_set] }.keys\n end", "title": "" }, { "docid": "78a93cf5475253e85a7be59ca3f26dfc", "score": "0.56657994", "text": "def normalize_blank_comment_to_nil\n comment_field = self.class.comment_field\n return unless self.has_attribute?(comment_field) # Not all client class may have comment field.\n return if self[comment_field].present?\n self[comment_field] = nil\n end", "title": "" }, { "docid": "fae3402347402ceaba14446280fc9c7e", "score": "0.5665278", "text": "def comment_params\n params.require(:comment).permit(:name, :description)\n end", "title": "" }, { "docid": "6e5bae7226930d0cb68f496e71d4f78b", "score": "0.5662802", "text": "def permitted_create_params\n params.permit(:comment)\n end", "title": "" }, { "docid": "941c1c46fdf503ec486a4fb0f58386c1", "score": "0.56561273", "text": "def comment_params\n if defined?(ActionController::Parameters) && params.instance_of?(ActionController::Parameters)\n params.require(:comment).permit(:body, :author, :email)\n else\n params[:comment]\n end\n end", "title": "" }, { "docid": "941c1c46fdf503ec486a4fb0f58386c1", "score": "0.56561273", "text": "def comment_params\n if defined?(ActionController::Parameters) && params.instance_of?(ActionController::Parameters)\n params.require(:comment).permit(:body, :author, :email)\n else\n params[:comment]\n end\n end", "title": "" }, { "docid": "3ce062945aa1ddefd2702ec1d7817cd4", "score": "0.56415135", "text": "def supports_comments_in_create?; end", "title": "" }, { "docid": "adf05639f4a6ced29f350c9962d05fc5", "score": "0.5640084", "text": "def comment_params\n params.require(:comment).permit(:body, :title)\n end", "title": "" }, { "docid": "f50ec8f901a978247a444b318af56660", "score": "0.5634846", "text": "def comment_params\n params.require(:comment).permit(:content, :endorsed, :anonymous, :commentable_id, :commentable_type, :user_id)\n end", "title": "" }, { "docid": "b567433992e1e5431fcd98c67e76d7c2", "score": "0.5634697", "text": "def required_attributes\n self.class._module.required_fields\n end", "title": "" }, { "docid": "b426f05c3e17fa641a88cf633d8a33f4", "score": "0.5626268", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "b426f05c3e17fa641a88cf633d8a33f4", "score": "0.5626268", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "b426f05c3e17fa641a88cf633d8a33f4", "score": "0.5626268", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "15a55d8bd60c7ca2fe4fd2e7a8572d36", "score": "0.5616767", "text": "def required\n @attributes[:required]\n end", "title": "" }, { "docid": "3308e6f57be89dc7809dbc4df266e544", "score": "0.5614354", "text": "def comment_info\n {\n :id => self.id,\n :user => self.user.json_hash_no_token,\n :dinner_id => self.dinner_id,\n :content => self.content\n }\n end", "title": "" }, { "docid": "68f330adcb55efb9e7a1f008ae33752a", "score": "0.561019", "text": "def comment_params\n params.require(:comment).permit(:description)\n end", "title": "" }, { "docid": "68f330adcb55efb9e7a1f008ae33752a", "score": "0.561019", "text": "def comment_params\n params.require(:comment).permit(:description)\n end", "title": "" }, { "docid": "68f330adcb55efb9e7a1f008ae33752a", "score": "0.561019", "text": "def comment_params\n params.require(:comment).permit(:description)\n end", "title": "" }, { "docid": "db25db806692f8a71ace818be01f1612", "score": "0.5605389", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "e8b04aaf11aad5290dd4b8c022e063ea", "score": "0.56035465", "text": "def comment_params\n\t\t\tparams.require(:comment).permit(:title, :content)\n\t\tend", "title": "" }, { "docid": "d8fa8337e7d6af3449a44c41b40170bf", "score": "0.56023276", "text": "def valid_attributes\n {}\n end", "title": "" }, { "docid": "9e4e55e8ea5abe0f4b06ad1264fd74fb", "score": "0.5601989", "text": "def comment_params\n params.require(:comment).permit(:commentable_type, :commentable_id, :parent_id, :body)\n end", "title": "" }, { "docid": "0117a6a8fc344f4d1d2befe7c51afa97", "score": "0.55984366", "text": "def comment_params\n params.require(:comment).permit(:title, :comment)\n end", "title": "" }, { "docid": "0117a6a8fc344f4d1d2befe7c51afa97", "score": "0.55984366", "text": "def comment_params\n params.require(:comment).permit(:title, :comment)\n end", "title": "" }, { "docid": "67160e9f6be24b09cc7e85f5281889da", "score": "0.55982554", "text": "def comment_params\n params.require(:comment).permit(:user_id, :body, :approved, :commentable_id, :commentable_type, :comment_id)\n end", "title": "" }, { "docid": "c5daede961ccf1f1732891ee22ba5246", "score": "0.5597507", "text": "def comment_params\n # params.require(:comment).permit(:name, :comment)\n end", "title": "" }, { "docid": "604ca817e3deeb1e9827fc61f73cc406", "score": "0.5589811", "text": "def comment_params\n params.require(:comment).permit(:title, :body)\n end", "title": "" }, { "docid": "dfc928a42789fcd510bfcc205c183d8e", "score": "0.5586817", "text": "def optional_attributes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "8aba13195136bbaacbd67c467947ae7f", "score": "0.55758995", "text": "def comment_params\n params.require(:comment).permit(:body, :user_id, :commentable_id, :commentable_type, :parent_id)\n end", "title": "" }, { "docid": "750ebfc464153290bdd631b1b277250f", "score": "0.5569727", "text": "def comment_params\n params.require(:comment).permit(:description)\n end", "title": "" }, { "docid": "750ebfc464153290bdd631b1b277250f", "score": "0.5569727", "text": "def comment_params\n params.require(:comment).permit(:description)\n end", "title": "" }, { "docid": "5f8d227bfe6a9a161f1c9da8b14ce69a", "score": "0.5566429", "text": "def comment_params\n params[:comment].permit(:id, :title, :comment, :user_id, :commentable_id, :commentable_type)\n end", "title": "" }, { "docid": "f240ede3be8b1316ca3ad310f5108cc8", "score": "0.556624", "text": "def attributes\n unskipped_attributes = self.class.attributes.reject { |_, opts| opts[:skip] }\n attributes_hash_from_attributes_options(unskipped_attributes)\n end", "title": "" }, { "docid": "3c0dacc17144383e7a47993dac9c6cce", "score": "0.5561824", "text": "def comment_params\n params.require(:comment).permit(:comment, :task_id, :creator_email)\n end", "title": "" }, { "docid": "ea906e9bc40abfc8a6cf3e032963f751", "score": "0.55603784", "text": "def comment_params\n #agregar los parámetros que modifiqué en el modelo.\n params.require(:comment).permit(:title, :description, :likes, :dislikes, :user_id, :product_id)\n #params.require(:comment).permit(:title, :description, :likes, :dislikes, :parent_comment)\n end", "title": "" }, { "docid": "9100c54c10612f8d6a25d11edf967cd2", "score": "0.5552896", "text": "def comment_params\n params.require(:comment).permit(:comment)\nend", "title": "" }, { "docid": "f7ff193061cc6cbe5827d91b4e6a3d8d", "score": "0.5542728", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "f7ff193061cc6cbe5827d91b4e6a3d8d", "score": "0.5542728", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "f7ff193061cc6cbe5827d91b4e6a3d8d", "score": "0.5542728", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "f7ff193061cc6cbe5827d91b4e6a3d8d", "score": "0.5542728", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "f7ff193061cc6cbe5827d91b4e6a3d8d", "score": "0.5542728", "text": "def comment_params\n params.require(:comment).permit(:comment)\n end", "title": "" }, { "docid": "fb4a6122459a24a32dd7a2a4cd051311", "score": "0.5542371", "text": "def comment_params\n params[:comment].permit!\n end", "title": "" } ]
29e7fe057f08066724e10b56382d3d00
find lowest cost path, negative costs allowed
[ { "docid": "2ef7e18d20994b2f6b2446451807a8ef", "score": "0.0", "text": "def bellmanford start, cost, &goal\n end", "title": "" } ]
[ { "docid": "a4e6a7f4538958a14e6723ba6dad4d2b", "score": "0.7825105", "text": "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |(vertex, data)|\n data[:cost]\n end\n\n vertex\nend", "title": "" }, { "docid": "a4e6a7f4538958a14e6723ba6dad4d2b", "score": "0.7825105", "text": "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |(vertex, data)|\n data[:cost]\n end\n\n vertex\nend", "title": "" }, { "docid": "a4e6a7f4538958a14e6723ba6dad4d2b", "score": "0.7825105", "text": "def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |(vertex, data)|\n data[:cost]\n end\n\n vertex\nend", "title": "" }, { "docid": "c57255f6e530ba72b1129384032fa5f3", "score": "0.76749396", "text": "def select_possible_path(possible_paths)\n # find min cost vertex\n # this iteration is the bottleneck :(\n vertex, data = possible_paths.min_by do |(vertex, data)|\n data[:cost]\n end\n\n vertex\nend", "title": "" }, { "docid": "5341f0b2f10d6a07b0c847e16da39042", "score": "0.7579993", "text": "def mincost_path\n return [] if length==0\n # calc cost\n self[0].each{|n|\n n.total_cost=n.word.cost\n n.nearest_prev=nil\n }\n (1...length).each{|i|\n prevs=@ends[i-1]\n curs=@begins[i]\n prevs.each{|prev|\n # 途中で行き止まりのNodeはtotal_costが設定されない\n next if prev.total_cost.nil?\n curs.each{|cur|\n join_cost=@mat.cost(prev.word.right.id,cur.word.left.id)\n next if join_cost.nil?\n cost=prev.total_cost+join_cost+cur.word.cost\n if !cur.total_cost || cost < cur.total_cost\n cur.total_cost=cost\n cur.nearest_prev=prev\n end\n }\n }\n }\n # calc mincost path\n ret=[]\n cur=self[-1][0]\n until cur.nil?\n ret.push cur\n cur=cur.nearest_prev\n end\n # TODO: disconnected\n # return nil unless ...\n # success\n return ret.reverse\n end", "title": "" }, { "docid": "5341f0b2f10d6a07b0c847e16da39042", "score": "0.7579993", "text": "def mincost_path\n return [] if length==0\n # calc cost\n self[0].each{|n|\n n.total_cost=n.word.cost\n n.nearest_prev=nil\n }\n (1...length).each{|i|\n prevs=@ends[i-1]\n curs=@begins[i]\n prevs.each{|prev|\n # 途中で行き止まりのNodeはtotal_costが設定されない\n next if prev.total_cost.nil?\n curs.each{|cur|\n join_cost=@mat.cost(prev.word.right.id,cur.word.left.id)\n next if join_cost.nil?\n cost=prev.total_cost+join_cost+cur.word.cost\n if !cur.total_cost || cost < cur.total_cost\n cur.total_cost=cost\n cur.nearest_prev=prev\n end\n }\n }\n }\n # calc mincost path\n ret=[]\n cur=self[-1][0]\n until cur.nil?\n ret.push cur\n cur=cur.nearest_prev\n end\n # TODO: disconnected\n # return nil unless ...\n # success\n return ret.reverse\n end", "title": "" }, { "docid": "05cee148fd4f9789954f668fadae4661", "score": "0.7191989", "text": "def find_path_of_least_resistance\n paths = @path_finder.find_all_paths\n \n path_of_least_resistance = nil\n path_resistance = nil\n \n paths.each do |path|\n resistance = path.inject(0) {|resistance, edge| resistance + edge[2] }\n \n # keep the path with the least resistance\n if path_of_least_resistance == nil || path_resistance == nil || resistance < path_resistance\n path_of_least_resistance = path\n path_resistance = resistance\n end\n end\n \n path_of_least_resistance\n end", "title": "" }, { "docid": "05cee148fd4f9789954f668fadae4661", "score": "0.7191989", "text": "def find_path_of_least_resistance\n paths = @path_finder.find_all_paths\n \n path_of_least_resistance = nil\n path_resistance = nil\n \n paths.each do |path|\n resistance = path.inject(0) {|resistance, edge| resistance + edge[2] }\n \n # keep the path with the least resistance\n if path_of_least_resistance == nil || path_resistance == nil || resistance < path_resistance\n path_of_least_resistance = path\n path_resistance = resistance\n end\n end\n \n path_of_least_resistance\n end", "title": "" }, { "docid": "0bb90b275110646faea7e14b1e546084", "score": "0.70537674", "text": "def shortest_path\n distances.min_by(&:last).first\n end", "title": "" }, { "docid": "260b05a2c47c07bd1e4e613352e434d0", "score": "0.6977216", "text": "def find_costs\n\t\t# initialize the cost of the first cell to its cost\n\t\t@costs[0][0] = @matrix[0][0]\n\t\t\n\t\tnode_queue = [[0,0]]\n\t\twhile !node_queue.empty?\n\t\t\tcurr_node = node_queue.shift()\n\t\t\tadjacent_nodes = get_adjacent_nodes(curr_node)\n\t\t\tmin_adjacent_cost = $infinity\n\t\t\tmin_adjacent = nil\n\t\t\t\n\t\t\tcurr_cost = @costs[curr_node[0]][curr_node[1]]\n\t\t\t\n\t\t\tadjacent_nodes.each do |node|\n\t\t\t\tpath_cost = curr_cost + @matrix[node[0]][node[1]]\n\t\t\t\tif @costs[node[0]][node[1]] == $infinity || @costs[node[0]][node[1]] > path_cost\n\t\t\t\t\t@costs[node[0]][node[1]] = path_cost\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tnode_queue.push(node) unless @visited[node[0]][node[1]]\n\t\t\tend\n\t\t\t\n\t\t\t@visited[curr_node[0]][curr_node[1]] = true\n\t\t\tcurr_node = min_adjacent\n\t\tend\n\t\t\n\t\treturn @costs[@size -1][@size -1]\n\tend", "title": "" }, { "docid": "497543fcd84a5cd00c2b6628e0078470", "score": "0.6957197", "text": "def optimal_cost(node)\n optimal_costs = self[node].keys\n optimal_costs.empty? ? INFINITY : optimal_costs.min\n end", "title": "" }, { "docid": "4f0337ca926b3e854515edf0464195e7", "score": "0.68229944", "text": "def min_cost_climbing_stairs(cost)\n i = 2\n \n while i < cost.length\n cost[i] += [cost[i-1], cost[i-2]].min\n i += 1\n end\n\n return [cost[-1], cost[-2]].min\nend", "title": "" }, { "docid": "0c84c2f090b3fb6f61fb7088c7bc10f5", "score": "0.6820276", "text": "def path_cost(path)\n return INFINITY if !path\n path.inject(0) { |sum,hex|\n sum + entrance_cost(hex)\n }\n end", "title": "" }, { "docid": "31d40d4c94590752418eecde2fafdc0f", "score": "0.67931974", "text": "def my_shortest_path(goal, exclusions = [])\n time = Time.now\n closedset = exclusions.map{ |x| x.hex } # The set of nodes already evaluated. Perform a copy of the array\n openset = [@hex] # The set of tentative nodes to be evaluated, initially containing the start node\n came_from = Hash.new # The map of navigated nodes.\n zoc_hash = Unit.init_zoc_hash(@game)\n g_score = Hash.new\n h_score = Hash.new\n f_score = Hash.new\n\n g_score[@hex] = 0 # Cost from start along best known path.\n h_score[@hex] = heuristic_cost_estimate(@hex, goal, @hex, zoc_hash)\n f_score[@hex] = g_score[@hex] + h_score[@hex] # Estimated total cost from start to goal through y.\n\n while not openset.empty?\n x = openset.sort_by{ |x| f_score[x]}.first # the node in openset having the lowest f_score[] value\n #return reconstruct_path(came_from, goal) if x == goal\n if x == goal.hex\n #puts \" path time: #{Time.now-time}\"\n return came_from\n end\n\n openset.delete(x)\n closedset.push(x)\n #x.value = \". \"\n #x.map.print_map\n\n for y in x.neighbours\n next if closedset.include?(y)\n tentative_g_score = g_score[x] + x.dist_between(y)\n if not openset.include?(y)\n openset.push(y)\n tentative_is_better = true\n elsif tentative_g_score < g_score[y]\n tentative_is_better = true\n else\n tentative_is_better = false\n end\n if tentative_is_better\n came_from[y] = x\n g_score[y] = tentative_g_score\n h_score[y] = heuristic_cost_estimate(y, goal, x, zoc_hash)\n f_score[y] = g_score[y] + h_score[y]\n end\n end\n end\n puts \"! time: #{Time.now-time}. no path from #{self} to #{goal}\"\n nil\n end", "title": "" }, { "docid": "9d37f59dd1027c0a35d32986083fd4f3", "score": "0.6786645", "text": "def best_plan()\n # best_plan = nil\n # lowest_cost = 9999999999\n#\n # each_plan do |plan|\n # cost = plan.cost\n # if (cost < lowest_cost)\n # lowest_cost = cost\n # best_plan = plan\n # end\n # end\n best_plan = @complete_plans.min do |p1, p2|\n p1.cost <=> p2.cost\n end\n best_plan\n end", "title": "" }, { "docid": "6b1d174eaf766eb0c447996b60f5e3ec", "score": "0.6778847", "text": "def naiveShortest\n\t\tcar = @nodes.first\n\t\tcdr = @nodes.drop 1\n\t\tmyroute = [car]+ cdr.permutation.min_by {|e| self.route [car]+e}\n\t\tr=Route.new self\n\t\tr.route = myroute\n\t\tr.cost =route(myroute)\n\t\tr\n\tend", "title": "" }, { "docid": "db3e1f409237544c73b87436d8516379", "score": "0.67584497", "text": "def calc_costs\n start_vertex, end_vertex = @vertices.first, @vertices.last\n \n @vertices.each do |vertex|\n best_cost = nil\n best_prev = nil\n best_edge_type = nil\n\n vertex.in_edges.each do |in_edge|\n prev_vertex = in_edge.out_vertex\n prev_cost = prev_vertex.value[:cost]\n\n next if prev_cost.nil?\n\n current_cost = prev_cost + in_edge.value\n\n if best_cost.nil? || current_cost < best_cost\n best_cost = current_cost\n best_prev = prev_vertex\n best_edge_type = in_edge.type\n end\n end\n \n if vertex.value[:pos] != 0\n vertex.value[:cost] = best_cost\n vertex.value[:prev] = best_prev\n vertex.value[:edge] = best_edge_type\n end\n end\n\n nil\n end", "title": "" }, { "docid": "4d60ddce8d17519f621bea915f27f831", "score": "0.6677453", "text": "def pathOfLeastResistance\n findPossibleRoutes\n winningRoute=nil\n winningOhmage=0\n path=[] \n @possibleRoutes.each do |rt|\n currentOhmage = calculateOhmageForRoute(rt) \n if currentOhmage < winningOhmage or winningOhmage==0\n\tcurrentOhmage=winningOhmage\n\twinningRoute=rt\n end\n end \t\t\n printRedundant(winningRoute) unless winningRoute.nil?\n end", "title": "" }, { "docid": "5dd3f66cfe1a7b02316602d833cfd099", "score": "0.6676984", "text": "def cost\n @path.inject(0) { |cost, edge| cost += edge.cost }\n end", "title": "" }, { "docid": "759548ed443693d0542e5dc5fa5a7be9", "score": "0.66087574", "text": "def choose_node_in(open_nodes)\n\t\tmin_cost = Float::INFINITY\n\t\tbest_node = nil\n\n\t\topen_nodes.each do |node|\n\t\t\tcost_start_to_node = node.cost # G\n\t\t\tcost_node_to_goal = estimate_distance(node, @goal_node) # H\n\t\t\t# F = G + H\n\t\t\ttotal_cost = cost_start_to_node + cost_node_to_goal\n\n\t\t\t# find the lowest total cost in open_nodes\n\t\t\tif total_cost < min_cost\n\t\t\t\tmin_cost = total_cost\n\t\t\t\tbest_node = node\n\t\t\tend\n\t\tend\n\n\t\tbest_node\n\tend", "title": "" }, { "docid": "c4368ed30bf56d2be6173c95dabb2c4c", "score": "0.65945035", "text": "def compute_shortest_path\n update_distance_of_all_edges_to(Float::INFINITY)\n @distance_to[@source_node] = 0\n\n # The prioriy queue holds a node and its distance from the source node.\n @pq.insert(@source_node, 0)\n while @pq.any?\n node = @pq.remove_min\n node.adjacent_edges.each do |adj_edge|\n relax(adj_edge)\n end\n end\n end", "title": "" }, { "docid": "17bb5b1f6a2a32a5978eb1c0b5b33616", "score": "0.6584694", "text": "def get_min_cost(menu, items)\n\tif (menu.length == 0) \n\t\treturn nil\n\telsif (menu.length == 1)\n\t\treturn menu[0].to_a[0]\n\telse\n\t\tmin_price = (1.0/0.0)\n\t\t#Because prices are never non-negative and we assume that only one of any item is\n\t\t#desired, we can check only the limited number of combinations generated below\n\t\titem_combos = get_item_combos(menu.length)\n\t\titem_combos.each do |item_combo|\n\t\t\t#Check if the given combination will satisfy the constraints\n\t\t\tif is_valid_combo?(menu, item_combo, items) \n\t\t\t\t#If so, check the price\n\t\t\t\tcombo_price = get_price(menu, item_combo)\n\t\t\t\tif combo_price < min_price \n\t\t\t\t\tmin_price = combo_price\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn min_price\n\tend\nend", "title": "" }, { "docid": "74dbe80e2ca3c76dfa9d80754440c91f", "score": "0.65267825", "text": "def get_min_distance_in_fringe\n @fringe.reduce(Float::INFINITY) do |memo,node|\n if (node.destination_distance < memo)\n node.destination_distance\n else\n memo\n end\n end\n end", "title": "" }, { "docid": "bf2106d2ddeb89522e79193cb3798c3c", "score": "0.65237176", "text": "def getShortestPath(startpt, endpt)\n # create vertex set Q\n # initialize weights\n unseen = []\n seen = []\n @metros.map{ |metro|\n v = DNode.new(metro.code)\n if startpt == metro.code\n v.weight = 0\n end\n unseen.push(v)\n }\n\n until unseen.empty?\n curr = unseen.min_by(&:weight)\n seen.push(curr)\n unseen.delete(curr)\n\n @routes[@@code_to_city[curr.code]].each{ |neighbor|\n unless seen.flatten.include?(neighbor.city.code)\n neighbor_node = unseen.index { |node| node.code == neighbor.city.code }\n cumulative_distance = curr.weight + neighbor.distance\n\n if cumulative_distance < unseen[neighbor_node].weight\n unseen[neighbor_node].weight = cumulative_distance\n unseen[neighbor_node].prev = curr\n end\n end\n }\n end\n\n end", "title": "" }, { "docid": "a249caf53800957fe1d257caf0f12089", "score": "0.65162313", "text": "def shortest_flight\n\t\t\n\t\tprint \"Enter the two points (Ex: A-B) : \"\n\t\tinitial_node, final_node = gets.chomp.upcase.split(/\\s*-\\s*/)\n\t\tunvisited_nodes = []\n\t\tnode_set_price = {initial_node => [0,initial_node]}\n\t\tnode_set_time = {initial_node => [0,initial_node, str_to_time(\"0000\")]}\n\t\t\n\t\t@combinations.each do |key, value|\n\t\t\tfor i in 0...2 do\n\t\t\t\tunvisited_nodes << key[i] if !unvisited_nodes.include?(key[i])\n\t\t\tend\n\t\tend\n\t\t\n\t\tcheapest_price, path = find_least_price(node_set_price, unvisited_nodes.dup, final_node)\t\t\t\t#for cheapest fare\n\t\tputs \"\\nCheapest price from #{initial_node} to #{final_node} is #{cheapest_price} and path is #{path}\"\n\t\t\n\t\tearliest_time, path = find_earliest_time(node_set_time, unvisited_nodes.dup, final_node)\t\t#for earliest time\n\t\tearliest_time /= 60\n\t\thours = earliest_time.to_i / 60\n\t\tmins = earliest_time.to_i % 60\n\t\tputs \"Earliest time is #{hours} hours and #{mins} mins, path is #{path}\"\n\tend", "title": "" }, { "docid": "2213fa6b6013e0d47181840cb0484869", "score": "0.64820325", "text": "def shortest_route\n @res = []\n @distance = []\n @result\n stops = 10\n\n # create a list of all available routes\n for l in 1..stops - 1\n @railroad.stations[@origin].each do |k, v|\n @res.push(helper(k, @destination, l, @origin+k))\n end\n end\n\n # select the route with the minimum distance of travel\n min = 1000;\n @res.each do |i|\n calculated_dist = calc_dist(i)\n if (i[i.length - 1] == @destination) && (calculated_dist.is_a? Fixnum) && ((calculated_dist) < min)\n min = calculated_dist\n @result = i\n end\n end\n return min\n end", "title": "" }, { "docid": "c1234986fbd4ca90fc507892e54fbaff", "score": "0.64724046", "text": "def min_path_sum(grid)\n\n return 0 if grid[0].empty?\n row = 0\n col = 0\n shortest = nil\n current_sum = 0\n num_stack = [[grid[row][col], current_sum, row, col]]\n\n until num_stack.empty?\n current_num, current_sum, row, col = num_stack.pop\n current_sum += current_num\n right = grid[row][col + 1]\n down = grid[row + 1]\n\n if right.nil? && down.nil?\n if shortest.nil? || current_sum < shortest\n shortest = current_sum\n end\n else\n if down\n num_stack.push([down[col], current_sum, row + 1, col])\n end\n if right\n num_stack.push([right, current_sum, row, col + 1])\n end\n end\n end\n shortest\nend", "title": "" }, { "docid": "1038dbb53ce3df2dc4601cc03c37232c", "score": "0.64495575", "text": "def estimate_cost_over_all_goals_from(node)\n estimates = Array.new\n goals.each do |goal|\n estimates << node.estimate_cost_to(goal)\n end\n return estimates.min\n end", "title": "" }, { "docid": "c736592772a91f59b9b1f679f659b0c7", "score": "0.64479953", "text": "def calculate_minimum_speed\n self.points.slowest.first.speed if self.points.slowest and self.points.slowest.first and self.points.slowest.first.speed\n end", "title": "" }, { "docid": "2c77eb4580de46b29c46c6791dc7d705", "score": "0.6424702", "text": "def optimal_cost(node)\n end", "title": "" }, { "docid": "c84f145891d627f0c39ba1a698627c2c", "score": "0.6407777", "text": "def findBestPath(matrix)\n p = findMax(matrix)\n path = []\n\n dy = [-1, -1, 0]\n dx = [-1, 0, -1]\n\n choices = [[0, 0], [0, 0], [0, 0]]\n\n while p[0] > 0 && p[1] > 0 && matrix[p[0]][p[1]] != 0\n path.push(p)\n for i in 0..2\n choices[i] = [p[0] + dx[i], p[1] + dy[i]]\n end\n p = argMax(choices, matrix)\n end\n return path\nend", "title": "" }, { "docid": "ee2a0de4c1b0357fe858397cb970fefd", "score": "0.64051825", "text": "def find_shortest_route\n node = @closed_nodes[@goal[0]][@goal[1]]\n loop do\n break if node.from == @start\n @result << node.from\n @shortest_route[node.from[0]][node.from[1]] = true\n node = @closed_nodes[node.from[0]][node.from[1]]\n end\n end", "title": "" }, { "docid": "b5055e993db6df10f2ce8229f8886564", "score": "0.6384915", "text": "def find_path(start, goal, closest_path = false)\n # The set of nodes already evaluated\n closed_set = [] # [Vertex]\n\n # The set of current covered nodes that are not evaluated yet.\n # Initially, only the start node is known.\n open_set = [start] # [Vertex]\n\n # For each node, which node it can most efficiently be reached from.\n # If a node can be reached from many nodes, came_from will eventually\n # contain the most efficient previous step.\n came_from = {} # { Vertex => Vertex }\n\n # For each node, the cost of getting from the start node to that node.\n g_score = Score.new\n\n # The cost of going from start to start is zero.\n g_score[start] = 0\n\n # For each node, the total cost of getting from start node to the goal\n # by passing by that node. That value is partly known, partly heuristic.\n f_score = Score.new\n\n # For the first node, that value is completely heuristic.\n f_score[start] = heuristic_cost_estimate(start, goal)\n\n # closest_path\n #\n # Record h so that if we can't find a path, we can return the path to\n # the closest.\n h_score = Score.new\n h_score[start] = heuristic_cost_estimate(start, goal)\n\n while !open_set.empty?\n # the node in openSet having the lowest f_score[] value\n current = f_score.lowest_of_verteces(open_set).first\n\n break unless current\n\n if current == goal\n return reconstruct_path(came_from, current)\n end\n\n open_set.delete(current)\n closed_set << current\n\n current.neighbors.each do |neighbor|\n if neighbor.blocked?\n next # Ignore blocked neighbors, as if they aren't there\n end\n\n if closed_set.include?(neighbor)\n next # Ignore the neighbor which is already evaluated.\n end\n\n if !open_set.include?(neighbor) # Discover a new node\n open_set << neighbor\n end\n\n old = g_score[neighbor]\n\n compute_cost(current, neighbor, g_score, came_from)\n\n if g_score[neighbor] < old\n f_score[neighbor] = g_score[neighbor] + heuristic_cost_estimate(neighbor, goal)\n\n # closest_path\n h_score[neighbor] = heuristic_cost_estimate(neighbor, goal)\n end\n end\n end\n\n # closest_path\n if closest_path\n closest_to_target = h_score.lowest_of_verteces\n if closest_to_target.count > 0\n closest_from_origin = g_score.lowest_of_verteces(closest_to_target).first\n return reconstruct_path(came_from, closest_from_origin) if closest_from_origin\n end\n end\n\n return [] # Failure; no path found\n end", "title": "" }, { "docid": "178948dc036ead83312445ababa0c83e", "score": "0.63748884", "text": "def find_optimal\n # @type [ConditionGraph] g\n @set_of_graphs.keep_if { |g| g.nxt_conditions.empty? }\n @set_of_graphs.min { |a, b| a.graph.count_complexity <=> b.graph.count_complexity }.graph\n end", "title": "" }, { "docid": "6be0698fa2defb4037ddb80cd3eae57a", "score": "0.6342184", "text": "def a_star(graph)\n queue = [ graph.start_node ]\n closed = { graph.start_node => true }\n while (!queue.empty?)\n if ((node = queue.shift) == graph.goal_node) # success!\nputs \"!!!! total cost = #{node.path_cost} !!!!\"\n path_nodes = [ ]\n node = graph.goal_node\n while (node != graph.start_node)\n path_nodes.unshift(node)\n node = node.prev_node\n end\n return path_nodes.unshift(graph.start_node)\n end\n node.successors.each do |successor|\n next if (successor.step_cost < 0) # don't go there!\n path_cost = node.path_cost + successor.step_cost\n if (closed.has_key?(successor)) # already processed?\n next unless (path_cost < successor.path_cost) # a better path?\n # keep original successor.prev_node\n else # haven't seen yet\n successor.prev_node = node\n closed[successor] = true\n end\n successor.path_cost = path_cost\n successor.exp_cost \\\n = path_cost + successor.distance_cost(graph.goal_node)\n queue.ordered_insert(successor)\n end\n end\n nil\nend", "title": "" }, { "docid": "ffa38a973f82a03e32309ffbc4d5cad3", "score": "0.63300884", "text": "def node_with_minimum_distance # unvisited node with minimum distance\n debug \"node_with_minimum_distance\"\n @candidates.min_by{ |x| best_distance_to(x) }\\\n .tap{|x| debug \"=> #{x.inspect}\"}\n end", "title": "" }, { "docid": "97c597bb11c02d23bf0c651ace21c4fa", "score": "0.6320506", "text": "def find_min_priced_restauarnt(list)\n @searchItems = []\n list.each do |name|\n @searchItems.push(@items[name])\n end\n #return the nil values\n @searchItems.compact!\n\n #check for empty array\n return nil if @searchItems.size == 0 || @searchItems.size < list.size\n\n\n #using dynamic programming to solve this problem\n #Using the multi stage graph approach. Consider each searchItem which is list of invertedIndex as a level with nodes.\n #If the last level(n) is destination, then find the mincost from every node in level(n-1) to level(n) , find the min price and store it in the attribute called minprice of invertedIndex class.\n # so now the we have minimimum cost from n-1 to n. Now similary construct it from n-2 level to n-1(which inturn is till nth level).\n # finally at level 1 we have all the elements with the all the cost. Sort them and return the min priced.\n\n if @searchItems.size > 1\n count = @searchItems.size\n\n @searchItems.reverse.each do |item|\n if count == @searchItems.size\n count = count - 1\n next\n end\n successorItem = @searchItems[count]\n item.each do |iIndex|\n cost = 9999999\n id = iIndex.id\n successorItem.each do |sItem|\n\n if sItem.addedIds.include?(iIndex.id)\n iIndex.minPrice = sItem.minPrice\n id = iIndex.id\n\n elsif cost > (sItem.price + iIndex.price)\n cost = sItem.price + iIndex.price\n iIndex.minprice = cost\n id = sItem.id\n end\n end\n iIndex.addedIds = iIndex.addedIds.concat([id])\n end\n end\n\n end\n #should find the min of this array\n temp = @searchItems[0].sort\n temp[0]\n end", "title": "" }, { "docid": "dad0fee2809a69db0b6960522788d4a0", "score": "0.6311215", "text": "def find_closest_unvisited()\r\n\r\nend", "title": "" }, { "docid": "df3742fd7532de5a94dcec8e8cfeca90", "score": "0.6307545", "text": "def solve\n # @ending = [@map.width - 1, (@map.height - 1)*25]\n @infinity = @map.size * 10\n res = shortest_path_wg(@map.array)\n res.sum\n # prepare_cost_map\n end", "title": "" }, { "docid": "ac787ce1cb38470a5466add1d21a5746", "score": "0.6286129", "text": "def findPath\n\t\twhile @open_nodes.size > 0 do\n\t\t\t# grab the lowest f(x)\n\t low_i = 0\n\t for i in 0..@open_nodes.size-1\n\t if @open_nodes[i].fCost\t< @open_nodes[low_i].fCost || (@open_nodes[i].fCost == @open_nodes[low_i].fCost && @open_nodes[i].hCost == @open_nodes[low_i].hCost) then\n\t low_i = i\n\t end\n\t end\n\t best_node = low_i\n\n\t # set current node\n\t current_node = @open_nodes[best_node]\n\n\t # check if we've reached our destination\n\t \n\t game_over = goalReached(current_node.x ,current_node.y)\n\t if (game_over) then\n\t \tpath = drawPath(@start_node,@goal_node)\n\t return path\n\t end\n\n\t #now we have to remove currnt node from open set and add it to closed se\n\t @open_nodes.delete_at(best_node)\n\t @closed_nodes.push(current_node)\n\n\t #now we traverse all neighbour nodes that are not in the closed \n\t neighbours = getNeighbours(current_node) #array of neighbors\n\t for n in 0..neighbours.size-1\n\t \tneighbor = neighbours[n]\n\t nx = neighbor[0] #grab the x value\n\t ny = neighbor[1] #grab the y value\n\t\t\n\t\t\t\tmovement_cost = TERRAIN_COST[neighbor[0][1]]\n\n\t if(walkable(neighbor) && !goalReached(nx,ny))\n\t \tin_closed = false\n\t for j in 0..@closed_nodes.size-1\n\t closed_node = @closed_nodes[j]\n\t if nx == closed_node.x and ny == closed_node.y then\n\t in_closed = true\n\t break\n\t end\n\t end\n\t next if in_closed\n\n\t # check if the node is in the open nodes list\n\t # if not, use it!\n\t in_open = false\n\t for j in 0..@open_nodes.size-1\n\t open_node = @open_nodes[j]\n\t if nx == open_node.x and ny == open_node.y then\n\t in_open = true\n\t break\n\t end\n\t end\n\n\t unless in_open then\n\t new_node = Astar_Node.new(nx, ny, @closed_nodes.size-1, -1, -1, -1)\n\n\t # setup costs\n\t new_node.gCost = current_node.gCost + movement_cost.to_i\n\t new_node.hCost = determineHeuristic(new_node, @goal_node)\n\t new_node.fCost = determineFcost(new_node)\n\n\t @open_nodes.push(new_node)\n\t end\n\t end\n\t end\n\t\tend\n\t\treturn [] # return empty path\n\tend", "title": "" }, { "docid": "6c74269602c2419b901cb45c6471e8be", "score": "0.6271185", "text": "def shortestSingleFlight()\n return reduceVariable('edges', 'distance', '<')\n end", "title": "" }, { "docid": "3a121a1f9a9f301100edfc52ba271dca", "score": "0.6263827", "text": "def shortest_path(to, max_depth: Float::INFINITY)\n return self.class.no_result unless @is_visitable.call(@grid[to])\n @heuristic = PathFinder::Euristiques.method(:oil_stain)\n dijkstra(to: to,\n break_if: @break_if || -> (current,to) { current.uid == to || current.depth >= max_depth }\n )\n generate_result(to)\n end", "title": "" }, { "docid": "d8d8a6636391373b91caa825ccce1d54", "score": "0.623966", "text": "def find_highest_cost(grid)\n cost, total = 0, 1\n grid_with_cost = grid.map { |row| row.map { |e| [e, e] } }\n\n grid_with_cost[0...(grid_with_cost.size - 1)].each_with_index do |row, i|\n row.each_with_index do |node, j|\n [j, j + 1].each do |col|\n connected_node = grid_with_cost[i+1][col]\n new_total = node[total] + connected_node[cost]\n connected_node[total] = new_total if new_total > connected_node[total]\n end\n end\n end\n\n grid_with_cost[-1].map { |e| e[1] }.max\nend", "title": "" }, { "docid": "71dd99fab4936d35ed9e4ac478ac0d1e", "score": "0.62310874", "text": "def best_path\n path = []\n\n vertex = @vertices.last\n until vertex.value[:pos] == 0\n prev_vertex = vertex.value[:prev]\n path.unshift([prev_vertex.value[:pos], vertex.value[:pos]]) if vertex.value[:edge] == \"jet\"\n vertex = prev_vertex\n end\n\n path\n end", "title": "" }, { "docid": "e6b08035f04dc4ea04f3906bb34b5138", "score": "0.62287796", "text": "def shortest_path\n road(@end)\n @path\n end", "title": "" }, { "docid": "c3abf0c38e3a905ca6577629ce88316e", "score": "0.6222025", "text": "def shortest_path(start,finish)\n prev = {}\n node_dist = {}\n\n for node in get_all_nodes\n if node.get_elt == start then next end\n prev[node] = nil\n node_dist[node.get_elt] = 1/0.0 #starting value of infinity\n end\n\n node_dist[start] = 0\n\n pq = PriorityQueue.new(node_dist)\n\n while !pq.is_empty\n curr = pq.get_top\n\n for edge in get_node_edges(get_node(curr))\n next_elt = edge.to_node.get_elt\n \n if node_dist[next_elt] > node_dist[curr] + edge.get_weight\n pq.update_priority(next_elt,\n node_dist[curr] + edge.get_weight)\n prev[get_node(next_elt)] = get_node(curr)\n end\n end\n end\n\n #Extra check to find shortest (non-zero) cycle path by using our\n #known shortest distances and finding the shortest one back\n #to our start node. It requires another graph traversal in \n #the worst case.\n node_dist[start] = 1/0.0\n for node in get_all_nodes\n for edge in get_node_edges(node)\n from = edge.from_node.get_elt\n to = edge.to_node.get_elt\n if to == start and node_dist[from] < 1/0.0\n if node_dist[start] > node_dist[from] + edge.get_weight\n node_dist[start] = node_dist[from] + edge.get_weight\n prev[get_node(start)] = get_node(from)\n break\n end\n end\n end\n end\n\n return node_dist[finish]\n end", "title": "" }, { "docid": "a0a6bb18748acf1daeed95f6e46eeaf4", "score": "0.6210613", "text": "def brute_force_tsp(return_to_origin = true)\n min_distance = 1.0/0.0\n best_path = nil\n paths = (0...count).to_a.permutation.to_a\n\n paths.each do |path|\n cumulative_distance = 0\n\n path[0..path.length - 2].each_with_index do |start_index, i|\n end_index = path[i + 1]\n if vertices[start_index].weights[end_index]\n cumulative_distance += vertices[start_index].weights[end_index]\n else\n cumulative_distance += 1.0/0.0\n end\n end\n\n if return_to_origin\n if vertices[path[-1]].weights[path[0]]\n cumulative_distance += vertices[path[-1]].weights[path[0]]\n else\n cumulative_distance += 1.0/0.0\n end\n end\n\n if cumulative_distance < min_distance\n min_distance = cumulative_distance\n best_path = path\n end\n end\n\n if return_to_origin\n puts \"The shortest distance for a complete loop is #{min_distance}\"\n else\n puts \"The shortest route to visit each vertex exactly once is #{min_distance}\"\n end\n puts humanize_tsp_route(best_path, return_to_origin)\n [min_distance, best_path]\n end", "title": "" }, { "docid": "d9b853ea748bcdf0e93da38bab0c94a4", "score": "0.6205754", "text": "def shortest(circuit)\n wires = []\n trace = []\n IO.foreach(circuit) do |line|\n wire = wirepath(line)\n #puts wire.empty?\n #puts wire\n wires.push(wire)\n #puts wires\n end\n crossings = wires[0] & wires[1]\n crossings.delete([0,0]) # remove origin\n #puts crossings\n crossings.each do |crossing|\n lega = wires[0].index(crossing)\n legb = wires[1].index(crossing)\n trace.push(lega + legb)\n end\n @result = trace.min\n end", "title": "" }, { "docid": "74df617e270352eb9a7e15d9bae22369", "score": "0.6205436", "text": "def path_cost(c, state1, action, state2)\n return c + 1\n end", "title": "" }, { "docid": "3be8aafd4b96014fed533f6e845be893", "score": "0.6205369", "text": "def min_path_sum(grid)\n return 0 if grid.nil? || grid.empty?\n n = grid.size\n m = grid.first.size\n infinity = 2 ** (0.size * 8 - 1)\n (n - 1).downto(0) { |i|\n (m - 1).downto(0) { |j|\n next if i == n - 1 && j == m - 1\n down = i == n - 1 ? infinity : grid[i + 1][j]\n right = j == m - 1 ? infinity : grid[i][j + 1]\n grid[i][j] += [down, right].min\n }\n }\n \n grid[0][0]\nend", "title": "" }, { "docid": "e60c24d07cd4c084cae7aec70446dbdc", "score": "0.6204392", "text": "def min_expected_time\n # start from vertex 0\n u = 0\n # route is an array of distinct vertice, aka pivots, starting from 0\n # in the order that each pivot vertex is first visited\n # in the search of sophie\n route = Array.new\n route.push u\n $simple_paths[u] = Array.new(1, u)\n # start the search from vertex 0\n search_from u, route, 0\nend", "title": "" }, { "docid": "eecde74d212e02fb033bf6ccef3cfe18", "score": "0.6192896", "text": "def shortestRoute()\n sh = 99999\n frm = 0\n to = 0\n ROUTE_DATA.each do |r|\n if r[RTE_DIST] < sh\n sh = r[RTE_DIST]\n frm = r[RTE_FROM]\n to = r[RTE_TO] \n end\n end\n return to,frm,sh\n end", "title": "" }, { "docid": "574b67a4103539278b47a71829f00d6c", "score": "0.6175262", "text": "def shortest_flight\n # return max integer of no edges\n return Edge.new('', (2**(0.size * 8 -2) -1)) if @edges.length == 0\n\n # find the shortest distance in the distances array\n min = distances.min\n @edges.each{|edge| return edge if edge.distance == min}\n end", "title": "" }, { "docid": "d74718a94d769acea1de55048039e20e", "score": "0.61750615", "text": "def shortest_path(paths)\n l = paths[0].length\n shortest = paths[0]\n for i in 1...paths.length\n if l > paths[i].length\n l = paths[i].length\n shortest = paths[i]\n end\n end\n shortest\n end", "title": "" }, { "docid": "2c3f0093782052c79dd37a1a10a1b9dd", "score": "0.61650527", "text": "def get_vertext_min_PL(i_vertices)\n #puts \" --entered get_vertext_min_PL1\"\n #puts \" --input #{i_vertices.length} \" #---\"[294029732]}\"\n min=INFINITY\n x=EMPTY\n i_vertices.each do |cur_vertex|\n #puts \"cur_vertex #{cur_vertex[0]} #{cur_vertex[1].status} path length: #{cur_vertex[1].path_length}\"\n if (cur_vertex[1].status == TEMPORARY and cur_vertex[1].path_length < min ) #perm=pokus...osledni podminka navic and edge.v1.path_length != INFINITY\n #puts \" --vertex.sts= #{cur_vertex[1].status} vertex.path_length(#{cur_vertex[1].path_length}) is less then min #{min}\"\n x=cur_vertex[1]\n min=cur_vertex[1].path_length\n end\n end\n\n #if x != EMPTY\n #puts \" - get_nearest_vertex - about to return #{x.id} with min #{min} value of all connected Vx\"\n #end\n return x\n end", "title": "" }, { "docid": "0d443bd6717628a85ddbfb008f832245", "score": "0.6163392", "text": "def return_shortest\n @min = @infinity\n @node = \"\"\n @unoptimized_nodes.each do |node|\n if @vertices[node].distance <= @min\n @min = @vertices[node].distance\n @node = @vertices[node].node\n @unoptimized_nodes.delete_if{|x| x == @node}\n end\n end\n return @node\n end", "title": "" }, { "docid": "0d443bd6717628a85ddbfb008f832245", "score": "0.6163392", "text": "def return_shortest\n @min = @infinity\n @node = \"\"\n @unoptimized_nodes.each do |node|\n if @vertices[node].distance <= @min\n @min = @vertices[node].distance\n @node = @vertices[node].node\n @unoptimized_nodes.delete_if{|x| x == @node}\n end\n end\n return @node\n end", "title": "" }, { "docid": "ba15794384424e9994a5192922dd24fc", "score": "0.6161206", "text": "def path_to(goal)\n closed_nodes = Set.new\n open_nodes = Set.new\n open_nodes.add(self)\n\n g_scores = {self => 0}\n h_scores = {self => guess_distance(goal)}\n f_scores = h_scores.dup\n came_from = {}\n\n until open_nodes.empty?\n fmin_node = nil\n fmin = nil\n open_nodes.each do |node|\n next unless fmin.nil? || f_scores[node] < fmin\n fmin_node = node\n fmin = f_scores[node]\n end\n\n if fmin_node == goal\n path = []\n node = fmin_node\n while node\n path.unshift(node)\n node = came_from[node]\n end\n return [g_scores[goal], path]\n end\n\n open_nodes.delete(fmin_node)\n closed_nodes.add(fmin_node)\n\n fmin_node.neighbors.each do |neighbor|\n next if closed_nodes.include?(neighbor)\n tmp_g_score = g_scores[fmin_node] + fmin_node.movement_cost(neighbor)\n if !open_nodes.include?(neighbor)\n open_nodes.add(neighbor)\n tmp_is_better = true\n elsif tmp_g_score < g_scores[neighbor]\n tmp_is_better = true\n else\n tmp_is_better = false\n end\n\n if tmp_is_better\n came_from[neighbor] = fmin_node\n g_scores[neighbor] = tmp_g_score\n h_scores[neighbor] = neighbor.guess_distance(goal)\n f_scores[neighbor] = g_scores[neighbor] + h_scores[neighbor]\n end\n end\n end\n\n [nil, nil]\n end", "title": "" }, { "docid": "4ba8e7e3740c6106b342086f2a4159ac", "score": "0.6146845", "text": "def cost\n self.path if @path.empty?\n return @cost\n end", "title": "" }, { "docid": "de7989a43f43bb771877c59243b07cc7", "score": "0.6144893", "text": "def find_next_optimal_path\n # Find the next path.\n until @agenda.empty?\n node = @cost.fetch_optimal_node(@agenda)\n optimal_cost = @cost[node]\n @agenda.delete(node)\n LOGGER.debug(\"Explore node #{node}(#{optimal_cost})\\n\" + \\\n \"New agenda #{@agenda}\")\n if optimal_cost == INFINITY\n LOGGER.debug(\"Target #{@target} is inaccessible\")\n return false\n end\n if node == @target\n LOGGER.debug(\"Reached target #{@target}\")\n break\n end\n @graph.each_adjacent(node) do |next_node|\n d = optimal_cost + @graph.weight(node, next_node)\n @backtrace.add_path_head(node, next_node, d)\n if d < @cost[next_node]\n @cost[next_node] = d\n LOGGER.debug(\"Relax cost(#{next_node}) = #{@cost[next_node]}\\n\" +\n \"New cost #{@cost}\")\n end\n end\n end\n true\n end", "title": "" }, { "docid": "a93bff50d0971017604751f4c5b455e8", "score": "0.61273944", "text": "def shortest_path(start, finish)\n maxint = Float::INFINITY\n distances = Hash.new\n previous = Hash.new\n nodes = PriorityQueue.new\n \n @vertices.each do | vertex, value |\n if vertex == start\n distances[vertex] = 0\n nodes[vertex] = 0\n else\n distances[vertex] = maxint\n nodes[vertex] = maxint\n end\n previous[vertex] = nil\n end\n \n while nodes\n smallest = nodes.delete_min_return_key\n \n if smallest == finish\n path = Array.new\n while previous[smallest]\n path.push(smallest)\n smallest = previous[smallest]\n end\n return path.reverse\n end\n \n if smallest.nil? || distances[smallest] == maxint\n break \n end\n \n @vertices[smallest].each do | neighbor, value | \n alt = distances[smallest] + @vertices[smallest][neighbor]\n if alt < distances[neighbor]\n distances[neighbor] = alt\n previous[neighbor] = smallest\n nodes[neighbor] = alt\n end\n end\n end\n end", "title": "" }, { "docid": "63cb8176ea76e71a1bad6d718eec131f", "score": "0.6118785", "text": "def two_city_sched_cost(costs)\n n_interviews = costs.size / 2\n\n sorted_costs = costs.sort_by { |pair| pair[0] - pair[1] }\n\n total_minimum_cost = 0\n\n sorted_costs.each_with_index do |pair, index|\n if n_interviews >= index + 1\n total_minimum_cost += pair[0]\n else\n total_minimum_cost += pair[1]\n end\n end\n\n total_minimum_cost\nend", "title": "" }, { "docid": "eae835f4555ba0ea88d46bd4188ea784", "score": "0.6111636", "text": "def path\n return @path if @path.any?\n node = @goal\n @cost = 0\n while node\n parent = @tree[node]\n @path.insert(0, node)\n @cost += parent ? parent.cost(node) : 0\n node = parent\n end\n return @path\n end", "title": "" }, { "docid": "b159614b6760751a5d748605041d691a", "score": "0.61109173", "text": "def find_optimal_solution(edges)\n index = 0\n # start with the maximum score possible\n best = @grid.no_of_nodes * 100\n\n #iterate through the history of routes and find the best score\n edges.each_with_index do |val,i| \n if val[:score] < best\n best = val[:score]\n index = i\n end\n end\n return edges[index]\n end", "title": "" }, { "docid": "465b2193558a66afeb2ef9315d4da0a7", "score": "0.6108188", "text": "def shortest_distance\n distances.min_by(&:last).last\n end", "title": "" }, { "docid": "a4e93a745866764ead18f5410b004c18", "score": "0.60995305", "text": "def get_path_home()\n min = @count;\n min_path = nil;\n @labyrinth.get_cave(@position).adj_caves.each { |neighbor|\n path = @labyrinth.get_path(@position, neighbor)\n if(path.number < min && path.number != 0)\n min = path.number\n min_path = path\n end\n }\n return min_path\n end", "title": "" }, { "docid": "a5f18d2819e3fb9cb541b7615347db38", "score": "0.6096596", "text": "def each_optimal_path(source, target)\n # Do a depth-first enumeration through the backtrace.\n paths = [OptimalPath[target]]\n until paths.empty?\n path = paths.pop\n node = path.first\n optimal_cost = optimal_cost(node)\n # The optimal cost into the last node is the total cost for the path.\n path.total_cost ||= optimal_cost\n # Get the optimal-cost nodes pointing into the head of this path.\n prev_nodes = self[node][optimal_cost]\n # If this path crosses a less optimal one, remember this in\n # last_branch_edges.\n if multicost_incoming_nodes?(node)\n path.last_branch_edges ||= prev_nodes.map do |prev_node|\n [prev_node, node]\n end\n end\n # Enumerate the optimal-cost nodes pointing into the head of this\n # path.\n prev_nodes.each do |prev_node|\n # Prepend the incoming node to the path.\n new_path = [prev_node] + path\n # Yield the new path if it is complete. Otherwise, put it back on\n # the paths list.\n if prev_node == source\n # If this path did not cross any less optimal ones, place the\n # branch after the source node.\n path.last_branch_edges ||= [new_path[0], new_path[1]]\n yield new_path\n else\n paths << new_path\n end\n end # prev_nodes.each\n end # until paths.empty?\n end", "title": "" }, { "docid": "40f3f681e753e172555560c531be35aa", "score": "0.60841924", "text": "def min_path_sum(grid)\n min_sum(grid, row = grid.size - 1, col = grid[0].size - 1, {})\nend", "title": "" }, { "docid": "7d76300ec9cf8266785b1d085d444d9f", "score": "0.6081975", "text": "def minimum_path_sum(matrix)\n dp_matrix = Array.new(matrix.length + 1){Array.new(matrix[0].length + 1){ Float::INFINITY }}\n dp_matrix[0][1], dp_matrix[1][0] = [0, 0]\n\n (1..matrix.length).each do |i|\n (1..matrix[0].length).each do |j|\n dp_matrix[i][j] = [dp_matrix[i - 1][j], dp_matrix[i][j - 1]].min + matrix[i - 1][j - 1]\n end\n end\n dp_matrix.last.last\nend", "title": "" }, { "docid": "b3a493e813759f25de9fcb44626e7573", "score": "0.6075191", "text": "def find_shortest_path(name1, name2)\n dijkstra(name1)\n @distance[name2].nil? ? Float::INFINITY : @distance[name2]\n end", "title": "" }, { "docid": "314c2ccfbcbefe35ba47c04d59f44357", "score": "0.6073092", "text": "def solve\n # Start with the start_node\n current_node = @unvisited_vertices.delete @start_node\n current_node.dist = 0\n\n # Apply algorithm \n while !@unvisited_vertices.empty?\n current_node.neighbors.each do |neighbor, neighbor_distance|\n alt = current_node.dist + neighbor_distance\n if alt < @vertices[neighbor].dist\n @vertices[neighbor].dist = alt\n @vertices[neighbor].prev = current_node.point\n end\n end\n\n min_dist_node = @unvisited_vertices.min_by{|k, v| v.dist} # [1] is the vertex, [0] key \n current_node = @unvisited_vertices.delete min_dist_node[0]\n end\n\n # Back track to get the shortest path\n shortest_sequence = Array.new\n current_target = @vertices[@target_node]\n while !current_target.prev.nil?\n shortest_sequence << current_target\n current_target = @vertices[current_target.prev]\n end\n shortest_sequence << @vertices[@start_node]\n\n result = \"Shortest path is [#{shortest_sequence.reverse.map{|x| x.point}.join(',')}] with total cost #{@vertices[@target_node].dist}\"\n end", "title": "" }, { "docid": "3dcb417f9f0f42a6fb086cc7ba65f037", "score": "0.6061799", "text": "def critical_path\n return nil if range.include?(nil) or @graph.type != \"digraph\"\n r = [ [0, [1]] ]\n\n critical_path_recursion( distance_matrix, adjancy_matrix, r, [], 0 ).inject( {:distance => 0, :path => []} ) { |_r, item|\n (_r[:distance] < item[0]) ? { :distance => item[0], :path => item[1] } : _r\n }\n end", "title": "" }, { "docid": "420f121b0cb0633ff90d350edf1f5b0b", "score": "0.6061206", "text": "def longest_path(source, dg)\n distance = Hash.new(Float::INFINITY)\n distance[source] = source.values.first.to_i\n traverse_vertices(dg.vertices, distance, dg)\n distance.to_a.min_by { |k, v| v }\nend", "title": "" }, { "docid": "961e8cea0585c7d38852f015d306d3ce", "score": "0.60567963", "text": "def findShortestPath(city1, city2)\n node1 = getCode(city1)\n node2 = getCode(city2)\n if(node1 == nil || node2 == nil)\n return nil\n end\n #start with city1\n startNode = createPathNode(node1.code, false, 0, nil)\n hash = {node1.code =>startNode}#for storing the unvisited pathNodes\n totalHash = {node1.code =>startNode}#for storing all the pathNodes\n \n while(hash.length != 0 )\n #sort\n hash = hash.sort_by{|k,v| v[\"dist\"]}.to_h\n #pop\n curCode = hash.keys[0]\n curPathNode = hash.delete(curCode)\n neighbors = @map[curCode].destinations\n #loop destinations\n neighbors.each do |code, dis|\n codes = setDistanceMapKey(curCode, code)\n directDis = @distanceMap[codes]\n alt = directDis + curPathNode[\"dist\"]\n if(totalHash.has_key?(code))#if in totalHash, check if visited, then compare path\n pathNode = totalHash[code]\n if(pathNode['visited'] == true)\n next\n else\n if(alt < pathNode[\"dist\"])\n pathNode[\"dist\"] = alt\n pathNode[\"prevCode\"] = curCode\n end\n end\n else #if not exist, create a new path node, add it to both hash and totalhash\n pathNode = createPathNode(code, false, alt, curCode)\n hash[code] = pathNode\n totalHash[code] = pathNode\n end\n end\n curPathNode[\"visited\"] = true\n end\n \n #check if the city2 is actually visited\n curPathNode = totalHash[node2.code]\n if(curPathNode[\"visited\"] == false)\n return nil\n end\n \n #trace back to find the routeString\n routeString = city2\n while(curPathNode[\"prevCode\"] != nil)\n prevCode = curPathNode[\"prevCode\"]\n prevNode = @map[prevCode]\n routeString = prevNode.name+ \",\"+routeString\n curPathNode = totalHash[prevCode]\n end\n return routeString\n end", "title": "" }, { "docid": "e01acda9ececd3a7281e69caab6c3eef", "score": "0.60509306", "text": "def compute_cost(src, dest)\n cost = @distances[src] + @graph.length(src, dest)\n return if cost > @distances[dest]\n # shorter path has been found\n @distances[dest] = cost\n @previous[dest] = src\n end", "title": "" }, { "docid": "da99e1c8e826ecc4cec2934762daf6ee", "score": "0.6050921", "text": "def dijkstra1(vertex)\n shortest_paths = {}\n possible_paths = { vertex => {cost: 0, edge: nil } }\n until possible_paths.length == 0\n next_vertex = find_min_vertex(possible_paths)\n shortest_paths[next_vertex] = possible_paths[next_vertex]\n possible_paths.delete(next_vertex)\n\n next_vertex.out_edges.each do |edge|\n possible_cost = shortest_paths[edge.from_vertex][:cost] +\n edge.cost\n last_cost = possible_paths[edge.to_vertex]\n if !last_cost || possible_cost < last_cost[:cost]\n possible_paths[edge.to_vertex] = {cost: possible_cost,\n edge: edge}\n end\n end\n end\n\n shortest_paths\nend", "title": "" }, { "docid": "54844c49ed54c4ae68a03668366b9d17", "score": "0.6049136", "text": "def bfs_shortest_path(start, goal, paths=false)\n\t\tdist = nil\n\t explored = {} # keep track of explored nodes\n\t previous = {}\n\t queue = [[start, 0]] # keep track of all the paths to be checked\n\t is_goal = false\n\t while !queue.empty? && !is_goal # keeps looping until all possible paths have been checked\n\t node, dist = queue.pop # pop the first path from the queue\n\t if !explored.include?(node) # get the last node from the path\n\t neighbours = @edges[node] \n\t explored[node] = true # mark node as explored\n\t next if neighbours.nil?\n\t dist += 1 \n\t neighbours.each do |neighbour| # go through all neighbour nodes, construct a new path\n\t \tnext if explored.include?(neighbour)\n\t queue.unshift([neighbour, dist]) # push it into the queue\n\t previous[neighbour] = node if paths\n\t if neighbour == goal # return path if neighbour is goal\n\t \tis_goal = true\n\t \tbreak\n\t end\n\t end\n\t end\n\t end\n\t\tif is_goal\n\t\t\tpath = build_path(previous, start, goal) if paths\n\t\telse\n\t\t\tdist = nil \n\t\t\tpath = []\n\t\tend\n\t return dist, path\n\tend", "title": "" }, { "docid": "1f721492a87674473cf713373c4621f6", "score": "0.60458255", "text": "def shortest_path(root, dest)\n priority = Hash.new\n visited = Hash.new\n previous = Hash.new\n q = PriorityQueue.new\n @vertices.each do |k, up|\n if up\n priority[k] = @@infinity\n visited[k] = false\n previous[k] = nil\n end\n end\n priority[root] = 0\n q[root] = 0\n until q.empty?\n u = q.delete_min\n visited[u[0]] = true\n break if u[1] == @@infinity\n @edges_cost.each_key do |s|\n @edges_cost[s].each_key do |d|\n if edges_up[s].fetch(d) and vertices[s] and vertices[d]\n if !visited[d] and priority[s] + @edges_cost[s].fetch(d) < priority[d]\n previous[d] = s\n priority[d] = priority[s] + @edges_cost[s].fetch(d)\n q[d] = priority[d]\n end\n end\n end\n end\n end\n prior = dest\n out = \"#{prior} \"\n while previous[prior]\n out = \"#{previous[prior]} \" + out\n prior = previous[prior]\n end\n out += \"#{priority[dest]}\\n\"\n print out\n priority[dest]\n end", "title": "" }, { "docid": "501279de236e25150b2af2810c662e42", "score": "0.6041757", "text": "def minimax_indexing(current_node)\n if current_node.board.over?\n return current_node.cost = 1 if current_node.winning_node?(@player_mark) \n return current_node.cost = -1 if current_node.losing_node?(@player_mark)\n return current_node.cost = 0 if current_node.tied?\n end\n \n if current_node.mark == @player_mark #self's turn, find the max among children\n max_cost = -1\n current_node.children.each do |child|\n tmp = minimax_indexing(child) \n max_cost = tmp if tmp > max_cost\n end\n current_node.cost = max_cost\n return current_node.cost \n else #opponent's turn, find the min among children\n min_cost = 1\n current_node.children.each do |child|\n tmp = minimax_indexing(child) \n if tmp < min_cost\n min_cost = tmp\n end\n end\n current_node.cost = min_cost\n return current_node.cost\n end\n end", "title": "" }, { "docid": "250ecd653835ccdb91356cb5d7ba937d", "score": "0.6030658", "text": "def min_path_sum(grid)\n row = grid.length - 1\n column = grid[0].length - 1\n result = min_path_helper(grid, row, column, {})\nend", "title": "" }, { "docid": "4505d9a42dc8c88b450394bd36109c0a", "score": "0.60229397", "text": "def shortest_vector_paths\n paths = {@start => [0]} # cache total path cost\n\n Racc.set_closure([@start]) do |node|\n node_path = paths[node]\n vectors(node) do |label, child|\n child_path = paths[child]\n cost = block_given? ? yield(label) : 1\n if child_path.nil? || child_path[0] > node_path[0] + cost\n paths[child] = node_path.dup.tap { |p| p[0] += cost } << label\n end\n end\n children(node)\n end\n\n paths.each_value { |p| p.shift } # drop cached total costs\n paths\n end", "title": "" }, { "docid": "7bd9653f78bf3d0ee9838c8308d77a25", "score": "0.60179573", "text": "def cost_from(start_level, end_level)\n cost_to_reach(end_level) - cost_to_reach(start_level)\nend", "title": "" }, { "docid": "7bd9653f78bf3d0ee9838c8308d77a25", "score": "0.60179573", "text": "def cost_from(start_level, end_level)\n cost_to_reach(end_level) - cost_to_reach(start_level)\nend", "title": "" }, { "docid": "398adbef23045d8d46e0685f861300ff", "score": "0.60031843", "text": "def get_next_path()\n max = 0;\n max_path = nil;\n @labyrinth.get_cave(@position).adj_caves.each { |neighbor|\n path = @labyrinth.get_path(@position, neighbor)\n if(path.number == 0)\n return path\n end\n if(path.number > max && path.marked == false)\n max_path = path\n end\n }\n return max_path\n end", "title": "" }, { "docid": "a5805fe12576a2f7ba0e387e6776ce48", "score": "0.59917486", "text": "def get_shortest_path(traversed, node, weight)\n # if node is in the traversed list, return.\n return if traversed.include? node\n \n # push the node as we have traversed it\n traversed.push node\n \n # iterate throught the node's hash\n @circuit[node].each do |key, value|\n \n if key == @end\n if @lowest_load > weight+value\n @lowest_load = weight+value\n @shortest_path = Array.new(traversed.push(key))\n traversed.pop\n end\n # skip if we have reached the 'end node' but load is greater.\n else\n # invoke shortest_path with traversed and this node\n get_shortest_path traversed, key, weight+value\n end\n end\n \n # remove the node as we have traversed all its children\n traversed.pop\n end", "title": "" }, { "docid": "9737a859e304d5a71ee76a636879ed48", "score": "0.5990641", "text": "def find_path(start, goal)\n raise \"loc1 must not be the same as loc2\" if start == goal\n\n # Using A* path-finding algorithm\n # See pseudocode here: https://en.wikipedia.org/wiki/A*_search_algorithm\n # https://www.redblobgames.com/pathfinding/a-star/introduction.html\n # NOTE that this is overkill for this problem...\n open_set = Set.new([start])\n came_from = {}\n\n # Default value of \"Infinity\", but we can just use nil\n g_score = {}\n g_score[start] = 0\n\n # f_score = g_score[node] + h_score[node]\n # This uses both current best path (g score) aka similar to Djikstra's algorithm,\n # plus the heuristic score.\n f_score = {}\n # g_score[start] is 0, so not included here\n f_score[start] = h_score(start, goal)\n\n # Note that we add d_score as the weight of the edge, but in our\n # case, we consider all edges equally, so hardcode 1\n d_score = 1\n\n until open_set.empty? do\n # Node in open set with lowest f score (would ideally use PriorityQueue)\n current = open_set.min_by { |node| f_score[node] }\n\n if current == goal\n return reconstruct_path(came_from, current)\n end\n\n open_set.delete(current)\n\n valid_neighbours(current).each do |neighbour_loc|\n tentative_g_score = g_score[current] + d_score\n if g_score[neighbour_loc].nil? || tentative_g_score < g_score[neighbour_loc]\n # This path to neighbor is better than any previous one. Record it!\n came_from[neighbour_loc] = current\n g_score[neighbour_loc] = tentative_g_score\n f_score[neighbour_loc] = g_score[neighbour_loc] + h_score(neighbour_loc, goal)\n if !open_set.include?(neighbour_loc)\n open_set << neighbour_loc\n end\n end\n end\n end\n\n raise \"error, no path found!\"\n end", "title": "" }, { "docid": "95aa6f86176cd6ff29540c18284e69ff", "score": "0.59877616", "text": "def shortest_path(visited, ground)\n unless self == ground\n # really large number guaranteed to be larger than the resistance of a particular segment\n ohms = Math.exp(999)\n path = []\n # for each segment connected to this node...\n self.segments.each do |s|\n tar_node = s.target_node(self)\n unless visited.include?(tar_node)\n visited_copy = visited.clone << self\n # recursively ask target node to compute its shortest path\n result = tar_node.shortest_path(visited_copy, ground)\n # if the result path is shorter than our current shortest path then...\n if ((result[:ohms] + s.ohms) < ohms)\n # the new shortest resistance value = target node's shortest resistance\n # plus the resistance of the segment connecting to that node\n ohms = result[:ohms] + s.ohms\n # record the shortest path also. it is an array and we need to add the\n # segment at the 'head' of the array\n path = result[:path].unshift(s)\n end\n end\n end\n # return the shortest path (segment array) and value of total resistance for that path\n {:path => path, :ohms => ohms}\n else # self == ground\n # for ground, we have nothing interesting to return - we are already at th end\n {:path => [], :ohms => 0}\n end\n end", "title": "" }, { "docid": "891fe87be98b8d5f879dd0b991f4ef42", "score": "0.598091", "text": "def min_path_sum(grid)\n cache = {\n [0, 0] => grid[0][0]\n }\n\n cols = grid[0].size\n rows = grid.size\n\n (0...rows).each do |row|\n (0...cols).each do |col|\n cache[[row, col]] = calculate_min(grid, row, col, cache)\n end\n end\n\n return cache[[rows - 1, cols - 1]]\nend", "title": "" }, { "docid": "4c7fa542d57f20b3a701f8242c62af53", "score": "0.5973705", "text": "def find_path\n\n\t\t# INITIALIZE\n\t\tvalid = valid_nodes(@nodes_arr)\n\t\treachable = [@start_node] # nodes we can reach from current node\n\t\texplored = [] # closed nodes\n\t\t# nodes reachable, valid, and not explored\n\t\topen_nodes = (valid - explored) & reachable\n\t\tnode = nil\n\n\t\twhile !open_nodes.empty?\n\n\t\t\tnode = choose_node_in(open_nodes) # least total cost node\n\n\t\t\t# STOP if reached goal\n\t\t\treturn build_path if node == @goal_node \n\n\t\t\t# Don't repeat ourselves.\n\t\t\treachable.delete(node) # remove curr node from reachable\n\t\t\texplored.push(node) # add curr node to explored\n\n\t\t\t# What nodes are now open from this node?\n\t\t\t# Adjacent, not explored, and valid (not an obstacle and in maze)\n\t\t\tnew_reachable = (get_adjacent_nodes(node) - explored) & valid\n\n\t\t\t# ADD new adjacent nodes to reachable\n\t\t\tnew_reachable.each do |adj_node|\n\t\t\t\tif !reachable.include?(adj_node)\n\t\t\t\t\treachable << adj_node \n\t\t\t\tend\n\n\t\t\t\t# if this is a new path (adj_node.cost==infinity) or a shorter distance from start than before, save this path\n\t\t\t\tif adj_node.cost > (node.cost + 1)\n\t\t\t\t\tadj_node.previous = node # reset current node as parent\n\t\t\t\t\tadj_node.cost = (node.cost + 1) # reset minimum cost\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t# REFRESH OPEN NODES\n\t\t\topen_nodes = (valid - explored) & reachable\n\n\t\tend\n\n\t\tnil # open_nodes empty - no path found\n\tend", "title": "" }, { "docid": "61b6aef6fc1572a1f54864ba469a9f17", "score": "0.59664345", "text": "def solve\n #walk through vertices, using modified A* algorithm to find the most direct route to finish node\n consider_set = Containers::PriorityQueue.new {|v1, v2| (v1 <=> v2) == -1} #MinHeap. Lowest priority/total-cost at root\n distance = 0\n parent = -1\n priority = (distance + cost(@start, @finish))\n consider_set.push(@start, priority)\n\n while (not @solved) and (current = consider_set.pop)\n visit(current, parent)\n\n if (current == @finish)\n @solved = true\n break\n end\n\n #get all neighboring nodes we can go to sorted based on their heuristical distance from finish\n accessible_neighbors(current).each do |neighbor|\n unless visited?(neighbor)\n #add every accessible neighbor with its priority = distance so far to the node + cost/straight line to finish\n priority = (distance + cost(neighbor, @finish))\n consider_set.push(neighbor, priority)\n end\n end\n parent = current\n end\n trace_shortest_path\n end", "title": "" }, { "docid": "1a9a17acf884af31f40435148ea24be2", "score": "0.59632766", "text": "def shortest_path(source, finish_list)\n dist = {} # The distance of all vertices from start vertex\n prev = {} # Previous node in the optimal path\n q = Depq.new\n\n @dg.each_vertex do |v|\n # dist contains the \"Depq::Locator\" for that value\n dist[v] = (v == source) ? q.insert(v, 0) : q.insert(v, INFINITY)\n end\n\n while not q.empty?\n u = q.delete_min\n if dist[u].priority == INFINITY\n @log.info(\"shortest_path(): dist[#{u}] == Infinity\")\n break\n end\n if finish_list.include?(u)\n finish_vertex = u\n break\n end\n @dg.adjacent_vertices(u).each do |v|\n alt = dist[u].priority + 1\n if alt < dist[v].priority\n dist[v].update(v, alt)\n prev[v] = u\n end\n end\n end # while\n\n s = [] # The shortest path from source to finish_vertex\n w = finish_vertex\n while not prev[w].nil?\n s.push(w)\n w = prev[w]\n end\n\n return s\n end", "title": "" }, { "docid": "95f297edddfedbb0c6b5d3cf02bb59f1", "score": "0.59618765", "text": "def shortest_path_to target\n node = Node.new(pos, 0, nil)\n seen = Set.new\n queue = []\n\n seen << node.pos\n queue << node\n adj = [\n [0, 1],\n [1, 0],\n [0, -1],\n [-1, 0],\n ]\n\n while !queue.empty?\n node = queue.shift\n\n return node if node.pos == target\n\n dist = node.dist\n i, j = node.pos\n\n neighbors = adj.map { |x, y| [x+i, y+j] }.select { |c| is_valid? c, seen }\n neighbors.each do |pos|\n n = Node.new(pos, dist + 1, node)\n queue << n\n seen << pos\n end\n end\n\n # p \"No path found to #{target}\"\n return\n end", "title": "" }, { "docid": "5b798430676865c3af7bdf30148f77fe", "score": "0.59496903", "text": "def find_min_cells(max_exponent)\n # ... how to do this?\n # the max is easy, because all states in the model have nonzero probability\n # the min seems harder... how to guarantee that there is a path using only\n # a given number of cells... that seems easy enough. increase a threshold\n # and see whether there's a way to get to a win state using states with\n # only at most that number of states.\n transitions = build_markov_chain(max_exponent)\n (2..16).each do |threshold|\n allowed_transitions = filter_states(transitions) do |state|\n state.size <= threshold\n end\n return threshold if winnable?(allowed_transitions, max_exponent)\n end\n nil\nend", "title": "" }, { "docid": "0a77cda6e2d5f26da591d35c2b6e0ae2", "score": "0.5948962", "text": "def shortest_path(source, target = nil)\n distances = {}\n previouses = {}\n\n vertices.each_pair do |key, vertex|\n distances[key] = nil # Infinity\n previouses[key] = nil\n end\n\n distances[source] = 0\n verts = vertices.clone \n\n until verts.empty?\n nearest_vertex = verts.inject(verts.first.first) do |a, (b, c)|\n next b unless distances[a]\n next a unless distances[b]\n next a if distances[a] < distances[b]\n b\n end\n\n break unless distances[nearest_vertex] # Infinity\n\n if target && nearest_vertex == target\n return compose_path(target, distances[target], previouses)\n end\n\n neighbors = verts[nearest_vertex].neighbors\n neighbors.each_pair do |name, vertex|\n alt = distances[nearest_vertex] + 1\n\n if distances[name].nil? || alt < distances[name]\n distances[name] = alt\n previouses[name] = nearest_vertex\n end\n end\n verts.delete(nearest_vertex)\n end\n end", "title": "" }, { "docid": "4989f9f4bebdaf1418da9555d4d47d2f", "score": "0.5940828", "text": "def intresect_least_steps(wire2)\n least_steps = -1\n \n for sloc in @path\n loc = sloc.split(\",\")\n if (wire2.path.include? sloc) && (sloc != \"0,0\")\n steps = @pos_steps[sloc] + wire2.pos_steps[sloc]\n least_steps = steps if (least_steps < 0) || (steps < least_steps)\n end\n end\n return least_steps\n end", "title": "" }, { "docid": "b23c98add9400bd94c6c859c89ec2456", "score": "0.5928051", "text": "def getShortestDistance(destination)\n ## if alays comes your ed_pt as empty value and no path so defined some interger as en_pt size\n d = @distance[destination]\n #p @distance[destination]\n if d == nil\n return (2**(0.size * 8 -2) -1) #max integer\n else\n return d\n end \n end", "title": "" }, { "docid": "1211094076d95b1bae8b2efaebe90151", "score": "0.5924853", "text": "def optimal_path\n solution_path = nil\n (0...row_count).each do |rownum|\n if resistance(rownum, 0) < max_resistance\n working_path = new_path << rownum\n\n # The sole underscore is used by Erlang and (AFAIK) other languages\n # to indicate an ignored value/variable:\n _, row_solution_path = optimal_path_recursive(working_path)\n solution_path = Path.min_copy(solution_path, row_solution_path)\n end\n end\n (solution_path && solution_path.complete_optimal_path_candidate?) ? solution_path : nil\n end", "title": "" }, { "docid": "061d636e3f373f233fd9b872eab28376", "score": "0.5919502", "text": "def calculate_path\n path = []\n open_nodes = []\n closed_nodes = []\n\n # References for the start and destination node for easier use.\n starting_node = @board_handler.start_node\n destination_node = @board_handler.destination_node\n\n open_nodes << starting_node\n\n until open_nodes.empty?\n # Selects the node with the lowest F value from the open node list, then checks it's neighbours.\n current_node = get_node_with_lowest_f_value(open_nodes)\n\n closed_nodes << current_node\n open_nodes.delete(current_node)\n\n # If the closed node list contains the destination, then the path is completed.\n if closed_nodes.include? destination_node\n\n # Backtracking and adding the steps to the array.\n until current_node.parent.nil?\n path << current_node\n current_node = current_node.parent\n end\n\n break\n end\n\n # Checks each neighbour of the node.\n current_node.neighbours.each do |neighbour|\n\n # Filtering out nodes that are not fit for path.\n next unless neighbour.type != :wall\n\n next if closed_nodes.include? neighbour\n\n neighbour.g = get_g_value(current_node) + neighbour.cost\n neighbour.h = get_h_value(neighbour)\n neighbour.f = get_f_value(neighbour)\n\n # If it's not in the open list, add it and set the parent.\n # Else check if the F value is better with the current node, if it is then set the it's parent to the current node.\n if !open_nodes.include? neighbour\n neighbour.parent = current_node\n open_nodes << neighbour\n else\n neighbour.parent = current_node if get_f_value(neighbour) > get_f_value_with_g(neighbour, current_node.g)\n end\n end\n end\n\n closed_nodes.each do |node|\n node.type = :checked if node != starting_node && node != destination_node\n end\n\n path\n end", "title": "" }, { "docid": "03c8aa03b5653bd23507bd0a687dcfe4", "score": "0.591794", "text": "def shortest_path_util(grid,sr,sc,tr,tc)\n\t# Return -1 if any of source or target is not equal to 0.\n if grid[sr][sc] != 0 || grid[tr][tc] != 0\n\t\treturn -1\n\tend\n @rows = grid.size\n @cols = grid[0].size\n visited = Array.new(@rows) {Array.new(@cols) {false} } # Maintain visited matrix to keep track if cell is visited or not\n adj_rows = [-1,0,0,1,-1,-1,1,1] # All possible direction adjacent rows including diagonals.\n\tadj_cols = [0,-1,1,0,-1,1,-1,1] # All possible direction adjacent cols including diagonals.\n queue_node = QueueNode.new(sr,sc,1) # Initialize queue_node with x,y and distance 1. As first is included in distance as per question statement.\n q = [queue_node] # Initialize queue and insert source cell to queue with distance 0 in form of queue_node.\n visited[sr][sc] = true # Mark visited true for source cell.\n # Traverse queue while its not empty\n while !q.empty? do\n \tpopped_node = q.pop\n \t# If popped_node is target cell, return distance.\n \tif popped_node.x == tr && popped_node.y == tc\n \t\treturn popped_node.dist\n \tend\n \t# Push adjacent nodes to queue using adj_rows and adj_cols.\n \tfor i in 0..7 do\n \t\trow = popped_node.x + adj_rows[i]\n \t\tcol = popped_node.y + adj_cols[i]\n \t\t# If cell is valid and cell equals 0 and has not been visited.\n \t\t# Enqueue item to queue and mark as visited.\n \t\tif is_valid?(row,col) && grid[row][col] == 0 && visited[row][col] == false\n \t\t\tqueue_node = QueueNode.new(row,col,popped_node.dist+1)\n \t\t\tq.unshift(queue_node)\n \t\t\tvisited[row][col] = true\n \t\tend\n \tend\n end\n return -1 # If whole matrix has been traversed and target cell not found, return -1.\nend", "title": "" }, { "docid": "fadd40b6cdde07946f8ac425cdae67f2", "score": "0.5915126", "text": "def find_max_path\n\t\ttime do\n\t\t\t# we have to end at one of the bottom nodes, so work bottom-up\n\t\t\t(@rows-2).step(0, -1) do |row|\n\t\t\t\t(0..row).each do |pos|\n\t\t\t\t\t@tri[row][pos] += [@tri[row+1][pos], @tri[row+1][pos+1]].max\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"the maximum sum is #{@tri[0][0]}.\"\n\t\tend\n\tend", "title": "" }, { "docid": "5e0296890a1cf9d7a0e26cd9feec7ea4", "score": "0.5913739", "text": "def min_path_sum(grid)\n rows = grid.size\n cols = grid[0].size\n min_path_helper(grid, rows - 1, cols - 1)\nend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "089d9b368dc9d759a5b7ddfdeac61b87", "score": "0.0", "text": "def set_amenity\n @amenity = Amenity.where(id: params[:id], property_id: params[:property_id]).first\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59229624", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5899037", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889287", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5877498", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5862599", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5810375", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.5740072", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57316417", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5718692", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700777", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5692726", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668117", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56531155", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.565059", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56384724", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5625417", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56102014", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5596785", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5596253", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55899394", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55090857", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55058104", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54677796", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465028", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.5448835", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5447902", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54402983", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54168683", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400121", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392725", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53884417", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53783494", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53593004", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53494495", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5349437", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53471607", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.53441674", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5342784", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53281486", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53036916", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.528415", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.52831894", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5258319", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5256983", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52521855", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52472556", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52398384", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52329665", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.5229699", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5225785", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.52239066", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.5219224", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52147436", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52146924", "text": "def pick_action; end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5211636", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52089876", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5206151", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.5204869", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.520361", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5201687", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51926094", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5181837", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178642", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51642865", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153578", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51448536", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5142863", "text": "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", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51412", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.5139861", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5134318", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51167125", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5115634", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51111007", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5106379", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.510497", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51013684", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5096925", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5093146", "text": "def config(action, *args); end", "title": "" } ]
3872741c01f7df7a9b869d1b2c956dd9
parse command line arguments
[ { "docid": "b891b8eb73471042b2ad8f9412707419", "score": "0.6655858", "text": "def parse_arguments\n @cmd_line_arguments = {}\n\n @options = OptionParser.new do |opt|\n opt.on('-C', '--change-dir DIR', 'Change working directory to DIR') do |directory|\n @cmd_line_arguments[:working_directory] = directory\n end\n\n opt.on('-d', '--debug', 'Debug mode') do\n @cmd_line_arguments[:debug] = true\n end\n\n opt.on('-e', '--environment NAME', 'set environment to NAME') do |environment|\n @cmd_line_arguments[:environment] = environment\n end\n\n opt.on('-G', '--generate-json', 'Generate json files, which are commited to api') do\n @cmd_line_arguments[:generate_json_file] = true\n @cmd_line_arguments[:action] ||= :generate\n end\n\n opt.on('--generate-report', 'Generate report csv in output directory') do\n @cmd_line_arguments[:generate_report] = true\n end\n\n opt.on('-g', '--group NAME[,NAME]', Array, 'set groups') do |groups|\n @cmd_line_arguments[:groups] ||= []\n @cmd_line_arguments[:groups] += groups\n end\n\n opt.on('-j', '--job JOB[,JOB,...]', Array, 'Limit action to JOB, which is a regexpression') do |jobs|\n @selected_jobs += jobs\n end\n\n opt.on('-l', '--list', 'List available jobs') do\n @cmd_line_arguments[:action] = :list\n end\n\n opt.on('-p', '--project NAME', 'set project') do |project|\n @cmd_line_arguments[:project] = project\n end\n\n opt.on('-o', '--output-directory DIR', 'generate json file into DIR directory', 'default: ' + @config.output_directory) do |directory|\n @cmd_line_arguments[:output_directory] = directory\n end\n\n opt.on('-q', '--quiet', 'be quiet') do\n @cmd_line_arguments[:quiet] = true\n end\n\n opt.on('-r', '--run', 'Run all configured jobs or all jobs passed with -j') do\n @cmd_line_arguments[:action] = :run\n end\n\n opt.on('-R', '--report', 'show report') do\n @cmd_line_arguments[:report] = true\n end\n\n opt.on('-s', '--save-response', 'save respone in output directory') do\n @cmd_line_arguments[:save_response] = true\n end\n\n opt.separator \"\n\n Examples:\n # List all available jobs\n #{File.basename $0} -l\n\n # List all available jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -l\n\n # Run all configured jobs\n #{File.basename $0} -r\n\n # Run all configured jobs and show a report\n #{File.basename $0} -r --report\n\n # Run all configured jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -r\n\n # Run Job_A and Job_B, which must configured in project.yml or group.yml\n #{File.basename $0} -r -j Job_A -j Job_B\n\n # Run all Jobs, which beginn with JOB\n #{File.basename $0} -r -j JOB.*\n\n # Run all Jobs, which contains with JOB\n #{File.basename $0} -r -j .*JOB.*\n\n # Generate json files, which are going to be requested, for all configured jobs\n #{File.basename $0} -G\n\n # Generate json file, which are going to be requested, for Job_A\n #{File.basename $0} -G -j Job_A\n\n # Run jobs for delti group and generate json files\n #{File.basename $0} -r -G -g delti\n\n Available template macros:\n\n Variables and Responses:\n response('<job_name>', '<name>') - return value from the response of a job (see examples)\n response('<job_name>', - return value from the response of a job in another group (must be run before)\n '<name>',\n group: '<group_name>')\n var('<name>', - return variable defined in Job in Vars section.\n default: nil, when default is set (not nil) and variable is undefined, return default\n ignore_error: false) when variable is undefined, do not throw an error\n\n Date and Time:\n now() - returns today (now) in seconds\n yesterday() - returns yesterday in iso8601\n time([<day_shift>[, format: <format>]]) - returns time in specificied format\n defaults: day_shift = 0, format = :seconds\n format:\n :seconds : return time in seconds\n :iso8601 : return timestamp in iso8601\n :iso8601utc : return timestamp in iso8601 (utc)\n\n Examples:\n # get variable test\n var('test')\n\n # get value pdfToken from register response\n response('Delti_Create_DE', 'pdfToken')\n\n # get value pdfToken from register response, where job name is defined as variable in cancel job\n response(var('CreateJob'), 'pdfToken')\n\n # get value token from GenerateToken response in group auth\n response('GenerateToken', 'token', group: 'auth')\n\n # return time of today in seconds\n time()\n\n # return timestamp of today in iso8601\n time(format: :iso8601)\n\n # return timestamp of yesterday in iso8601\n time(-1, format: :iso8601)\n\n # return timestamp of last year in iso8601\n time(-365, format: :iso8601)\n\n # return timestamp of tomorrow in iso8601\n time(1, format: :iso8601)\n\n # return credential\n credential('PROJECT_NAME_username')\n\n # return basic auth header value\n basicauth('PROJECT_NAME_username', 'PROJECT_NAME_password')\n \"\n end\n @options.parse!\n\n @config.insert 0, '<command_line>', @cmd_line_arguments\n\n unless File.directory?(@config.output_directory)\n Dir.mkdir @config.output_directory\n end\n\n Dir.chdir @config.working_directory\n end", "title": "" } ]
[ { "docid": "1e211a00cdbb0a010283db89ac3cc687", "score": "0.7401021", "text": "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "title": "" }, { "docid": "ce4ffdb99bda38035bab102c53c8e81f", "score": "0.7280364", "text": "def parse!( args )\n @args = args\n @options.grep!(args)\n end", "title": "" }, { "docid": "a0f1267129073a5b905c399d0c4039be", "score": "0.72663003", "text": "def parse_options(opts, args); end", "title": "" }, { "docid": "ae31f3f7bf2165348bed7c86ebc2d29d", "score": "0.7261952", "text": "def parse argv\n parse_args argv do |argv, remaining_args, arg|\n remaining_args << arg\n end\n end", "title": "" }, { "docid": "bae98db6604f6d35f684161c7aa63693", "score": "0.7236387", "text": "def parse_args\n case ARGV[0]\n when '-a'\n # check that no arg was passed with the -a flag.\n if ARGV[1]\n puts \"Error, '-a' flag cannot accept additional arguments.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n parse_directory(File.expand_path(Dir.pwd))\n when '-d'\n ARGV.shift\n ARGV.each do |d|\n unless File.directory?(d)\n puts \"Error, #{d} is not a directory.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n end\n dirs = ARGV.map { |d| File.expand_path(d) }\n dirs.each { |d| parse_directory(d) }\n when \"-f\"\n ARGV.shift\n ARGV.each do |f|\n unless File.extname(f) == '.pp'\n puts \"Error, #{f} is not a '.pp' file\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end \n end\n ARGV.each { |f| PuppetFile.new(File.expand_path(f)) }\n when '-g'\n if ARGV[1]\n puts \"Error, '-g' flag cannot accept additional arguments.\"\n puts \"Run `validate-pp -h` for more info.\"\n exit!\n end\n parse_git_repo\n end\nend", "title": "" }, { "docid": "fd53e9b0755b173d9e59c8819ab48f6e", "score": "0.72249085", "text": "def parse_arguments\n OptionParser.new do |parser|\n # parser.banner = \"Usage: init.rb -c <integer>\"\n parser.on(\"-c\", \"--count COUNT\", Integer, \"Specify number of uuid's to generate\") do |c|\n @options[:count] = c\n end\n parser.on(\"-f\", \"--file FILE\", \"Specify path to save csv file example -f '/path/to/file.csv'\") do |path|\n @options[:path] = path\n end\n end.parse!\n end", "title": "" }, { "docid": "6a1b7327061c1df1fd46c6097ac87cd4", "score": "0.719085", "text": "def parse\n @opts = OptionParser.new { |opts| process_opts(opts) }\n @opts.parse!(@args)\n\n process_args\n\n @options\n end", "title": "" }, { "docid": "c94614acee1d61b6138a3d89b0e1f7a1", "score": "0.71754545", "text": "def command_parse(argv)\n end", "title": "" }, { "docid": "7e3e8eeb4363eec033e9e9dbc313a4a2", "score": "0.7174259", "text": "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "title": "" }, { "docid": "902fe238109944c2e22a92b0d4bc68dc", "score": "0.71504337", "text": "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "title": "" }, { "docid": "b74fb68399a079b1a14fc43c256c4552", "score": "0.71447366", "text": "def parse_args()\n opts = GetoptLong.new(\n ['--host', GetoptLong::OPTIONAL_ARGUMENT],\n ['--port', GetoptLong::OPTIONAL_ARGUMENT],\n ['--columns', GetoptLong::OPTIONAL_ARGUMENT],\n ['--index', GetoptLong::REQUIRED_ARGUMENT],\n ['--type', GetoptLong::REQUIRED_ARGUMENT]\n )\n\n opts.each do |opt, arg|\n case opt\n when '--host'\n @host = arg\n when '--port'\n @port = arg\n when '--columnns'\n @cols = arg.split(\",\")\n when '--index'\n @index = arg\n when '--type'\n @type = arg\n end\n end\n\n if @index.nil?\n STDERR.puts 'missing argument: --index'\n exit 1\n end\n\n if @type.nil?\n STDERR.puts 'missing argument: --type'\n exit 1\n end\n\n if ARGV.length != 1\n STDERR.puts 'Missing argument: file'\n exit 1\n end\n\n @file = ARGV.shift\nend", "title": "" }, { "docid": "5519d67e71daa44305db5779e116c024", "score": "0.7132383", "text": "def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend", "title": "" }, { "docid": "485c121b28d3290c85c3be0655b8e36f", "score": "0.71169966", "text": "def parse_arguments(args)\n Trollop::with_standard_exception_handling argument_parser do\n if args.empty? || args.include?('-h') || args.include?('--help')\n raise Trollop::HelpNeeded\n elsif args.include?('--examples')\n print_examples\n end\n argument_parser.parse args\n end\n end", "title": "" }, { "docid": "3021bad4dc87039e81d46da18e16e90b", "score": "0.71099794", "text": "def parse_arguments\n options = {}\n parser = OptionParser.new do |opts|\n opts.on(\"-d\", \"--dir DIR\", \"absolute or relative path of the directory\") do |arg|\n options[:dir] = arg\n end\n\n opts.on(\"-p\", \"--pattern PATTERN\", \"search pattern - can contain asterisk(*) as wildcard\") do |arg|\n options[:pattern] = arg\n end\n end\n parser.parse!\n [options, parser]\nend", "title": "" }, { "docid": "00c4377ace17e743070e53205210e28c", "score": "0.70408595", "text": "def parse_args\n args = {\n :stack_name => nil,\n :parameters => {},\n :interactive => false,\n :region => default_region,\n :profile => nil,\n :nopretty => false,\n :s3_bucket => nil,\n }\n ARGV.slice_before(/^--/).each do |name, value|\n case name\n when '--stack-name'\n args[:stack_name] = value\n when '--parameters'\n args[:parameters] = Hash[value.split(/;/).map { |pair| parts = pair.split(/=/, 2); [ parts[0], Parameter.new(parts[1]) ] }]\n when '--interactive'\n args[:interactive] = true\n when '--region'\n args[:region] = value\n when '--profile'\n args[:profile] = value\n when '--nopretty'\n args[:nopretty] = true\n when '--s3-bucket'\n args[:s3_bucket] = value\n end\n end\n\n args\nend", "title": "" }, { "docid": "9a6dc4e4c492d9a396697ca8d9a6679a", "score": "0.70068395", "text": "def parse_args\n parser = Trollop::Parser.new do\n opt :resume\n opt :verbose\n version \"\"\n end\n\n parse do\n parser.parse\n end\n end", "title": "" }, { "docid": "0e77db8e3196346daf958782a3b5f586", "score": "0.69771755", "text": "def parse_opts\n option_parser.parse(@argv)\n end", "title": "" }, { "docid": "e83f0f479d84317377efa40c5baaea76", "score": "0.6962205", "text": "def process_args\n if has_directory?\n @directory_to_parse = @args[0]\n else\n @files = @args[0...@args.count-3]\n @owner = @args[@args.count-3]\n @repo = @args[@args.count-2]\n @token = @args[@args.count-1]\n end\n end", "title": "" }, { "docid": "6b7dc69ea7edd3806c30b22af1e7f5e2", "score": "0.69429106", "text": "def parse arguments\n begin\n @option_parser.parse! arguments\n rescue StandardError => e\n puts @option_parser\n puts\n puts e.message\n exit(-1)\n end\n\n @options\n end", "title": "" }, { "docid": "6936987dc11d84442e7301ae2f989e4c", "score": "0.6936485", "text": "def parse_command_line_args(args)\n opts = OptionParser.new do |opts|\n opts.banner = 'Usage: tbibtools [OPTIONS] [FILES] < IN > OUT'\n opts.separator ''\n opts.separator 'tbibtools is a free software with ABSOLUTELY NO WARRANTY under'\n opts.separator 'the terms of the GNU General Public License version 2 or newer.'\n opts.separator ''\n \n opts.on('-c', '--config=FILE', String, 'Configuration file') do |value|\n @configuration.config value\n end\n\n opts.on('-e', '--regexp=REGEXP', String, 'Display entries matching the regexp') do |value|\n @configuration.filter Regexp.new(value)\n end\n\n opts.on('-f', '--format=STRING', String, 'Re-format entries (order matters)') do |value|\n @configuration.format *value.split(/,/)\n end\n\n opts.on('--[no-]formatted', 'Unformatted output') do |bool|\n unless bool\n @configuration.entry_format = []\n @configuration.entry_format_default = []\n end\n end\n\n opts.on('-i', '--[no-]case-sensitive', 'Case insensitive') do |bool|\n @configuration.sort_case bool\n end\n \n opts.on('-l', '--format-list=[STRING]', String, 'Format string for list (implies --ls)') do |value|\n @configuration.shortcut_ls\n @configuration.list_format value if value\n end\n\n opts.on('--ls', 'Synonym for: -f list,stripPrelude (\"list\" implies \"unwrap\")') do |bool|\n @configuration.shortcut_ls if bool\n end\n\n opts.on('-o', '--output=FILE', String, 'Output file') do |value|\n @configuration.output value\n end\n\n opts.on('-P', '--strip-prelude', 'Strip the prelude: same as -f stripPrelude but helps to maintain the original formatting') do |bool|\n @configuration.strip_prelude\n end\n\n opts.on('-q', '--query=FIELD=REGEXP', String, 'Show entries for which field matches the regexp') do |value|\n field, rx = value.split(/=/, 2)\n @configuration.query field => Regexp.new(rx, Regexp::IGNORECASE)\n end\n\n opts.on('-s', '--sort=STRING', String, 'Sort (default: sort by key; key = _id, type = _type)') do |value|\n @configuration.sort_key value\n end\n\n opts.on('-S', '--[no-]expand-strings', 'Replace/expand strings') do |bool|\n @configuration.expand_strings bool\n end\n\n opts.on('--strip=FIELDS', String, 'Ignore/strip fields') do |value|\n @configuration.strip value.split(/,/)\n end\n\n opts.on('-u', '--unsorted', 'Unsorted output') do |bool|\n @configuration.sort_key nil\n end\n\n opts.separator ''\n opts.separator 'Other Options:'\n \n opts.on('--debug', Integer, 'Show debug messages') do |v|\n $DEBUG = true\n $VERBOSE = true\n end\n \n opts.on('-v', '--verbose', 'Run verbosely') do |v|\n $VERBOSE = true\n end\n \n opts.on('-h', '--help', 'Show this message') do\n puts opts\n exit 1\n end\n\n opts.separator ''\n opts.separator 'Available formats:'\n format_rx = /^(format|preprocess|head|body|tail)_/\n format_names = (['nnIsYear', 'sortCrossref', 'downcaseType', 'upcaseType'] + \n @configuration.methods.find_all{|m| m =~ format_rx}.collect{|m| m.sub(format_rx, '')}).uniq.sort.join(', ')\n opts.separator format_names\n\n opts.separator ''\n opts.separator 'Known format shortcuts:'\n acc = []\n @configuration.methods.find_all{|m| m =~ /^shortcut_/}.sort.each do |meth|\n fn = meth.sub(/^shortcut_/, '')\n fs = @configuration.send(meth, acc)\n opts.separator \"#{fn}: #{fs.join(',')}\"\n end\n end\n @configuration.input *opts.parse!(args)\n self\n end", "title": "" }, { "docid": "d57f8b3b8af8dd51880cea179e27d098", "score": "0.6916027", "text": "def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend", "title": "" }, { "docid": "56d7e20a7ae51d88bbe5972acbff5d40", "score": "0.6915557", "text": "def parse(args)\n opts = OptionParser.new\n opts.banner = usage\n\n descriptions.each do |text|\n opts.separator ' ' + text\n end\n\n set_options(opts)\n parse_options(opts, args)\n end", "title": "" }, { "docid": "fa54dbc4aa096d2a884cd91136bedb19", "score": "0.69108886", "text": "def parse(argv)\n options = parser.process!(argv)\n validate_options(options)\n Revamp.logger.level = Logger::INFO unless options[:verbose]\n options\n end", "title": "" }, { "docid": "353a1353ee1a50e27491230e8da7cfc6", "score": "0.6880481", "text": "def parse_args\n options = {}\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: harness.rb [-c || --config ] FILE [-d || --testdir] DIR\"\n\n options[:testdir] = nil\n opts.on( '-d', '--testdir DIR', 'Execute tests in DIR' ) do|dir|\n options[:testdir] = dir\n end\n options[:config] = nil\n opts.on( '-c', '--config FILE', 'Use configuration FILE' ) do|file|\n options[:config] = file\n end\n\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n return options\nend", "title": "" }, { "docid": "8702c195776654d43fef08af81455677", "score": "0.68775845", "text": "def parse(args)\n @options = args\n end", "title": "" }, { "docid": "348f3bf9951ac62abe0adb608ce4e49b", "score": "0.6873922", "text": "def parse_command_line()\n opts = GetoptLong.new(\n [ \"--input-file\" , \"-i\", GetoptLong::REQUIRED_ARGUMENT ],\n [ \"--verbose\" , \"-v\", GetoptLong::NO_ARGUMENT ]\n )\n #----------------------------- defaults\n\n opts.each do |opt, arg|\n if (opt == \"--input-file\" ) ; $input_file = arg\n elsif (opt == \"--verbose\" ) ; $verbose = 1\n end\n\n if ($verbose != 0) ; puts \"Option: #{opt}, arg #{arg.inspect}\" ; end\n end\nend", "title": "" }, { "docid": "b1a36c38505efa93a897bf732c15471b", "score": "0.68685085", "text": "def parse_arguments\n @command_line_options = {}\n @config.insert 0, '<command_line>', @command_line_options\n\n @options = OptionParser.new do |opts|\n opts.on('-a', '--application STRING', 'set application name') do |application|\n @command_line_options[:application] = application\n end\n\n opts.on('-d', '--destination DIR', 'set destination directory', \"default: #{@config[:destination_directory]}\") do |directory|\n @command_line_options[:destination_directory] = directory\n end\n\n opts.on('-n', '--dryrun', 'do not switch') do\n @command_line_options[:dryrun] = true\n end\n\n opts.on('-V', '--version STRING', 'set application version to deploy') do |version|\n @command_line_options[:version] = version\n end\n end\n @options.parse!\n end", "title": "" }, { "docid": "2884d72d9840fb77b8fdba23455c5351", "score": "0.6865963", "text": "def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: stratus [options] target [target args]'\n\n opts.separator ''\n\n desired_opts = %[--describe --prereqs --tasks --trace]\n app.standard_rake_options.each do |options|\n next unless desired_opts.include?(options.first)\n opts.on(*options)\n end\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) do\n @out.puts opts\n exit\n end\n opts.on_tail( '-q', '--quiet', 'show compact messages' ) do\n ENV['STRATUS_LOGGING'] = 'quiet'\n end\n opts.on_tail( '--version', 'show version' ) do\n @out.puts \"Stratus #{::Stratus::VERSION}\"\n exit\n end\n \n begin\n opts.parse! args\n rescue OptionParser::InvalidOption => ex\n puts \"!! #{ex}\"\n end\n \n \n ARGV.replace Array(args.shift)\n args.delete_if do |arg|\n if %r/^[A-Z_]+=/ =~ arg\n ARGV << arg\n next true\n end\n false\n end\n\n args\n end", "title": "" }, { "docid": "edb955781cd1c26b53a9069762490e16", "score": "0.68632656", "text": "def parse(args)\n arg_list = arg_groups(args)\n options = DEFAULT_OPTIONS.dup\n options[:exclude] += default_excludes\n options[:locations] = arg_list.shift\n\n arg_list.reject(&:empty?).each do |set|\n flag, *args = set\n args.map! { |arg| arg.delete(\"/\") } # \"log/\" => \"log\"\n\n case flag\n when '-f', '--flags' then options[:flags] += args\n when '-e', '--exclude' then options[:exclude] += args\n else puts \"Unknown argument: #{flag}\"\n end\n end\n\n options\n end", "title": "" }, { "docid": "7aa4267fe6a584246883cfa719a611a3", "score": "0.68512154", "text": "def parse_args\n @args.extend OptionParser::Arguable\n opts = @args.getopts('cdDi:lm:n:o:s:St:uvVz')\n @nsocks = opts['s'] ? opts['s'].to_i : 1\n @max_idle = opts['i'] ? opts['i'].to_i : DEFAULT_MAX_IDLE\n @max_use = opts['m'] ? opts['m'].to_i : DEFAULT_MAX_USE\n $VERBOSE = true if opts['v']\n end", "title": "" }, { "docid": "ec7aa8610aae857e8156086ca283b5e6", "score": "0.6837633", "text": "def parse_arguments\n\toptions = {}\n\t\n\toptparse = OptionParser.new do|opts| \n\t\t# Set a banner, displayed at the top \n\t\t# of the help screen. \n\t\topts.banner = \"Usage: ruby #{$0} [options] file1 file2...\"\n\n\t\t#Figure out the framerate\n\t\toptions[:framerate] = DEFAULT_FRAMERATE\n\t\trates = [23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60]\n\t\topts.on('-f', '--framerate RATE', Float, \"The framerate of your sequence. Defaults to #{DEFAULT_FRAMERATE}. Acceptable rates: #{rates}\") do |fr|\n\t\t\tif !rates.include?(fr)\n\t\t\t\tputs \"Invalid framerate. Must be one of: #{rates}.\".red\n\t\t\t\texit\n\t\t\tend\n\t\t\toptions[:framerate] = fr\n\t\tend\n\n\t\t# This displays the help screen, all programs are\n\t\t# assumed to have this option. \n\t\topts.on( '-h', '--help', 'Display this screen' ) do\n\t\t\tputs opts\n\t\t\texit\n\t\tend\n\n\tend\n\n\t#Parse the options we've set above.\n\t#Whatever is left goes into ARGV\n\toptparse.parse!\n\n\t#XML requirements. Timebase is the round number closest to the framerate\n\ttimebase = options[:framerate].round\n\tntsc = \"FALSE\"\n\n\t#NTSC is true if the true framerate is not a round number\n\t#NTSC should be true if the framerate does not match the timebase\n\tif timebase != options[:framerate]\n\t\tntsc = \"TRUE\"\n\tend\n\n\toptions[:timebase] = timebase\n\toptions[:ntsc] = ntsc\n\n\tif ARGV.length == 0\n\t\tputs \"No files listed.\".red\n\t\texit\n\tend\n\n\t#Parse out the remaining files\n\toptions[:files] = Array.new(ARGV)\n\t \n\treturn options\nend", "title": "" }, { "docid": "76453e0dbdb70a54ce07e59e65fa5765", "score": "0.68307793", "text": "def setup\n begin\n @options = OptParser.parse(ARGV)\n rescue ParserExceptions::MissingArgument\n exit(1)\n end\n\n end", "title": "" }, { "docid": "6178a1999c3e1e9aa74c837b00020124", "score": "0.68290573", "text": "def parse_args(args)\n options = {\n :excount => 5,\n :testdata => nil,\n :console => false,\n :raw => false,\n :pronounciation_offset => 1,\n :definition_offset => 2,\n :url => \"m\"\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n opts.on(\"-p N\", Integer, \"Offset to pronunciation column, default 1\") do |n|\n options[:pronounciation_offset] = n\n end\n opts.on(\"-d N\", Integer, \"Offset to definition column, default 2\") do |n|\n options[:definition_offset] = n\n end\n opts.on(\"-n N\", Integer, \"Number of example sentences, default 5\") do |n|\n options[:excount] = n\n end\n opts.on(\"-u U\", String, \"Source url (#{WWWJDICExampleProvider::SOURCES.to_s}), default #{options[:url]}\") do |u|\n options[:url] = u\n end\n\n opts.separator \"\"\n opts.separator \"Testing:\"\n opts.on(\"-t\", \"--testdata [DATAFILE]\",\n \"Path to yaml data file of examples (useful for testing)\") do |d|\n options[:testdata] = d\n end\n\n opts.separator \"\"\n opts.separator \"Output:\"\n opts.on(\"-c\", \"--console\", \"Dump to console only\") do |c|\n options[:console] = c\n end\n opts.on(\"-r\", \"--raw\", \"Output raw data (all examples)\") do |c|\n options[:raw] = c\n end\n\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend", "title": "" }, { "docid": "45a38d6f6c56b04d381acd9b83e237b4", "score": "0.6812344", "text": "def parse!\n begin\n @opts = OptionParser.new(&method(:set_opts))\n @opts.parse!(@args)\n @options\n rescue Exception => e\n raise e if e.is_a?(SystemExit)\n\n $stderr.puts e.message\n exit 1\n end\n exit 0\n end", "title": "" }, { "docid": "6d198057db556096be568154b1469127", "score": "0.680567", "text": "def process_args\n @options = { sequence_num: nil, directory: nil, verbose: false }\n\n @optparse = OptionParser.new do |opts|\n opts.banner = 'Usage: Upload directory to MOA repository'\n\n @options[:sequence_num] = nil\n opts.on( '-s', '--seq SEQ', Integer, 'disk upload sequence number' ) do |seq|\n @options[:sequence_num] = seq\n end\n\n @options[:batch] = 1\n opts.on( '-b', '--batch BATCH', Integer, 'Start from batch number' ) do |batch|\n @options[:batch] = batch\n end\n\n @options[:batchsize] = BATCH_SIZE\n opts.on( '-n', '--batchsize BATCHSIZE', Integer, 'Set Batch Size (Default 5000 files)' ) do |batchsize|\n @options[:batchsize] = batchsize\n end\n\n @options[:directory] = nil\n opts.on( '-d', '--dir DIR', String, 'directory to upload' ) do |dir|\n @options[:directory] = dir\n end\n\n @options[:verbose] = false\n opts.on( '-v', '--verbose', 'Output more information' ) do\n @options[:verbose] = true\n end\n\n opts.on( '-?', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n\n @optparse.parse!\n\n if @options[:directory].nil? || @options[:sequence_num].nil?\n puts @optparse\n exit(-1)\n end\nend", "title": "" }, { "docid": "8e7258fd56f23929b5cf4565444a7f50", "score": "0.6787886", "text": "def parse_args(args)\n options = OpenStruct.new\n\n options[:html] = false\n options[:directory] = './'\n options[:ext] = '.jpg'\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: main.rb [options]'\n opts.separator ''\n opts.separator 'Options:'\n\n opts.on('-f', '--filename FILE', 'Filename to write') do |f|\n options[:filename] = f\n end\n\n opts.on('-d', '--directory DIRECTORY', 'Image directory to process') do |d|\n options[:directory] = d\n end\n\n opts.on('--html', 'Output HTML instead of CSV') do\n options[:html] = true\n end\n\n opts.on('-h', '--help', 'Help') do\n puts opts\n exit\n end\n end\n\n begin\n opt_parser.parse(args)\n rescue OptionParser::ParseError\n $stderr.print(\"Argument Error: #{$ERROR_INFO}\\n\")\n exit\n end\n\n # set default filename if not supplied\n unless options[:filename]\n ext = options[:html] ? 'html' : 'csv'\n options[:filename] = \"exif_data_#{Time.now.strftime('%s')}.#{ext}\"\n end\n\n options\n end", "title": "" }, { "docid": "3e090ffd7d9562c08db3be180416e85a", "score": "0.67703974", "text": "def parse!(argv)\n options = {}\n parser = configure_base!(OptionParser.new)\n parser.parse!(argv, into: options)\n unless options.key?(:input)\n puts 'Missing --input argument, which is required.'\n Advent2019.show_help(parser)\n end\n options\n end", "title": "" }, { "docid": "73260a2ede76f62057bed7058baeae41", "score": "0.6768524", "text": "def parse_command_line(args)\n all_opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{PROGRAM_NAME} [OPTIONS] PASSWORD\"\n opts.separator ''\n\n opts.on(\n '-t',\n '--load-timeout [TIMEOUT_SECONDS]',\n Integer,\n 'Timeout in seconds to wait for',\n 'gitlab-rails console to load',\n 'and process the change.',\n \"Defaults to #{DEFAULT_LOAD_TIMEOUT} seconds.\"\n ) do |timeout|\n @options.load_timeout = timeout\n end\n\n opts.on(\n '-v',\n '--verbose',\n 'Print out debug info when processing.'\n ) do\n @options.debug = true\n end\n\n opts.on(\n '-h',\n '--help',\n 'Help Message'\n ) do\n puts opts\n @options.help_requested = true\n end\n end\n\n all_opts.parse!(args)\n\n unless @options.help_requested\n fail('ERROR: You must specify the password to set') if (ARGV.length < 1)\n\n @options.password = ARGV[0]\n fail('ERROR: Password cannot be empty') if @options.password.strip.empty?\n end\n end", "title": "" }, { "docid": "4f7fa8a34b7cc2a3d4ffb3109c7977c8", "score": "0.6763835", "text": "def parse_args()\r\n\t\tfor arg in ARGV\r\n\t\t\tif arg == \"-d\"\r\n\t\t\t\t@daemonize = true\r\n\t\t\telsif arg == \"development\" || arg == \"production\"\r\n\t\t\t\t@db_env = arg\r\n\t\t\tend\r\n\t\tend\r\n\t\tputs \"Using DB: #{@db_env}\"\r\n\tend", "title": "" }, { "docid": "5d52f5af3e6cc6275a9104e566a3e91e", "score": "0.6754632", "text": "def argv; argline.split(/ +/) unless argline.nil?; end", "title": "" }, { "docid": "124bb4c1d680ee6eaef3180f9a4c8608", "score": "0.6749553", "text": "def parse\n # The options specified on the command line will be collected in *options*.\n # We set default values here.\n OptionParser.new { |options| parse_options options}.parse!(@args)\n @options\n end", "title": "" }, { "docid": "4ebcc3cad4ab32b44f5f4569921e7f03", "score": "0.6735485", "text": "def parse_args\n options = {}\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: harness.rb [options...]\"\n\n options[:tests] = []\n opts.on( '-t', '--tests DIR/FILE', 'Execute tests in DIR or FILE (defaults to \"./tests\")' ) do|dir|\n options[:tests] << dir\n end\n\n options[:type] = 'skip'\n opts.on('--type TYPE', 'Select puppet install type (pe, git, skip) - default \"skip\"') do\n |type|\n unless File.directory?(\"setup/#{type}\") then\n puts \"Sorry, #{type} is not a known setup type!\"\n exit 1\n end\n options[:type] = type\n end\n\n options[:puppet] = 'git://github.com/puppetlabs/puppet.git#HEAD'\n opts.on('-p', '--puppet URI', 'Select puppet git install URI',\n \" #{options[:puppet]}\",\n \" - URI and revision, default HEAD\",\n \" just giving the revision is also supported\"\n ) do |value|\n options[:type] = 'git'\n options[:puppet] = value\n end\n\n options[:facter] = 'git://github.com/puppetlabs/facter.git#HEAD'\n opts.on('-f', '--facter URI', 'Select facter git install URI',\n \" #{options[:facter]}\",\n \" - otherwise, as per the puppet argument\"\n ) do |value|\n options[:type] = 'git'\n options[:facter] = value\n end\n\n options[:config] = nil\n opts.on( '-c', '--config FILE', 'Use configuration FILE' ) do|file|\n options[:config] = file\n end\n\n opts.on( '-d', '--dry-run', \"Just report what would be done on the targets\" ) do |file|\n $dry_run = true\n end\n\n options[:mrpropper] = FALSE\n opts.on( '--mrpropper', 'Clean hosts' ) do\n puts \"Cleaning Hosts of old install\"\n options[:mrpropper] = TRUE\n end\n\n options[:stdout_only] = FALSE\n opts.on('-s', '--stdout-only', 'log output to STDOUT but no files') do\n puts \"Will log to STDOUT, not files...\"\n options[:stdout_only] = TRUE\n end\n\n options[:quiet] = false\n opts.on('-q', '--quiet', 'don\\'t log output to STDOUT') do\n options[:quiet] = true\n end\n\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n return options\nend", "title": "" }, { "docid": "557be17c4fa2ef28f8f18c782817c0b1", "score": "0.6734897", "text": "def parse args=ARGV\n\t\t\tOptionParser.new do |opts|\n\t\t\t\t# Setup\n\t\t\t\tversion_path = File.expand_path('../../VERSION', File.dirname(__FILE__))\n\t\t\t\topts.version = File.exist?(version_path) ? File.read(version_path) : ''\n\t\t\t\t# Start of help text\n\t\t\t\topts.banner = 'Usage: tracking [mode]'\n\t\t\t\topts.separator ' display recent tasks'\n\t\t\t\topts.separator ' <task description> start a new task with the given text (spaces allowed)'\n\t\t\t\t# Modes\n\t\t\t\topts.on('-f', '--find', 'display all tasks that match a search query') do\n\t\t\t\t\tdisplay(:query => text_from_args)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-a', '--all', 'display all tasks') do\n\t\t\t\t\tdisplay(:max => :all)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-n', '--number integer', 'display n tasks') do |number_str|\n\t\t\t\t\tdisplay(:max => number_str.to_i)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-r', '--rename', 'rename the last task') do\n\t\t\t\t\tList.rename text_from_args\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-d', '--delete', 'delete the last task') do\n\t\t\t\t\tList.delete\n\t\t\t\t\tdisplay\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-c', '--clear', 'delete all tasks') do\n\t\t\t\t\tList.clear\n\t\t\t\t\tputs 'List cleared.'\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\topts.on('-h', '--help', 'display this help information') do\n\t\t\t\t\tputs opts\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend.parse! args\n\n\t\t\t# Basic modes (display and add)\n\t\t\tif args.count == 0\n\t\t\t\t# Display all tasks\n\t\t\t\tdisplay\n\t\t\telse\n\t\t\t\t# Start a new task\n\t\t\t\tList.add args.join(' ').gsub(\"\\t\",'')\n\t\t\t\tdisplay\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "dd47e06a1c32076a3c4ace862de8aa41", "score": "0.67236227", "text": "def parse_args\n parser = Trollop::Parser.new do\n opt :list\n opt :add, \"\", :type => :string\n opt :remove, \"\", :type => :string\n opt :query, \"\", :type => :strings\n opt :verbose\n opt :die, \"\", :short => \"-e\"\n opt :format, \"\", :type => :string, :default => \"json\"\n opt :timeout, \"\", :type => :int, :default => TAG_REQUEST_TIMEOUT\n version \"\"\n end\n\n parse do\n options = parser.parse\n options[:action] = :get_tags if options.delete(:list)\n if options[:add]\n options[:action] = :add_tag\n options[:tag] = options.delete(:add).strip\n raise ::Trollop::CommandlineError.new(\"Non-empty value required\") if options[:tag].empty?\n end\n if options[:remove]\n options[:action] = :remove_tag\n options[:tag] = options.delete(:remove).strip\n raise ::Trollop::CommandlineError.new(\"Non-empty value required\") if options[:tag].empty?\n end\n if options[:query]\n options[:action] = :query_tags\n options[:tags] = options.delete(:query).map { |tag| tag.strip }\n end\n options[:format] = parse_format(options[:format])\n options\n end\n end", "title": "" }, { "docid": "b0291b0eb4cce64a76449fc73ed2379a", "score": "0.671969", "text": "def parse(args)\n begin \n opt_parser.parse!(args)\n rescue ::OptionParser::InvalidOption => e\n puts help\n exit(1)\n end\n options\n end", "title": "" }, { "docid": "9064e1e029615b54673606552cacbde3", "score": "0.670888", "text": "def parse\n # parse flag arguments\n @oparse.parse!(@argv) rescue(bail_args($!))\n @parsed=true\n\n # the overriding class may implement additional arguments from here\n end", "title": "" }, { "docid": "6930ef6c1795e04b7885f51707ea5ad1", "score": "0.6706082", "text": "def parse_args\n { :ip => ARGV[1] || '0.0.0.0', :port => (ARGV[0] || '9000').to_i,\n :logging => !(ENV['DEBUG'] &&\n ['0', 'no', 'false'].include?(ENV['DEBUG'].downcase)) }\nend", "title": "" }, { "docid": "27fbe885df95a13e2df95a8931c5270d", "score": "0.66923624", "text": "def parse_command_line_options\n options = {}\n options[:config] = \"config/clamav.yml\" # default\n opts = OptionParser.new\n # define options\n opts.banner = \"Usage: clamav.rb [-c file] [-u] [-i time]\"\n opts.on('-c', '--config FILE',\n \"Specify config file other than default \",\n \"'config/clamav.yml' - use relative path\") do |file|\n options[:config] = file\n end\n opts.on('-i', '--install TIME', Time,\n \"Install LaunchAgent to run clamav.rb every\",\n \"day at specified time {eg: 2:30pm}\",\n \"Try using with --config FILE\",\n \"Requires RELOGIN\") do |time|\n options[:install] = time\n end\n opts.on('-u', '--uninstall', \"Uninstall LaunchAgent - requires RELOGIN\") do |time|\n options[:uninstall] = true\n end\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") {puts opts; exit 0}\n opts.on_tail(\"-v\", \"--version\", \"Show version\") {puts \"clamav.rb 1.1.0\"; exit 0}\n # parse options\n opts.parse!(ARGV)\n options\nend", "title": "" }, { "docid": "b639c1a3f126d04c133515b9e2703a83", "score": "0.66852117", "text": "def parse_args(args)\n options = {\n :console => false,\n :tag => nil\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n\n opts.on(\"-t T\", String, \"Tag\") do |t|\n options[:tag] = t\n end\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend", "title": "" }, { "docid": "3b19c83b49f9359313502d1e4ba5bfc8", "score": "0.66826797", "text": "def parse!(argv)\n\t\t$log.debug(\"#{self.class}.#{__method__}('#{argv.join(\" \")}'#{block_given? ? ',&block' : ''})\")\n\t\tif (argv.size == 0)\n\t\t\traise OptionParser::InvalidArgument, \"No arguments specified.\"\n\t\tend\n\n\t\t# @options is used to store recognized command-line args\n\t\t@options = Hash.new\n\t\twhile arg = argv.shift\n\t\t\tcase arg\n\t\t\twhen \"-cmd\"\n\t\t\t\t@command = argv.shift\n\t\t\twhen \"-debug\"\n\t\t\t\t$log.level = Logger::DEBUG\n\t\t\t\t$logerr.level = Logger::DEBUG\n\t\t\twhen \"-opt\"\n\t\t\t\t@options[:dataset] = argv.shift\n\t\t\twhen \"-path\"\n\t\t\t\t@options[:path] = argv.shift\n\t\t\twhen \"-target\"\n\t\t\t\t@options[:target] = argv.shift\n\t\t\twhen \"-log\"\n\t\t\t\tlevel = $log.level\n\t\t\t\tlog_path = argv.shift\n\t\t\t\t$log = Logger.new(log_path)\n\t\t\t\t$log.level = level\n\t\t\t\t$logerr = Logger.new(log_path)\n\t\t\t\t$logerr.level = level\n\t\t\telse\n\t\t\t\targv.unshift(arg)\n\t\t\t\tif block_given?\n\t\t\t\t\tunless (argv = yield(argv))\n\t\t\t\t\t\traise OptionParser::InvalidArgument, \"Unknown argument.\"\n\t\t\t\t\tend\n\t\t\t\telse break\n\t\t\t\tend\n\t\t\tend\t\t\n\t\tend\n\t\traise OptionParser::InvalidArgument, \"No command specified.\" unless @command\n\t\tunless (self.class::COMMANDS.include?(@command) && self.respond_to?(@command))\n\t\t\traise OptionParser::InvalidArgument, \"Unknown command '#{@command}' specified.\"\n\t\tend\n\t\treturn argv\n\tend", "title": "" }, { "docid": "f428223139f5c43dd2d432b78824079a", "score": "0.6676502", "text": "def parse_options\n set_defaults\n unless parsed_options? && arguments_valid?\n output_usage\n exit 1\n end\n end", "title": "" }, { "docid": "aa5b18771c4659ca595abf1105bba573", "score": "0.6661481", "text": "def parse_cmd_arguments( args ) # {{{\n\n original_args = args.dup\n options = OpenStruct.new\n\n # Define default options\n options.verbose = false\n options.colorize = false\n options.process = []\n options.sources = []\n options.debug = false\n options.db_path = \"data/databases/test.sqlite3\"\n options.db_type = \"sqlite3\"\n options.read = false\n options.automatic = false\n options.interval = 3600 # update normally only every hour\n options.rate = false\n options.username = \"\"\n options.manual_input = false\n options.joke_count = false\n options.random_intervals = false\n options.random_interval_time = 25\n\n pristine_options = options.dup\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{__FILE__.to_s} [options]\"\n\n opts.separator \"\"\n opts.separator \"General options:\"\n\n opts.on(\"-d\", \"--db-path PATH\", \"Use the database which can be found in PATH\") do |d|\n options.db_path = d\n end\n\n opts.on(\"-t\", \"--db-type TYPE\", \"Use the database of class TYPE (e.g. sqlite3)\") do |t|\n options.db_type = t\n end\n\n opts.on(\"-r\", \"--read\", \"Read jokes that are stored in the DB\") do |r|\n options.read = r\n end\n\n opts.on(\"-r\", \"--rate\", \"Rate jokes that are stored in the DB for user account\") do |r|\n options.rate = r\n end\n\n opts.on(\"-u\", \"--username OPT\", \"Use username OPT\") do |u|\n options.username = u\n end\n\n opts.on(\"-m\", \"--manual-input\", \"Input a joke manually to the Database\") do |m|\n options.manual_input = m\n end\n\n opts.on(\"-j\", \"--joke-count\", \"Count how many jokes we have in the Database\") do |j|\n options.joke_count = j\n end\n\n opts.on(\"-r\", \"--random-intervals\", \"Use random intervals when downloading to mask our usage pattern\") do |r|\n options.random_intervals = r\n end\n\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n # Boolean switch.\n opts.on(\"-a\", \"--automatic\", \"Run automatically every #{options.interval.to_s} seconds unless the --interval option is given\") do |a|\n options.automatic = a\n end\n\n opts.on(\"-i\", \"--interval OPT\", \"Run every OPT seconds (works only with --automatic together)\") do |i|\n options.interval = i.to_i\n end\n\n # Set of arguments\n opts.on(\"-p\", \"--process OPT\", @configurations, \"Process one or more detected configuration (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.process << d\n end\n\n # Set of arguments\n opts.on(\"-s\", \"--sources OPT\", @configurations, \"Use only these sources for read and rate (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.sources << d\n end\n\n # Boolean switch.\n opts.on(\"-v\", \"--verbose\", \"Run verbosely\") do |v|\n options.verbose = v\n end\n\n opts.on(\"-d\", \"--debug\", \"Run in debug mode\") do |d|\n options.debug = d\n end\n\n # Boolean switch.\n opts.on(\"-q\", \"--quiet\", \"Run quietly, don't output much\") do |v|\n options.verbose = v\n end\n\n opts.separator \"\"\n opts.separator \"Common options:\"\n\n # Boolean switch.\n opts.on(\"-c\", \"--colorize\", \"Colorizes the output of the script for easier reading\") do |c|\n options.colorize = c\n end\n\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n # Another typical switch to print the version.\n opts.on_tail(\"--version\", \"Show version\") do\n puts `git describe --tags`\n exit\n end\n end\n\n opts.parse!(args)\n\n # Show opts if we have no cmd arguments\n if( original_args.empty? )\n puts opts\n exit\n end\n\n options\n end", "title": "" }, { "docid": "5a21ab736839203a075945ee29d53063", "score": "0.666047", "text": "def parse\n\t\t\tif ARGV.empty?\n\t\t\t\tprint_targets \"SYNTAX: tbm <targets>\\n\\nWhere <targets> is a comma-separated list of:\"\n\t\t\telsif ARGV == ['--version']\n\t\t\t\tputs \"Tunnel Boring Machine v#{VERSION}\"\n\t\t\telse\n\t\t\t\tparse_targets( ARGV )\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "8886fd7b9854e19dc477bc462128bfc2", "score": "0.6659769", "text": "def parse\n @opts = OptionParser.new(&method(:set_opts))\n @opts.parse!(@args)\n\n process_result\n\n @options\n end", "title": "" }, { "docid": "36a3fedec2cfe596ea31fa4942de7c39", "score": "0.6653724", "text": "def parse_options=(_arg0); end", "title": "" }, { "docid": "36a3fedec2cfe596ea31fa4942de7c39", "score": "0.6653724", "text": "def parse_options=(_arg0); end", "title": "" }, { "docid": "c66d434027d571fa12b968d89df0819d", "score": "0.6650297", "text": "def parsed_argv\n Hash[ARGV.map { |arg| arg.split(\":\") }]\nend", "title": "" }, { "docid": "ab05443e34fd636e3902a013979ddd2b", "score": "0.6648556", "text": "def parse_options(args)\n\t\t\t\tbegin\n\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t@options['verbose'] = false\n\t\t\t\t\t@options['rescan'] = false\n\t\t\t\t\t@options[:timeout] = 25\n\t\t\t\t\t@options[:directory] = nil\n\n\t\t\t\t\topts = OptionParser.new do |opt|\n\t\t\t\t\t\topt.banner = \"#{APP_NAME} v#{VERSION}\\nJacob Hammack\\n#{HOME_PAGE}\\n\\n\"\n\t\t\t\t\t\topt.banner << \"Usage: #{APP_NAME} <options>\"\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('File Options')\n\n\t\t\t\t\t\topt.on('-h HASH', '--search-hash HASH', 'Searches a single hash on virustotal.com') do |hash|\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-r HASH[,HASH]', '--rescan-hash HASH[,HASH]', 'Requests a rescan of a single hash, or multiple hashes (comma separated), by virustotal.com') do |hash|\n\t\t\t\t\t\t\t@options['rescan'] = true\n\t\t\t\t\t\t\t@hashes.push(hash)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-f FILE', '--search-hash-file FILE', 'Searches each hash in a file of hashes on virustotal.com') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@files_of_hashes.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-u FILE', '--upload-file FILE', 'Uploads a file to virustotal.com for analysis') do |file|\n\t\t\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\t\t\tputs \"[+] Adding file #{file}\" if @options['verbose']\n\t\t\t\t\t\t\t\t@uploads.push(file)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs \"[!] #{file} does not exist, please check your input!\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator(\"Url Options\")\n\n\t\t\t\t\t\topt.on('-s SITE', '--search-site SITE', 'Searches for a single url on virustotal.com') { |site|\n\t\t\t\t\t\t\t@sites.push(site)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.separator('')\n\t\t\t\t\t\topt.separator('Output Options')\n\n\t\t\t\t\t\topt.on('-j', '--json-output', 'Print results as json to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :json\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-x', '--xml-output', 'Print results as xml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :xml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-y', '--yaml-output', 'Print results as yaml to stdout') do\n\t\t\t\t\t\t\t@options['output'] = :yaml\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--stdout-output', 'Print results as normal text line to stdout, this is default') do\n\t\t\t\t\t\t\t@options['output'] = :stdout\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Advanced Options'\n\n\t\t\t\t\t\topt.on('-c', '--create-config', 'Creates a skeleton config file to use') do\n\t\t\t\t\t\t\tcreate_config\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-d DIRECTORY', '--directory', 'Scans a directory recursively for files and submits the hashes') do |directory|\n\t\t\t\t\t\t\t@options[:directory] = directory\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('-p PROXY', '--proxy-server', 'Uses a specified proxy server') do |proxy|\n\t\t\t\t\t\t\t@options['proxy'] = proxy\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on('--[no-]verbose', 'Print verbose information') do |v|\n\t\t\t\t\t\t\t@options['verbose'] = v\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.separator ''\n\t\t\t\t\t\topt.separator 'Other Options'\n\n\t\t\t\t\t\topt.on('-v', '--version', 'Shows application version information') do\n\t\t\t\t\t\t\tputs \"#{APP_NAME} - #{VERSION}\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\topt.on_tail('-?', '--help', 'Show this message') { |help|\n\t\t\t\t\t\t\tputs opt.to_s + \"\\n\"\n\t\t\t\t\t\t\texit\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\n\t\t\t\t\tif ARGV.length != 0\n\t\t\t\t\t\topts.parse!\n\t\t\t\t\telse\n\t\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\trescue OptionParser::MissingArgument\n\t\t\t\t\tputs opts.to_s + \"\\n\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "3dfaaa94e78f3b2d55da608bff2406c4", "score": "0.66244024", "text": "def parse_options\n options = {}\n case ARGV[1]\n when '-e'\n options[:e] = ARGV[2]\n when '-d'\n options[:d] = ARGV[2]\n end\n options\nend", "title": "" }, { "docid": "38ef9edda00430f1a182c0e2610a82cb", "score": "0.65970206", "text": "def run(argv = ARGV)\n parser.parse(argv)\n end", "title": "" }, { "docid": "4f83bb45e97bfee5fb6d09cf01853825", "score": "0.65960526", "text": "def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: webby [options] target [target args]'\n\n opts.separator ''\n\n desired_opts = %[--describe --prereqs --tasks --trace]\n app.standard_rake_options.each do |options|\n next unless desired_opts.include?(options.first)\n opts.on(*options)\n end\n opts.on('-o', '--options [PATTERN]',\n 'Show configuration options (matching optional pattern), then exit.') { |value|\n @command = [:show_options, value]\n }\n\n opts.separator ''\n opts.separator 'autobuild options:'\n\n opts.on('--web-server', 'Start a local web server') {\n cmd_line_options[:use_web_server] = true\n }\n opts.on('--no-web-server', 'Do not start a local web server') {\n cmd_line_options[:use_web_server] = false\n }\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) do\n @stdout.puts opts\n exit\n end\n opts.on_tail( '--version', 'show version' ) do\n @stdout.puts \"Webby #{::Webby::VERSION}\"\n exit\n end\n\n opts.parse! args\n\n ARGV.replace Array(args.shift)\n args.delete_if do |arg|\n if %r/^[A-Z_]+=/ =~ arg\n ARGV << arg\n next true\n end\n false\n end\n\n args\n end", "title": "" }, { "docid": "e0666876515c0daeab89a6ad70638bfe", "score": "0.65916127", "text": "def parse_yardopts_options(*args); end", "title": "" }, { "docid": "ad4d580b46d68dccfa037a2b17fba805", "score": "0.65850794", "text": "def parse_arguments!(argv)\n results = {\n embed: false\n }\n\n option_parser = OptionParser.new do |opts|\n opts.on(\"-h\", \"--help\", \"Prints this help\") do\n results[:help] = opts.help\n end\n\n opts.on(\"-sS\", \"--match-string=S\", \"Match nodes containing the string\") do |s|\n results[:pattern] = s\n end\n\n opts.on(\"-mD\", \"--month=D\", \"Only return results for the month containing the given date\") do |d|\n results[:month] = month_for_date(d)\n end\n\n opts.on(\"-fF\", \"--file=F\", \"Use the given file as input. If absent, will parse STDIN\") do |f|\n results[:file] = f\n end\n\n opts.on(\"-a\", \"--include-all\", \"Include all the matching results, not just the first\") do |a|\n results[:include_all] = true\n end\n\n opts.on(\"-e\", \"--embed\", \"Place resulting block refs in an embed\") do |a|\n results[:embed] = true\n end\n\n opts.on(\"-E\", \"--no-embed\", \"Do not place resulting block refs in an embed (default)\") do |a|\n results[:embed] = false\n end\n end\n\n option_parser.parse!(argv)\n if argv.count != 0 || !config_valid?(results)\n results = { :help => option_parser.help }\n end\n\n results\nend", "title": "" }, { "docid": "bb9b2622af130c1b7019e976d71edc92", "score": "0.65762377", "text": "def parse_args\n args_map = {:main => $0}\n ARGV.each { |arg|\n sep = arg.index('=')\n\n key = arg[0..sep-1].to_sym\n val = arg[sep+1..-1]\n\n if val == 'true'\n val = true\n end\n if val == 'false'\n val = false\n end\n args_map[key] = val\n }\n return args_map\n end", "title": "" }, { "docid": "20321a4b8c69eeeafb3e68095a5d3de2", "score": "0.6574684", "text": "def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end", "title": "" }, { "docid": "dc6ca5ce97327111588319749aa575a6", "score": "0.6567723", "text": "def parse_command_line\n OptionParser.new do |opts|\n opts.banner = \"Usage: ruby #{$0} [options]\"\n\n opts.on_head(\"-h\", \"--help\", \"Show this help message\") do\n puts opts\n exit\n end\n\n opts.on(\"-v\", \"--verbose\", \"Show all progress messages (INFO, DEBUG, WARNING, ERROR)\") do\n Logger.verbose = true\n end\n\n opts.on(\"-q\", \"--quiet\", \"Only show WARNING and ERROR messages\") do\n Logger.quiet = true\n end\n\n opts.on(\"--console\", \"Open up a console to query the source via rbgccxml\") do\n @requesting_console = true\n end\n\n opts.on(\"--clean\", \"Force a complete clean and rebuild of this extension\") do\n @force_rebuild = true\n end\n\n end.parse!\n end", "title": "" }, { "docid": "4b9c9ba8caff7c5a1281c7313ac6c820", "score": "0.65635127", "text": "def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 1,\n :cols => 3, :rows => 3,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => false,\n :moveto_color => '#0000ff', :lineto_color => '#ff0000',\n :xshift => 0, :yshift => 0, :gcode => false, :do_tform => false\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n elsif v = a.match(/^--gcode$/) then params[:gcode] = true\n elsif v = a.match(/^--apply-maths$/) then params[:do_tform] = true\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n params\nend", "title": "" }, { "docid": "ac4d5aa6c43c245fada57e4ca2fcc816", "score": "0.6553579", "text": "def getArguments\n\n\t# Parse the arguments\n\ttheArgs = { :clang => false,\n\t\t\t\t:rewrite => false,\n\t\t\t\t:help => false,\n\t\t\t\t:paths => [],\n\t\t\t\t:exclude => [] }\n\n\ttheParser = OptionParser.new do |opts|\n\t\topts.banner = \"Usage:\\n rn-format [--help] [--clang] [--rewrite] [--exclude=PATH] PATH [PATH...]\";\n\t\topts.separator \"\";\n\t\topts.separator \"Reformat any source files within the supplied paths,\";\n\t\topts.separator \"displaying the results to standard output.\";\n\t\topts.separator \"\";\n\t\topts.separator \"Options:\";\n\n\t\topts.on('--clang',\t\t\t\t\t\t'Show raw clang-format output') do\n\t\t\ttheArgs[:clang] = true;\n\t\tend\n\n\t\topts.on('--rewrite',\t\t\t\t\t'Rewrite files in-place') do\n\t\t\ttheArgs[:rewrite] = true;\n\t\tend\n\n\t\topts.on('--exclude=PATH',\t\t\t\t'Exclude a path') do |thePath|\n\t\t\ttheArgs[:exclude] << File.expand_path(thePath);\n\t\tend\n\n\t\topts.on('--help',\t\t\t\t\t\t'Show the help') do\n\t\t\ttheArgs[:help] = true;\n\t\tend\n\tend\n\n\ttheParser.parse!;\n\ttheArgs[:paths] = ARGV;\n\n\n\n\t# Show the help\n\tif (theArgs[:help] || theArgs[:paths].empty?)\n\t\tputs theParser.help();\n\t\texit(false);\n\tend\n\t\n\treturn theArgs;\n\nend", "title": "" }, { "docid": "bfc30dc70001e717aae9aed60288dce1", "score": "0.65529215", "text": "def parse(args)\n\t\thelp = nil\n\t\t\n\t\toption = OptionParser.new do |opts|\n\t\t\topts.banner = \"String To Integer\".center(80, '-')\n\t\t\topts.separator \"\"\n\t\t\topts.separator \"Usage:\"\n\t\t\topts.separator \"\tCan be used to convert a string representation of a integer to an integer.\"\n\t\t\topts.separator \"Example\"\n\t\t\topts.separator \"\t ./atoi.rb -s \\'[STRING_REPESENTATION_OF_AN_INTEGER]\\'\"\n\t\t\topts.separator \"\t e.g. ./atoi.rb -s '148'\"\n\t\t\topts.separator \"\t => 148\"\n\t\t\topts.separator \" \"\n\t\t\topts.on(\"-s ASCII_STRING\", \"--ascii_string ASCII_STRING\", String, \"The string representation of a integer; e.g \\'148\\'\", :REQUIRED){ |s| @ascii_string = s.split('') }\n\t\t\topts.on(\"-h\", \"--help\", \"help\"){puts option}\n\t\t\thelp = opts.help\n\t\tend.parse!\n\n\t\tif @ascii_string.nil?; puts help; exit 1; end\n\t\tself\n\tend", "title": "" }, { "docid": "6e4fc54f8a43ef0d213133184db75a53", "score": "0.6551308", "text": "def parse_options(args)\n args.each do |arg|\n case arg\n when '-h', '--help' then @opts[:help] = true\n when '-un', '--user' then @opts[:user] = args.next(arg)\n when '-pw', '--pass' then @opts[:pass] = args.next(arg)\n when '-t', '--token' then @opts[:token] = args.next(arg)\n when '-g', '--get' then @opts[:get] = args.next(arg)\n when '-d', '--debug' then @opts[:debug] = true\n when '-r', '--random' then @opts[:get] = nil\n else next\n end\n end\n end", "title": "" }, { "docid": "f094eb5ce73cca116b71a1bc1fa8c37e", "score": "0.6550859", "text": "def parse_arguments(args)\n ret = {}\n ret[\"timeout\"] = 15\n op = OptionParser.new do |opts|\n opts.banner = \"Usage: #{__FILE__} [options]\"\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n opts.on(\"-a\", \"--argument=[JSON]\",\n \"Pass the supplied JSON data over the bridge\") do |v|\n ret[\"argument\"] = v\n end\n\n opts.on(\"-b\", \"--b64argument=[B64-JSON]\",\n \"Pass the base64-encoded JSON data over the bridge\") do |v|\n ret[\"b64argument\"] = v\n end\n\n opts.on(\"-s\", \"--selector=SELECTOR\",\n \"Call the given function (selector) via the bridge\") do |v|\n ret[\"selector\"] = v\n end\n\n opts.on(\"-c\", \"--callUID=UID\",\n \"Use the given UID to properly identify the return value of this call\") do |v|\n ret[\"callUID\"] = v\n end\n\n opts.on(\"-r\", \"--hardwareID=[HARDWAREID]\",\n \"If provided, connect to the physical iOS device with this hardware ID instead of a simulator\") do |v|\n ret[\"hardwareID\"] = v\n end\n\n opts.on(\"-t\", \"--timeout=[TIMEOUT]\",\n \"The timeout in seconds for reading a response from the bridge (default 15)\") do |v|\n ret[\"timeout\"] = v.to_i\n end\n\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n end\n op.parse!(args)\n return ret\nend", "title": "" }, { "docid": "39e844b57fd738a002d1deaf46261d55", "score": "0.65489036", "text": "def parse_args\n doc = <<DOCOPT\nschwifty saves and downloads objects from ipfs, keeping track of their hashes in a garbage collection file in ~/.ipfs/ipfs_pinned_objects.yaml and an objects file in ./ipfs_objects.yaml\n\nUsage:\n schwifty add <files>...\n schwifty bootstrap (--clear | <nodes>... | --file=<bootstrap_list_yaml>)\n schwifty get <files_or_hashes>...\n schwifty gc\n schwifty -h | --help\n schwifty --version\n\nOptions:\n -h --help Show this screen.\n --version Show version.\nDOCOPT\n begin\n Docopt.docopt(doc)\n rescue Docopt::Exit => e\n puts e.message\n exit\n end\n end", "title": "" }, { "docid": "d279f725d44f1174f8e51a0be6668dc0", "score": "0.6542694", "text": "def process_argv!\n args = ARGV.dup\n self.rest = []\n @unknown_argvs = []\n until args.empty? do\n arg = args.shift\n case\n # end of options parsing\n when arg == '--'\n self.rest += args\n break\n # --param=val or --param\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n warn \"Configliere uses _underscores not dashes for params\" if param.include?('-')\n @unknown_argvs << param.to_sym if (not has_definition?(param))\n self[param] = parse_value(val)\n # -abc\n when arg =~ /\\A-(\\w\\w+)\\z/\n $1.each_char do |flag|\n param = find_param_for_flag(flag)\n unless param then @unknown_argvs << flag ; next ; end\n self[param] = true\n end\n # -a val\n when arg =~ /\\A-(\\w)\\z/\n flag = find_param_for_flag($1)\n unless flag then @unknown_argvs << flag ; next ; end\n if (not args.empty?) && (args.first !~ /\\A-/)\n val = args.shift\n else\n val = nil\n end\n self[flag] = parse_value(val)\n # -a=val\n when arg =~ /\\A-(\\w)=(.*)\\z/\n flag, val = [find_param_for_flag($1), $2]\n unless flag then @unknown_argvs << flag ; next ; end\n self[flag] = parse_value(val)\n else\n self.rest << arg\n end\n end\n @unknown_argvs.uniq!\n end", "title": "" }, { "docid": "e04916fc11812f9a937695c4b309a1cc", "score": "0.6537265", "text": "def parse_options(args)\n opt_parser = OptionParser.new do |opts|\n # Set a banner, displayed at the top\n # of the help screen.\n opts.banner = 'Usage: k9 [options] [<filename.rb>]'\n # Define the options, and what they do\n\n opts.on('-v', '--version', 'JRubyArt Version') do\n options[:version] = true\n end\n\n opts.on('-?', '--check', 'Prints configuration') do\n options[:check] = true\n end\n\n opts.on('-i', '--install', INSTALL) do\n options[:install] = true\n end\n\n opts.on('-f', '--force', 'Force removal of old Config') do\n options[:force] = true\n end\n\n opts.on('-c', '--create', 'Create new outline sketch') do\n options[:create] = true\n end\n\n opts.on('-r', '--run', 'Run the sketch') do\n options[:run] = true\n end\n\n opts.on('-w', '--watch', 'Watch/run the sketch') do\n options[:watch] = true\n end\n\n opts.on('-l', '--live', 'As above, with pry console bound to Processing.app') do\n options[:live] = true\n end\n\n opts.on('-a', '--app', 'Export as app NOT IMPLEMENTED YET') do\n options[:export] = true\n end\n\n opts.on_tail('-h', '--help', 'Display this screen') do\n puts opts\n exit\n end\n end\n @argc = opt_parser.parse(args)\n @filename = argc.shift\n end", "title": "" }, { "docid": "884ea7ee225516252dbb65ced067d98d", "score": "0.6534596", "text": "def parse_args\n options = { :verbose => false, :status => false, :immediately => false, :action => :attach}\n\n parser = Trollop::Parser.new do \n opt :url, \"\", :long => \"--attach\", :short => \"-a\", :type => String, :required => true\n opt :force\n opt :cloud, \"\", :type => String\n version \"\"\n end\n\n parse do\n options.merge(parser.parse)\n end\n end", "title": "" }, { "docid": "6d3e73e3473f999895f48d31591abca1", "score": "0.65340424", "text": "def parse(args)\n @options = {}\n @options[:command] = :scan # Default command is to scan for lints\n\n OptionParser.new do |parser|\n parser.banner = \"Usage: #{@application.executable_name} [options] [file1, file2, ...]\"\n\n add_linter_options parser\n add_file_options parser\n add_misc_options parser\n add_info_options parser\n end.parse!(args)\n\n # Any remaining arguments are assumed to be files that should be linted\n @options[:included_paths] = args\n\n @options\n rescue OptionParser::InvalidOption => ex\n raise InvalidCliOptionError,\n \"#{ex.message}\\nRun `#{@application.executable_name} --help` to \" \\\n 'see a list of available options.'\n end", "title": "" }, { "docid": "2ad373e893393b02411ecfb35a6ce3a6", "score": "0.6533847", "text": "def parse_options!(args)\n option_parser.parse!(args)\n\n if args.empty?\n abort(\"You must give exactly one command to execute.\")\n else\n @options.command = args.join(\" \")\n end\n end", "title": "" }, { "docid": "aa4c42c51d92d5facd39f7c41a02dbe7", "score": "0.6530114", "text": "def arguments\n parser.arguments\n end", "title": "" }, { "docid": "60f9de2ebe6b394e782be7d3030b02f2", "score": "0.65279615", "text": "def handle_arguments(args)\n if input_file.nil?\n print_usage\n true\n else\n args.help || args.version\n end\n end", "title": "" }, { "docid": "8dd3ebb04143a2ac7e3f32ecdd500d83", "score": "0.6522694", "text": "def parse(args)\r\n full_args_str = args.to_s\r\n args_list = _trim_end_caps(full_args_str)\r\n args_arr = []\r\n\r\n loop do\r\n match = false\r\n ARGUMENT_REGEXP.match(args_list) do |match_context|\r\n match = true\r\n args_arr << _unescape_arg(match_context[:first_arg])\r\n if match_context[:other_args]\r\n args_list = match_context[:other_args]\r\n else\r\n return args_arr\r\n end\r\n end\r\n\r\n fail unless match\r\n end\r\n end", "title": "" }, { "docid": "c586bf13e692fbb1733a9bd3e861531d", "score": "0.65192944", "text": "def parse_options\n @opts = Slop.parse do |o| \n o.string '-f1', '--file1', 'First source file'\n o.string '-f2', '--file2', 'Second source file'\n o.on '-v', '--version' do\n puts Slop::VERSION\n end\n end\n rescue Exception => e\n raise\n end", "title": "" }, { "docid": "0e19191214f30b9a5e484be1fc26278f", "score": "0.6511485", "text": "def parse_arguments(raw_args, args)\n opts = OptionParser.new\n opts.banner = banner\n opts.separator ''\n opts.separator 'Options:'\n\n opts.on('-r', '--rule <rule>', 'Only output this rule') do |rule|\n args.rule = rule\n end\n\n opts.on(\n '-f', '--format <format>', VALID_FORMATS, 'The output form to use' +\n valid_formats_description\n ) do |format|\n args.format = format.to_sym\n end\n\n opts.on('--indent <level>', 'Indentation level used for ' \\\n 'formatting') do |value|\n args.indent = value\n end\n\n opts.on('--indent-text <text>', 'Indentation text used for ' \\\n 'formatting') do |value|\n args.indent_text = value\n end\n\n opts.on('-v', '--[no-]verbose', 'Show verbose output') do |value|\n args.verbose = value\n end\n\n opts.on('--version', 'Print version information and exit') do\n args.version = true\n puts TmGrammar::VERSION\n end\n\n opts.on('-h', '--help', 'Show this message and exit') do\n args.help = true\n print_usage\n end\n\n opts.separator ''\n opts.separator \"Use the `-h' flag for help.\"\n\n opts.parse!(raw_args)\n opts\n end", "title": "" }, { "docid": "e6b47a278c902a63b7e1e255ba803900", "score": "0.65075725", "text": "def test_parse04c\n options = ArgumentManager.parse( [ '-k', '3' ] )\n assert_equal( 3, options[ 'k' ] )\n end", "title": "" }, { "docid": "c8f5b0e1e9ad72bb741106330395cc27", "score": "0.6503671", "text": "def options args = ARGV, *a, &b\n @p = Parser.new(*a, &b)\n begin\n vals = @p.parse args\n args.clear\n @p.leftovers.each { |l| args << l }\n vals\n rescue CommandlineError => e\n $stderr.puts \"Error: #{e.message}.\"\n $stderr.puts \"Try --help for help.\"\n exit(-1)\n rescue HelpNeeded\n @p.educate\n exit\n rescue VersionNeeded\n puts @p.version\n exit\n end\n end", "title": "" }, { "docid": "f6d678411add584a905cc2329ab757e4", "score": "0.6497817", "text": "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "title": "" }, { "docid": "5b796661effa3ca1f82d4dcba40cea2f", "score": "0.64863855", "text": "def parse_command_line(args)\n test_configuration = {}\n\n option_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: run-tests.rb [options]'\n opts.separator 'Specific options:'\n\n opts.on('--blinkr', 'Execute broken link checks') do |opt|\n test_configuration[:blinkr] = opt\n end\n\n opts.on('--dcp', 'Execute dcp broken link checks') do |opt|\n test_configuration[:dcp] = opt\n end\n\n opts.on('--base-url RHD_BASE_URL', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|\n test_configuration[:base_url] = host\n end\n\n opts.on('-c CONFIG_FILE', 'specify the config.yaml file for broken link checks') do |opt|\n test_configuration[:config] = opt\n end\n\n opts.on('--ignore-internal', \"Ignore internal URL's\") do |opt|\n test_configuration[:ignore_internal] = opt\n end\n\n opts.on('--ignore-external', \"Ignore external URL's\") do |opt|\n test_configuration[:ignore_external] = opt\n end\n\n opts.on('--ignore-ssl', 'Disable SSL certificate checking for staging environments') do |opt|\n test_configuration[:ignore_ssl] = opt\n end\n\n #\n # Options supporting the execution of the tests within Docker\n #\n opts.on('--use-docker', 'Run the specified test type using Docker') do\n test_configuration[:docker] = true\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n Kernel.exit(1)\n end\n end\n\n begin\n option_parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e\n option_parser.parse(%w(-h))\n end\n bind_test_type_environment_variable(test_configuration)\n build_test_execution_command(test_configuration)\n test_configuration\n end", "title": "" }, { "docid": "d5a32b37a63ba3dc407784e48463476e", "score": "0.6484703", "text": "def parse_command_line &block\n data = {}\n\n OptionParser.new do |opts|\n opts.banner = \"Usage: #{File.basename($0)} [options]\"\n\n opts.on(\"-c CONFIG\", \"--conf CONFIG\", \"YAML config file\") do |config|\n data[\"config\"] = config\n end\n\n opts.on(\"-p PARAMS\", \"--params PARAMS\", \"Additional default options - key: value as JSON string, override values from config file\") do |params|\n data[\"params\"] = JSON.parse(params)\n end\n\n # process custom args, if given\n block.call(opts) if block_given?\n\n opts.on_tail('-h', '--help', 'display this help and exit') do\n puts opts\n exit\n# return nil\n end\n\n# begin\n opts.parse(ARGV)\n# rescue OptionParser::InvalidOption\n# # do nothing\n# end\n\n end\n\n @args = data\n end", "title": "" }, { "docid": "02989878f53369ca2388dcaa47dad657", "score": "0.64773816", "text": "def parse( argv )\n self.data = ::Crate.data_path\n opts = option_parser\n begin\n opts.parse!( argv )\n self.project = argv.shift\n\n if project.nil?\n puts opts\n exit 1\n end\n rescue ::OptionParser::ParseError => pe\n puts \"#{opts.program_name}: #{pe}\"\n puts \"Try `#{opts.program_name} --help` for more information\"\n exit 1\n end\n end", "title": "" }, { "docid": "57f0dfcfbd008dc38df01de896c8b34a", "score": "0.6476009", "text": "def test_parse02c\n options = ArgumentManager.parse( [ '-i', '1' ] )\n assert_equal( 1, options[ 'i' ] )\n end", "title": "" }, { "docid": "23194a7a92ae3fb1f483f6f46f4e1fcb", "score": "0.6475939", "text": "def parse_options\nmain_opts = %w(jadd cadd jgadd cgadd wadd sum list ausgleich)\nbetrag_opts = %w(jadd cadd jgadd cgadd wadd)\n\n\tusage if ARGV.size < 1\n\n\toptions = {:modus => ARGV.shift}\n\n\tusage unless main_opts.include?(options[:modus])\n\n\tif betrag_opts.include?(options[:modus])\n\t\tusage if ARGV.size < 1\n\t\toptions[:betrag] = ARGV.shift.to_f\n\t\toptions[:tags] = sanitize_tags(ARGV)\n\n\t\toptions[:jahr] = Time.now.year\n\t\toptions[:monat] = Time.now.month\n\telsif options[:modus] == \"sum\" || options[:modus] == \"list\"\n\t\t#usage if ARGV.size < 1\n\t\toptions[:name] = parse_name\n\t\toptions[:jahr], options[:monat] = parse_date\n\telsif options[:modus] == \"ausgleich\"\n\t\toptions[:jahr], options[:monat] = parse_date\n\tend\n\n\treturn options\nend", "title": "" }, { "docid": "8b2b679fbbd1f387ddb65700ff05bddd", "score": "0.6469594", "text": "def parse\n parser.parse(ARGV)\n @options\n rescue OptionParser::InvalidOption => e\n puts e\n puts parser\n #p @options\n exit(1)\n end", "title": "" }, { "docid": "75b2c633174ac537778db71566ef63ce", "score": "0.6458373", "text": "def parse(args)\n #add the possible arguments to the argument parser\n\topt_parser = OptionParser.new do |opts|\n\t\topts.banner = \"Usage: Scanner.rb [options] file [files...]\"\n\t\topts.on(\"-s [FILE]\", \"--save [FILE]\", \"Saves to file [FILE]\") do |file|\n\t\t\t$save2File = true\n\t\t\t$file = File.new(Pathname.new(file).realpath, \"w+\")\n\t\tend\n opts.on(\"-x [FILE]\", \"--xml [FILE]\", \"Saves to XML file [FILE]\") do |file|\n $save2XML = true\n $xmlFile = File.new(Pathname.new(file).realpath, \"w+\")\n end\n\t\topts.on(\"-q\", \"--quiet\", \"Do not show output on console\") do\n\t\t\t$quiet = true\n\t\tend\n opts.on(\"-v\", \"--verbose\", \"Show additional output on the console, overwrites quiet\") do\n $verbose = true\n end\n\tend\n\t#start the parsing of the arguments\n\topt_parser.parse!(args)\nend", "title": "" }, { "docid": "c0a07d37ee9434bee02b505f578f9241", "score": "0.6449909", "text": "def parse_args\r\n self.names = cmd.args ? list_arg(cmd.args) : [enactor.name]\r\n end", "title": "" }, { "docid": "69892f6e6e4b1c78bd41285993e2cb63", "score": "0.6448748", "text": "def test_parse05c\n options = ArgumentManager.parse( [ '-k', '3', '-l', '7' ] )\n assert_equal( 7, options[ 'l' ] )\n end", "title": "" }, { "docid": "92e6fcdf0ba53699bfbec50adc8c475f", "score": "0.64471304", "text": "def parse_options(args)\n opt_parser = OptionParser.new do |opts|\n # Set a banner, displayed at the top\n # of the help screen.\n opts.banner = 'Usage: k9 [options] [<filename.rb>]'\n # Define the options, and what they do\n options[:version] = false\n opts.on('-v', '--version', 'JRubyArt Version') do\n options[:version] = true\n end\n\n options[:install] = false\n opts.on('-i', '--install', 'Installs jruby-complete and examples') do\n options[:install] = true\n end\n\n options[:check] = false\n opts.on('-?', '--check', 'Prints configuration') do\n options[:check] = true\n end\n\n options[:app] = false\n opts.on('-a', '--app', 'Export as app NOT IMPLEMENTED YET') do\n options[:export] = true\n end\n\n options[:watch] = false\n opts.on('-w', '--watch', 'Watch/run the sketch') do\n options[:watch] = true\n end\n\n options[:run] = false\n opts.on('-r', '--run', 'Run the sketch') do\n options[:run] = true\n end\n\n options[:live] = false\n opts.on('-l', '--live', 'As above, with pry console bound to Processing.app') do\n options[:live] = true\n end\n\n options[:create] = false\n opts.on('-c', '--create', 'Create new outline sketch') do\n options[:create] = true\n end\n\n # This displays the help screen, all programs are\n # assumed to have this option.\n opts.on('-h', '--help', 'Display this screen') do\n puts opts\n exit\n end\n end\n @argc = opt_parser.parse(args)\n @filename = argc.shift\n end", "title": "" }, { "docid": "fba8854a2b30437c3aa0ae00b1c17df0", "score": "0.64450645", "text": "def parse(args)\n @options = Options.new\n @args = OptionParser.new do |parser|\n @options.define_options(parser)\n begin\n parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e.message\n exit\n end\n end\n @options\n rescue OptionParser::MissingArgument => e\n puts e.message\n exit\n end", "title": "" }, { "docid": "8175e3c963fc5365f17b891df03206b6", "score": "0.6438566", "text": "def parse_command_line\n prepend_environment_options\n options = options_with_defaults\n\n OptionParser.new do |parser|\n\n parser.on(\"-h\", \"--help\", \"Show help\") do |_help_requested|\n ARGV << 'h' # pass on the request to the command processor\n options.suppress_command_line_validation = true\n end\n\n parser.on('-i', '--input_dir DIR',\n \"Input directory containing source data files, default: '#{DEFAULT_INPUT_DIR}'\") do |v|\n options.input_dir = File.expand_path(v)\n end\n\n parser.on('-o', '--output_dir DIR',\n \"Output directory to which report files will be written, default: '#{DEFAULT_OUTPUT_DIR}'\") do |v|\n options.output_dir = File.expand_path(v)\n end\n\n parser.on('-r', '--receipt_dir DIR',\n \"Directory root from which to find receipt filespecs, default: '#{DEFAULT_RECEIPT_DIR}'\") do |v|\n options.receipt_dir = File.expand_path(v)\n end\n\n parser.on('-s', '--shell', 'Start interactive shell') do |v|\n options.interactive_mode = true\n end\n\n parser.on('-v', '--[no-]verbose', 'Verbose mode') do |v|\n options.verbose_mode = v\n end\n\n parser.on('-y', '--[no-]say', 'Say error messages.') do |v|\n options.say = v\n end\n\n parser.on('', '--[no-]receipts', 'Include report on existing and missing receipts.') do |v|\n options.do_receipts = v\n end\n end.parse!\n\n if options.verbose_mode\n puts \"Run Options:\"\n ap options.to_h\n end\n\n options\n end", "title": "" }, { "docid": "eba90b6ff233433a982605de32323396", "score": "0.64251125", "text": "def parse(args)\n arg_index = 0\n while arg_index < args.size\n arg = args[arg_index]\n\n if arg.start_with? '--'\n # Argument is a long option (eg: --verbose)\n op = arg[2,arg.length]\n value = nil\n\n # Check if the option and value are specified together (\"--op=value\")\n eql_index = op.index '='\n if !eql_index.nil?\n # Split \"op=value\" string and store\n value = op[eql_index+1, op.size]\n op = op[0, eql_index]\n end\n\n # Check if option is accepted\n raise \"Option '--#{op}' not accepted\" if !accepts? op\n\n # Remember that the option was specified\n data = @options[op]\n data.given = true\n\n # Check if given a value that wasn't expected\n if !data.has_value? && !eql_index.nil?\n raise \"Option '--#{op}' does not expect a value\"\n end\n \n # Get associated value\n if data.has_value?\n # If the option was not given as \"op=value\", get the next value.\n # Otherwise, save the value we stored before\n if eql_index.nil?\n # Get index of next value\n arg_index += 1\n # Make sure we actually have a value to save\n if arg_index >= args.size\n raise \"Option '--#{op}' must be followed by a value\"\n end\n # Then save the value\n data.value = args[arg_index]\n else\n data.value = value\n end\n end\n\n elsif arg.start_with? '-'\n # Argument is a short option (eg: -a, -abc)\n op = arg[1,arg.length]\n \n # Make sure each character is accepted\n op.chars.each_with_index do |c,i|\n # Check for errors\n raise \"Option '-#{c}' not accepted\" if !accepts? c\n\n # Remember that the option was specified\n data = @options[c]\n data.given = true\n\n # Check for and save the option's values\n if data.has_value?\n # Get index of next value\n arg_index += 1\n # Make sure we actually have a value to save\n if arg_index >= args.size || i >= op.size\n raise \"Option '-#{c}' must be followed by a value\"\n end\n # Then save the value\n data.value = args[arg_index]\n end\n end\n\n else\n # Argument is a param (ie. not an option)\n @params << arg\n end\n\n # Increment argument index\n arg_index += 1\n end\n end", "title": "" }, { "docid": "34e19b48e392a0c7f62ae12ac8f58a12", "score": "0.64226323", "text": "def parse_args(args)\n opts = {}\n args.each do |(k, v)|\n if v.index('name=') == 0\n parts = v.split('=')\n opts[:names] ||= []\n opts[:names] << parts.last\n elsif v.include?('=')\n parts = v.split('=')\n opts[parts.first.to_sym] = parts.last\n elsif k != :suite\n opts[v.to_sym] = true\n end\n end\n opts\n end", "title": "" }, { "docid": "b48f3f9ed2ae22d9ba66dc3986fa6daf", "score": "0.6415649", "text": "def parse(args)\n true\n end", "title": "" } ]
7e21f2d22c4a02bcebc5602b137eb28f
Q1: mystery5('hi') => '' Q1: mystery5('') => '' Q1: mystery5('Hi, there!') => '' Time Complexity: 0(s.length) Space Complexity: O(s.length) return '' + mystery5(s[1..1]) if s[0] is a letter
[ { "docid": "f1bd31cd714b05defaa6213ca5d5dc33", "score": "0.7449225", "text": "def mystery6(s)\n if s == nil || s.length == 0\n return \"\"\n else\n space = 0\n until space >= s.length || s[space] == \" \"\n space += 1\n end\n return mystery6(s[(space+1)..-1]) + \" \" + s[0...space]\n end\nend", "title": "" } ]
[ { "docid": "932f9da0facaf92d868ab8b36525f821", "score": "0.8012599", "text": "def mystery5(s)\n if s.length == 0\n return \"\"\n else\n return \"*\" + mystery5(s[1..-1])\n end\nend", "title": "" }, { "docid": "932f9da0facaf92d868ab8b36525f821", "score": "0.8012599", "text": "def mystery5(s)\n if s.length == 0\n return \"\"\n else\n return \"*\" + mystery5(s[1..-1])\n end\nend", "title": "" }, { "docid": "932f9da0facaf92d868ab8b36525f821", "score": "0.8012599", "text": "def mystery5(s)\n if s.length == 0\n return \"\"\n else\n return \"*\" + mystery5(s[1..-1])\n end\nend", "title": "" }, { "docid": "c5f1b7f88a5abefa439c61fab20a855c", "score": "0.7689588", "text": "def mystery5B(s)\n s.gsub!(/[^a-zA-Z]/, '')\n if s.length == 0\n return \"\"\n else\n return \"*\" + mystery5(s[1..-1])\n end\nend", "title": "" }, { "docid": "9c34b574e23756a346a785532e42ec44", "score": "0.7633222", "text": "def mystery5C(s)\n alpha_all = (\"A\"..\"Z\").to_a.concat (\"a\"..\"z\").to_a\n if s.length == 0\n return \"\"\n else\n if alpha_all.include?(s[0])\n return \"*\" + mystery5C(s[1..-1])\n else\n return mystery5C(s[1..-1])\n end\n end\nend", "title": "" }, { "docid": "9a9fd75885adaa9f68c55d409128cf9b", "score": "0.73019105", "text": "def mystery6(s) # n => the length of s\n if s == nil || s.length == 0\n return \"\"\n else\n space = 0\n until space >= s.length || s[space] == \" \"\n space += 1\n end\n return mystery6(s[(space+1)..-1]) + \" \" + s[0...space] # m => recursive calls (by word)\n end\nend", "title": "" }, { "docid": "9abb654efce7d6917b9379a4f74e09fa", "score": "0.6504563", "text": "def missing_letter(string_7)\n \"The case of the disappearing last letter\".chop\nend", "title": "" }, { "docid": "b305008d2dcc53cb45ba939a866560d5", "score": "0.6354382", "text": "def redact_five_letter_words(string)\r\nend", "title": "" }, { "docid": "8cd8c22c70024a7d5a21d13429da845a", "score": "0.6323769", "text": "def redact_five_letter_words(string)\nend", "title": "" }, { "docid": "8cd8c22c70024a7d5a21d13429da845a", "score": "0.6323769", "text": "def redact_five_letter_words(string)\nend", "title": "" }, { "docid": "b60b985960a86808aed614ccb90fcc49", "score": "0.6303184", "text": "def lisp(string)\r\n letters = string.chars\r\n letters.each_with_index { |letter, i| letters[i] = \"th\" if letter == \"s\"}\r\n return letters.join(\"\")\r\nend", "title": "" }, { "docid": "d7e156e1f8f812c70ae6fab2639d366b", "score": "0.6268607", "text": "def formingMagicSquare(s)\n\n\nend", "title": "" }, { "docid": "d7e156e1f8f812c70ae6fab2639d366b", "score": "0.6268607", "text": "def formingMagicSquare(s)\n\n\nend", "title": "" }, { "docid": "9c42db7a8de732e8f0476830b5b72af4", "score": "0.6256297", "text": "def redact_five_letter_words(string)\n\nend", "title": "" }, { "docid": "64d2a82d84f8552b68bc749397a69999", "score": "0.62476325", "text": "def scream(string)\n if string.length > 10\n string.upcase!\n return string\n else\n return string\n end\nend", "title": "" }, { "docid": "1c99c9b985860a91d5204712fe01063e", "score": "0.61832935", "text": "def missing_letters(str)\nend", "title": "" }, { "docid": "e1c421b37ccae33e02e90305ffd1a978", "score": "0.61808956", "text": "def evenator(s)\n s.gsub(/[^a-zA-Z0-9\\s]/i, '').split.map{ |e| e.size.odd? ? e+e.chars.last : e }.join(' ')\nend", "title": "" }, { "docid": "393728e9df384cd36e6defa22ad0d785", "score": "0.6178325", "text": "def missing_letters(str)\n\nend", "title": "" }, { "docid": "9afff75c9e2b01befe59328152c073d6", "score": "0.6118012", "text": "def missing_letters(string)\nend", "title": "" }, { "docid": "4cb21a6153ec12ce53cd8fd2b74c0fb8", "score": "0.61123323", "text": "def crunch(str)\n stripped_string = ''\n str.chars.each_with_index { |letter, index| stripped_string << letter if stripped_string[- 1] != letter}\n stripped_string\nend", "title": "" }, { "docid": "be938cbfa5e59ad3b88b6d704c934e7a", "score": "0.6093979", "text": "def crunch(string)\r\n new_str = ''\r\n string.chars.each do |char|\r\n new_str << char unless new_str.chars.last == char\r\n end\r\n new_str\r\nend", "title": "" }, { "docid": "45441e891904326bcc2d5bbbeb0c4ffc", "score": "0.60806984", "text": "def crunch(string)\n\n\treturn '' if string.eql?('')\n\n\tresult = []\n\n\tstring.chars.each_with_index do |letter, index|\n\t\tresult << letter if string[index + 1] != letter\n\tend\n\n\tresult.join\n\nend", "title": "" }, { "docid": "62fedee076aca4aa438571ccee701bee", "score": "0.6075703", "text": "def initialism(s)\n return s\n .strip\n .gsub(/[^A-Za-z]/, ' ')\n .gsub(/ +/, ' ')\n .split(' ')\n .reject {|w| w.length < 4}\n .map {|w| w[0]}\n .join ''\nend", "title": "" }, { "docid": "a4253299aeaee2ba1f1bdcf406bd04c3", "score": "0.6061564", "text": "def silly_talk(str)\n vowels = \"AEIOUaeiou\"\n result = \"\"\n arr = str.split\n arr.each do |word|\n if vowels.include?(word[word.length-1] )\n result += + word + word[word.length-1]\n else\n word.each_char do |char|\n if vowels.include?(char)\n result+= char + 'b' + char\n else\n result += char\n end\n end\n end\n result += \" \"\n end\n\n result\nend", "title": "" }, { "docid": "bac90d96f0c7308302ef82d308b33fc9", "score": "0.605655", "text": "def shout2(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\nend", "title": "" }, { "docid": "32e2c619f4df9957682eda197ce8154d", "score": "0.6055712", "text": "def crunch(string)\n\n # return '' if string.size == 0\n \n # arr_chars = string.chars\n size = string.size \n new_str = ''\n\n 0.upto(size) do |idx|\n if string[idx] != string[idx + 1]\n new_str << string[idx]\n end\n end\n # new_str << arr_chars[size - 1]\n new_str\nend", "title": "" }, { "docid": "09f16aa9b929812112742e20dd347217", "score": "0.60516185", "text": "def superReducedString(s)\n return 'Empty String' if s.nil? || s == ''\n\n size = s.length\n chars = s.chars\n (0..(size - 2)).each do |i|\n if chars[i] == chars[i + 1]\n chars[i] = nil\n chars[i + 1] = nil\n end\n end\n s = chars.join\n return 'Empty String' if s.nil? || s == ''\n return superReducedString(s) if s.length != size\n \n s\nend", "title": "" }, { "docid": "4a546238985613310f7470f891027492", "score": "0.6040772", "text": "def yell my_string\n my_string = my_string.to_s\n if my_string.length >= 10\n my_string = my_string.upcase\n end\n my_string\nend", "title": "" }, { "docid": "7253ea21140989310c929dacc32c3a7f", "score": "0.6020824", "text": "def snake_it_up(string)\n if string[0] == \"s\"\n # delete this line 10 * \"s\" + string\n \"ssssssssss\" + string\n else\n string\n end\nend", "title": "" }, { "docid": "1ace4aea93827314b44f163cda902328", "score": "0.6017164", "text": "def crunch(string)\n new_string = \"\"\n current_letter = \"\"\n string.chars.each do |letter|\n if current_letter == letter\n current_letter = letter\n else new_string << letter\n end\n current_letter = letter\n end\n new_string\nend", "title": "" }, { "docid": "c082d7914c974a8108e247fba985111e", "score": "0.6008397", "text": "def remLetter( s )\n if not s then\n s = \"\"\n end\n if s.length <= 2 then\n return s\n end\n place = rand( s.length )\n first = s[0..place]\n last = s[place+2 .. s.length-1]\n return first + last\nend", "title": "" }, { "docid": "e1d808ca97388e7aca43d9bcde185379", "score": "0.5998738", "text": "def non_unique_letters(string)\nend", "title": "" }, { "docid": "9d460f084b427f6647c237100d5ef7fb", "score": "0.5992984", "text": "def space_out_letters(person) #creates method to space out letters that takes a person argument\n return person.split(\"\").join(\" \") #splits the string into an array and joins it\nend", "title": "" }, { "docid": "4a6f6664d5fc8b337767da5ab8b50a44", "score": "0.5992655", "text": "def yelling(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\nend", "title": "" }, { "docid": "a035c5e2374e85887891be8eea02d85b", "score": "0.5989687", "text": "def solution(string)\n string.chars.map.with_index do |char, index|\n if ('A'..'Z').include?(char) && index > 0 &&\n ('a'..'z').include?(string[index - 1])\n \" \"+ char\n else\n char\n end\n end.join\nend", "title": "" }, { "docid": "0814585c30b206c512517348937d46b6", "score": "0.59695333", "text": "def string_magic(word)\n if word.length <= 3\n puts word.reverse\n elsif word.length >= 4 && word.length < 6\n puts word.upcase\n else\n puts \"#{word} is too long!\"\n end\nend", "title": "" }, { "docid": "e88395955fe72d04658b3e1fbe9118bd", "score": "0.59684855", "text": "def non_unique_letters(str)\nend", "title": "" }, { "docid": "e88395955fe72d04658b3e1fbe9118bd", "score": "0.59684855", "text": "def non_unique_letters(str)\nend", "title": "" }, { "docid": "446e71533e4cb525e7ae8ca248a5a51e", "score": "0.59574693", "text": "def crunch(string)\n result = ''\n letters = string.chars\n\n loop do\n break if letters.size == 0\n current_letter = letters.shift\n result << current_letter unless result.end_with?(current_letter)\n end\n\n result\nend", "title": "" }, { "docid": "bf4829d4780414dab3626f834db19cd4", "score": "0.5951701", "text": "def speak(string)\n if string.length > 10\n return string.upcase\n else\n return string\n end\nend", "title": "" }, { "docid": "542acfad562afa11234be565ec1c56a9", "score": "0.5945926", "text": "def string_magic(word)\n\tunless word.length > 3\n\t\tputs word.reverse\n\telse\n\t\tputs word\n\tend\nend", "title": "" }, { "docid": "cbdfeb9a3d4f9a1bc6bb82497e7770c8", "score": "0.59331393", "text": "def crunch(str)\n result_str = ''\n current_letter = ''\n # str.chars.each do |letter|\n # unless letter == current_letter\n # result_str << letter\n # current_letter = letter\n # end\n # end\n str.each_char do |letter|\n unless letter == current_letter\n result_str << letter\n current_letter = letter\n end\n end\n result_str\nend", "title": "" }, { "docid": "9f602fe87e5bcd5b2d4a7d653e2e7ae1", "score": "0.5932864", "text": "def silly_talk(str)\n words = str.split\n vowels = \"aeiouAEIOU\"\n new_words = words.map do |word|\n if vowels.include?(word[-1])\n word+word[-1]\n else\n add_b(word)\n end\n end\n new_words.join(\" \")\nend", "title": "" }, { "docid": "0a49abec4744d0cd71584b1df2656180", "score": "0.59288657", "text": "def crunch(string)\n letters = string.chars\n result = ''\n\n loop do\n break if letters.empty?\n\n if result[-1] == letters.first\n letters.shift\n else\n result << letters.shift\n end\n end\n\n result\nend", "title": "" }, { "docid": "6072537219b44aa898af5172ee9ef956", "score": "0.5910561", "text": "def funny_string(s)\n a = s.to_s.chars\n c = a.count\n\n h = {}\n ('a'..'z').each_with_index do |l, i|\n h[l] = i\n end\n\n t = (c.to_f / 2).round\n t.times do |i|\n k1 = h[a[i]] - h[a[i + 1]]\n k2 = h[a[c - i - 1]] - h[a[c - i - 2]]\n\n return 'Not Funny' unless k1.abs == k2.abs\n end\n\n 'Funny'\nend", "title": "" }, { "docid": "32ec5f23df05803334f002ecc3129435", "score": "0.59080553", "text": "def silly_talk(sentence)\n sentence.split.map do |word|\n if \"aeiou\".include?(word[-1])\n word + word[-1]\n else\n word.chars.map { |char| \"aeiou\".include?(char) ? char + \"b\" + char : char }.join\n end\n end.join(\" \")\nend", "title": "" }, { "docid": "0ac46969d76eb8b069b8bfd24d8c22f3", "score": "0.5902835", "text": "def groom_string(*string)\n string = string.join\n string = string[0..string.index(/[!.?]/)]\n string.squeeze!(' ')\n string.strip!\nend", "title": "" }, { "docid": "27c740616f0860595c07be7d0521f46b", "score": "0.5902756", "text": "def custom_sqeeze(string)\n new_string = \"\"\n string.chars.each_with_index { |elem, index| new_string << elem unless elem == string[index + 1] }\n new_string\nend", "title": "" }, { "docid": "3e4559e9fb8a21e99b60fdd1d194e5ee", "score": "0.59019446", "text": "def wave(str)\n i, answer, string = 0, [], str.chars\n string.length.times do \n string = str.chars\n if string[i] == \" \"\n else\n answer << string.insert(i, (string.delete_at(i).upcase))\n end\n i += 1\n end \n p answer\nend", "title": "" }, { "docid": "258789f3a6e9491df276cde3e86ba218", "score": "0.5892738", "text": "def crunch4 str\n str.chars.map.with_index {|char, idx| char != str[idx + 1] ? char : ''}.join\nend", "title": "" }, { "docid": "2c13c24c0ec94d5ab36284caa2e365e8", "score": "0.5886531", "text": "def simplify\n @phrase.upcase!\n @phrase.remove_non_word_characters!\n @phrase.append_xs!\n @phrase.split_into_groups_of_five!\n end", "title": "" }, { "docid": "9416257e87ee21fc4eb04825d6ec5257", "score": "0.588193", "text": "def redact_five_letter_words(str)\r\n\r\n # temporary collector array created\r\n new_arr = []\r\n\r\n # checking length of each word and pushing to array\r\n str.split(' ').each {|el|\r\n\r\n if el.length != 5\r\n new_arr << el\r\n else new_arr << '#####'\r\n end }\r\n\r\n new_arr.join(' ')\r\nend", "title": "" }, { "docid": "d13532f920aa34dbff06b9286d227f5c", "score": "0.58762926", "text": "def spy_name(string)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n new_string = string.split(' ').reverse.join\n new_string = new_string.downcase.split('')\n new_string.map! do |char|\n if vowels.include? char \n #new_string(char) = vowles.rotate(1)\n vowels.rotate(1)[vowels.index(char)]\n elsif consonants.include? char \n consonants.rotate(1)[consonants.index(char)]\n else\n char \n end\n end\n new_string.join\nend", "title": "" }, { "docid": "3fc12bd6780efd0d5b01d107f1609872", "score": "0.5872782", "text": "def crunch(str)\n output = ''\n letters = str.chars\n letters.each_with_index do |character, idx|\n if letters[idx] != letters[idx + 1]\n output << character\n end \n end\n output\nend", "title": "" }, { "docid": "596aa71878424c49993c03ced6450369", "score": "0.5870898", "text": "def tutnese str\n\tstr.strip!\n\tnewstr, letters, i = \"\", [], 0\n\twhile i < str.length\n\t\tletters.push(str[i])\n\t\ti += 1\n\tend\n\n\ti = 0\n\twhile i < letters.length\n\t\tif letters[i] == letters[i + 1]\n\t\t\tif is_vowel? letters[i]\n\t\t\t\tnewstr << \"squat\" + letters[i]\n\t\t\telse\n\t\t\t\tnewstr << \"squa\" + tutnese_letter(letters[i])\n\t\t\tend\n\t\t\ti += 1\n\t\telse\n\t\t\tnewstr << tutnese_letter(letters[i])\n\t\tend\n\t\ti += 1\n\tend\n\n\tnewstr\nend", "title": "" }, { "docid": "bedaa7a9467921d5d2bab2eb4c4fbb3b", "score": "0.58704925", "text": "def redact_five_letter_words(string)\n word = string.split\n nSent = []\n word.each {|w| w.length == 5 ? nSent << '#####' : nSent << w}\n nSent.join(' ')\nend", "title": "" }, { "docid": "8835809f002248dcb5967a602833f364", "score": "0.58663034", "text": "def sanitizeInput(input)\n out = ''\n input = input.upcase\n input = input.gsub(/[^A-Z]/, '')\n input << \"X\" * (5 - (input.length % 5)) unless input.length % 5 == 0\n return input.scan(/.{1,5}/).join(' ').strip\n end", "title": "" }, { "docid": "cf636f032ecb2c149947dbd2de2fc516", "score": "0.5865765", "text": "def crunch(str)\n crunch_str = ''\n\n letters = str.chars\n letters.each do |ch|\n crunch_str << ch unless ch == crunch_str[-1]\n end\n\n crunch_str\nend", "title": "" }, { "docid": "b060858977b350d6f4e3782b14f205a3", "score": "0.5864099", "text": "def crunch(string)\r\n new_string = string.split(' ').map do |word|\r\n word_chars = word.chars\r\n new_word = []\r\n word_chars.each_with_index {|c, idx| new_word << word_chars[idx] unless word_chars[idx] == new_word.last }\r\n new_word.join('')\r\n end\r\n new_string.join(' ')\r\nend", "title": "" }, { "docid": "00493683d99513c2fb6cc3224b2bdd52", "score": "0.5863409", "text": "def sanitize_string(given_string)\n # Only keep letter characters\n onlyletter_string = given_string.gsub(/[^a-zA-z]/, \"\")\n # Change all letters to uppercase\n onlyupper_string = onlyletter_string.upcase\n # Setting the initial x number to 0\n x_number = 0\n # Decide how many 'X' should be padded into the string\n string_size = onlyupper_string.size\n if string_size < 1\n abort(\"ABORTED! The string size is less than 1\\n\")\n end\n if string_size % 5 != 0\n x_number = 5 - (string_size % 5)\n end\n # Padding the created \"X\" into the string. Be aware of the order: 'X' should be in front of the Fixnum\n sanitize_string = onlyupper_string + ('X' * x_number)\n # Add one space every five characters\n result_string = sanitize_string.gsub(/(.{5})/, '\\1 ').strip\n # Return the final result\n return result_string\n end", "title": "" }, { "docid": "e685c9785c1c9c2ec475fbb81a2a94d1", "score": "0.58587766", "text": "def example3(string, character)\n stc = string << character\n stc.\nend\np example3('aa','vbbb')\nputs '-----------------------------example4----------------------------------'\n# Write a function to check whether the first and the last word of a given string are the same\n\n# Params: string\n\n# Example:\n\n# Input: 'Kati Kati'\n\n# Output: true\ndef example4(string)\n string.start_with? 'Ka'\n string.end_with? 'ti'\nend\nputs example4('Kati Katia')\nputs '-----------------------------example5----------------------------------'\n# Skim through the documentation for strings in the Ruby documentation (https://ruby-doc.org/core-2.1.4/String.html), and look at method prepend Using that method write a function to prepend a string into another string\n\n# Params: string1, string2\n\n# Example:\n\n# Input: 'Hello ', 'Ruby'\n\n# Output: 'Hello Ruby'\ndef example5(string1, string2)\n \"#{string1} #{string2}\"\nend\nputs example5('Xin chào', 'Ruby')\nputs '-----------------------------example6----------------------------------'\n# Skim through the documentation for strings in the Ruby documentation (https://ruby-doc.org/core-2.1.4/String.html), and look at method delete Using that method write a function to remove all white space within a string.\n\n# Params: string\n\n# Example:\n\n# Input: 'Ja v aS cr ip t'\n\n# Output: 'JavaScript'\ndef example6(string)\n string.delete \" \"\nend\nputs example6(\"Ja v aS cr ip t\")\n\n\ntext = \"Sammy has a balloon\"\nindices = text.map{|pair| pair.last}\nend", "title": "" }, { "docid": "09dfc8c78cf64f44b87d0a7c506b433d", "score": "0.58369297", "text": "def solution(str)\n if str.length > 0\n \tstr.split('').reduce { |current, newChar| newChar+current }\n else\n \treturn ''\n end\nend", "title": "" }, { "docid": "fb6d41acd842f5d1b0134be6689ec055", "score": "0.5833881", "text": "def puzzle_6\n random_string = \"\"\n 1.upto(5) { random_string << (97+rand(26)).chr }\n return random_string\nend", "title": "" }, { "docid": "6b523e21eb0f1ebed4e3bb0a8aa6fce4", "score": "0.58291984", "text": "def redact_five_letter_words(str)\n str_new = []\n str.split.each do |word|\n if word.length == 5\n str_new << '#####'\n else\n str_new << word\n end\nend\nstr_new.join(' ')\nend", "title": "" }, { "docid": "336e764698f5c47942373abc54cebc59", "score": "0.58245295", "text": "def crunch(sentence)\n crunched = ''\n sentence.chars.each { |char| crunched += char unless crunched[-1] == char }\nend", "title": "" }, { "docid": "22db166fccd696c68327ecc9ee5dfcc8", "score": "0.5816765", "text": "def greeting str\n str[-1] == '!' ? \"HELLO #{str.chop.upcase}. WHY ARE WE SCREAMING?\" : \"Hello #{str.capitalize}.\"\nend", "title": "" }, { "docid": "80271fffcd297e5084deb46abb0034a1", "score": "0.58143795", "text": "def crunch(string)\n new_string = ''\n current_char = ''\n string.chars.each do |char|\n new_string << char unless char == current_char\n current_char = char\n end \n new_string\nend", "title": "" }, { "docid": "85470f36afb1af3ef3cae5a6e39526f3", "score": "0.58103603", "text": "def letter_shifter(string)\n\tstring.chars.map do |char|#recall that string#each_char also iterates over each char in a string w/o the ary conversion!\n\t\tif is_non_letter(char)\n\t\t\tchar\n\t\telsif is_vowel(char)\n\t\t\tnext_vowel(char)\n\t\telse\n\t\t\tnext_cons(char)\n\t\tend\n\tend.join(\"\")\nend", "title": "" }, { "docid": "d79536674e360fb7e520237d3e1fbc4d", "score": "0.57992893", "text": "def animal(species)\r\n if species.length > 10\r\n species.upcase\r\n else\r\n species\r\n end\r\nend", "title": "" }, { "docid": "136de88844579bae5e486be4bf19d5a4", "score": "0.57980555", "text": "def basic_plurilized(string, count)\n count > 1 ? string + 's' : string\n end", "title": "" }, { "docid": "7249374c09333bf391096b3b4f5cddbc", "score": "0.5796133", "text": "def crunch(string)\n results = []\n n = 0\n\n string.chars.each do |letter|\n results << letter unless string[n] == string[n+1]\n n += 1\n end\n\n results.join(\"\")\nend", "title": "" }, { "docid": "1c0ac8712a3327b6333d1a7e81b6f001", "score": "0.5794307", "text": "def solution(string)\n string.chars.map { |s| s == s.downcase ? s : \" #{s}\" }.join\nend", "title": "" }, { "docid": "1c0ac8712a3327b6333d1a7e81b6f001", "score": "0.5794307", "text": "def solution(string)\n string.chars.map { |s| s == s.downcase ? s : \" #{s}\" }.join\nend", "title": "" }, { "docid": "9c59f332379172713f920ac8102d8ac0", "score": "0.57929355", "text": "def talk(string)\n\tif string.length >10\n\t\tstring.upcase\n\telse\n\t\tstring\n\tend\nend", "title": "" }, { "docid": "51a921480393d73f94f560eba28d25df", "score": "0.5785796", "text": "def pure_letter(char)\n ('a'..'z').cover?(char) ? char : \"\"\nend", "title": "" }, { "docid": "295907c70d4c6099ff06a5ec26b5362c", "score": "0.578557", "text": "def super_reduced_string(s)\n # puts \"Original String: #{s}\"\n\n # Complete this function\n s.each_char.each_with_index do |char, i|\n # puts \"Index #{i} Char #{char}\"\n # Get all string with alternative chars\n if i == 0\n next\n end\n if s[i]\n if (s[i] == s[i-1])\n # puts \"S Plus #{s[i]}\"\n # puts \"S Minu #{s[i-1]}\"\n pair = s[i] + s[i-1]\n s.slice! pair\n # puts \"Remove string: #{s}\"\n super_reduced_string(s)\n end\n end\n end\n\n # puts \"Final String: #{s}\"\n if s == \"\"\n return \"Empty String\"\n end\n s\nend", "title": "" }, { "docid": "c32078fd828229fadf6e138a6b66ce24", "score": "0.5779397", "text": "def custom_squeeze(string)\r\n sentence = \"\"\r\n chars = string.split(\"\")\r\n chars.each_with_index { |char, index| char == chars[index + 1] ? next : sentence << char }\r\n return sentence\r\nend", "title": "" }, { "docid": "d61f3ce7ac3aef55b7f05a9d9fcfa1b3", "score": "0.57793355", "text": "def happy() 'happy! happy! happy!' end", "title": "" }, { "docid": "d3443763e1c9e38f511850b2e151b999", "score": "0.57786375", "text": "def string2\n 'What is going on here?'\nend", "title": "" }, { "docid": "016362279fe79a5640af00907a0b9a12", "score": "0.57725656", "text": "def crunch(str)\n str_deduped = ''\n\n str.each_char.with_index do |char, index|\n if index == 0\n str_deduped += char\n elsif char != str[index-1]\n str_deduped += char\n end\n end\n\n str_deduped\nend", "title": "" }, { "docid": "ead2694bfe69033f3ee352ec94fc4972", "score": "0.57703084", "text": "def silly90s(word)\n\tvowels4 = [\"o\",\"i\",\"猛\",\"e\",\"a\"]\n \tword90 = \"\"\n \tword = word.chars\n \tcnt = 0;\n\tword.each_with_index do |char, idx|\n\t if char.scan(/[aeio]/).count==1\n\t\t vowels4.each do |vowel|\n\t\t if char == vowel\n\t\t char = vowels4.index(vowel)\n\t\t word90 = word90 + char.to_s\n\t\t end\n\t\t end\n\t\telsif idx == 0\n\t\t\tword90 += char.to_s.downcase\n\t\telse \n\t\t\tif cnt%2 == 0\n\t\t\t\tword90 += char.to_s.upcase\n\t\t\t\tcnt+=1\n\t\t\telsif char.scan(/[0-9]/).count>=1\n\t\t\t\tcnt = 0\n\t\t\telsif char.to_s == \" \"\n\t\t\t\tword90 += char.to_s\n\t\t\telse \n\t\t\t\tword90 += char.to_s.downcase\t\t\t\t\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\t\t\n\t\tend\n\tend\n\treturn word90\n end", "title": "" }, { "docid": "4e3d065c3f585087996c8af4a4375a33", "score": "0.57563084", "text": "def take_string(my_string)\n if my_string.length >= 10\n return puts my_string.upcase\n else\n return puts \"Your string is good like this\" + my_string\n end\nend", "title": "" }, { "docid": "03f5e90700759b061b6dcb3e5ff1e38d", "score": "0.57513976", "text": "def crunch(string)\n new_string = \"\"\n string.chars.each do |char|\n if new_string[-1]\n new_string << char unless (new_string[-1].downcase == char.downcase)\n else\n new_string << char\n end\n new_string\n end\n new_string\nend", "title": "" }, { "docid": "5c2d3f6afbbb60d5aab0900b002a33a6", "score": "0.5751338", "text": "def crazy_strings(goodbye, worlds)\n return \"#{goodbye.reverse.upcase} #{worlds.swapcase.gsub('S','Z')}\"\nend", "title": "" }, { "docid": "f9e0ec3c5441bd2262e25539d01219d0", "score": "0.574887", "text": "def gordon(string)\n words = string.scan(/\\w+/)\n words.each {|word| word.upcase!}\n words.each {|word| word << \"!!!!\"}\n words.each {|word| word.gsub!(/[ieou]/i,\"*\")}\n words.each {|word| word.gsub!('A',\"@\")}\n words.join(' ')\nend", "title": "" }, { "docid": "81a1a3161b107263d089e9c131cec84c", "score": "0.57467586", "text": "def crunch5(string)\n string.gsub(/(.)\\1+/, '\\1')\nend", "title": "" }, { "docid": "2d11b6f004ff903e1d3dd49d60564153", "score": "0.5744992", "text": "def solve(string)\n word = string.chars\n \n word.map! do |char|\n if char.match?(/a|e|i|o|u/)\n char\n else\n ' '\n end\n end\n \n word.join.split(' ').max_by {|chars| chars.length}.length\nend", "title": "" }, { "docid": "e68a7b7755b5e63826118f49eadba5f8", "score": "0.5743179", "text": "def crunch str\n str.chars.reject.with_index {|char, idx| char == str[idx + 1] }.join('')\nend", "title": "" }, { "docid": "5dbf6c396dd4e79905062554352cb8d4", "score": "0.5741992", "text": "def say_it_loud(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend", "title": "" }, { "docid": "5697fa041713a0153534a800fb133a0a", "score": "0.57401884", "text": "def crunch(sentence)\n result = sentence.chars.each_with_object([]) do |char, arr|\n arr << char if arr.last != char\n end\n\n result.join\nend", "title": "" }, { "docid": "b58d4f61c8e3913cf4ed5e08dd4918e4", "score": "0.57351404", "text": "def custom_squeeze(string)\r\n final_str = \"\"\r\n string.chars.each_with_index { |c,i| c != string[i+1] ? final_str << c : next}\r\n # unless c == string[i+1]\r\n # final_str << c\r\n # else\r\n # next\r\n # end\r\n #end\r\n final_str\r\nend", "title": "" }, { "docid": "6c010c6d3c606e9368b496f51851dc51", "score": "0.5733972", "text": "def crunch(str)\n result = []\n str.chars.each do |char|\n result << char if result.last != char\n end\n result.join('')\nend", "title": "" }, { "docid": "f294352be6ccaa2159da00db208f7dde", "score": "0.5731757", "text": "def makeAcronym(string)\n if string.class != String\n #ou if !string.is_a?(String) \n #ou return \"Not a string\" unless string.is_a?(String).\n \"Not a string\"\n elsif string.count(\"0-9\") > 0\n \"Not letters\"\n else\n string.split.map{|word|word[0]}.join.upcase\n end\nend", "title": "" }, { "docid": "41cd7170ae9d758595406be8a065dc87", "score": "0.57285106", "text": "def addLetter( s )\n if s.length <= 2 then\n return s.chr + randomLetter\n end\n print s, \" \", s.length, \"\\n\"\n place = rand( s.length ) \n letter = randomLetter\n first = s[0..place]\n last = s[place+1 .. s.length-1]\n return first + letter.chr + last\n \nend", "title": "" }, { "docid": "2685d622caa2ed032814ea52d8768c53", "score": "0.572707", "text": "def captialize(str)\n return str.upcase if str.length > 10\nend", "title": "" }, { "docid": "a2ccc7ba5deff9af78c9df543eaac0b4", "score": "0.57259715", "text": "def crunch2 str\n str.chars.reject.with_index {|char, idx| char == str[idx + 1] }.join('')\nend", "title": "" }, { "docid": "99b37470cf4d181ad895dcd39d4baf73", "score": "0.57237715", "text": "def crunch(str)\n result = []\n str.chars.each do |char|\n result << char unless result.last == char\n end\n result.join\nend", "title": "" }, { "docid": "22bd795268ffa47f17ce105a82ba704f", "score": "0.57234097", "text": "def unusual_five()\n 'fives'.length\nend", "title": "" }, { "docid": "03ff8db1b506dfa0cd432510bc003b1d", "score": "0.5713981", "text": "def scream(phrase)\n words = phrase.split.count\n if phrase.include?(\"!\" * words)\n return phrase.upcase\n else\n return phrase.upcase + (\"!\" * words)\n end\nend", "title": "" } ]
36a5cfb873957f520cdadf989c1ba876
POST /incomes POST /incomes.json
[ { "docid": "ab4d90db564805c4b208bf19ddd4cab6", "score": "0.66719234", "text": "def create\n #@income = Income.new(income_params)\n @income = current_user.incomes.build(income_params)\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path, notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "c8ee9bdfa34c3ee202d51d1cad0968d9", "score": "0.7126155", "text": "def create\n\n @income = Income.new(params[:income])\n @income.budget = current_budget\n @income.generate_periods = true\n\n if @income.save\n render :json => @income.to_json(:include => :income_values), status: :created, location: @income\n else\n render json: @income.errors, status: :unprocessable_entity \n end\n\n end", "title": "" }, { "docid": "f27ea3a2ef7e9c2d9a8d4a27d23d37fb", "score": "0.7081623", "text": "def create\n @income = Income.new(income_params)\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to @income, notice: t('Income was successfully created.') }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7653ba8ccf23a1254ae245c096cb8a4a", "score": "0.7002566", "text": "def create\n @income = Income.new(income_params)\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to edit_income_path(@income), notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1bdf76a7b775bc7aba7af8e36df1ea47", "score": "0.689402", "text": "def create\n @income = Income.new(income_params)\n @income.user = current_user\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path, notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e33f600b0cd0681a655af5d962b81fc", "score": "0.6863544", "text": "def create\n @income = Income.new(date: income_params[:date],\n description: income_params[:description], amount: income_params[:amount])\n\n income_params[:income_categories].reject(&:blank?).each do |id|\n @income.income_categories << IncomeCategory.find(id)\n end\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path, notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: incomes_path }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a4c345a101292ea541a59eed501d33c", "score": "0.6820089", "text": "def create\n @income = Income.new(income_params)\n\n respond_to do |format|\n if @income.save\n # format.html { redirect_to @income, notice: 'Income was successfully created.' }\n format.html { redirect_to @income, notice: '収入1件登録しました。' }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b62b7a3cbf9639f84775fbfe80281c18", "score": "0.6738047", "text": "def create\n income = IncomeService.create_income(income_params)\n if income.persisted?\n redirect_to :back, notice: '收入创建成功!'\n else\n redirect_to :back, error: '收入创建失败!'\n end\n end", "title": "" }, { "docid": "8d64377c313582497b43470f0e9b439f", "score": "0.6673627", "text": "def income_params\n params.require(:income).permit :name, :amount, :date, :account_id, :goal_id\n end", "title": "" }, { "docid": "70dcf8752c9427ad11221657cff7ecda", "score": "0.66551733", "text": "def create\n @fixed_income = FixedIncome.new(fixed_income_params)\n\n respond_to do |format|\n if @fixed_income.save\n format.html { redirect_to @fixed_income, notice: 'Fixed income was successfully created.' }\n format.json { render :show, status: :created, location: @fixed_income }\n else\n format.html { render :new }\n format.json { render json: @fixed_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ecd3f0c4d56779cf5e5b51e75b0d5bc", "score": "0.6604537", "text": "def create\n @income = @income_category.incomes.new(income_params)\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to income_category_incomes_path(@income_category), notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @income }\n #format.js\n end\n end\n end", "title": "" }, { "docid": "b71961c0d622205b3e73ec1ed72937de", "score": "0.6550272", "text": "def create\n @income_summary = IncomeSummary.new(income_summary_params)\n\n respond_to do |format|\n if @income_summary.save\n format.html { redirect_to @income_summary, notice: 'Income summary was successfully created.' }\n format.json { render :show, status: :created, location: @income_summary }\n else\n format.html { render :new }\n format.json { render json: @income_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d779cd9ac7142389e05f598a14d36b27", "score": "0.65357596", "text": "def create\n date = if params[:income][:date] == \"\"\n Date.today\n else\n Date.strptime(params[:income][:date],'%m/%d/%Y')\n end\n\n @income = Income.new(\n amount: process_amount(params[:income][:amount]),\n longitude: params[:income][:longitude],\n latitude: params[:income][:latitude],\n description: params[:income][:description],\n date: date,\n user_id: current_user.id\n )\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path, notice: 'Income was successfully created.' }\n format.json { render json: @income, status: :created, location: @income }\n else\n format.html { render action: \"new\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1addadc1f2b11a3b70514136717d847", "score": "0.6518591", "text": "def create\n @budget = Budget.find(params[:budget_id])\n @proposed_income = @budget.proposed_incomes.build(proposed_income_params)\n\n respond_to do |format|\n if @proposed_income.save\n format.html { redirect_to @budget, notice: 'Proposed income was successfully created.' }\n format.json { render :show, status: :created, location: @proposed_income }\n else\n format.html { render :new }\n format.json { render json: @proposed_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92699c08e9c2fdf88ac7f6c39428d151", "score": "0.64980215", "text": "def create\n @income_statement = IncomeStatement.new(income_statement_params)\n\n respond_to do |format|\n if @income_statement.save\n format.html { redirect_to @income_statement, notice: 'Income statement was successfully created.' }\n format.json { render :show, status: :created, location: @income_statement }\n else\n format.html { render :new }\n format.json { render json: @income_statement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "650ae1de22e506fa13452bdd5b668082", "score": "0.6478091", "text": "def create\n @income = Income.new(income_params)\n @income.user = current_user\n @income.budget = @budget\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to edit_budget_path(@budget), notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: edit_budget_path(@budget) }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02431c65247e2dac48b607034dd4a221", "score": "0.6466847", "text": "def create\n @income = Income.new(params[:income])\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to(@income, :notice => 'Income was successfully created.') }\n format.xml { render :xml => @income, :status => :created, :location => @income }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @income.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f49ea8e93c6a46647b9b285f73cf755", "score": "0.6450699", "text": "def create\n @income_expense = IncomeExpense.new(income_expense_params)\n\n respond_to do |format|\n if @income_expense.save\n format.html { redirect_to @income_expense, notice: 'Income expense was successfully created.' }\n format.json { render :show, status: :created, location: @income_expense }\n else\n format.html { render :new }\n format.json { render json: @income_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f83d57e6bcb6cabcc0fe0f6a1c7bc796", "score": "0.64427304", "text": "def incomes_params\n params.require(:income).permit(:category, :amount, :date)\n end", "title": "" }, { "docid": "f37ea6708e78189584ff95efdfd46c3a", "score": "0.6438774", "text": "def create\n\t@income = Income.new(income_params)\n if @income.save\n\t flash[:success] = \"Record was created successfully\"\n redirect_to @income\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "14284c93a4228885ec0a347878ef4a34", "score": "0.643877", "text": "def income_params\n params.require(:income).permit(:frequency_id, :name, :category, :date, :amount, :notes, :budget_id, :user_id)\n end", "title": "" }, { "docid": "b22220bbc4e97ef22b44bc9a4586d551", "score": "0.6434165", "text": "def income_params\n params.require(:income).permit :name, :amount, :date, :account_id\n end", "title": "" }, { "docid": "cf8b18619e99e024204ac17468185316", "score": "0.6430419", "text": "def income_params\n params.require(:income).permit(\n :income_type_id,\n :amount\n )\n end", "title": "" }, { "docid": "89f529c865b6921da2bce413ae87167c", "score": "0.63652414", "text": "def income_params\n params.require(:income).permit(:nome, :valor, :dividido, :ajuste, :mounth)\n end", "title": "" }, { "docid": "d47218073cf1a12ebc3a8728964ac090", "score": "0.6354088", "text": "def create\n @financial_objects_income = manager.create(financial_objects_income_params, current_user)\n\n respond_to do |format|\n if @financial_objects_income.valid?\n format.html { redirect_to @financial_objects_income, notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @financial_objects_income }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @financial_objects_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9bf127dcec67c62b0503ac94f421db0", "score": "0.6351508", "text": "def income_params\n params.require(:income).permit(:date, :description, :amount, income_categories: [])\n end", "title": "" }, { "docid": "314160b5a07d00579c8dc5730a0492ea", "score": "0.6349092", "text": "def income_params\n params.require(:income).permit(:date, :price, :income_category_id)\n end", "title": "" }, { "docid": "05fa42006512e4fbae6df9980b2195e8", "score": "0.6347934", "text": "def create\n @income_item = IncomeItem.new(income_item_params)\n\n respond_to do |format|\n if @income_item.save\n format.html { redirect_to @income_item, notice: 'Income item was successfully created.' }\n format.json { render :show, status: :created, location: @income_item }\n else\n format.html { render :new }\n format.json { render json: @income_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e010dba2ed22773af333991310f6f47", "score": "0.6347836", "text": "def income_params\n params.require(:income).permit(\n :income_type_id,\n :amount,\n :person_id,\n )\n end", "title": "" }, { "docid": "110352cebdd9498050b8421499192e81", "score": "0.63424927", "text": "def income_params\n params.require(:income).permit(:name, :reason, :indent_id, :order_id, :money, :username,\n :income_at, :status, :note, :bank_id, :agent_id, :deleted)\n end", "title": "" }, { "docid": "84e5fce0e78497ec9d19f1fb054b5f14", "score": "0.6332145", "text": "def income_params\n params.require(:income).permit(:sources, :amount, :tax, :execution_date, :wallet_id, :user_id)\n end", "title": "" }, { "docid": "b7ace6d2ab855980d43ccd84c8273caa", "score": "0.6328106", "text": "def income_params\n params.require(:income).permit(:fee_amount, :code, :payer_id, :abstract, :bill_date, :account_date, :income_amount, :settlement_amount, :invoice_date, :invoice_num, :tax_rate, :explain, :discount_rate, :available_amount, :actual_amount, :actual_date, \n revenues_attributes: [:id, :date, :amount, :_destroy])\n end", "title": "" }, { "docid": "f6bbb722fb1c0369c2f14b82880a1cd3", "score": "0.6327223", "text": "def create\n @income_item = IncomeItem.new(params[:income_item])\n\n respond_to do |format|\n if @income_item.save\n format.html { redirect_to @income_item, notice: 'Income item was successfully created.' }\n format.json { render json: @income_item, status: :created, location: @income_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @income_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9dfe7e4c348e3994141d76baed06f790", "score": "0.6309031", "text": "def create\n @income_method = IncomeMethod.new(params[:income_method])\n\n respond_to do |format|\n if @income_method.save\n format.html { redirect_to @income_method, notice: 'Income method was successfully created.' }\n format.json { render json: @income_method, status: :created, location: @income_method }\n else\n format.html { render action: \"new\" }\n format.json { render json: @income_method.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf8100611d6d667a2b3c8becb947696f", "score": "0.63006794", "text": "def new\n @income = Income.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income }\n end\n end", "title": "" }, { "docid": "a48998262d785776c7b0d02090ea6b88", "score": "0.62885743", "text": "def create\n @income_status = IncomeStatus.new(income_status_params)\n\n respond_to do |format|\n if @income_status.save\n format.html { redirect_to @income_status, notice: 'Income status was successfully created.' }\n format.json { render :show, status: :created, location: @income_status }\n else\n format.html { render :new }\n format.json { render json: @income_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87dfd992fa6c343e669a805e5cf3beac", "score": "0.62606615", "text": "def create\n @budget_income = BudgetIncome.new(budget_income_params)\n\n respond_to do |format|\n if @budget_income.save\n format.html { redirect_to @budget_income.budget, notice: 'Budget income was successfully created.' }\n format.json { render :show, status: :created, location: @budget_income }\n else\n format.html { render :new }\n format.json { render json: @budget_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a71ef021b002e571401f2f3452a4c746", "score": "0.62575656", "text": "def create\n @income_value = IncomeValue.new(params[:income_value])\n\n respond_to do |format|\n if @income_value.save\n format.html { redirect_to @income_value, notice: 'Income value was successfully created.' }\n format.json { render json: @income_value, status: :created, location: @income_value }\n else\n format.html { render action: \"new\" }\n format.json { render json: @income_value.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38af7a2beb315ab9f968c288b910a924", "score": "0.62506217", "text": "def create\n user = User.find(current_user.id)\n @incomes = user.incomes.new(incomes_params)\n if @incomes.valid?\n if @incomes.save\n @incomes.transactions.create(date: params[:income][:date], amount: params[:income][:amount], user_id: current_user.id)\n render 'show'\n end\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "b07ce16986cedec1b62b194693dde295", "score": "0.62186456", "text": "def income_params\n params.require(:income).permit(:idate, :ivalue, :iorgvalue, :iperson,\n :iobject, :ikindx, :ikindy, :ifrom, :inotice, :idiary, :idetail)\n end", "title": "" }, { "docid": "7d2c5bc68af68c13f05e0cad57e84bc1", "score": "0.6215269", "text": "def income_resource\n income_resource = InvestorDetail.income_resources\n render json: {\n ststus: 'OK',\n results: income_resource,\n error: nil\n }, status: :ok\n end", "title": "" }, { "docid": "e48a112dce56b3b297ec899ec947f184", "score": "0.6191219", "text": "def post_expense(expense)\n post '/expenses', JSON.generate(expense)\n expect(last_response.status).to eq(200)\n\n parsed = JSON.parse(last_response.body)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n expense.merge('id' => parsed['expense_id'])\n end", "title": "" }, { "docid": "950a39d954e62ace2dd90922447619aa", "score": "0.6170383", "text": "def create\n @periodic_income = PeriodicIncome.new(periodic_income_params.merge(profile: @profile))\n\n respond_to do |format|\n if @periodic_income.save\n format.html { redirect_to profile_path(@profile), notice: 'Periodic income was successfully created.' }\n format.json { render :show, status: :created, location: profile_path(@profile) }\n else\n format.html { render :new }\n format.json { render json: @periodic_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5648604c7e8d8608b8f92f88fdcaeb0", "score": "0.6147579", "text": "def income_params\n\t\tparams.require(:income).permit(:description, :category, :amount, :date, :parent_id, :tender_type, :check_number)\n\tend", "title": "" }, { "docid": "81f9bdffaa78c945fa0a8cf4f077c373", "score": "0.6123413", "text": "def income_params\n params.require(:income).permit(:user_id, :job, :pay)\n end", "title": "" }, { "docid": "7fcf1d4198288d011ac4eecbc5b179bb", "score": "0.61008614", "text": "def income_params\n params.require(:income).permit(:source, :pay_date, :gross_amount, :use_month, :start_date, :end_date, :recurring, :federal_tax, :state_tax, :social_sec_tax, :medicare_tax, :net_amount, :annual_budget_id, :month_ids => [])\n end", "title": "" }, { "docid": "fdd4fdddeac6c07f8b4328206b483591", "score": "0.60943997", "text": "def create\n @app_income = AppIncome.new(params[:app_income])\n\n respond_to do |format|\n if @app_income.save\n format.html { redirect_to @app_income, notice: 'Завоз был успешно добавлен.' }\n format.json { render json: @app_income, status: :created, location: @app_income }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b3e626af5a28280b866092b1aa35f79", "score": "0.606326", "text": "def create\n @income_source = IncomeSource.new(income_source_params)\n\n respond_to do |format|\n if @income_source.save\n format.html { redirect_to @income_source, notice: 'Income source was successfully created.' }\n format.json { render :show, status: :created, location: @income_source }\n else\n format.html { render :new }\n format.json { render json: @income_source.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64f0c5ea71279309202df676b1eb4ea6", "score": "0.60390997", "text": "def index\n @incomes = Income.all\n end", "title": "" }, { "docid": "4c5d2b8864a02402cc4c4b7b94b26574", "score": "0.603364", "text": "def create\n @income = Income.new(income_params)\n @income.user_id = current_user.id if current_user\n\n\n respond_to do |format|\n if @income.save\n format.html { redirect_to incomes_path , notice: 'Income was successfully created.' }\n format.json { render :show, status: :created, location: @income }\n else\n format.html { render :new }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f172adbf05d66e4da2b179fbafc794de", "score": "0.6027602", "text": "def index\n @incomes = Income.all\n\n end", "title": "" }, { "docid": "cd97d3ab219472a45499decbcc75e3f6", "score": "0.6007175", "text": "def create\n expense = Expense.new(expense_params)\n if expense.save\n render json: {\n status: 201,\n expense: expense\n }\n else\n render json: {\n status: 422,\n errors: expense.errors.full_messages.join(\", \")\n }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0067ff20b55953b785072295d1a28e3c", "score": "0.5997341", "text": "def create_income\n @transaction = FinanceTransaction.new(transaction_params)\n if @transaction.save\n flash[:notice] = t('income_create')\n redirect_to new_income_finance_index_path\n else\n @categories ||= FinanceTransactionCategory.income\n render 'new_income'\n end\n end", "title": "" }, { "docid": "79aae8df8d51b8c72729995a8a1cbf34", "score": "0.5965941", "text": "def income_expense_params\n params.require(:income_expense).permit(:income_expense_id, :borrower_id, :base_income, :over_time, :bonuses, :commissions, :dividends_interest, :net_rental_income, :other_income, :rent, :first_mortgage, :other_financing, :harzard_insurance, :real_estate_taxes, :mortage_insurance, :home_owner_assn_dues)\n end", "title": "" }, { "docid": "823ba905dc14a5a015e6f7a6977f1749", "score": "0.59655094", "text": "def post_expense(expense)\n post '/expenses', JSON.generate(expense)\n #check the post attempt was a success\n expect(last_response.status).to eq(200)\n\n #check the data is in JSON structure\n parsed = JSON.parse(last_response.body)\n\n #check the data includes an expense_id\n #passing a matcher into another = composing matchers\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n\n #add an id key to the hash\n expense.merge('id' => parsed['expense_id'])\n end", "title": "" }, { "docid": "2880dcbea402143e286997364f7da8c6", "score": "0.5963304", "text": "def proposed_income_params\n params.require(:proposed_income).permit(:source, :comment, :amount, :budget_id)\n end", "title": "" }, { "docid": "876962f3d55e04d12795c5eae26d9884", "score": "0.59488356", "text": "def create\n @income = Income.new(params[:income])\n\n respond_to do |format|\n if @income.save\n flash[:notice] = 'Income was successfully created.'\n format.html { redirect_to income_url(@income) } \n format.js # render create.rjs << added for P/C >>\n format.xml { head :created, :location => income_url(@income) }\n else\n format.html { render :action => \"new\" }\n format.js # render create.rjs << added for P/C >>\n format.xml { render :xml => @income.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "ab03e25e80fc579f152fc18dc393835f", "score": "0.5945381", "text": "def create\n @income_tipe = IncomeTipe.new(income_tipe_params)\n\n respond_to do |format|\n if @income_tipe.save\n format.html { redirect_to tenant_income_tipes_path(tenant_id: @tenant.id), notice: 'Income tipe was successfully created.' }\n format.json { render :show, status: :created, location: @income_tipe }\n else\n format.html { render :new }\n format.json { render json: @income_tipe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2e15ced5fb069c8d1d0432981a602b4", "score": "0.5942183", "text": "def financial_objects_income_params\n params.require(:financial_objects_income).permit(:description, :currency, :category_id, :date)\n end", "title": "" }, { "docid": "fb19554d21b0b873af03dbbaa95fc808", "score": "0.59240127", "text": "def new\n index\n @income = Income.new\n\n end", "title": "" }, { "docid": "26473aa6fc56893536394f7930684ac5", "score": "0.5923027", "text": "def update_income\n\t\tunless api_key_is_valid?\n\t\t\treturn render json: 'Invalid API key.', status: 401\n\t\tend\n\n\t\tunless params[:id].present?\n\t\t\treturn render json: 'You must supply a user ID.', status: 400\n\t\tend\n\n\t\tunless User.exists? params[:id]\n\t\t\treturn render json: 'No such user found.', status: 404\n\t\tend\n\n\t\tuser = User.find(params[:id])\n\t\tuser.sb_annual_income = params[:income]\n\t\tif user.save\n\t\t\treturn render json: 'Changes saved.', status: 200\n\t\telse\n\t\t\treturn render json: 'Server error while saving.', status: 500\n\t\tend\n\tend", "title": "" }, { "docid": "5f8190e3af0181bdc1ba2ac8b958c866", "score": "0.59047246", "text": "def create\n @interest = Interest.new(interest_params)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n format.json { render :show, status: :created, location: @interest }\n else\n format.html { render :new }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f8190e3af0181bdc1ba2ac8b958c866", "score": "0.59047246", "text": "def create\n @interest = Interest.new(interest_params)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n format.json { render :show, status: :created, location: @interest }\n else\n format.html { render :new }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecedb61fe38f14cc822f361ecb20097b", "score": "0.5887581", "text": "def create\n @insurance = Insurance.new(params[:insurance])\n\n respond_to do |format|\n if @insurance.save\n format.html { redirect_to @insurance, notice: 'Insurance was successfully created.' }\n format.json { render json: @insurance, status: :created, location: @insurance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0046c114247db292ec652cf96e17af2a", "score": "0.58793986", "text": "def create\n @incomelog = Incomelog.new(incomelog_params)\n\n respond_to do |format|\n if @incomelog.save\n format.html { redirect_to @incomelog, notice: 'Incomelog was successfully created.' }\n format.json { render :show, status: :created, location: @incomelog }\n else\n format.html { render :new }\n format.json { render json: @incomelog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "729f2abeee4a19f3ba6a3b0ea8faf298", "score": "0.58745533", "text": "def new\n @income_method = IncomeMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income_method }\n end\n end", "title": "" }, { "docid": "cc4f83e63c6cf704b22c0b75c8d0f44b", "score": "0.58726686", "text": "def index\n @fixed_incomes = FixedIncome.all\n end", "title": "" }, { "docid": "2bd1731a8549c276f97293d9d00ad4c2", "score": "0.5847017", "text": "def update\n income = IncomeService.update_income(@income, income_params)\n if income.persisted?\n redirect_to incomes_path, notice: '收入记录编辑成功!'\n else\n redirect_to incomes_path, error: '收入记录编辑失败!'\n end\n end", "title": "" }, { "docid": "1272f1b6e0197958c47b96675c172c05", "score": "0.58386153", "text": "def create\n @expense = Expense.new(params[:expense])\n @expense.budget_id = session[:budget_id]\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to \"/budgets\", notice: 'Expense was successfully created.' }\n format.json { render json: @expense.to_json(:include => :expense_values), status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed6874a19615123712c634ae701631f9", "score": "0.5836419", "text": "def index\n @income_statements = IncomeStatement.all\n end", "title": "" }, { "docid": "349e3d0e417c8bb8a73133d7827eb6e7", "score": "0.5834987", "text": "def fixed_income_params\n params.require(:fixed_income).permit(:category, :entity, :due_date, :time_limit, :tax)\n end", "title": "" }, { "docid": "d9f83c3114d848271fb9310342bd4074", "score": "0.5812651", "text": "def new\n @income_item = IncomeItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income_item }\n end\n end", "title": "" }, { "docid": "126e1f35e85e7c29adc045965db8fc08", "score": "0.5805256", "text": "def income_statement_params\n params.require(:income_statement).permit(:period, :date, :total_revenue, :cost_of_revenue, :gross_profit,\n :operating_expense, :operating_income, :net_non_operating_interest_income_expense, :other_income_expense, :pretax_income, :tax_provision, :net_income_common_stockholders, :diluted_ni_available_to_com_stockholders, :basic_eps, :diluted_eps, :basic_average_shares, :diluted_average_shares, :total_operating_income_as_reported, :total_expenses, :net_income_from_continuing_and_discontinued_operation, :normalized_income, :interest_income, :interest_expense, :net_interest_income, :ebit, :ebitda, :reconciled_cost_of_revenue, :reconciled_depreciation, :net_income_from_continuing_operation_net_minority_interest, :normalized_ebitda, :tax_rate_for_calcs, :tax_effect_of_unusual_items)\n end", "title": "" }, { "docid": "0f6b0178b722362c81934d2ca0de252a", "score": "0.5794451", "text": "def post_expense_json(expense)\n header \"Content-Type\", \"application/json\" \n post '/expenses', JSON.generate(expense)\n expect(last_response.status).to eq(200)\n\n parsed = JSON.parse(last_response.body)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database\n expense.merge('id' => parsed['expense_id'])\nend", "title": "" }, { "docid": "e035f1af5ed10c11637904df40537078", "score": "0.5778481", "text": "def create\n @fixed_income = FixedIncome.new(params[:fixed_income])\n @fixed_income.user_id = current_user.id\n\n respond_to do |format|\n if @fixed_income.save\n flash[:notice] = 'FixedIncome was successfully created.'\n format.html { redirect_to(fixed_incomes_path) }\n format.xml { render :xml => @fixed_income, :status => :created, :location => @fixed_income }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_income.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d53593a445bb174d7aab898a3515f3b5", "score": "0.57687825", "text": "def new\n @income_value = IncomeValue.new\n\n respond_to do |format|\n format.html\n format.json { render json: @income_value }\n end\n end", "title": "" }, { "docid": "fee1d8f9adf65666139d38be4480825d", "score": "0.5761143", "text": "def create\n @income_category = IncomeCategory.new(params[:income_category])\n\n respond_to do |format|\n if @income_category.save\n format.html { redirect_to @income_category, notice: 'Income category was successfully created.' }\n format.json { render json: @income_category, status: :created, location: @income_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @income_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daf0f088ac03fb56fdea580690c311db", "score": "0.5742308", "text": "def create\n\n if !params[\"user\"][\"interests\"].nil?\n\n UserInterest.create(user_id: current_user.id, interest_id: params[\"user\"][\"interests\"][\"id\"])\n\n end\n\n render json: {\n interests: current_user.interests\n }\n\n end", "title": "" }, { "docid": "9857f86468160558a923d23d4654f945", "score": "0.5741365", "text": "def source_of_income_params\n params.require(:source_of_income).permit(:salary_income, :independent, :mixed_income, :expenses, :difference, :approval, :user_id, :loan_id)\n end", "title": "" }, { "docid": "78f0017936ba6f50772ab29368b2d2f5", "score": "0.57395124", "text": "def update\n respond_to do |format|\n if @income.update(income_params)\n format.html { redirect_to incomes_path, notice: 'Income was successfully updated.' }\n format.json { render :show, status: :ok, location: @income }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "698ac948378c24c0f98a0ad6ab46753f", "score": "0.57335395", "text": "def create\n @interest = Interest.new(interest_params)\n\n respond_to do |format|\n if @interest.save\n # format.html { redirect_to @interest, notice: 'Interest was successfully created.' }\n format.html { redirect_to :action => 'index', notice: 'Interest was successfully created.' }\n format.json { render :show, status: :created, location: @interest }\n else\n format.html { render :new }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffc4fc79d18377483ca7409657778dd6", "score": "0.5729873", "text": "def index\n @income_items = IncomeItem.all\n end", "title": "" }, { "docid": "6274a7537e459cfbe1597d5ffa9aff6c", "score": "0.5728962", "text": "def index\n @incomes = Income.all.order(created_at: :desc)\n if params[:indent_id].present?\n indent = Indent.find_by_id(params[:indent_id])\n @incomes = @incomes.where(order_id: indent.orders.pluck(:id))\n end\n if params[:start_at].present? && params[:end_at].present?\n @incomes = @incomes.where('income_at between ? and ?',\n params[:start_at].to_datetime.beginning_of_day,\n params[:end_at].to_datetime.end_of_day)\n end\n @incomes = @incomes.where(agent_id: params[:agent_id]) if params[:agent_id].present?\n if params[:bank_id].present?\n # 子订单号 order_id 和 总订单号 indent_id 为空时表示 代理商汇款; 不为空时表示 订单扣款\n @incomes = @incomes.where(bank_id: params[:bank_id])\n end\n @income = Income.new(bank_id: Bank.find_by(is_default: 1).try(:id),\n username: current_user.username,\n income_at: Time.now)\n\n @agent_incomes = @incomes.where('bank_id is not null and order_id is null and agent_id is not null').pluck(:money).sum\n @order_incomes = @incomes.where('bank_id is null and order_id is not null').pluck(:money).sum\n @other_incomes = @incomes.where(agent_id: nil).pluck(:money).sum\n respond_to do |format|\n format.html { @incomes = @incomes.page(params[:page]) }\n format.json\n format.xls do\n timestamp = Time.now.strftime('%Y%m%d%H%M%S%L')\n create_incomes(timestamp, @incomes)\n send_file Rails.root.join(\"public/excels/incomes/#{timestamp}.xls\"), type: 'text/xls; charset=utf-8'\n end\n end\n end", "title": "" }, { "docid": "55c13085ee4a9c323fe523a0a438756b", "score": "0.5727567", "text": "def update\n set_income\n respond_to do |format|\n if @income.update(income_params)\n format.html { redirect_to incomes_path, notice: 'Income was successfully updated.' }\n format.json { render :show, status: :ok, location: @income }\n else\n format.html { render :edit }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f58725540b457312ac396fffd8d21d22", "score": "0.5717349", "text": "def prepare_income_data(data)\n JSON.parse(data)\n end", "title": "" }, { "docid": "a667f33d6891d6d513ebde2dbd860ca6", "score": "0.5715325", "text": "def set_income\n @income = Income.find(params[:income_id])\n end", "title": "" }, { "docid": "a667f33d6891d6d513ebde2dbd860ca6", "score": "0.5715325", "text": "def set_income\n @income = Income.find(params[:income_id])\n end", "title": "" }, { "docid": "62f204c197d80c5ae82ebec626c702e5", "score": "0.57122165", "text": "def income_item_params\n params.require(:income_item).permit(:income_category_id, :money, :date)\n end", "title": "" }, { "docid": "6de468e262302f4689de360ebac8e3ea", "score": "0.57107055", "text": "def new\n @income = Income.new\n\n respond_to do |format|\n format.html { render :layout => false } \n format.js { render :layout => false } \n format.json { render json: @income }\n end\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "4ddbb7858e95235d610b9d5db0e09434", "score": "0.57041377", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "69199608b4dc7840607e98637fb24258", "score": "0.56912595", "text": "def income_summary_params\n params.require(:income_summary).permit(:trust, :individual, :company)\n end", "title": "" }, { "docid": "b013230e9dbb7dbf1d85ec21340da8dd", "score": "0.5667262", "text": "def create\n @income = Income.new(params[:income])\n\n respond_to do |format|\n if @income.save && Account.credit(@income) #if account can spend and the debit is succesfully saved\n flash[:notice] = \"Income of #{@income.amount} succesfully saved.\"\n format.html { redirect_to(@income) }\n format.xml { render :xml => @income, :status => :created, :location => @income }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @income.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d8abf74e1e2cd6470b57eadc4970e47", "score": "0.5665732", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" }, { "docid": "7d8abf74e1e2cd6470b57eadc4970e47", "score": "0.5665732", "text": "def set_income\n @income = Income.find(params[:id])\n end", "title": "" } ]
8032e178d0c7db66a85e8bc6f91fc0eb
GET /lexicons/1 GET /lexicons/1.json
[ { "docid": "5eda39361c538fbf81594ecaef781e29", "score": "0.685289", "text": "def show\n language = params[:id][0].capitalize\n number = params[:id][1..-1].to_i\n @lexicon = Lexicon.find_by_code(\"#{language}#{number}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lexicon }\n format.js\n end\n end", "title": "" } ]
[ { "docid": "2406145952c011c612d770fa153bc310", "score": "0.6757075", "text": "def new\n @lexicon = Lexicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lexicon }\n end\n end", "title": "" }, { "docid": "6bd74d6eb3eb7646cfe66112cf94760e", "score": "0.64482564", "text": "def show\n @lexicon_term = LexiconTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lexicon_term }\n end\n end", "title": "" }, { "docid": "287231f0ced114d8713a5e78521f45fa", "score": "0.6351194", "text": "def silicon\n @silicons = Silicon.all\n\n respond_to do |format|\n format.html\n format.json { render json: @silicons }\n end\n end", "title": "" }, { "docid": "8178d0b4e4e265e3156e7331f6661b21", "score": "0.6323574", "text": "def create\n @lexicon = Lexicon.new(params[:lexicon])\n\n respond_to do |format|\n if @lexicon.save\n format.html { redirect_to @lexicon, notice: 'Lexicon was successfully created.' }\n format.json { render json: @lexicon, status: :created, location: @lexicon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lexicon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a26f3c8e7f8a7689bc9f18c5af2d622e", "score": "0.6249104", "text": "def lexicon\n @lexicon ||= {}\n end", "title": "" }, { "docid": "9863b42129d04790f9e48c9bde9cd4c7", "score": "0.6225029", "text": "def index\r\n @icons = Icon.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @icons }\r\n end\r\n end", "title": "" }, { "docid": "d00b8ebf32930eca1c6c1b0f6533cac4", "score": "0.6065011", "text": "def index\n @icons = @current_user.icons\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end", "title": "" }, { "docid": "7de2797ddeec63e555990f887041954c", "score": "0.5936935", "text": "def show\r\n @icon = Icon.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @icon }\r\n end\r\n end", "title": "" }, { "docid": "76b3ac1ee4672b334c6e0c15b3b9c4f6", "score": "0.59367967", "text": "def index\n @icons = []\n Icon.all.each do |icon|\n @icons << {\n class_name: icon.class_name,\n data_uri_encoded_data: icon.data_uri_encoded_data,\n }\n end\n respond_to do |format|\n format.html\n format.json do\n render json: @icons\n end\n end\n end", "title": "" }, { "docid": "9c8bed19bba1d0062c51036317fbc086", "score": "0.59254223", "text": "def destroy\n @lexicon = Lexicon.find(params[:id])\n @lexicon.destroy\n\n respond_to do |format|\n format.html { redirect_to lexicons_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5230402b48282d19bf73031e9d8c4e11", "score": "0.58158", "text": "def show\n @lexicon_group = @lexicon.lexicon_group\n breadcrumb_for_projects(@project)\n semantic_breadcrumb @project.name, @project\n\n semantic_breadcrumb \"Lexicons\", project_lexicon_groups_path(@project)\n semantic_breadcrumb @lexicon_group.name, lexicon_group_lexicons_path(@lexicon_group)\n semantic_breadcrumb @lexicon.lexicon_id\n end", "title": "" }, { "docid": "3a0cb0c1b8987aa144bec1fbd7635b1c", "score": "0.57875687", "text": "def update\n @lexicon = Lexicon.find(params[:id])\n\n respond_to do |format|\n if @lexicon.update_attributes(params[:lexicon])\n format.html { redirect_to @lexicon, notice: 'Lexicon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lexicon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbd334d56124af78143307187b480f0e", "score": "0.5749937", "text": "def lexicon_params\n params.require(:lexicon).permit(:ltype, :lexicon_id, :name, :lexicon_group_id)\n end", "title": "" }, { "docid": "03e766a32fd0f4fb10e8b4224cbe97af", "score": "0.5704802", "text": "def index\n breadcrumb_for_projects(@project)\n semantic_breadcrumb @project.name, @project\n semantic_breadcrumb \"Lexicons\", project_lexicon_groups_path(@project)\n semantic_breadcrumb @lexicon_group.name, lexicon_group_lexicons_path(@lexicon_group)\n @lexicons = @lexicon_group.lexicons.page params[:page]\n respond_to do |format|\n format.html\n format.csv { send_data Lexicon.to_csv(@lexicons), filename: \"lexicon_#{@lexicon_group.id}_#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.tsv\" }\n end\n end", "title": "" }, { "docid": "5569f0c211ae500310d6ffd39ffb6400", "score": "0.5657648", "text": "def icons_tags\n begin\n icons = Icon.select(\"DISTINCT tag\").where(\"tag <> ''\").order('tag')\n result = []\n \n\t icons.each do |icon|\n\t result.push(icon.tag)\n\t end\n \n render :json => output(result)\n rescue Exception => exception\n error exception.message, :not_found\n end\n end", "title": "" }, { "docid": "eddc419502f347c589148eede8a319d5", "score": "0.5643857", "text": "def index\n @lexemes = Lexeme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lexemes }\n end\n end", "title": "" }, { "docid": "d20f42b11a75722f25f2ef96213ef295", "score": "0.5614444", "text": "def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @icons }\n end\n end", "title": "" }, { "docid": "0826f69757110be7c82bf4985047754d", "score": "0.5596243", "text": "def show\n @lexique = Lexique.where(:permalink => params[:permalink])\n redirect_to root_url if !@lexique or !@lexique.first\n\n @lexique = @lexique.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lexique }\n end\n end", "title": "" }, { "docid": "f767d4b9198848c49c28a20706a60a63", "score": "0.5585113", "text": "def show\n @lexeme = Lexeme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lexeme }\n end\n end", "title": "" }, { "docid": "7ac73fdd07d854f786e69d46176e94f4", "score": "0.557125", "text": "def new\n @lexicon_term = LexiconTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lexicon_term }\n end\n end", "title": "" }, { "docid": "9b018b62e93f395840f6d609b0de3f7f", "score": "0.55594605", "text": "def show\n @illust = Illust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illust }\n end\n end", "title": "" }, { "docid": "0ed5e8a86ecc74f7254ce00e02ca5415", "score": "0.55553204", "text": "def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end", "title": "" }, { "docid": "a05af84d1590878f10c03bfa23add87f", "score": "0.55411345", "text": "def show\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glossary }\n end\n end", "title": "" }, { "docid": "d1a65e1dc702800f81ed8cf6dd6f91e1", "score": "0.5499105", "text": "def print_lexicon(l)\n print \"\\n\"\n $lexicon_infos.each do |lex|\n if l != '' and (l.to_i != lex['k']) then\n next\n else\n print lex['k'].to_s + ' ~ '\n end\n print $lexicon[lex['k']].to_s\n lex['e'].each do |element|\n print ' (#' + element.to_s + ')'\n end\n lex['~'].each do |synonym|\n print ' ~ ' + synonym.to_s\n end\n print \"\\n\"\n end\nend", "title": "" }, { "docid": "3a5ee31babba872df91a5d7566741e9e", "score": "0.54886854", "text": "def fetch_emoticons\n\t\t\tquery_point = \"https://api.twitch.tv/kraken/chat/\"+@account_name+\"emoticons\"\n\t\t\t@emoticons = open(query_point).read\n\t\tend", "title": "" }, { "docid": "df548840dc56c080b8e95c7d1e4298a7", "score": "0.54798585", "text": "def icon\n response[\"icon\"]\n end", "title": "" }, { "docid": "e49fd845c1f5d5d5fde3a5ec23a73a27", "score": "0.5465836", "text": "def show\n @ontology = Ontology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ontology }\n end\n end", "title": "" }, { "docid": "a47e8bf88ef05ff1fca1e008fbefceaa", "score": "0.5455237", "text": "def show\n @icon_theme = IconTheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @icon_theme }\n end\n end", "title": "" }, { "docid": "c7b5c138326d3ae87e735e4ba4e65b52", "score": "0.5451913", "text": "def index\n @instructions = @game.instructions.all\n\n respond_to do |format|\n format.html { render action: :index }\n format.json do\n render json: { instructions: @instructions.map { |i| i.command.data } }\n end\n end\n end", "title": "" }, { "docid": "06d02292cc11c78cabdf174bd6e3bf55", "score": "0.5448715", "text": "def index\n @wikis = Wiki.all\n\n render json: @wikis\n end", "title": "" }, { "docid": "291a623d0363ab430c6626c6ab19ad10", "score": "0.5447363", "text": "def show\n @isle = Isle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @isle }\n end\n end", "title": "" }, { "docid": "120968306aa0bad1bf9db354b7e56ee1", "score": "0.5398316", "text": "def icon\n @icon = response[\"icon\"]\n @icon[\"urls\"] = {\n \"32x32\" => \"#{@icon[\"prefix\"].chomp(\"_\")}#{@icon[\"suffix\"]}\",\n \"64x64\" => \"#{@icon[\"prefix\"]}_64#{@icon[\"suffix\"]}\",\n \"256x256\" => \"#{@icon[\"prefix\"]}_256#{@icon[\"suffix\"]}\",\n }\n @icon\n end", "title": "" }, { "docid": "c6799eca6c4a83bef4a7194094bd6e21", "score": "0.5392249", "text": "def show\n @wiki = Wiki.find(params[:id])\n\n render json: @wiki\n end", "title": "" }, { "docid": "a22102f19ea0277d68326c2ea0ae5817", "score": "0.5376548", "text": "def lyric\n fetch('prince.lyric')\n end", "title": "" }, { "docid": "177fc29d3a4e4d3d1128807c2ff6f3f6", "score": "0.5373592", "text": "def index\n @lyks = Lyk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lyks }\n end\n end", "title": "" }, { "docid": "6a4dc0ff767350776cd9e085d3018a36", "score": "0.53332144", "text": "def show\n @my_glossary = MyGlossary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_glossary }\n end\n end", "title": "" }, { "docid": "477fc772461dce29090df58215c03ce0", "score": "0.5331467", "text": "def show\n curWord = Word.find_by_word(params[:id])\n respond_to do |format|\n format.json { render json: curWord }\n end\n end", "title": "" }, { "docid": "eff0459416f519e4efeee988aa645a3a", "score": "0.5310746", "text": "def show\n render json: @spell_circle\n end", "title": "" }, { "docid": "0f15fb87c7367a64f3d766510d057509", "score": "0.5309907", "text": "def new\r\n @icon = Icon.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @icon }\r\n end\r\n end", "title": "" }, { "docid": "70f4e9428da76f530dedf015a5cff7ce", "score": "0.53083944", "text": "def index\n @helptexts = Helptext.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @helptexts }\n end\n end", "title": "" }, { "docid": "a676fe87e7ecd6b22029cdf924f2f818", "score": "0.5307828", "text": "def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json { render json: motions.map { |m| { label: m.to_s(:numbered), value: m.id } } }\n end\n end", "title": "" }, { "docid": "47b2429ae23d8851ef0ad57d8d993b70", "score": "0.5305993", "text": "def show\n @lithium = Lithium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lithium }\n end\n end", "title": "" }, { "docid": "ae22bef83375fa073aa49ba27dae8bc8", "score": "0.5300353", "text": "def new\n @icon = Icon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @icon }\n end\n end", "title": "" }, { "docid": "c1feb054396732e3c84ef44787e2f0cc", "score": "0.52868605", "text": "def show\r\n @icon = Icon.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @icon }\r\n end\r\n end", "title": "" }, { "docid": "09cc0760f6f08683ed7c7b8c62df681a", "score": "0.5285091", "text": "def show\n @wikialgo = Wikialgo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wikialgo }\n end\n end", "title": "" }, { "docid": "f21da38a74737b394e645b226b7a4834", "score": "0.5280429", "text": "def show\n @illustrator = Illustrator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustrator }\n end\n end", "title": "" }, { "docid": "ba740ee624cfc95bd4475dd88951c965", "score": "0.5279327", "text": "def new\n @lexique = Lexique.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lexique }\n end\n end", "title": "" }, { "docid": "87aee8965db531de742fc0d60a612c45", "score": "0.52706593", "text": "def index\n @iklans = Iklan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iklans }\n end\n end", "title": "" }, { "docid": "e489e5dfdbbb7d836f71dbedd1159328", "score": "0.5260713", "text": "def index\n @image = Image.new\n @images = Image.all\n @faces = ['face_0.png', 'face_1.png', 'face_2.png', 'face_3.png', 'face_4.png']\n @faces.shuffle!\n respond_to do |format|\n format.html\n format.js \n end\n lingo = MediawikiApi::Client.new \"https://en.wikipedia.org/w/api.php\"\n wikipage = lingo.action :parse, page: 'Glossary_of_graffiti', token_type: false\n glossary = wikipage.as_json\n glossary['response']['body']\n end", "title": "" }, { "docid": "ca7bc910faae523a7df4bf84134dfbd5", "score": "0.5258373", "text": "def icon\n @data['icon']\n end", "title": "" }, { "docid": "dcd478a1323a7470716b62445d4f0ba7", "score": "0.5256015", "text": "def show\n @dictionary = Dictionary.find(params[:id])\n @source_language = (@dictionary.source_language || Language::UNDETERMINED)\n unsorted_lexemes = @dictionary.lexemes.includes([{:dictionaries => [:source_language]}, {:headwords => [:phonetic_forms, :language]}, {:subentries => [{:senses => [{:glosses => :language}, :notes, :language]}, {:etymologies => [:notes, :original_language, {:next_etymon => [:notes, :original_language, :next_etymon] }]}, {:notes => :language}, :language]}])\n @lexemes = @source_language.sort(unsorted_lexemes, by: :primary_headword)\n @page_title = @dictionary.title\n @langs = Dictionary.langs_hash_for(@dictionary)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dictionary }\n end\n end", "title": "" }, { "docid": "ec382acfe39bd5629d51bf1ab210afb6", "score": "0.52496487", "text": "def show\n @icon = Icon.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @icon.to_xml }\n end\n end", "title": "" }, { "docid": "ec382acfe39bd5629d51bf1ab210afb6", "score": "0.52496487", "text": "def show\n @icon = Icon.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @icon.to_xml }\n end\n end", "title": "" }, { "docid": "663622e247105ffc81ded6dfd019e754", "score": "0.5247031", "text": "def show\n @pirty = Pirty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pirty }\n end\n end", "title": "" }, { "docid": "26e2d54c8afdbf56fa40c80d92166dcd", "score": "0.52413446", "text": "def show\n @voice_hygiene = VoiceHygiene.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voice_hygiene }\n end\n end", "title": "" }, { "docid": "3609d45e2f43f715f46e1ec2bf18c5ec", "score": "0.5235894", "text": "def index\n if params[:lexique] and params[:lexique][:name]\n @lexiques = Lexique.where(\"name LIKE '%#{params[:lexique][:name]}%'\").published\n elsif current_user and current_user.is_admin\n @lexiques = Lexique.all\n end\n\n redirect_to root_url if !@lexiques\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lexiques }\n end\n end", "title": "" }, { "docid": "d7af005754a409d099863b91fb8a84e0", "score": "0.5234118", "text": "def show\n @lyk = Lyk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lyk }\n end\n end", "title": "" }, { "docid": "12b15b4b59d7e27a639d0b86d66b1202", "score": "0.52267283", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @icons }\n end\n end", "title": "" }, { "docid": "13566463480c77ddb2b3bff1c316c489", "score": "0.52257025", "text": "def show\n @smiley = Smiley.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @smiley }\n format.json { render :json => @smiley }\n end\n end", "title": "" }, { "docid": "189ca89328b7893381ac54598dc6881e", "score": "0.52201056", "text": "def index\n @spell_circles = SpellCircle.all\n\n render json: @spell_circles\n end", "title": "" }, { "docid": "9a9575b05f5d1d0f32ab71004209ae4d", "score": "0.5219162", "text": "def icons()\n return @icons \n end", "title": "" }, { "docid": "9a9575b05f5d1d0f32ab71004209ae4d", "score": "0.5219162", "text": "def icons()\n return @icons \n end", "title": "" }, { "docid": "9a9575b05f5d1d0f32ab71004209ae4d", "score": "0.5219162", "text": "def icons()\n return @icons \n end", "title": "" }, { "docid": "9a9575b05f5d1d0f32ab71004209ae4d", "score": "0.5219162", "text": "def icons()\n return @icons \n end", "title": "" }, { "docid": "b43d27c182157fba492ef3a0c9843dfe", "score": "0.52127784", "text": "def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end", "title": "" }, { "docid": "7c399cfd7b43d2e93235c45ffd99e485", "score": "0.5211555", "text": "def show\n @microposy = Microposy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposy }\n end\n end", "title": "" }, { "docid": "cd41ccd5729681a21d62372cc25fd837", "score": "0.52111906", "text": "def show\n @lsa_word = LsaWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_word }\n end\n end", "title": "" }, { "docid": "1fad309279a8a273508fcd9f0707b56c", "score": "0.52096", "text": "def index\n @matriclickers = Matriclicker.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matriclickers }\n end\n end", "title": "" }, { "docid": "67d936208fdaf16dcf7f860f8324929b", "score": "0.5208809", "text": "def index\n @entries = SourceGlossaryEntry.eager_load(:locale_glossary_entries).sort_by { |e| e.source_copy.downcase }\n\n respond_with @entries do |format|\n format.json { render json: decorate(@entries).to_json }\n end\n end", "title": "" }, { "docid": "cda65aec1a8c829ab75b1d17997f4a03", "score": "0.518772", "text": "def show\n project_id = params.permit(:id)[:id]\n base_url = \"https://vipul.mingle.thoughtworks.com\"\n pages_url = \"/api/v2/projects/#{project_id}/wiki.xml\"\n response = get_response(base_url + pages_url)\n response_body = Crack::XML.parse(response.body)[\"pages\"]\n @pages = response_body.collect {|a| {:identifier => a[\"identifier\"], :name => a[\"name\"] } }\n render :json => @pages\n end", "title": "" }, { "docid": "a6dd6241b0cce7ec58bbc82e9c4aa6d5", "score": "0.51866555", "text": "def show\n @lexique = Lexique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lexique }\n end\n end", "title": "" }, { "docid": "0a8d0a190ce5a43a6cb84ae3ad8a3842", "score": "0.51768774", "text": "def fetch_for(name)\n all = YAML.load_file(\"all_instagrams.yml\")\n regex = regex_for(name)\n pictures = all.select {|h| h[:caption] =~ regex }\n Dir.mkdir(name) unless File.exists?(name)\n pictures.each do |picture|\n caption = picture[:caption]\n path = \"#{name}/%s.png\" % caption.downcase.scan(/\\w+/).join(\"-\")[0..100]\n url = picture[:picture_url]\n `curl -o #{path} #{url}`\n end\nend", "title": "" }, { "docid": "868506c55a09c59cd087aa52fedb0d24", "score": "0.5174234", "text": "def index\n @hreflangs = Hreflang.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hreflangs }\n end\n end", "title": "" }, { "docid": "dbd070d6f80666eb4de1ac2907da3264", "score": "0.51690304", "text": "def show\n @ithero = Ithero.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ithero }\n end\n end", "title": "" }, { "docid": "52fae7d58689ac2eb08f1ead296df964", "score": "0.51662654", "text": "def show\n @wordy = Wordy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wordy }\n end\n end", "title": "" }, { "docid": "0b110383ae1431d61e73944168f01de7", "score": "0.5162137", "text": "def show\n @word_core = WordCore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_core }\n end\n end", "title": "" }, { "docid": "ff07e9cd4e3a3465491b8dcd977c44be", "score": "0.5160682", "text": "def show\n @dictionary = Dictionary.find(params[:id])\n @source_language = (@dictionary.source_language || Language::UNDETERMINED)\n unsorted_lexemes = @dictionary.lexemes.includes(Lexeme::INCLUDE_TREE[:lexemes])\n @lexemes = @source_language.sort(unsorted_lexemes, by: :primary_headword)\n @page_title = @dictionary.title\n @langs = Dictionary.langs_hash_for(@dictionary)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @dictionary }\n end\n end", "title": "" }, { "docid": "d09e101e9aca9b458aa1582eda72df39", "score": "0.51554334", "text": "def show\n @corpus_neutral = CorpusNeutral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corpus_neutral }\n end\n end", "title": "" }, { "docid": "0a3a618ac03f28e566c1a7ce652053b4", "score": "0.5153091", "text": "def show\n @core_nota_liberada = Core::NotaLiberada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_nota_liberada }\n end\n end", "title": "" }, { "docid": "bf7e24f0693a963f41a3f666d0b1287a", "score": "0.51515186", "text": "def show\n render json: @spell\n end", "title": "" }, { "docid": "89be0c55fedea36b7adb47d6c104e576", "score": "0.5142448", "text": "def show\n @coasilicon = Coasilicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coasilicon }\n end\n end", "title": "" }, { "docid": "24e5d8ca81b432f1345f804191dd7529", "score": "0.5142287", "text": "def show\n @lesson_tags = @lesson.tags\n \n respond_to do |format|\n format.html\n format.json\n end\n end", "title": "" }, { "docid": "d36536a84efe23d014fd7d8fdcd156bc", "score": "0.5137834", "text": "def show\n respond_to do |format|\n format.html\n format.json { render json: @base_word}\n end\n end", "title": "" }, { "docid": "cfafe301e44316db9ff1b9b2a4895516", "score": "0.51370037", "text": "def index\n @lexemes = Lexeme.sorted.includes(Lexeme::INCLUDE_TREE[:lexemes]).paginate(page: params[:page])\n @page_title = t('lexemes.index.page_title')\n @all_langs = Hash[@lexemes.collect do |lex|\n [lex, Dictionary.langs_hash_for(lex.dictionaries)]\n end]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @lexemes }\n end\n end", "title": "" }, { "docid": "6c125eb1f4fabffa66417936a15fcfe3", "score": "0.5129331", "text": "def show\n @wiki = Wiki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @wiki }\n end\n end", "title": "" }, { "docid": "197284413c13654807411a698123a7e4", "score": "0.51264125", "text": "def index\n @intelligence_mods = IntelligenceMod.all\n\n render json: @intelligence_mods\n end", "title": "" }, { "docid": "829c535f98ecd90f17582d6290f5247b", "score": "0.51220536", "text": "def monolingual_definition(word_to_define)\n uri = \"http://en.wiktionary.org/w/api.php?action=parse&prop=wikitext&page=#{word_to_define}&format=json\"\n encoded_uri = URI::encode(uri)\n response = HTTParty.get(encoded_uri)\n binding.pry\n\n \n\n # decode_response = ActiveSupport::JSON.decode(response)\n return response[\"parse\"][\"wikitext\"][\"*\"].split(\"\\n\")\nend", "title": "" }, { "docid": "f0371b9beddf0f8a065f57c7e7f4b7bd", "score": "0.51175684", "text": "def index\n render status: :ok, json: @lectures\n end", "title": "" }, { "docid": "0347d326aafe800c9c679f24c03ba08f", "score": "0.5113391", "text": "def show\n @skillset_lang = SkillsetLang.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skillset_lang }\n end\n end", "title": "" }, { "docid": "a39ea2e3a2f7e28334539e27d3b3a6e9", "score": "0.510899", "text": "def show\n @implate = Implate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @implate }\n end\n end", "title": "" }, { "docid": "3445e4c400181bdeb5c847362bdd746d", "score": "0.5097184", "text": "def show\n @chenil = Chenil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chenil }\n end\n end", "title": "" }, { "docid": "d4909180e25dadcad85cfcf7f6e3fe9d", "score": "0.5095905", "text": "def index\n @patron = patron\n @illiad_response = IlliadResponse.new(current_user.username)\n end", "title": "" }, { "docid": "672f39cc2c227233d576180e4edc0099", "score": "0.50922763", "text": "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "title": "" }, { "docid": "672f39cc2c227233d576180e4edc0099", "score": "0.50922763", "text": "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "title": "" }, { "docid": "c784ec18ff9b164653bb5c90419e9581", "score": "0.50857764", "text": "def show\n @hypocrite = Hypocrite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hypocrite }\n end\n end", "title": "" }, { "docid": "712d4bbcda5726b73286febaeadd6e49", "score": "0.5080555", "text": "def show\n\n @recipe = Recipe.find(params[:id])\n\n @recipe.ingredient = @recipe.ingredient.gsub(\",\", \"\\n\")\n\n token = '' \n\n uri = URI.parse(\"https://api.instagram.com/v1/tags/#{@recipe.name}/media/recent?access_token=#{token}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n @information = response.body\n @hash = JSON.parse(@information)\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n\n \n\n end", "title": "" }, { "docid": "0588791559761321c919f10e4f267599", "score": "0.5078947", "text": "def create_lexicon\n \n File.open(\"../tmp/lexicon.txt\",\"w\") do |file|\n File.open(\"../input/#{@input}/#{@input}.lexicon\").each do |line|\n LexiconRule.new(line).each do |from, terminal, probability|\n file << \"#{@codifier.encode(from)}+#{terminal}+#{@normalizer.normalize(probability)}\\n\"\n end\n end\n end\n \n end", "title": "" }, { "docid": "57e27575d62567125e41d12357fb8095", "score": "0.5074033", "text": "def create\n @lexicon_term = LexiconTerm.new(params[:lexicon_term])\n\n respond_to do |format|\n if @lexicon_term.save\n flash[:notice] = 'LexiconTerm was successfully created.'\n format.html { redirect_to(@lexicon_term) }\n format.xml { render :xml => @lexicon_term, :status => :created, :location => @lexicon_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lexicon_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4c7713faaeed18e3ca48bc87bc1e77f", "score": "0.5072311", "text": "def get_lexicon\n if @hxml.at('Class').inner_text == 'Scientific Name'\n 'Scientific Names'\n else\n 'english'\n end\n end", "title": "" }, { "docid": "b866b47b778ab2a1a9ae2f9ac5047afa", "score": "0.5070265", "text": "def show\n @xvocab = Xvocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xvocab }\n end\n end", "title": "" } ]
72d5c10967f547da98a7aa50d87f6204
convert original transaction data to one with indexed item
[ { "docid": "9e32e03aeabd37468cc50b830f7e72c7", "score": "0.0", "text": "def convTra(ifile,idxObj,index,convTraFile)\n\ttemp=MCMD::Mtemp.new\n\txxmf=temp.file\n\tidxObj.writeAlphaIndex(index,xxmf)\n\tf=\"\"\n\tf << \"mjoin k=item K=alphabet m=#{xxmf} f=index i=#{ifile} |\"\n\tf << \"mcut f=tid,time,index |\"\n\tf << \"muniq k=tid,time,index |\"\n\tf << \"mtra k=tid,time f=index |\"\n\tf << \"mvcount vf=index:size |\"\n\tf << \"mcut f=tid,time,size,index -nfno o=#{convTraFile}\"\n\tsystem(f)\nend", "title": "" } ]
[ { "docid": "ffbb541b7f24cc55df563139252ca7e9", "score": "0.6122215", "text": "def item\n return @data && index >= 0 ? @data[index] : nil unless @category == :transaction\n return transaction_entry(index)\n end", "title": "" }, { "docid": "c9cf91eb863d3e640b25a4aaf63b0b75", "score": "0.59968555", "text": "def reindex\n unspent_tx_outputs = blockchain.unspent_transaction_outputs\n grouped_by_tx_id = unspent_tx_outputs\n\n blockchain.db.transaction do |db|\n db[DB_NAME] = grouped_by_tx_id\n db.commit\n end\n end", "title": "" }, { "docid": "a7bb5b41e13c54199b8bf6ff1eed3afb", "score": "0.59395605", "text": "def process_transactions(txns)\n txns.collect do |txn|\n t = txn.dup\n t['Date'] = Date.strptime(txn['Date'],\"%Y-%m-%d\")\n t['Amount'] = (txn['Amount'].to_f * 100).to_i\n t['Clean Company'] = clean_vendor_name(t)\n t\n end\nend", "title": "" }, { "docid": "74601f16ad1d81f65182667195b52d97", "score": "0.57242686", "text": "def build_inverted_index(key, restaurant)\n @items = {}\n restaurant.items.each do |item|\n item.names.each do |name|\n if(@items[name])\n @items[name].push(InvertedIndexClass.new(item.id, item.price, key, item.price, Array.new([item.id])))\n else\n @items[name] = Array.new([InvertedIndexClass.new(item.id, item.price, key, item.price , Array.new([item.id]))])\n end\n end\n end\n end", "title": "" }, { "docid": "57dc9be4e83e07b5ec9da98736645966", "score": "0.5713568", "text": "def rearrange_the_slow_transactions(slow_transactions); end", "title": "" }, { "docid": "8febbc7a320e81f2aefc368ac5870bac", "score": "0.56795007", "text": "def rearrange_slow_transaction(slow_t); end", "title": "" }, { "docid": "a8664b8bb18755a908022fb4743507a2", "score": "0.56697077", "text": "def new_inventory_transaction\n tran = InventoryTransaction.new\n skus = Product.where(id: items.map(&:order_item).map(&:product_id)).pluck(:sku).uniq\n\n skus.each do |sku|\n quantity = items.select { |x| x.order_item.product.sku == sku }.sum(&:quantity)\n tran.items << InventoryItem.get(sku, quantity) unless quantity == 0\n end\n\n tran\n end", "title": "" }, { "docid": "e3180d4ce074fc15bd7c526d25eff5f5", "score": "0.56338334", "text": "def transform_item(item)\n item\n end", "title": "" }, { "docid": "73e73dd760d6f5851f1106453803945f", "score": "0.5577336", "text": "def parse_from_indexed(data)\n # decode if data is JSON\n data.is_a?(String) and data = ActiveSupport::JSON.decode(data)\n values = self.class.parse_indexed_to_hash(data, self)\n parse_from_json(values)\n end", "title": "" }, { "docid": "757673481afd90aa8d837ef94d95547f", "score": "0.55640006", "text": "def final_value\n middle_value = self.middle_value\n shard_key = @es_options[:sharding][:index][:key]\n Array(middle_value.delete(shard_key)).map do |shard_value|\n data = middle_value.merge(shard_key => shard_value)\n index = Configuration.transaction_index({shard_key => shard_value}, @es_options)\n type = Configuration.type(@es_options)\n id = Configuration.document_id(data, @es_options)\n routing = Configuration.transaction_routing(data, @es_options)\n {:data => data, :_index => index, :_type => type, :_routing => routing, :_id => id}.delete_if{|_, v| v.blank?}\n end\n end", "title": "" }, { "docid": "82a3bc6a70d67922218cbfd180ab74ad", "score": "0.55583036", "text": "def serialize_to_indexed\n data = serialize_to_hash\n self.class.serialize_hash_to_indexed(data).to_json\n end", "title": "" }, { "docid": "0d415df7eec6652909353c36141eb90e", "score": "0.5556967", "text": "def recombine(items)\n items.chunk(&:id).map { |id, items|\n item = items.first\n item.amount = items.count\n item\n }\n end", "title": "" }, { "docid": "a506a879d591b38f5346b88f3a2d0d80", "score": "0.55516344", "text": "def transactionByIndex(index)\n begin\n map = JSON.parse(Net::HTTP.get(@@api_url, \"/tx-index/#{index}?format=json\"))\n rescue\n raise ArgumentError, 'Invalid transaction index'\n end\n parseTransaction(map)\n end", "title": "" }, { "docid": "89ae38f58cd17ee88a4cc3d9a09a1ae8", "score": "0.5544714", "text": "def convert_to_transaction(items)\n type = items[0]\n date = Date.strptime(items[1], \"%m/%d/%Y\") \n description = items[2]\n amnt = items[3].to_f\n Transaction.new(type, date, description, amnt)\n end", "title": "" }, { "docid": "017a5ab723089c13b5404d3a1714dfb9", "score": "0.5510775", "text": "def pack(item, index); end", "title": "" }, { "docid": "7047994267eb341aa6d257b392fd72fe", "score": "0.54806167", "text": "def convert_raw_to_model(array)\n array.map do |hash|\n object = new\n ARRAY_FIELDS.each do |field|\n object.public_send :\"#{field}=\", make_array(hash[DataIndex::FIELDS[field]])\n end\n\n SIMPLE_FIELDS.each do |field|\n object.public_send :\"#{field}=\", hash[DataIndex::FIELDS[field]]\n end\n\n object.hits = hash[:hits]\n\n object\n end\n end", "title": "" }, { "docid": "393329ed3c056e7ed7d8d927045f8e79", "score": "0.5426575", "text": "def upsert_to_search_index!\n self.class.where(id: id).import transform: lambda {|item| item.to_search_mapping }\n end", "title": "" }, { "docid": "393329ed3c056e7ed7d8d927045f8e79", "score": "0.5426575", "text": "def upsert_to_search_index!\n self.class.where(id: id).import transform: lambda {|item| item.to_search_mapping }\n end", "title": "" }, { "docid": "b9a1e25cc6a0e66c5eb2cc79597f463f", "score": "0.5420632", "text": "def set_transaction_ids\n\t\tunless self.barcode.blank?\n\t\t\tresponse = Elasticsearch::Persistence.client.search index: \"pathofast-item-*\", body: {\n\t\t\t\tsize: 1,\n\t\t\t\tquery: {\n\t\t\t\t\tids: {\n\t\t\t\t\t\tvalues: [self.barcode]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmash = Hashie::Mash.new response \n\t\t\t@search_results = mash.hits.hits.map{|c|\n\t\t\t\tc = c[\"_type\"].underscore.classify.constantize.new(c[\"_source\"].merge(:id => c[\"_id\"]))\n\t\t\t\tif c.created_by_user.can_transfer?(c)\n\t\t\t\t\tc.add_owner(self.to_user_id)\n\t\t\t\tend\n\t\t\t\tc\n\t\t\t}\n\t\tend\n\tend", "title": "" }, { "docid": "a27d7e133f771878f5bfe862f08604d3", "score": "0.5416264", "text": "def to_indexed_json\n self.to_json\n end", "title": "" }, { "docid": "48d064a17c0fb012f07ba37146dd45c9", "score": "0.5407452", "text": "def to_transactions(table)\n table.rows.map do |row|\n row_data = table.column_names.zip(row).map do |column_name, value|\n case column_name\n when 'Id'\n ['key', value]\n when 'Timestamp'\n ['timestamp', convert_timestamp(value).utc.iso8601]\n when 'Description'\n ['description', value]\n when 'Account'\n ['account', value]\n when 'Sign'\n ['sign', value]\n when 'Amount'\n ['amount', value.to_f.round(2)]\n else\n raise ArgumentError.new(\"Unknown Transaction column #{column_name}\")\n end\n end\n Hash[row_data]\n end\nend", "title": "" }, { "docid": "1d044a83c0528e90fdc27b16e60bddb9", "score": "0.53901696", "text": "def create_transaction(data)\n t = data\n\n t[:id] = all.length + 1\n t[:result] = data[:result]\n t[:created_at] = Time.new.to_s\n t[:updated_at] = Time.new.to_s\n\n new_transaction = Transaction.new(t, self)\n @all << new_transaction\n new_transaction\n end", "title": "" }, { "docid": "ee2e0c3b184d0b961bbe538fc778ec5a", "score": "0.5384641", "text": "def as_indexed_json\n as_json\n end", "title": "" }, { "docid": "12129cd81aac5211b74f1fc5fff2cd90", "score": "0.5367939", "text": "def current_items_for_index(_items)\n _current_items = []\n # Add purchase orders found\n _items.each do |i|\n _current_items = _current_items << i.id\n end\n _current_items\n end", "title": "" }, { "docid": "58422248c751ae4e1284a6930cae4fb0", "score": "0.53649634", "text": "def rearrange_slow_transaction(slow_t)\n slow_t.as_json.merge(:metrics => rearrange_the_metrics(slow_t.metrics), :allocation_metrics => rearrange_the_metrics(slow_t.allocation_metrics))\n end", "title": "" }, { "docid": "b6a84a3cc03c1580a85f02cbf47118e8", "score": "0.5361492", "text": "def to_hash\n {\n 'Index' => index,\n 'ItemID' => item_id,\n 'TIC' => tic,\n 'Price' => price,\n 'Qty' => quantity\n }\n end", "title": "" }, { "docid": "29d7e93e55a6896ef1551bf74b448f41", "score": "0.5342118", "text": "def simplified_tranxs\n #go through the ur_tranx and just put into charges + payments\n tranxs = self.ur_transactions\n if tranxs.empty? then\n return []\n end\n\n final_tranxs = []\n tranxs.each do |tranx|\n if [\"initial_charge\"].include? tranx.detail_type then\n final_tranxs << UrTransaction.new(\n created_at:tranx.created_at,\n user_reservation_id:tranx.user_reservation_id,\n trans_amount:tranx.trans_amount,\n detail_type:UrTransaction.detail_types[:general_charges])\n elsif [\"cash_payment\", \"cc_payment\", \"tax_payment\", \"provider_share\", \"excess_payment\"].include? tranx.detail_type then\n if final_tranxs.last.detail_type == \"general_payment\" then\n final_tranxs.last.trans_amount += tranx.trans_amount\n else\n final_tranxs << UrTransaction.new(\n created_at:tranx.created_at,\n user_reservation_id:tranx.user_reservation_id,\n trans_amount:tranx.trans_amount,\n detail_type:UrTransaction.detail_types[:general_payment])\n end\n elsif [\"delta_charge\"].include? tranx.detail_type then\n if final_tranxs.last.detail_type == \"general_charges\" then\n final_tranxs.last.trans_amount += tranx.trans_amount\n else\n final_tranxs << UrTransaction.new(\n created_at:tranx.created_at,\n user_reservation_id:tranx.user_reservation_id,\n trans_amount:tranx.trans_amount,\n detail_type:UrTransaction.detail_types[:general_charges])\n end\n else\n final_tranxs << tranx\n end\n end\n\n final_tranxs\n end", "title": "" }, { "docid": "91600e329ff4896b2cb6ed5750a72530", "score": "0.5332993", "text": "def flatten_index\n #new_width = (Math.log(Scripsi.redis.strlen(@document_key),2)/8).ceil\n indxs = Scripsi.redis.zrange \"#{@index_key}:0\", 0, -1\n if Scripsi.redis.strlen(@index_flat_key) == 0\n str = indxs.map{|indx|Scripsi.write_number(indx)}.join\n Scripsi.redis.set @index_flat_key, str\n else\n insertions = {}\n current = Scripsi.redis.get @index_flat_key\n size = Scripsi.redis.strlen(@index_flat_key)/8\n slot = 0\n indxs.each_with_index do |indx,i|\n if slot >= size\n insertions[slot] = indx\n next\n end\n indx = indx.to_i\n puts \"indx: #{indx}, slot: #{slot}, size: #{size}\"\n data = current[i..i*8]\n n = Scripsi.read_number(data)\n word = string_at_index(n)\n cmp = compare_with_index(word,i)\n if cmp < 1\n slot += 1\n redo\n else\n insertions[slot] = indx\n end\n end\n # TODO: insert the stuff\n p insertions\n end\n\n# i = 0\n# loop do\n# d = Scripsi.redis.del \"#{@index_key}:#{i}\"\n# break unless d == 1\n# i += 1\n# end\n end", "title": "" }, { "docid": "6f3cf9aa79553ee6a6038f9e60831964", "score": "0.53031135", "text": "def straighten_transaction(transaction, address: nil)\n outs = []\n total_amount = 0\n transaction['data']['outputs'].each do |out|\n total_amount += out['value'] if address.nil? || address == out['to_address']\n outs << { amount: out['value'], receiving_address: out['to_address'] } \n end\n\n {\n tid: transaction['data']['hash'],\n total_amount: total_amount,\n confirmations: transaction['data']['confirmations'],\n outs: outs\n }\n end", "title": "" }, { "docid": "a32a828e3f07e8aca0dd790e79122b8a", "score": "0.5274816", "text": "def data_for_update(*args)\n data = super\n add_transaction_id_to(data)\n data\n end", "title": "" }, { "docid": "53d51ce872d816bc223c0b5d5bbdc998", "score": "0.52605873", "text": "def straighten_transaction(transaction, address: nil)\n outs = []\n total_amount = 0\n transaction['data']['outputs'].each do |out|\n total_amount += out['value'] if address.nil? || address == out['to_address']\n outs << { amount: out['value'], receiving_address: out['to_address'] } \n end\n\n {\n tid: transaction['data']['hash'],\n total_amount: total_amount,\n confirmations: transaction['data']['confirmations'],\n block_height: (transaction['data']['in_blocks'][0]['height'] rescue nil),\n outs: outs,\n meta: {\n fetched_via: self,\n },\n }\n end", "title": "" }, { "docid": "d35f675614c06635d28e7e761ba731dd", "score": "0.525893", "text": "def skeletonize_primary_index(index_value)\n inventory_object = primary_index.delete(index_value)\n return unless inventory_object\n\n fill_versions!(inventory_object.data)\n\n index[index_value] = inventory_object\n end", "title": "" }, { "docid": "232645c2169241e3355d620bf8ac68b2", "score": "0.52197963", "text": "def transactions\n @_transactions ||= begin\n account_ids_and_names = plaid_item.account_ids_and_names\n\n # we can't use `by month` for imported transactions, as its possible the date was changed to\n # a different month\n imported_transaction_ids = user.transactions.where(\"plaid_transaction_id IS NOT NULL\").pluck(:plaid_transaction_id)\n ignored_transaction_ids = user.ignored_transactions.by_month(month).pluck(:plaid_transaction_id)\n\n data.map do |transaction|\n next unless account_ids_and_names.keys.include?(transaction[\"account_id\"])\n next if transaction[\"pending\"]\n\n transaction[\"account_name\"] = account_ids_and_names[transaction[\"account_id\"]]\n transaction[\"hierarchy\"] = transaction[\"category\"]&.join(\", \")\n transaction[\"imported\"] = imported_transaction_ids.include?(transaction[\"transaction_id\"])\n transaction[\"ignored\"] = ignored_transaction_ids.include?(transaction[\"transaction_id\"])\n\n transaction\n end.compact\n end\n end", "title": "" }, { "docid": "ba33ae7a060240b9af98d8a0f2b35d3e", "score": "0.5218533", "text": "def straighten_transaction(transaction, address: nil)\n outs = []\n total_amount = 0\n transaction['out'].each do |out|\n total_amount += out['value'] if address.nil? || address == out['addr']\n outs << { amount: out['value'], receiving_address: out['addr'] }\n end\n\n {\n tid: transaction['hash'],\n total_amount: total_amount,\n confirmations: calculate_confirmations(transaction),\n block_height: transaction['block_height'],\n outs: outs,\n meta: {\n fetched_via: self,\n },\n }\n end", "title": "" }, { "docid": "9baf8837aa004c52efd4fa9d247be84a", "score": "0.52164865", "text": "def tran_obj\n transaction_object\n end", "title": "" }, { "docid": "427aa797eb6fd7aac43d96804272210a", "score": "0.52089465", "text": "def update(model, item)\n model[name] ||= { 'data': [], 'index': {} }\n model[name]['data'] << item.stringify_keys\n index(model)\n end", "title": "" }, { "docid": "e092e6b938d5ba6936a7204d15738ab9", "score": "0.5208005", "text": "def to_transaction_hash\n {\n account: row_hash[\"Account\"],\n flag: row_hash[\"Flag\"],\n date: row_hash[\"Date\"],\n payee: row_hash[\"Payee\"],\n category_group_and_category: row_hash[\"Category Group/Category\"],\n category_group: row_hash[\"Category Group\"],\n category: row_hash[\"Category\"],\n memo: row_hash[\"Memo\"],\n outflow: row_hash[\"Outflow\"],\n inflow: row_hash[\"Inflow\"],\n cleared: row_hash[\"Cleared\"] == \"Cleared\"\n }\n end", "title": "" }, { "docid": "13e7c37796d973ceabd83736d5d89b17", "score": "0.5204068", "text": "def collect_delta_information( from_tia_item, to_tia_item )\n self.delta_hash = Hash.new\n FIELDS_TO_COPY.each do |f|\n if from_tia_item[ f ] != to_tia_item[ f ] then\n self.delta_hash[ f ] = from_tia_item[ f ]\n end\n end\n\n # set reference to TiaItem only when there were changes\n # to force valid? to fail\n\n self.tia_item_id = self.delta_hash.empty? ? nil : to_tia_item.id\n end", "title": "" }, { "docid": "5ea3ede0a40cd419b4cb815ca1b97a32", "score": "0.5201841", "text": "def reindex(prefix_id = nil)\n tuid = 1\n self.transunits.each do |unit|\n unit.unitid = \"#{prefix_id}#{tuid}\"\n tuid += 1\n end\n end", "title": "" }, { "docid": "14d292b1ce0af539b23df64d74805df5", "score": "0.52011627", "text": "def as_indexed_json(*)\n respond_to?(:serialized_json) ? serialized_json : as_json(except: [:id, :_id])\n end", "title": "" }, { "docid": "cb41daf726daa6971126bbdc6e462a5f", "score": "0.51923424", "text": "def decode_tx_to_btc_tx(tx)\n hash = {\n 'version' => tx['version'],\n 'lock_time' => tx['locktime'],\n 'hex' => tx['hex'],\n 'txid' => tx['txid'],\n 'blockhash' => tx['blockhash'],\n 'confirmations' => tx['confirmations'],\n 'time' => tx['time'],\n 'blocktime' => tx['blocktime'],\n 'in' => tx['vin'].map{|input|\n {'output_index' => input['vout'], 'previous_transaction_hash' => input['txid'], 'coinbase' => input['coinbase'],\n 'scriptSig' => input['scriptSig']['asm'], 'sequence' => input['sequence']}},\n 'out' => tx['vout'].map{|out|\n {'amount' => out['value'], 'scriptPubKey' => out['scriptPubKey']['asm']}\n }\n }\n Bitcoin::Protocol::Tx.from_hash(hash)\n end", "title": "" }, { "docid": "f3a448119630f89ca016146aef1b828c", "score": "0.5186394", "text": "def straighten_transaction(transaction, address: nil)\n outs = []\n total_amount = 0\n transaction['outputs'].each do |out|\n total_amount += out['value'] if address.nil? || address == out['addresses'].first\n outs << { amount: out['value'], receiving_address: out['addresses'].first }\n end\n\n {\n tid: transaction['hash'],\n total_amount: total_amount,\n confirmations: transaction['confirmations'],\n block_height: transaction['block_height'],\n outs: outs,\n meta: {\n fetched_via: self,\n },\n }\n end", "title": "" }, { "docid": "c64d3a407678c917e375c7361d4718e3", "score": "0.5173485", "text": "def item; @data[@index]; end", "title": "" }, { "docid": "38f2638f2960a938d7b214899d4d6eed", "score": "0.51725537", "text": "def prepare_for_index(batch, options = { })\n # some models need some extra preparation for faster indexing.\n # I tried to just define a custom `prepare_for_index` in\n # Taxon, but this one from this module took precedence\n if self.respond_to?(:prepare_batch_for_index) && !options[:skip_prepare_batch]\n prepare_batch_for_index(batch)\n end\n batch.map do |obj|\n { index: { _id: obj.id, data: obj.as_indexed_json } }\n end\n end", "title": "" }, { "docid": "ea3e2467cb54da37d10c434e2f7700f5", "score": "0.5152037", "text": "def reindex\n @indexes = {}\n add_to_indexes( @records )\n end", "title": "" }, { "docid": "b9ded57a275197f565ee74c31ae8cd56", "score": "0.5148737", "text": "def reindex\n index = 1\n @all.each {|item|\n if not item.completed\n item.index = index\n index = index + 1\n end\n }\n end", "title": "" }, { "docid": "aeea66376a328d47645b1fe76f4b2076", "score": "0.5145901", "text": "def to_hash\n index_hash = Hash.new\n self.each do |invoices|\n index_hash[invoices.accounts_id] = invoices.to_s\n end\n index_hash\n end", "title": "" }, { "docid": "bbfb946c9ec634560113233462115828", "score": "0.5140375", "text": "def item_to_model(item)\n ret_attributes = {}\n ret_attributes[id_field] = item.name\n \n data_attributes = item.respond_to?(:data) ? item.data.attributes : item.attributes\n (attributes - [id_field.to_sym]).each do |a|\n attribute_name = a.to_s\n values = data_attributes[attribute_name]\n if values\n val = attribute_name.pluralize == attribute_name ? values : values.select {|v| !v.nil?}.first #if attribute looks like an array, return an array\n ret_attributes.merge!({a => val })\n end\n end\n \n self.new(ret_attributes)\n end", "title": "" }, { "docid": "8b7b057cfcfd397a99564b987fa2b273", "score": "0.511677", "text": "def rearrange_the_slow_transactions(slow_transactions)\n slow_transactions.to_a.map { |t| rearrange_slow_transaction(t) }\n end", "title": "" }, { "docid": "8b736d17ed0e2e3c277cdbda51941b8f", "score": "0.51121527", "text": "def touch(index)\n record = item(index)\n record.touch\n record.store\nend", "title": "" }, { "docid": "a3788a6cb9b93014210de1a99c84a3cc", "score": "0.509432", "text": "def to_indexed_json\n super.merge({\n avatar_url: decorate.avatar(:thumb),\n parts: parts.approved.map{|p|\n {\n id: p.id,\n mpn: p.mpn,\n name: p.name,\n }\n },\n synonyms: synonym_tags_cached,\n _tags: product_tags_cached,\n })\n end", "title": "" }, { "docid": "1dd3dabe738d899ced0aa577351eb5d9", "score": "0.5091874", "text": "def get_item_list\n arr = []\n @transaction[:items].each do |item|\n arr << { name: item[:name], price: item[:price], currency: item[:currency], quantity: item[:quantity] }\n end\n end", "title": "" }, { "docid": "415b9aa9cada7f2f6744ab66ebda395f", "score": "0.50795335", "text": "def retrieve_index\n set_objects_instance @master_objects\n s = { objects_name => filter_records.as_json(current_user: current_user), multiple_results: objects_name }\n s.merge!(extend_result)\n if object_instance\n s[:original_item] = object_instance\n s[objects_name] << object_instance\n end\n s[:master_id] = @master.id unless primary_model.no_master_association\n s.to_json\n end", "title": "" }, { "docid": "3e1996c9e0761485d711b812c544b954", "score": "0.5077216", "text": "def transaction_data(accid)\n cur_key = @last_block.hashid\n data = []\n while @blocks[cur_key] && cur_key\n records = @blocks[cur_key].record\n cur_key = @blocks[cur_key].parent_hash\n records.each do |trans|\n next unless trans.source.id == accid || trans.recipient.id == accid\n data << trans\n puts SPLIT_LINE\n puts \"Info: #{trans.info} | payment is from: #{trans.source.name} | to: #{trans.recipient.name}\"\n puts \"Bits Amount: #{trans.value}\"\n puts \"Item: #{trans.goods.name} x#{trans.good_amount}\" if trans.goods\n end\n end\n puts SPLIT_LINE\n return data\n end", "title": "" }, { "docid": "3e1996c9e0761485d711b812c544b954", "score": "0.5077216", "text": "def transaction_data(accid)\n cur_key = @last_block.hashid\n data = []\n while @blocks[cur_key] && cur_key\n records = @blocks[cur_key].record\n cur_key = @blocks[cur_key].parent_hash\n records.each do |trans|\n next unless trans.source.id == accid || trans.recipient.id == accid\n data << trans\n puts SPLIT_LINE\n puts \"Info: #{trans.info} | payment is from: #{trans.source.name} | to: #{trans.recipient.name}\"\n puts \"Bits Amount: #{trans.value}\"\n puts \"Item: #{trans.goods.name} x#{trans.good_amount}\" if trans.goods\n end\n end\n puts SPLIT_LINE\n return data\n end", "title": "" }, { "docid": "fc89c58aae2ccd523caa4240db4e3e52", "score": "0.50701624", "text": "def to_catalog\n return @data.dup\n end", "title": "" }, { "docid": "a0a91122d6678a3bd0ace60d96eb69ce", "score": "0.5058443", "text": "def add_index_value(table_name, obj, opts = {})\n if Dynamoid::Config.partitioning?\n # existing = Dynamoid::Adapter.read(table_name, obj.hash_key, { :range_key => values[:range_value] })\n #ids = ((existing and existing[:ids]) or Set.new)\n #Dynamoid::Adapter.write(self.table_name, {:id => values[:hash_value], :ids => ids.merge([obj.hash_key]), :range => values[:range_value]})\n elsif Dynamoid::Config.remove_empty_index?\n key = opts.delete(:id)\n if obj.range_value\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}.#{obj.range_value}\"])}\n else\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}\"])}\n end\n \n adapter.update_item(table_name, key, opts, &add_block)\n else\n key = opts.delete(:id)\n if obj.range_value\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}.#{obj.range_value}\"])}\n else\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}\"])}\n end\n adapter.update_item(table_name, key, opts, &add_block)\n end\n end", "title": "" }, { "docid": "107570c9110e1d46bf635be55eb9272b", "score": "0.5056177", "text": "def to_trans_data\n bynary_data =\n @type.to_s(2).rjust(8, \"0\") +\n @code.to_s(2).rjust(8, \"0\") +\n @checksum.to_s(2).rjust(16, \"0\") +\n @id.to_s(2).rjust(16, \"0\") + # 0x01 -> 00000000 00000001\n @seq_number.to_s(2).rjust(16, \"0\")\n\n data_byte_arr = bynary_data.scan(/.{1,8}/)\n data_byte_arr.map! { |byte| byte.to_i(2).chr } # TO ASCII\n data_byte_arr.join + @data\n end", "title": "" }, { "docid": "f1058b222fad1003c5c83a570a024167", "score": "0.50560033", "text": "def as_indexed_json(*)\n # TODO: fix ES problems with #as_flattened_jsonld\n as_jsonld\n end", "title": "" }, { "docid": "f87a102742214fc779ac0eb6f43b37d0", "score": "0.5055433", "text": "def _transform(item)\n case item\n when Array\n item.each { |e| _transform(e) }\n when Hash\n # dates into Date objects\n for key in ['date', 'updated_at', 'created_at', 'expression_date', 'commencement_date', 'assent_date', 'publication_date']\n if item.has_key? key and item[key].is_a? String\n item[key] = Date.parse(item[key])\n end\n end\n\n # size to _size to avoid Hashie conflict\n item['_size'] = item.delete('size') if item.has_key? 'size'\n\n item.each_value { |e| _transform(e) }\n end\n end", "title": "" }, { "docid": "e3110aad8fb879b7c6793985b41cc08f", "score": "0.5054509", "text": "def slice_to_bulk_json(item_slice, index_name=\"entities\")\n\n ### conver tot format\n bulk_list = []\n item_slice.each do |i|\n # two lines per\n # https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html\n bulk_list << {\"index\" => { \"_id\" => i.id, \"_index\" => index_name}}\n bulk_list << i.to_hash\n end\n\n # return the bulk request we're going to make\n out = bulk_list.map{|x| x.to_json }\n\n \"#{out.join(\"\\n\") }\" << \"\\n\"\n end", "title": "" }, { "docid": "942fa4a313720d47638792dee48d2d43", "score": "0.50537366", "text": "def to_hash\n @index\n end", "title": "" }, { "docid": "8729f4b6c152fdbd72b39c496e21315f", "score": "0.5042196", "text": "def transform_row(row)\n row\n end", "title": "" }, { "docid": "8729f4b6c152fdbd72b39c496e21315f", "score": "0.5042196", "text": "def transform_row(row)\n row\n end", "title": "" }, { "docid": "8729f4b6c152fdbd72b39c496e21315f", "score": "0.5042196", "text": "def transform_row(row)\n row\n end", "title": "" }, { "docid": "ff349c1b0d4e4b497df04a74eba09d18", "score": "0.50411904", "text": "def as_indexed_json(_options={})\n Hash[regular_index_fields.map { |field| [field, self.send(field)] }].merge(special_index_fields.stringify_keys)\n end", "title": "" }, { "docid": "d35300f940ac5cf4a2c94810d7bffd0f", "score": "0.5040427", "text": "def as_indexed_json(*)\n { file: Base64.encode64(data) }\n end", "title": "" }, { "docid": "acf6f132ef9190c9ba044e57027d7f9f", "score": "0.5039182", "text": "def data_set(type, data)\n self.ser_type = type\n self.ser_data = data.serialize\n\n # Update the entries in the 'ident' index-table\n\n old_set = {}\n self.idents.each do |ident|\n old_set[ident.identifier] = ident\n end\n\n new_set = {}\n data.identifier.each do |identifier|\n new_set[identifier.to_s] = true\n end\n\n new_set.each_key do |identifier|\n if ! old_set.has_key?(identifier)\n i = Ident.new\n i.identifier = identifier.to_s\n self.idents << i\n end\n end\n\n old_set.each_pair do |identifier, ident|\n if ! new_set.has_key?(identifier)\n self.idents.delete(ident)\n end\n end\n \n end", "title": "" }, { "docid": "bfa15e18a776fcffad9e15824b7b5cd7", "score": "0.50292075", "text": "def to_indexed_json\n #result= self.as_json\n #puts \"to_indexed_json: #{result.inspect}\"\n #return result\n result = @attributes.as_json\n puts \"json: #{result.inspect}\"\n return result\n end", "title": "" }, { "docid": "d8360214f4b1e30ac016188258a2e3a3", "score": "0.5025415", "text": "def copy\n self.class.new.tap do |new_trans|\n attributes.each do |key,value|\n new_trans.send(\"#{key}=\", value) unless key == \"id\"\n end\n new_trans.save\n end\n end", "title": "" }, { "docid": "a9bba22d3ab318e5a028ee2bdba1c4c7", "score": "0.5025005", "text": "def convert\n options = @options.dup\n tag = options.delete(:tag)\n return CSV.generate(options) do |csv|\n csv << HEADERS\n @data[\"transactions\"].each do |txaction|\n csv << convert_txaction(txaction, tag)\n end\n end\n end", "title": "" }, { "docid": "ba07df1cf7eaa3cf1ecd07206d673864", "score": "0.5023693", "text": "def transcribe(old_array)\n old_array.each do |dynamic_array|\n dynamic_array.each do |item|\n self[item.key] = item.value\n end\n end\n end", "title": "" }, { "docid": "ccef1bc13bb326c44ef399a16973d9b5", "score": "0.5021984", "text": "def normalize_index(index)\n index\n end", "title": "" }, { "docid": "4d772498a75d892f5171d3d7d9b77a61", "score": "0.50219345", "text": "def to_indexed_json\n to_json(methods: [:state, :close_date, :item_name, :checkpoint_description, :aircraft_registration, :zone_name])\n end", "title": "" }, { "docid": "e7d5f7e437bb62f9cf0ae8da89b1d962", "score": "0.50212944", "text": "def gen_first_item\n sqlu = \"select * from ogoods.pospal_orders\"\n res = @rds.query(sqlu)\n res.each do |r|\n oid=r['order_id']\n\n if r['raw_data'].nil?\n sqlu = \"UPDATE ogoods.pospal_orders set first_item='', items_count=0 where order_id='#{oid}'\"\n else\n order = JSON.parse(r['raw_data'])\n items_count = 0\n if !order['items'].nil?\n order['items'].each do |itm|\n items_count += itm['productQuantity'].to_i\n end\n end\n first_item = ''\n first_item = order['items'][0]['productName'] if !order['items'].nil? && !order['items'].empty?\n sqlu = \"UPDATE ogoods.pospal_orders set first_item='#{first_item}', items_count=#{items_count} where order_id='#{oid}'\"\n end\n resu = @rds.query(sqlu)\n end\nend", "title": "" }, { "docid": "7f07777bcb6f364bbf2dd8ced0945e61", "score": "0.5021235", "text": "def to_item(**options) = convert_to('item', **options)", "title": "" }, { "docid": "b6da5aadd9544daf9aad409b1e8da5a4", "score": "0.5016736", "text": "def as_indexed_json(options = {})\n as_json(\n only: [:id, :barcode, :quantity, :cost],\n include: { product: {only: [:name, :id, :price]}}\n )\n end", "title": "" }, { "docid": "b42269afc41882e8d1e5413bc252c1bc", "score": "0.50166166", "text": "def merge_block(block)\n block.record.each do |trans|\n @balance -= trans.value if trans.source.id == @id\n @balance += trans.value if trans.recipient.id == @id\n next unless trans.goods\n good_hash = trans.goods.hashid\n @item_amount[good_hash] = 0 if @item_amount[good_hash].nil?\n @item_amount[good_hash] += trans.good_amount if trans.source.id == @id\n @item_amount[good_hash] -= trans.good_amount if trans.recipient.id == @id\n end\n end", "title": "" }, { "docid": "b42269afc41882e8d1e5413bc252c1bc", "score": "0.50166166", "text": "def merge_block(block)\n block.record.each do |trans|\n @balance -= trans.value if trans.source.id == @id\n @balance += trans.value if trans.recipient.id == @id\n next unless trans.goods\n good_hash = trans.goods.hashid\n @item_amount[good_hash] = 0 if @item_amount[good_hash].nil?\n @item_amount[good_hash] += trans.good_amount if trans.source.id == @id\n @item_amount[good_hash] -= trans.good_amount if trans.recipient.id == @id\n end\n end", "title": "" }, { "docid": "91434ba21bcb7fad4b1dc26ff7364539", "score": "0.50127184", "text": "def transform_data(record)\n arr = record.split\n if record.start_with?('insert')\n #@counters saves the state of the counters as the counternames get printed at fixed intervals\n #reset values to [] when counter names are reset\n @counters = arr\n @values = []\n else\n @values = arr\n end\n\n if @values and @values.length > 0\n rec = Hash[@counters.zip @values]\n transformed_rec = {}\n begin\n transformed_rec[\"Insert Operations/sec\"] = rec[\"insert\"].delete(\"*\") \n transformed_rec[\"Query Operations/sec\"] = rec[\"query\"].delete(\"*\")\n transformed_rec[\"Update Operations/sec\"] = rec[\"update\"].delete(\"*\")\n transformed_rec[\"Delete Operations/sec\"] = rec[\"delete\"].delete(\"*\")\n transformed_rec[\"Total Data Mapped (MB)\"] = rec[\"mapped\"].delete(\"M\")\n transformed_rec[\"Virtual Memory Process Usage (MB)\"] = rec[\"vsize\"].delete(\"M\")\n transformed_rec[\"Resident Memory Process Usage (MB)\"] = rec[\"res\"].delete(\"M\") \n transformed_rec[\"Get More Operations/sec\"] = rec[\"getmore\"]\n transformed_rec[\"Page Faults/sec\"] = rec[\"faults\"]\n transformed_rec[\"Total Open Connections\"] = rec[\"conn\"]\n transformed_rec[\"Replication Status\"] = rec[\"repl\"] if rec.has_key?(\"repl\")\n transformed_rec[\"Network In (Bytes)\"] = to_bytes(rec[\"netIn\"])\n transformed_rec[\"Network Out (Bytes)\"] = to_bytes(rec[\"netOut\"])\n\n ar, aw = rec[\"ar|aw\"].split(\"|\")\n transformed_rec[\"Active Clients (Read)\"] = ar\n transformed_rec[\"Active Clients (Write)\"] = aw\n\n qr, qw = rec[\"qr|qw\"].split(\"|\")\n transformed_rec[\"Queue Length (Read)\"] = qr\n transformed_rec[\"Queue Length (Write)\"] = qw\n\n command = rec[\"command\"]\n if command.include?(\"|\")\n local, replicated = command.split(\"|\")\n transformed_rec[\"Local Commands/sec\"] = local\n transformed_rec[\"Replicated Commands/sec\"] = replicated\n else\n transformed_rec[\"Commands/sec\"] = command \n end\n\n #version >= 3 rec has the counternames locked, dirty, used, non-mapped, flushes\n transformed_record[\"% Time Global Write Lock\"] = rec[\"locked\"] if rec.has_key?(\"locked\")\n transformed_record[\"% WiredTiger Dirty Byte Cache\"] = rec[\"dirty\"] if rec.has_key?(\"dirty\")\n transformed_record[\"% WiredTiger Cache in Use\"] = rec[\"used\"] if rec.has_key?(\"used\")\n if rec.has_key?(\"non-mapped\")\n transformed_rec[\"Total Virtual Memory (MB)\"] = rec[\"non-mapped\"].delete(\"M\")\n end\n if rec.has_key?(\"flushes\")\n version = get_mongostat_version\n transformed_rec[\"WiredTiger Checkpoints Triggered\"] = rec[\"flushes\"] if version >= 3.2\n transformed_rec[\"Fsync Operations/sec\"] = rec[\"flushes\"] if version < 3.2\n end\n\n #version >=3.2 has the counternames lr|lw, lrt|lwt\n if rec.has_key?(\"lr|lw\")\n lr, lw = rec[\"lr|lw\"].split(\"|\")\n transformed_rec[\"% Read Lock Acquisition Time\"] = lr\n transformed_rec[\"% Write Lock Acquisition Time\"] = lw\n end\n if rec.has_key?(\"lrt|lwt\")\n lrt, lwt = rec[\"lrt|let\"].split(\"|\")\n transformed_rec[\"Avg. Read Lock Acquisition Time (ms)\"] = lrt\n transformed_rec[\"Avg. Write Lock Acquisition Time (ms)\"] = lwt\n end\n rescue => e\n $log.warn e.to_s\n end\n \n dataitems = {} \n dataitems[\"Timestamp\"] = OMS::Common.format_time(Time.now.to_f)\n dataitems[\"Host\"] = OMS::Common.get_hostname\n dataitems[\"ObjectName\"] = \"MongoDB\"\n dataitems[\"InstanceName\"] = OMS::Common.get_hostname\n collections = []\n\n transformed_rec.each { |k,v|\n if v.nil? or v == \"nil\"\n OMS::Log.warn_once(\"Dropping null value for counter #{k}\")\n else\n counter_pair = {\"CounterName\" => k, \"Value\" => v} \n collections.push(counter_pair) \n end\n }\n dataitems[\"Collections\"] = collections \n \n return dataitems\n end\n end", "title": "" }, { "docid": "e14982cf285fa08de31c1f6d530c936a", "score": "0.50107074", "text": "def to_hash\n index_hash = Hash.new\n self.each do |billinghistories|\n index_hash[billinghistories.accounts_id] = billinghistories.to_s\n end\n index_hash\n end", "title": "" }, { "docid": "541a4cb7bed18f05bdb67455fb5f633b", "score": "0.5009204", "text": "def to_index_document\n georss = calc_bounding_box\n {\n uuid: doi,\n dc_identifier_s: doi,\n dc_title_s: default_title,\n dc_creator_sm: creator_names.map(&:strip),\n dc_type_s: type,\n dc_description_s: description_text_for(Datacite::Mapping::DescriptionType::ABSTRACT).to_s.strip,\n dc_subject_sm: subjects,\n dct_spatial_sm: geo_location_places,\n georss_box_s: (georss ? georss.to_s : nil),\n solr_geom: bounding_box_envelope,\n solr_year_i: publication_year,\n dct_issued_dt: issued_date,\n dc_rights_s: license_name,\n dc_publisher_s: publisher,\n dct_temporal_sm: dct_temporal_dates,\n dryad_related_publication_name_s: related_publication_name,\n dryad_related_publication_id_s: related_publication_id,\n dryad_author_affiliation_name_sm: author_affiliations,\n dryad_author_affiliation_id_sm: author_affiliation_ids,\n dryad_dataset_file_ext_sm: dataset_file_exts,\n dcs_funder_sm: dataset_funders,\n updated_at_dt: updated_at_str\n }\n end", "title": "" }, { "docid": "3ec5966a4058692a7949484809e7bf3d", "score": "0.50069964", "text": "def get_txn(id)\n txn_id = id\n\n # Get the transaction and check that it exists\n txn_doc = @firestore.col(TXN_COL_NAME).doc(txn_id).get\n if txn_doc.exists?\n # Construct the transaction object that we need\n txn_data = txn_doc.data\n\n # Deconstruct main transaction object\n total_amt = txn_data[:amount]\n tax_amt = txn_data[:taxes]\n date = txn_data[:date] # Ruby date object\n store_id = txn_data[:store_id]\n items_from_firestore = txn_data[:items]\n\n # Deconstruct each item\n items = []\n items_from_firestore.each do |firestore_item|\n\n item_name = firestore_item[:name]\n item_cost = firestore_item[:cost]\n item_qty = firestore_item[:quantity]\n item_price_unit = firestore_item[:price_unit]\n # Add to array\n items.push Transaction::Item.new(item_name, item_cost,\n item_price_unit, item_qty)\n end\n\n Transaction.new(txn_id, total_amt, tax_amt,\n date, store_id, items)\n else\n log_info \"Transaction with id #{txn_id} was not found\"\n nil\n end\n end", "title": "" }, { "docid": "9274b1b5402ec6b745edad3b2a803e2b", "score": "0.50053895", "text": "def to_indexed_json\n @attributes.to_json\n end", "title": "" }, { "docid": "d67fd74868278743999ccd2389f88661", "score": "0.50051296", "text": "def item_to_object(_item)\n self.new(_item, false) # new_record false for existing records\n end", "title": "" }, { "docid": "d4421dcebb39b211565a5b540d92206f", "score": "0.500427", "text": "def to(position); end", "title": "" }, { "docid": "d4421dcebb39b211565a5b540d92206f", "score": "0.500427", "text": "def to(position); end", "title": "" }, { "docid": "d4421dcebb39b211565a5b540d92206f", "score": "0.500427", "text": "def to(position); end", "title": "" }, { "docid": "737d3ff172e178727bb5da3b1ff8bac5", "score": "0.49996138", "text": "def build(hash)\n hash, uuid, inventory_object = primary_index_scan(hash)\n\n # Return InventoryObject if found in primary index\n return inventory_object unless inventory_object.nil?\n\n # We will take existing skeletal record, so we don't duplicate references for saving. We can have duplicated\n # reference from local_db index, (if we are using .find in parser, that causes N+1 db queries), but that is ok,\n # since that one is not being saved.\n inventory_object = skeletal_primary_index.delete(uuid)\n\n # We want to update the skeletal record with actual data\n inventory_object&.assign_attributes(hash)\n\n # Build the InventoryObject\n inventory_object ||= new_inventory_object(enrich_data(hash))\n\n # Store new InventoryObject and return it\n push(inventory_object)\n inventory_object\n end", "title": "" }, { "docid": "087fa34dffe40a897a02cc46a0cb3fb3", "score": "0.49891153", "text": "def items_formatted\n items = Array.new\n vouch_items.each do |item|\n new_item = Hash.new\n business = Business.find(item.business_id)\n new_item[\"id\"] = item.business_id\n new_item[\"name\"] = business.name\n new_item[\"neighborhood\"] = business.neighborhood\n new_item[\"city\"] = business.city\n new_item[\"yelp_rating\"] = business.yelp_rating\n new_item[\"yelp_reviews\"] = business.yelp_review_count\n new_item[\"item_id\"] = item.id\n\n items << new_item\n end\n items\n end", "title": "" }, { "docid": "e1fa88e17722a8773843120a032bc8e7", "score": "0.49874964", "text": "def txin_data tx_id, txin, idx, p2sh_type = nil\n data = {\n tx_id: tx_id, tx_idx: idx,\n script_sig: txin.script_sig.blob,\n prev_out: txin.prev_out.blob,\n prev_out_index: txin.prev_out_index,\n sequence: txin.sequence.unpack(\"V\")[0],\n }\n data[:p2sh_type] = SCRIPT_TYPES.index(p2sh_type) if @config[:index_p2sh_type]\n data\n end", "title": "" }, { "docid": "a2541ac34ce28a6e634991ea5e77b948", "score": "0.49773735", "text": "def compact_cast\n Production.transaction do\n cast_list.each_with_index do |credit, index|\n credit.position = index\n credit.save\n end\n end\n end", "title": "" }, { "docid": "6a43b963fc602cc9d56664f1c112990b", "score": "0.49706027", "text": "def to_indexed_json\n {\n :id => self._id.to_s,\n :filename => self.filename,\n :filetype => self.filetype,\n :filesize => self.filesize,\n :tag => self.tags,\n :category => self.categories.collect(&:_id),\n :description => self.description,\n :created_at => self.created_at,\n :downloads_count => self.downloads_count,\n :comments_count => self.comments_count,\n :rate => self.statistics.rate,\n :owner_id => self.owner_id.to_s,\n :owner_name => self.owner.name,\n }.to_json\n end", "title": "" }, { "docid": "48871d76cc8eb3b016f7ddc031734b87", "score": "0.4970491", "text": "def build_transaction(data)\n Transaction.new(\n account: self,\n id: data['nummov'],\n amount: money(data['importe']),\n description: data['conceptoTabla'],\n effective_date: parse_date(data['fechaValor']),\n operation_date: parse_date(data['fechaOperacion']),\n balance: money(data['saldo'])\n )\n end", "title": "" }, { "docid": "6c929cb291d54c70d8cf17fa14cf575b", "score": "0.49632418", "text": "def revert!\n new_split_rows = splits.map { |split| { amount: -split.amount, account: split.account, item: split.item } }\n\n Transaction.build do |tr|\n tr.description = \"Reversing Tranasction(#{id})\"\n tr.splits.create(new_split_rows)\n end\n end", "title": "" }, { "docid": "61057aff6d6d10834378e2b3737fdf1a", "score": "0.49590757", "text": "def make_index\n @triples.sort!\n\n @index = {}\n @triples.each { |x| @index[x.oid] = x }\n end", "title": "" }, { "docid": "c7bf3f51f545e0ddc2cc64f7713ada8d", "score": "0.4955501", "text": "def editToArray(record_number,record)\r\n editArray = deconstruct record\r\n $new_array[record_number.to_i] = editArray\r\n end", "title": "" }, { "docid": "efbb56df67d115deca0cb68a3264c410", "score": "0.49538442", "text": "def convert\n map do |item|\n if item['doc']\n document = item['doc']\n elsif item['id']\n document = { _id: item['id'] }\n revision = item['value']['rev'] || item['value']['_rev']\n document['_rev'] ||= revision if revision\n else\n raise \"Couldn't find _id for document in list #{item.inspect}\"\n end\n \n if document.is_a? ChillDB::Document\n document\n elsif document.respond_to? :to_hash\n revision = item['value']['_rev'] || item['value']['rev'] || item['doc']['_rev']\n document['_rev'] ||= revision if revision\n document = ChillDB::Document.new(@database, document.to_hash)\n else\n raise \"Cannot convert #{document.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "cc46cc75b97e69a5585d9e3b91f7fafc", "score": "0.4952735", "text": "def deserialize_transaction( transaction_hex ) \n\n\ttransaction = {}\n\ttransaction[:version] \t\t= reverse_byte_order( transaction_hex[0...8] ).to_i(16)\n\ttransaction[:in_counter] \t= transaction_hex[8...10].to_i(16)\n\tpt = 4\n\n\tget_next_val \t\t\t\t= get_var_length_val( transaction_hex, pt )\n\ttransaction[:in_counter] \t== get_next_val[0]\n\tpt += get_next_val[1]\n\n\t\n\ttransaction[:inputs] = []\n\t(0...transaction[:in_counter]).each { | i |\n\t\t\n\t\tinput = {}\n\t\tinput[:prevhash] \t\t= reverse_byte_order( transaction_hex[ (pt * 2)...(pt + 32)*2 ] )\n\t\tpt += 32\n\t\tinput[:prevoutputindex] = reverse_byte_order( transaction_hex[ (pt * 2)...(pt + 4)*2 ] ).to_i(16)\n\t\tpt += 4\n\n\t\tget_next_val \t\t\t= get_var_length_val( transaction_hex, pt )\n\t\tinput[:scriptLength] \t= get_next_val[0]\t\n\t\tpt += get_next_val[1]\n\n\t\tscript_sig = []\n\t\t(0...input[:scriptLength]).each { |j|\n\t\t\tscript_sig << transaction_hex[ (pt * 2)...(pt + 1)*2]\n\t\t\tpt += 1\n\t\t}\n\t\tinput[:scriptSig] = script_sig\n\t\tinput[:sequence] = transaction_hex[ (pt * 2)...(pt + 4)*2]\n\t\tpt += 4\n\t\ttransaction[:inputs] << input\n\t}\n\t\n\tget_next_val \t\t\t\t= get_var_length_val( transaction_hex, pt )\n\ttransaction[:out_counter] \t= get_next_val[0]\n\tpt += get_next_val[1]\n\t\n\n\ttransaction[:outputs] = []\n\t(0...transaction[:out_counter]).each { |i| \n\t\toutput = {}\n\t\toutput[:value] = reverse_byte_order( transaction_hex[ (pt * 2)...(pt + 8)*2] ).to_i(16)\n\t\tpt += 8\n\n\t\tget_next_val = get_var_length_val( transaction_hex, pt )\n\t\toutput[:pubkeyScriptLength] = get_next_val[0]\n\t\tpt += get_next_val[1]\n\n\t\tpubkeyScriptSig = []\n\t\t(0...output[:pubkeyScriptLength]).each { |j| \n\t\t\tpubkeyScriptSig << transaction_hex[ (pt * 2)...(pt + 1)*2]\n\t\t\tpt += 1\n\t\t}\n\t\toutput[:pubkeyScriptSig] = pubkeyScriptSig\n\n\t\ttransaction[:outputs] << output\n\t}\n\n\ttransaction[:lock_time] = transaction_hex[ (pt * 2)...(pt + 4)*2]\n\n\treturn transaction\nend", "title": "" }, { "docid": "9e55c1b8224c6fcc05965cae3ab35c07", "score": "0.49438065", "text": "def get_item_list\n arr = []\n @transaction.items.each do |item|\n # activate this later\n # arr << { name: item.name, price: item.price, currency: item: currency, quantity: item.quantity }\n end\n end", "title": "" }, { "docid": "7a1d3ec13b2f9d1920c93737164d0667", "score": "0.49431425", "text": "def to_hash\n {\n \"#{@name}@en-US\" => {\n \"items\" => @indices,\n \"lastAccess\" => @last_access.to_i\n }\n }\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "971467bb0beda5a46cb086ffe355edb3", "score": "0.0", "text": "def set_car\n @car = Car.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
373f5ed93b1ea9c5a148ef801c32f8e4
return html for markdown formatted page content
[ { "docid": "a5e9c2206e01e4d36ae32ffede97577d", "score": "0.6695246", "text": "def content\n\t\treturn Redcarpet.new(parse_links(@content)).to_html\n\tend", "title": "" } ]
[ { "docid": "3fad3dfd1e90cab8744101d84c1d528c", "score": "0.82271236", "text": "def render_md page, content\n markdown(content || self.body) # HACK\n end", "title": "" }, { "docid": "3fad3dfd1e90cab8744101d84c1d528c", "score": "0.82271236", "text": "def render_md page, content\n markdown(content || self.body) # HACK\n end", "title": "" }, { "docid": "c6cdf9f3213b035e581fd7dfbd507ab2", "score": "0.81594545", "text": "def html\n Markdown.render(self.content)\n end", "title": "" }, { "docid": "c6cdf9f3213b035e581fd7dfbd507ab2", "score": "0.81594545", "text": "def html\n Markdown.render(self.content)\n end", "title": "" }, { "docid": "b317616fa0eaf071b0489c0e1ceda6f4", "score": "0.80995464", "text": "def html_markup_markdown(text); end", "title": "" }, { "docid": "ec8b95a1bf937df9464379f56cc65024", "score": "0.7912706", "text": "def content\n MarkdownService.new.render(body).html_safe \n end", "title": "" }, { "docid": "c7063c4459f2611c6371fc699df6c1cb", "score": "0.7702279", "text": "def markdown content\n require \"kramdown\"\n\n content = content.\n gsub(/^``` *(\\w+)/) { \"{:lang=\\\"#$1\\\"}\\n~~~\" }.\n gsub(/^```/, '~~~')\n\n Kramdown::Document.new(content, KRAMDOWN_CONFIG).to_html\n end", "title": "" }, { "docid": "c7063c4459f2611c6371fc699df6c1cb", "score": "0.7702279", "text": "def markdown content\n require \"kramdown\"\n\n content = content.\n gsub(/^``` *(\\w+)/) { \"{:lang=\\\"#$1\\\"}\\n~~~\" }.\n gsub(/^```/, '~~~')\n\n Kramdown::Document.new(content, KRAMDOWN_CONFIG).to_html\n end", "title": "" }, { "docid": "7ca93a1038cb2662206960b10cbcb0a4", "score": "0.7598148", "text": "def content \n \trenderer = SyntaxRenderer.new(optionize [\n \t:with_toc_data,\n \t#{:hard_wrap,\n \t:xhtml,\n \t:prettify\n \t])\n \n \tmarkdown = Redcarpet::Markdown.new(renderer, optionize([\n \t:fenced_code_blocks,\n \t:no_intra_emphasis,\n \t:tables,\n \t:superscript,\n \t:autolink,\n \t:strikethrough,\n \t:space_after_headers,\n \t:with_toc_data,\n \t:quote,\n \t:lax_spacing\n \t]))\n \n \treturn markdown.render(parse_links(@content)) \n\tend", "title": "" }, { "docid": "c00ef9d8d6a65f9d7853a599fe242838", "score": "0.75795555", "text": "def to_html\n @markdown_class.new(@markdown).to_html\n end", "title": "" }, { "docid": "00b704266eae74ed4bcb4ba76690546b", "score": "0.7555984", "text": "def to_html\n determine_markdown_renderer\n @markdown.to_html\n end", "title": "" }, { "docid": "ea1e5638474ff3e57ba471fa32e8c43c", "score": "0.7548909", "text": "def markdown\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n end", "title": "" }, { "docid": "c368c8d42c411e31cce7d9d1243b6db3", "score": "0.75421685", "text": "def render_markdown\n return if self.markdown.nil?\n\n render_as = Redcarpet::Render::HTML\n engine = Redcarpet::Markdown.new(render_as, :autolink => true,\n :space_after_headers => true)\n self.content = engine.render(self.markdown)\n end", "title": "" }, { "docid": "7658534fe3dfc26f6a423d464de0df7a", "score": "0.75354195", "text": "def render_markdown\n return @render if @render\n @render = Markdown.new(:content => content, :indent => self.indent, :path => self.commit ? \"/commits/#{self.commit.id}#{self.web_path}\" : self.web_path)\n @render\n end", "title": "" }, { "docid": "e10e32407f6ee7788dc07bc2502d17e6", "score": "0.75012815", "text": "def markdown\n @markdown ||= process_markdown!\n end", "title": "" }, { "docid": "afce73aec5862569a74dd77539a4b499", "score": "0.7497602", "text": "def convert_markdown\n # self.content_html = Kramdown::Document.new(content).to_html\n self.content_html = markdown(content)\n end", "title": "" }, { "docid": "2fca5658a057f91c10cb74d3e83bae9f", "score": "0.7493262", "text": "def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end", "title": "" }, { "docid": "86da5b3bf14df8dbf1a80561f1e30362", "score": "0.74694765", "text": "def md(text)\n renderer = Redcarpet::Render::HTML.new\n extensions = {filter_html: true}\n redcarpet = Redcarpet::Markdown.new(renderer, extensions)\n redcarpet.render(text).html_safe\n end", "title": "" }, { "docid": "2e10083a7a39b4f2b42e6a2eddffd860", "score": "0.74428624", "text": "def print_markdown(txt)\n Markdown::Processor.instance.render(txt)\n end", "title": "" }, { "docid": "cd5cbea9dad60c9c8ff66af309ecd106", "score": "0.74244756", "text": "def markdown( text )\n Kramdown::Document.new( text ).to_html\n end", "title": "" }, { "docid": "0445912ce2993a08dc5ab013bdd37626", "score": "0.7409655", "text": "def mdrender\n \t@markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n end", "title": "" }, { "docid": "157ab27ce6e5bf220c71e445273fc5dd", "score": "0.7405961", "text": "def markdown(text)\n\t\tBlueCloth::new(text).to_html\n\tend", "title": "" }, { "docid": "662e7264be743d61885fe519fcf9ab35", "score": "0.7331886", "text": "def html_to_markdown(content,user)\n filenumber = user.id\n filename = filenumber.to_s+\".html\"\n %x[\"touch #{filename}\"]\n File.atomic_write(\"tmp/#{filename}\") do |file|\n file.write(content)\n end\n html_content = `pandoc -f html -t markdown \"tmp/#{filename}\"`\n File.delete(\"tmp/#{filename}\")\n return html_content\n end", "title": "" }, { "docid": "dff8e5dc4df41aa2031008edf991adc5", "score": "0.7297849", "text": "def process_markdown\n self.explanation_html = Kramdown::Document.new(explanation_md || '').to_html.gsub(/[\\r\\n]+/, '')\n end", "title": "" }, { "docid": "da222b591302586699fc123faefe0d3c", "score": "0.72891134", "text": "def markdown(text)\n# coderayified = CodeRayify.new(:filter_html => true,:hard_wrap => true)\n coderayified = PygmentsHTML.new(\n with_toc_data: true,\n hard_wrap: true\n )\n# coderayified = Redcarpet::Render::HTML.new(:filter_html => true,:hard_wrap => true)\n options = {\n :no_intra_emphasis => true,\n :tables => true,\n :fenced_code_blocks => true,\n :autolink => true,\n :strikethrough => true,\n :lax_spacing => true,\n :superscript => true\n }\n markdown_to_html = Redcarpet::Markdown.new(coderayified, options)\n markdown_to_html.render(text).html_safe\n end", "title": "" }, { "docid": "5d001be6b43817878e848d7bf0b3ec6d", "score": "0.7277837", "text": "def markdown(text)\n BlueCloth::new(text).to_html\n end", "title": "" }, { "docid": "92c09a3712acd3cc273a781ad59691a3", "score": "0.72597396", "text": "def content!\n if File.exist?(file)\n markdown_to_html\n else\n @type = :empty\n \"\"\n end\n end", "title": "" }, { "docid": "9e04d15b2f3ae52f44972f435739e086", "score": "0.72418046", "text": "def body_as_html\n markdown = MarkdownPresenter.new(body)\n markdown.convert_to_html\n end", "title": "" }, { "docid": "1020f191e5fc6972b8401be8c8340e57", "score": "0.7226132", "text": "def markdown(text)\n BlueCloth.new(text).to_html\n end", "title": "" }, { "docid": "a42d62413b5b3784d6489c25a23b31bb", "score": "0.7218175", "text": "def markdown(text) # Define method markdown with redcarpet gem\n\t\tRedcarpet::Markdown.new(Redcarpet::Render::HTML).render(text)\n end", "title": "" }, { "docid": "99bd23c9b877a2ec723448bbd104e502", "score": "0.7214059", "text": "def show\n @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n end", "title": "" }, { "docid": "2cd3595c11b72f7360f67907dcc31f98", "score": "0.7193669", "text": "def markdown_output_html\n \n if self.markdown_output\n self.markdown_output\n else\n self.markdown_output = MARKDOWN_RENDERER.render(self.output)\n end\n end", "title": "" }, { "docid": "0ea2f57269d509a8d73eecfee5f22e41", "score": "0.7189432", "text": "def markdown(text)\n raw sanitize Markdown.new(text).to_html\n end", "title": "" }, { "docid": "890b02e064de9e87cdedc49bd153972d", "score": "0.718152", "text": "def markdown_to_html\n html = RDiscount.new(File.read file).to_html\n html = syntax_highlight(html) if config.highlighter\n html = prepend_h1(html) if config.autoh1\n html\n end", "title": "" }, { "docid": "b40f971669152c7ef377489e70ce116b", "score": "0.7179209", "text": "def markdown(text)\n sanitize BlueCloth::new(text).to_html\n end", "title": "" }, { "docid": "ba635dd69587de93fd1128a8f2431533", "score": "0.7167181", "text": "def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end", "title": "" }, { "docid": "216562c0d5ea282e4861260967a393dc", "score": "0.7156446", "text": "def markdown(text)\n return '' if text.nil? || text.empty?\n Wink::Markdown.new(text, :smart).to_html\n end", "title": "" }, { "docid": "216562c0d5ea282e4861260967a393dc", "score": "0.7156446", "text": "def markdown(text)\n return '' if text.nil? || text.empty?\n Wink::Markdown.new(text, :smart).to_html\n end", "title": "" }, { "docid": "5502e50e3d7626ebc0fea765580ea0cd", "score": "0.71534044", "text": "def liquidize_markdown(content, arguments)\n # doc = BlueCloth.new(Liquid::Template.parse(content).render(arguments, :filters => [LiquidFilters], \n # :registers => {:controller => controller, :view => self, :account_site_assets => account_site_assets, :current_user => current_user}))\n doc = ::Kramdown::Document.new(Liquid::Template.parse(content).render(arguments, :filters => [LiquidFilters], \n :registers => {:controller => controller, :view => self, :account_site_assets => account_site_assets, :current_user => current_user}),\n :parse_block_html => true)\n return doc.to_html.html_safe\n end", "title": "" }, { "docid": "5cc611f46a2780ba993c939df3b93f83", "score": "0.7147459", "text": "def markdown(text)\n BlueCloth::new(text).to_html\nend", "title": "" }, { "docid": "b0b1d0e35217fb865f701998adce82de", "score": "0.71325165", "text": "def parse_markdown\n self.body_html = markdown.render(body_markdown.to_s)\n self.summary_html = markdown.render(summary_markdown.to_s)\n end", "title": "" }, { "docid": "99767f5938d6112a5878d19460831967", "score": "0.71217155", "text": "def markdown(content)\n @markdown_renderer ||= CodeRayify.new(:filter_html => true, :hard_wrap => true)\n \n @markdown_options ||= {\n :fenced_code_blocks => true,\n :no_intra_emphasis => true,\n :autolink => true,\n :lax_html_blocks => true,\n }\n \n @markdown ||= Redcarpet::Markdown.new(@markdown_renderer, @markdown_options)\n @markdown.render(content).html_safe\n end", "title": "" }, { "docid": "56a3b2b3d30e0527ac19ae45f1d01ef9", "score": "0.7110632", "text": "def writeMarkdown(doc, page)\n\n layers = page[\"children\"].reverse\n pagetitle = page[\"name\"]\n blocks = []\n\n # Let's get the text layers\n text = layers.select do |layer|\n layer[\"type\"] === \"TEXT\"\n end\n\n # Let's get only the frames\n frames = layers.select do |layer|\n layer[\"type\"] === \"FRAME\"\n end\n \n # let's build this\n frames.each do |frame|\n ftitle = self.showTitle?(frame[\"name\"]) ? frame[\"name\"] : nil\n fimage = self.getFrameImage(doc, page[\"name\"], frame)\n ftext = self.getFrameText(text, frame[\"name\"])\n\n blocks.push([ftitle, \"/#{@assetpath}/#{fimage}\", ftext])\n end\n\n\n # Do we have a summary?\n summary = text.select do |layer|\n layer[\"name\"] == \"_summary.md\"\n end\n\n summary = summary.size > 0 ? summary.first[\"characters\"] : nil\n\n # Do we have a tags?\n tags = text.select do |layer|\n layer[\"name\"] == \"_tags\"\n end\n\n tags = tags.size > 0 ? tags.first[\"characters\"] : nil\n menutag = !tags.nil? ? tags.split(\",\").first : nil\n\n \n # Export markdown from erb template\n filename = \"#{doc[\"document\"].parameterize}-#{pagetitle.parameterize}\"\n template = File.read('_plugins/figma-template.md.erb')\n result = ERB.new(template).result(binding)\n\n open(\"#{@pagespath}/#{filename}.md\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n [pagetitle, filename, menutag]\n end", "title": "" }, { "docid": "4370aa573d02438a853f4746accdd3a0", "score": "0.7100404", "text": "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "title": "" }, { "docid": "e09db1f9d96b2af47ac95c7d7a412ffe", "score": "0.7098316", "text": "def markdown(text)\n return \"\" unless text\n\n CommonMarker.render_doc(text, :SMART).to_html([:NOBREAKS]).html_safe\n end", "title": "" }, { "docid": "b2a6b1cfd5e2e2bd0a6a60330ea79925", "score": "0.70786816", "text": "def call\n markdown = markdown_renderer.result(schema: schema)\n if @html\n html = markdown_parser.render(markdown)\n html = html_renderer.result(body: html)\n html.gsub(/id=\"(.+)\"/) {|text| text.tr(\"/:\", \"\") }\n else\n markdown\n end\n rescue Jdoc::Link::ExampleNotFound => exception\n abort(\"Error: #{exception.to_s}\")\n end", "title": "" }, { "docid": "557abcdefe605efed46bfd7d5c60ed56", "score": "0.7072377", "text": "def markdown(content)\n renderer = CodeRayify.new(hard_wrap: true, filter_html: true)\n options = {\n autolink: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n lax_html_block: true,\n strikethrough: true,\n superscript: true,\n underline: true,\n disable_indented_code_blocks: true,\n }\n\n Redcarpet::Markdown.new(renderer, options).render(content).html_safe\n end", "title": "" }, { "docid": "ddc4f2cfc4f66021ca98f2c85e264d75", "score": "0.7070711", "text": "def md_to_html\n options = {\n filter_html: true,\n link_attributes: {\n rel: \"nofollow\",\n target: \"_blank\"\n }\n }\n\n extensions = {\n space_after_headers: true,\n autolink: true\n }\n\n renderer = Redcarpet::Render::HTML.new(options)\n markdown = Redcarpet::Markdown.new(renderer, extensions)\n\n self.description = markdown.render(self.description_md)\n end", "title": "" }, { "docid": "6a837940a185fc361b3c2677981bd218", "score": "0.7058999", "text": "def call\n result = self.class.markdown_renderer.result(schema: schema)\n if @html\n result = self.class.html_renderer.result(body: self.class.redcarpet.render(result))\n result.gsub(/id=\"(.+)\"/) {|text| text.tr(\"/:\", \"\") }\n else\n result\n end\n end", "title": "" }, { "docid": "3c77fe2a3c179209eda741885da957e8", "score": "0.70488715", "text": "def markdown\n @markdown ||= Redcarpet::Markdown.new(\n Blogelator::HTMLRenderer,\n autolink: true,\n disable_indented_code_blocks: true,\n fenced_code_blocks: true,\n space_after_headers: true\n )\n end", "title": "" }, { "docid": "3c77fe2a3c179209eda741885da957e8", "score": "0.70488715", "text": "def markdown\n @markdown ||= Redcarpet::Markdown.new(\n Blogelator::HTMLRenderer,\n autolink: true,\n disable_indented_code_blocks: true,\n fenced_code_blocks: true,\n space_after_headers: true\n )\n end", "title": "" }, { "docid": "4d25cde2748c5c5f7539a6091dfea721", "score": "0.70464045", "text": "def render_markdown(text)\n html_renderer.render(text).html_safe if text.present?\n end", "title": "" }, { "docid": "389029a1273db9c087ce5da07b2c483a", "score": "0.7043583", "text": "def markdown(text)\n BlueCloth::new(text).to_html.html_safe\n end", "title": "" }, { "docid": "ed1f8a87f884d83353f5e399cac1ac39", "score": "0.701636", "text": "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end", "title": "" }, { "docid": "ed1f8a87f884d83353f5e399cac1ac39", "score": "0.701636", "text": "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end", "title": "" }, { "docid": "e57827199c31a61f589d12840df6795d", "score": "0.70117015", "text": "def markdown(text)\n Markdown.new(text, :hard_wrap, :autolink).to_html.html_safe\n end", "title": "" }, { "docid": "7b8a11f76b654d5783df589d8b8e985d", "score": "0.7010701", "text": "def markdown(text)\n options = {\n filter_html: true,\n hard_wrap: true, \n link_attributes: { rel: 'nofollow', target: \"_blank\" },\n space_after_headers: true, \n fenced_code_blocks: true\n }\n\n extensions = {\n autolink: true,\n superscript: true,\n disable_indented_code_blocks: true\n }\n\n renderer = Redcarpet::Render::HTML.new(options)\n markdown = Redcarpet::Markdown.new(renderer, extensions)\n\n markdown.render(text).html_safe\n end", "title": "" }, { "docid": "48280bafd1a17be6a98d8233319bb8ec", "score": "0.7009607", "text": "def parse_markdown\n self.bio_html = markdown.render(bio_markdown)\n end", "title": "" }, { "docid": "4c515c594af4d695169a800740a742b3", "score": "0.69981927", "text": "def markdownToHTML(markdown)\n output = \"\"\n IO.popen($mmdPath, \"w+\") do |f|\n f.print markdown\n f.close_write\n output = f.gets(nil)\n end\n return output\nend", "title": "" }, { "docid": "ca48c16ca7a349a7c2b0527317a6d644", "score": "0.6995353", "text": "def markdown_to_html(content)\n render_options = {hard_wrap: true, filter_html: true, safe_links_only: true}\n markdown_options = {no_intraemphasis: true, autolink: true, superscript: true, fenced_code_blocks: true }\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(render_options),markdown_options)\n return markdown.render(content).html_safe\n end", "title": "" }, { "docid": "11aa1887b4e2d0a637b81596c2fd401b", "score": "0.69783044", "text": "def markdown(text)\n coderayified = CodeRayify.new(filter_html: true, hard_wrap: true)\n options = {\n link_attributes: { rel: 'nofollow', target: '_blank' },\n space_after_headers: true,\n fenced_code_blocks: true,\n no_intra_emphasis: true,\n autolink: true,\n strikethrough: true,\n lax_html_blocks: true,\n superscript: true\n }\n markdown = Redcarpet::Markdown.new(coderayified, options)\n markdown.render(text).html_safe\n end", "title": "" }, { "docid": "82a6013b8fcf44c512d007697160001c", "score": "0.6974548", "text": "def simple_markdown(text)\n simple_format markdown text\n end", "title": "" }, { "docid": "3d326b515b2ba6b3b901ea9d59c50f48", "score": "0.6966022", "text": "def display_body\n pages = $repo.commits.first.tree.contents.map { |blob| Page.new(blob.name) }\n \n # mostly taken from JunebugWiki, regexps this beautiful should be shared\n body.gsub(/\\[\\[([\\w0-9A-Za-z -]+)[|]?([^\\]]*)\\]\\]/) do\n page = title = $1.strip\n title = $2 unless $2.empty?\n page_url = page.gsub(/ /, '_')\n\n if pages.map(&:name).include?(page_url)\n %Q{<a href=\"/#{page_url}\">#{title}</a>}\n else\n %Q{<span>#{title}<a href=\"/e/#{page_url}\">?</a></span>}\n end\n end\n \n end", "title": "" }, { "docid": "b21c28edf05c1ec26320fc03f6faae5e", "score": "0.6950184", "text": "def markdown(text)\n htmlcoderay = HTMLWithCoderay.new(filter_html: true,\n hard_wrap: true)\n options = {\n fenced_code_blocks: true,\n no_intra_emphasis: true,\n autolink: true,\n lax_html_blocks: true,\n tables: true,\n strikethrough: true,\n superscript: true,\n underline: true,\n highlight: true,\n footnotes: true,\n with_toc_data: true\n }\n\n markdown_to_html = Redcarpet::Markdown.new(htmlcoderay, options)\n begin\n markdown_to_html.render(text).html_safe\n rescue ArgumentError => e\n \"<h1>Error in Markdown: #{e.message}</h1><p>#{@blog.body}</p>\".html_safe\n end\n end", "title": "" }, { "docid": "385c861bb189ec8460c434000304d8dc", "score": "0.6947177", "text": "def markdown_to_html(src)\n render_options = {\n prettify: true,\n }\n renderer = MdRenderer.new(render_options)\n extensions = {\n no_intra_emphasis: true,\n autolink: true,\n tables: true,\n fenced_code_blocks: true,\n strikethrough: true,\n underline: true,\n quote: true,\n footnotes: true,\n }\n md = ::Redcarpet::Markdown.new(renderer, extensions)\n html = md.render(src)\n return html\n end", "title": "" }, { "docid": "05f21ea5df25b1495f3ab1644344c1d0", "score": "0.6946642", "text": "def markdown(text)\n coderayified = CodeRayify.new(:filter_html => true, \n :hard_wrap => true,\n :coderay_default_lang => 'ruby'\n )\n options = {\n :fenced_code_blocks => true,\n :no_intra_emphasis => true,\n :autolink => true,\n }\n markdown_to_html = Redcarpet::Markdown.new(coderayified, options)\n markdown_to_html.render(text).html_safe\n end", "title": "" }, { "docid": "0d939e4c9c5bc06081aa7adbe0278553", "score": "0.69416416", "text": "def markdown_to_html(src)\n render_options = {\n prettify: true,\n }\n renderer = MarkdownRenderer.new(render_options)\n extensions = {\n no_intra_emphasis: true,\n autolink: true,\n tables: true,\n fenced_code_blocks: true,\n strikethrough: true,\n underline: true,\n quote: true,\n footnotes: true,\n }\n md = ::Redcarpet::Markdown.new(renderer, extensions)\n html = md.render(src)\n return html\n end", "title": "" }, { "docid": "700cbebc783771aefd8e4f7b8082421a", "score": "0.69363075", "text": "def markdown(text)\n sanitize(BlueCloth::new(text).to_html)\n end", "title": "" }, { "docid": "aea3181d54c4ffdeacce58991ea36550", "score": "0.69204885", "text": "def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end", "title": "" }, { "docid": "a3752c5ffee5d46f9f55901f5cf7051f", "score": "0.69170344", "text": "def render_markdown(markdown)\n settings.markdown_renderer.render(markdown)\n end", "title": "" }, { "docid": "ace9d81696c969c02d0ade3157bcd750", "score": "0.69039845", "text": "def markdown(txt)\n options = %i[\n hard_wrap filter_styles autolink\n no_intraemphasis fenced_code gh_blockcode\n ]\n doc = Nokogiri::HTML(Redcarpet.new(txt, *options).to_html)\n doc.search('//pre[@lang]').each do |pre|\n pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])\n end\n doc.xpath('//body').to_s.gsub(%r{</?body>}, '').html_safe\n end", "title": "" }, { "docid": "9478bb2eff3109ce58af644835f974e7", "score": "0.6901079", "text": "def body\n HTML.render render_md, options\n end", "title": "" }, { "docid": "f7237ed5b8ac51532d1f0a15e2cd4e07", "score": "0.6896876", "text": "def description_html\n Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(description)\n end", "title": "" }, { "docid": "a4b00e21135445e52155b17e9f2f1efa", "score": "0.6890265", "text": "def markdown(text)\n Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n autolink: true,\n tables: true\n ).render(text).html_safe # rubocop:disable Rails/OutputSafety\n end", "title": "" }, { "docid": "82b9a2aee30ca74b8ef22e92cf4eec6e", "score": "0.68790364", "text": "def formatter(content)\n #render_options = {hard_wrap: true, filter_html: true, safe_links_only: true}\n #markdown_options = {no_intraemphasis: true, autolink: true, superscript: true}\n #markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(render_options),markdown_options)\n #return markdown.render(content).html_safe\n return markdown_to_html(content) unless content.nil?\n end", "title": "" }, { "docid": "7db08d9f8907a53755d31faee723b4ff", "score": "0.6870853", "text": "def preprocessMarkdownForHTML(markdown)\n output = \"\"\n inInstructions = false\n \n markdown.split(\"\\n\").each do |line|\n # parse an instructions list\n # use a dummy HTML tag so our final regex doesn't get stuck in an infinite loop replacing itself\n instructionsMatch = line.match(/^>>\\s*(.*?)$/)\n if instructionsMatch\n if not inInstructions\n output += \"<instructions>\\n\"\n end\n output += instructionsMatch[1] + \"\\n\"\n inInstructions = true\n next # don't try to parse anything else\n elsif inInstructions\n output += \"</instructions>\\n\"\n inInstructions = false\n end\n\n # parse headers and page IDs\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length.to_s\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n node = nodeWithID(headerID, $doc.toc.rootNode)\n if not node\n puts \"ERROR: Couldn't find node with ID #{headerID}\"\n exit 1\n end\n output += \"<h#{headerLevel}><a name=\\\"#{headerID}\\\">#{node.levelPrefix} #{headerTitle}</a></h#{headerLevel}>\\n\"\n next\n end\n \n # parse links to page IDs and replace with links to the real .htm file\n while 1\n linkMatch = line.match(/\\[.*?\\]\\((@@(.*?))\\)/)\n if linkMatch\n linkID = linkMatch[2]\n linkValue = linkToPageIDFrom(linkID, \"_PAGE_\") # use dummy value\n if not linkValue\n puts \"ERROR: Invalid link ID \\\"#{linkID}\\\"\"\n exit 1\n end\n line[linkMatch[1]] = linkValue\n else\n break\n end\n end\n \n # parse image and label combo\n imgLabelMatch = line.match(/!!\\[(.*?)\\]\\((.*?)\\)/)\n if imgLabelMatch\n label = imgLabelMatch[1]\n imgPath = imgLabelMatch[2]\n \n # read the image and width height to force the size on images for better loading\n # when viewing the files in the boot DVD. there are some issues where anchor jump\n # links don't always jump to the right place on the boot DVD and apparently forcing\n # the image sizes allows the pages to jump properly.\n \t\timgWidth = 0\n \t\timgHeight = 1\n \t\tbegin\n \t\t data = nil\n \t\t if (imgPath =~ /.png$/)\n \t\t data = IO.read($pagesDir + \"/\" + imgPath, 8, 16).unpack('NN')\n\t\t else\n\t\t puts \"ERROR: Unsupported image type: #{imgPath}\"\n\t\t exit 1\n\t end\n \t\t if (data)\n \t\t imgWidth = data[0]\n \t\t imgHeight = data[1]\n\t\t end\n\t\t rescue\n\t end\n imgWidthHeightAttrs = \"\"\n if imgWidth != 0 and imgHeight != 0\n imgWidthHeightAttrs = \" width=\\\"#{imgWidth}\\\" height=\\\"#{imgHeight}\\\"\"\n end\n\n output += \"<p class=\\\"imageAndLabel\\\"><img src=\\\"#{imgPath}\\\" alt=\\\"\" + CGI::escapeHTML(label) + \"\\\"#{imgWidthHeightAttrs}/><br/><em>\" + CGI::escapeHTML(label) + \"</em></p>\\n\"\n next\n end\n \n # parse warning paragraphs\n warningMatch = line.match(/^!!\\s+(.*?)$/)\n if warningMatch\n output += \"<warning>\\n\" + warningMatch[1] + \"\\n<\\/warning>\\n\"\n next\n end\n \n output += line + \"\\n\"\n end\n \n # close off an open instructions div\n if inInstructions\n output += \"</instructions>\\n\"\n end\n \n # Markdown doesn't allow processing of markup within block-level tags such as <div>, so we have to manually process the markup.\n # We call preprocessMarkdownForHTML() to properly process our custom markup within these custom block elements.\n # An extra newline is added to force a paragraph\n while 1\n instructionsMatch = output.match(/(<instructions>)(.*?)(<\\/instructions>)/m)\n if instructionsMatch\n output[instructionsMatch[1]] = \"<div class=\\\"instructions\\\">\"\n output[instructionsMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+instructionsMatch[2]))\n output[instructionsMatch[3]] = \"</div>\"\n else\n break\n end\n end\n \n while 1\n warningMatch = output.match(/(<warning>)\\s*(.*?)(<\\/warning>)/m)\n if warningMatch\n output[warningMatch[1]] = \"<div class=\\\"warning\\\"><div class=\\\"warningBody\\\"><div class=\\\"warningImg\\\"></div><div class=\\\"warningContent\\\">\"\n output[warningMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+warningMatch[2]))\n output[warningMatch[3]] = \"</div></div></div>\"\n else\n break\n end\n end\n \n return output\nend", "title": "" }, { "docid": "22727eb5a8d14f44609f4cd39bacc4b6", "score": "0.68703866", "text": "def markdown(text)\n render_options = {\n filter_html: true,\n hard_wrap: true,\n link_attributes: { rel: 'nofollow' }\n # no_images: true\n }\n renderer = Redcarpet::Render::HTML.new(render_options)\n\n extensions = {\n autolink: true,\n fenced_code_blocks: true,\n lax_spacing: true,\n no_intra_emphasis: true,\n }\n Redcarpet::Markdown.new(renderer, extensions).render(text).html_safe\n end", "title": "" }, { "docid": "d85dfce3bb99ea4534158b4aa78b96fd", "score": "0.68639517", "text": "def render_markdown(file)\n renderer = PygmentizeHTML\n extensions = {:autolink => true, :hard_wrap => true, :space_after_headers => true, :highlight => true, :tables => true, :fenced_code_blocks => true, :gh_blockcode => true}\n redcarpet = Redcarpet::Markdown.new(renderer, extensions)\n @file = redcarpet.render file\n end", "title": "" }, { "docid": "e0b21fd3ca05e827ad3cf2bcc36bb5e6", "score": "0.6863211", "text": "def to_html(content)\n case @parser\n when :kramdown, 'kramdown'\n require 'kramdown'\n Kramdown::Document.new(content).to_html\n when :redcarpet, 'redcarpet'\n require 'redcarpet'\n markdown = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n smart: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n autolink: true,\n tables: true,\n with_toc_data: true\n )\n\n # add smartypants support\n Redcarpet::Render::SmartyPants.render markdown.render(content)\n when :rdiscount, 'rdiscount'\n require 'rdiscount'\n RDiscount.new(content).to_html\n when :gfm, :github, :github_markdown, 'gfm', 'github_markdown'\n require 'github/markdown'\n GitHub::Markdown.render(content)\n end\n end", "title": "" }, { "docid": "7684ff25228fef6b0fe7ba85946316e5", "score": "0.6857911", "text": "def markdown(text)\n renderer = Redcarpet::Render::SmartyHTML\n options = {\n autolink: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n lax_html_blocks: true,\n strikethrough: true,\n superscript: true\n }\n Redcarpet::Markdown.new(renderer, options).render(text).html_safe\n end", "title": "" }, { "docid": "2ecb63ce780918095ef22abc09e62c22", "score": "0.68422145", "text": "def to_s\n MarkdownService.markdown_as_text(md_title, true)\n end", "title": "" }, { "docid": "074a6b1e31fed09ca510ca86773b99fe", "score": "0.683", "text": "def markdownify(input); end", "title": "" }, { "docid": "a5cb5f48cc79f5a946f74f50dae69205", "score": "0.6809071", "text": "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "title": "" }, { "docid": "e21e70c2c05a33eac5c1a79b3eb87b05", "score": "0.6799979", "text": "def to_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true)\n html = markdown.render(content)\n html = markdown_extention_youtube_links(html)\n return html.html_safe\n end", "title": "" }, { "docid": "ace4e20061c7e9730eb11d39d0d7f460", "score": "0.6796474", "text": "def markdown(text)\n renderer = HTMLwithPygments.new(:hard_wrap => true)\n options = {\n :fenced_code_blocks => true,\n :no_intra_emphasis => true,\n :autolink => true,\n :strikethrough => true,\n :lax_html_blocks => true,\n :superscript => true,\n :space_after_headers => true\n }\n Redcarpet::Markdown.new(renderer, options).render(text).html_safe\n end", "title": "" }, { "docid": "29382f0ee70173c163aa76b143585aff", "score": "0.67936456", "text": "def markdown_body\n self[:markdown_body]\n end", "title": "" }, { "docid": "caac1da75ab4e03fbec75af043d65330", "score": "0.6773186", "text": "def markdown_command_html\n if self.markdown_command \n self.markdown_command\n else\n self.markdown_command = MARKDOWN_RENDERER.render(self.command)\n end\n end", "title": "" }, { "docid": "3cf43025a41f146ebbd856b66051bbba", "score": "0.67601484", "text": "def markdown(source)\n Open3.popen2('pandoc', '-s', '-f', 'markdown', '-t', 'html') do |stdin, stdout, wait_thr|\n stdin.puts(source)\n stdin.close\n stdout.read\n end\nrescue => e\n STDERR.puts e\n nil\nend", "title": "" }, { "docid": "d0878260a16371d903ffdd00cd7263e8", "score": "0.6757573", "text": "def block_html(html)\n html.gsub(/<markdown>([\\d\\D]+?)<\\/markdown>/) {|_|\n extensions = {fenced_code_blocks: true}\n renderer = Redcarpet::Markdown.new(WithHighlights, extensions)\n renderer.render(Regexp.last_match[1])\n }\n end", "title": "" }, { "docid": "fd2e54ed042807ea69a82ca1b4aeb2c1", "score": "0.6754646", "text": "def call\n # mode = (context[:gfm] != false) ? :gfm : :markdown\n # html = GitHub::Markdown.to_html(@text, mode)\n # html.rstrip!\n # html\n\n options = context[:redcarpet_options] || {}\n renderer = HtmlWithRouge.new(\n filter_html: options.fetch(:filter_html, false),\n hard_wrap: options.fetch(:hard_wrap, true)\n )\n options.reject! { |k, v| [:filter_html, :hard_wrap].include?(k) }\n markdown = Redcarpet::Markdown.new(renderer, options)\n html = markdown.render(@text)\n html.rstrip!\n html\n end", "title": "" }, { "docid": "196e8f1dad4247e04f3a7a02a53429fd", "score": "0.6753487", "text": "def html_markup_html(text); end", "title": "" }, { "docid": "c2af020f73b485252358d5babf57e20f", "score": "0.67521495", "text": "def markdown(text)\n coderay_options = {\n filter_html: true,\n hard_wrap: true,\n safe_links_only: true,\n with_toc_data: true,\n prettify: true\n }\n\n redcarpet_options = {\n autolink: true,\n disable_indented_code_blocks: false,\n fenced_code_blocks: true,\n highlight: true,\n lax_html_blocks: true,\n lax_spacing: true,\n no_intra_emphasis: true,\n strikethrough: true,\n superscript: true,\n tables: true\n }\n\n coderayified = CodeRayify.new(coderay_options)\n markdown_to_html = Redcarpet::Markdown.new(coderayified, redcarpet_options)\n markdown_to_html.render(text).html_safe\n end", "title": "" }, { "docid": "ddead8a01ea36af81348ba0acb7108d1", "score": "0.67463374", "text": "def markdown text\n markdown = Redcarpet::Markdown.new HTMLWithVideos, autolink: true, space_after_headers: true, no_intra_emphasis: true, superscript: true\n return markdown.render(text).html_safe\n end", "title": "" }, { "docid": "073d6516c105cd59036b0e1f4c9aae47", "score": "0.67399037", "text": "def bio_html\n return nil unless bio.present?\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(bio).html_safe\n end", "title": "" }, { "docid": "d06bd54f37e21dd95a0df39e10d2c845", "score": "0.67245185", "text": "def kss_markdown(input)\n markdown = ::Redcarpet::Markdown.new(::Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)\n markdown.render(input)\n end", "title": "" }, { "docid": "54036344181beb6621670a16395f83b0", "score": "0.67206836", "text": "def pretty_body\n Archiving.markdown.render(body).html_safe\n end", "title": "" }, { "docid": "535cda56f7679e4b86d6c37191bacdd9", "score": "0.67162585", "text": "def description_markdown\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, space_after_headers: true)\n markdown.render(description).html_safe\n end", "title": "" }, { "docid": "640c66f1fe6cdae055116e5fb540e352", "score": "0.6706221", "text": "def cache_markdown_content\n self.markdown_content = GitHub::Markdown.render(content)\n end", "title": "" }, { "docid": "74603dfb144b5c3cb7f8713f9aca1c15", "score": "0.6702701", "text": "def embed_md_erb(filename) # => markdown string\n ERB.new(File.read(filename)).result(binding)\n end", "title": "" }, { "docid": "83237b6e0f2842b64da8cfd147b672d7", "score": "0.6694117", "text": "def kss_markdown(text)\n require 'redcarpet'\n Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n autolink: true,\n tables: true,\n fenced_code_blocks: true,\n strikethrough: true,\n hard_wrap: true,\n space_after_headers: true,\n underline: true\n ).render(text).html_safe\n end", "title": "" } ]
c4911e182705705d23fe4fe94b07ae82
region is not needed for anything, but we can simulate a "more information required" error by passing region "EX" and postal code "99999". see tried to use `normalize_attributes :attempt, with: :integer`, but it wsan't working for an unknown reason
[ { "docid": "980d9ac459831b983cba4b6243d3b820", "score": "0.0", "text": "def attempt=(value)\n @attempt = value.to_i\n end", "title": "" } ]
[ { "docid": "99459407a85ef5dd8d439b8bdb2aaf0a", "score": "0.5944768", "text": "def youraddress_invalid_fill\n invalid = EnvConfig.data['formsV2_data']['formsV2_invalid']\n giw_invalid_youraddress(invalid['postcode'], invalid['a1'], invalid['a2'], invalid['towncity'])\n end", "title": "" }, { "docid": "ad94b051b064bed00cc99a6ea12fb591", "score": "0.5676208", "text": "def valid_attributes\n { name: \"the Venue\", postal_code: \"75003\", address_1: \"125, rue de Rivoli\", city: \"Paris\", country: \"FR\" }\n end", "title": "" }, { "docid": "50ea21a4654de352f715ab67ebb62f24", "score": "0.56076634", "text": "def valid_address(attributes = {})\n {\n :first_name => 'John',\n :last_name => 'Doe',\n :address1 => '2010 Cherry Ct.',\n :city => 'Mobile',\n :state => 'AL',\n :zip => '36608',\n :country => 'US'\n }.merge(attributes)\n end", "title": "" }, { "docid": "e0c0ec2ef4ae87e095caa087b708174c", "score": "0.55458677", "text": "def fake_area_code() ; fake_integer(:min => 200, :max => 987) ; end", "title": "" }, { "docid": "c5eccb1be50ded8a6b7dc9c048fe7d16", "score": "0.55424976", "text": "def valid_address(attributes = {})\r\n {\r\n :first_name => 'John',\r\n :last_name => 'Doe',\r\n :address1 => '2010 Cherry Ct.',\r\n :city => 'Mobile',\r\n :state => 'AL',\r\n :zip => '36608',\r\n :country => 'US'\r\n }.merge(attributes)\r\n end", "title": "" }, { "docid": "efd3c7aedeef546a46e504d50664d407", "score": "0.55237716", "text": "def validate_attributes\n unless address.present? || (lat.present? && lng.present?)\n raise ArgumentError, 'Must provide an address, or lat and lng.'\n end\n\n if address.present? && lat.present? && lng.present?\n raise ArgumentError, 'Cannot provide address, lat and lng.'\n end\n end", "title": "" }, { "docid": "df05de1703382470f344f505268fe0bf", "score": "0.55222553", "text": "def test_country_invalidity\n assert !@invalid_country.valid?\n attributes = [:name, :isocode_num, :isocode_2let, :isocode_3let]\n attributes.each do |attribute|\n assert @invalid_country.errors.invalid?(attribute)\n end\n end", "title": "" }, { "docid": "7be0eb9bf0bc17879d6d845c82979453", "score": "0.5447009", "text": "def test_country_invalidity\n assert !@invalid_grape.valid?\n attributes = [:name]\n attributes.each do |attribute|\n assert @invalid_grape.errors.invalid?(attribute)\n end\n end", "title": "" }, { "docid": "8a67d59bcfed79f154fdca5f1fc8070b", "score": "0.5359222", "text": "def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a region resource\"\n raise BadRequestError, msg\n end\n\n super\n end", "title": "" }, { "docid": "6d4f49075d6cdda51339999aba1ab3eb", "score": "0.53542733", "text": "def test_apptype_invalidity\n assert !@invalid_apptype.valid?\n attributes = [:abbrev, :fullname, :translation, :country_id]\n attributes.each do |attribute|\n assert @invalid_apptype.errors.invalid?(attribute)\n end\n end", "title": "" }, { "docid": "093876efa461d2eed71f65613953443c", "score": "0.53471917", "text": "def postal_code_validate\n return if country.blank? || country.iso.blank?\n return if !TwitterCldr::Shared::PostalCodes.territories.include?(country.iso.downcase.to_sym)\n\n postal_code = TwitterCldr::Shared::PostalCodes.for_territory(country.iso)\n errors.add(:value, :invalid) if !postal_code.valid?(value)\n end", "title": "" }, { "docid": "e803c30398718e35537a01db5fdb20ed", "score": "0.532103", "text": "def valid_organization_attributes\n {\n :email => 'brian.terlson@gmail.com',\n :zip_code => '55044',\n :password => 'test12',\n :password_confirmation => 'test12',\n :name => 'Denarius',\n :contact_name => 'Andersen Cooper',\n :city => 'New York',\n :location => 'Eastern Division',\n :state => 'New York',\n :industry => 'Software', \n :quoted_id => \"1\",\n :phone => \"1234567890\"\n }\nend", "title": "" }, { "docid": "fb814832c5d2366bfc0b22ae1e42fc3b", "score": "0.5260042", "text": "def valid_attributes\n {:name => \"Joe's\", :zip => \"12345\"}\n end", "title": "" }, { "docid": "ab41e8524c61a93a2bbf7f388c01610b", "score": "0.52446485", "text": "def valid_attributes\n { \"registrant_id\" => @registrant.id,\n \"place\" => 1 }\n end", "title": "" }, { "docid": "887d71d80ebda3c6324305c48b405bc1", "score": "0.5232224", "text": "def valid_attributes\n { \"registrant_id\" => @registrant.id,\n \"place\" => 1\n }\n end", "title": "" }, { "docid": "cd2ff909b664a7c8237c04fb89414f4b", "score": "0.52233994", "text": "def valid_attributes\n {\n first_name: \"f\",\n last_name: \"l\",\n family_health_unit_name: \"fhun\",\n phone: \"123\",\n locale: LOCALES.values.sample,\n study_identifier: rand(1000).to_s,\n status: Participant::STATUS.sample,\n gender: Participant::GENDER.sample,\n address: \"a\"\n }\n end", "title": "" }, { "docid": "c3df31e3e92bd9ceee7fbeb081802309", "score": "0.5221513", "text": "def reprocess_at(region)\n key = region.to_sym\n unless EducationForm::EducationFacility::REGIONS.include?(key)\n raise \"Invalid region. Must be one of #{EducationForm::EducationFacility::REGIONS.join(', ')}\"\n end\n\n self.regional_processing_office = region\n self.processed_at = nil\n save\n end", "title": "" }, { "docid": "b957975da4a3c8a8e667c3dadd287337", "score": "0.5204322", "text": "def valid_attributes\n {\n details: \"100pts\",\n points: 1,\n bib_number: 123,\n minutes: 1,\n seconds: 2,\n thousands: 3\n }\n end", "title": "" }, { "docid": "21dc7ff708261342a512caa4ae89017e", "score": "0.5200403", "text": "def test_for_format_of_zip_codes\n # test conditions\n bad_zip5 = %W( 0 123456 a ab abc abcd abcde abcdef a1b2c3 )\n bad_zip4 = %W( 0 12345 a ab abc abcd abcde a1b2 )\n\n # Create object\n p = PatientProfile.new\n\n # Test for good zip format\n p.zip5 = \"12345\"\n p.zip4 = \"1234\"\n p.valid? # force the error check\n assert !p.errors.invalid?(:zip5)\n assert !p.errors.invalid?(:zip4)\n\n # Test for bad zip formats\n bad_zip5.each do |x|\n p.errors.clear\n p.zip5 = x \n p.valid? # force the error check\n assert_equal I18n.translate('activerecord.errors.messages.invalid'), p.errors.on(:zip5)\n end\n\n bad_zip4.each do |x|\n p.errors.clear\n p.zip4 = x \n p.valid? # force the error check\n assert_equal I18n.translate('activerecord.errors.messages.invalid'), p.errors.on(:zip4)\n end\n end", "title": "" }, { "docid": "6724fe429478eaf85717178d84b9f220", "score": "0.51679873", "text": "def valid_attributes\n {source: \"NCBI\",\n name: \"NR\",\n version: \"2000-01-01\"}\n end", "title": "" }, { "docid": "ec23e2378b4a93a6eb17349957610f43", "score": "0.5155799", "text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end", "title": "" }, { "docid": "ec23e2378b4a93a6eb17349957610f43", "score": "0.5155799", "text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end", "title": "" }, { "docid": "52e9db88007ac246029d2bb4d630e859", "score": "0.5153536", "text": "def address_validation_request(address)\n {\n body: {\n requestAddress: {\n addressLine1: address.address_line_1,\n addressLine2: address.address_line_2,\n addressLine3: address.address_line_3,\n city: address.city,\n zipCode5: address.zip,\n zipCode4: address.zip4,\n international_postal_code: address.international_postal_code,\n stateProvince: { name: address.state_name, code: address.state },\n requestCountry: { countryName: address.country_name, countryCode: address.country },\n addressPOU: address.address_pou\n }\n },\n headers: {\n \"Content-Type\": \"application/json\", Accept: \"application/json\"\n },\n endpoint: ADDRESS_VALIDATION_ENDPOINT, method: :post\n }\n end", "title": "" }, { "docid": "68ce23c471381021964cca134b6d2aaf", "score": "0.5130746", "text": "def skip_test_geocode_api_validate_Invalid_Request\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?address=&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 400\n @data = JSON.parse response.body \n # Data validation based on address in POST API call\n assert_equal \"INVALID_REQUEST\", @data['status']\n \n \n end", "title": "" }, { "docid": "7aaea5fe9574bf46c59261786bc5cba3", "score": "0.512363", "text": "def administrative_region_params\n params.require(:administrative_region).permit(:name, :initials)\n end", "title": "" }, { "docid": "a39397109dff46912e070732e37f5d01", "score": "0.51062065", "text": "def invalid_pins\n { errors: \"invalid pins\" } \n end", "title": "" }, { "docid": "9c5f6418cc50f33149266f69eda9cb97", "score": "0.50949395", "text": "def skip_test_geocode_api_validate_Location_Lat\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 200\n @data = JSON.parse response.body \n # Data validation based on address in POST API call\n assert_equal \"37.4224267\", @data[\"location\"] \n # Retrying JSON Parsing\n #assert_equal \"37.4224267\", @data[\"location:lat\"] \n \n end", "title": "" }, { "docid": "b510abdc05ad194fb5b57cc13553bb1b", "score": "0.50935507", "text": "def postal_code_invalid_format_label\n $tracer.trace(__method__)\n return ToolTag.new(span.id(\"/valZipRegEx$/\"), __method__)\n end", "title": "" }, { "docid": "01bee397323e173daa9d19e21b8d7fda", "score": "0.50717175", "text": "def validate_address(form)\n full_address = form.street_address + ' ' + [form.city, form.state, form.zip_code].join(', ')\n response = @@api_client.validate_address(full_address)\n\n\n if response[\"status\"] == \"ZERO_RESULTS\"\n return { response_type: @@invalid,\n validated_address: nil }\n\n elsif response[\"status\"] == \"APP_ERROR\"\n return { response_type: @@failed,\n validated_address: nil }\n\n elsif response[\"status\"] == \"OK\"\n validated_address = ApiUtils.response_helper(response,form.street_address)\n address_model = Address.new(validated_address)\n \n return { response_type: @@invalid,\n validated_address: nil } unless address_model.valid?\n\n partial = check_partial_address(form, address_model)\n if partial.empty? \n return { response_type: @@success,\n validated_address: validated_address }\n else\n hash = { response_type: @@partial,\n validated_address: {\n form_address: form.as_json, \n api_address: validated_address,\n partial: partial\n }\n }\n return hash\n end\n \n else\n # Aww something went really wrong here.\n # Log this\n return { response_type: @@failed,\n validated_address: nil }\n end\n\n end", "title": "" }, { "docid": "3b043d8d0e2ffd5225a277e97aaf4fc1", "score": "0.5061818", "text": "def valid_attributes\n { \"organization_id\" => \"1\", \"user_id\" => \"2\" }\n end", "title": "" }, { "docid": "fad119b8495af20a2634449dc44481d6", "score": "0.506149", "text": "def valid_attributes\n {gi: '1234', db_sequence_id: db_sequence.id}\n end", "title": "" }, { "docid": "0306de214c64bb7ff98cf0c0f6179216", "score": "0.5060206", "text": "def convert_attributes\n address_params.delete(:address) if address_params[:line1]\n address_params.delete(:address2) if address_params[:line2]\n address_params.delete(:type) if address_params[:name]\n end", "title": "" }, { "docid": "72962f6ad8f325141f2613db61b1677b", "score": "0.50524426", "text": "def found_teen_address\n \tif latitude.blank? || longitude.blank?\n \t\terrors.add(:address, \"could not be found\")\n \tend\n \tend", "title": "" }, { "docid": "13e2b63f6fd94a7aa7729c1a036c3d12", "score": "0.50495845", "text": "def initialize( first_name=nil, last_name=nil, email=nil, work_phone=nil, line1=nil, line2=nil, city=nil, region=nil, postcode=nil, country=nil )\n @first_name, @last_name, @email, @work_phone, @line1, @line2, @city, @region, @country = first_name, last_name, email, work_phone, line1, line2, city, region, country\n @postcode = postcode?(postcode, country) ? format_postcode(postcode, country) : postcode\n end", "title": "" }, { "docid": "409c2d96d2432244465571abd47e4061", "score": "0.50419885", "text": "def skip_test_geocode_api_validate_Location_Lng\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 200\n @data = JSON.parse response.body \n # Data validation based address provided in POST API call\n assert_equal \"-122.0842499\", @data[\"location\"] \n # Retrying JSON Parsing\n #assert_equal \"37.4224267\", @data[\"location:lng\"] \n \n end", "title": "" }, { "docid": "3b15a9899a8897ac0c3495c4cf51ad8d", "score": "0.5037246", "text": "def validate_region!(region)\n unless Seahorse::Util.host_label?(region)\n raise Errors::InvalidRegionError\n end\n end", "title": "" }, { "docid": "f729734b291c895cf07ac4877cf25c95", "score": "0.50061536", "text": "def valid_attributes\n {:nome => 'Portugues'}\n end", "title": "" }, { "docid": "81a22a9239e93b265b1de83b24021280", "score": "0.50035095", "text": "def valid_attributes\n { business_unit_id: 1, name: \"budgetpost\", mage_arrangement_number: 1 }\n end", "title": "" }, { "docid": "9960c13878060c32ae4f8f3c315814b7", "score": "0.5000502", "text": "def check_special_mappings(ije_field_string, field_properties, data_row, county_mappings, ije_string)\n case field_properties['special value mapping']\n when'ethnicity'\n ethncitiy_mapping = { 'N' => 'N', 'Y' => 'H' }\n ethncitiy_mapping.default = 'U'\n ije_field_string = ethncitiy_mapping[ije_field_string]\n when 'extract_month'\n ije_field_string = ije_field_string.split('-')[1]\n when 'extract_day'\n ije_field_string = ije_field_string.split('-')[2]\n when 'military_time'\n # If the time type is \"P\" (PM), then add 12 hours to the hour for military time.\n if data_row['Time of Injury Modifier'] == \"P\"\n ije_field_string = (ije_field_string.to_i() + 12).to_s()\n end\n when 'capitalize_first_letter'\n ije_field_string = ije_field_string.downcase()\n ije_field_string[0] = ije_field_string[0].capitalize()\n when 'reuse_funstatecd'\n state_abbr = ije_string[3851..3852]\n ije_field_string = $state_abbr_to_name[state_abbr]\n when 'reuse_certstatecd'\n state_abbr = ije_string[4215..4216]\n ije_field_string = $state_abbr_to_name[state_abbr]\n when 'reuse_certstatecd'\n state_abbr = ije_string[4215..4216]\n ije_field_string = $state_abbr_to_name[state_abbr]\n when 'use_2022_if_no_injury'\n # If there is time of injury data, set it to 2022.\n if ije_string[981..982].empty?() && ije_string[983..984].empty?()\n ije_field_string = '2022'\n end\n when 'two_digit_country'\n if ije_field_string.downcase() == 'united states' || ije_field_string.downcase() == 'US'\n ije_field_string = 'US';\n else\n ije_field_string = ''\n end\n when 'full_state_name'\n ije_field_string = $state_abbr_to_name[ije_field_string]\n when 'county_code_to_name'\n county_code = ije_field_string.rjust(3, '0')\n residence_state_fips = data_row['Residence state FIPS code']\n county_row = county_mappings.select { |row| row[\"county_fips\"][row[\"county_fips\"].length-3, row[\"county_fips\"].length] == county_code && row[\"state_abbr\"] == residence_state_fips }[0]\n if county_row == nil && county_code != \"000\"\n puts(\"ERROR: Missing a county name mapping for State #{residence_state_fips} and County Code #{county_code}.\")\n end\n if county_row != nil && county_code != \"000\"\n ije_field_string = county_row[\"county_name\"]\n end\n when 'toi_unit_modifier'\n # Time of injury gets coverted to military time.\n if !ije_field_string.strip.empty?\n ije_field_string = 'M'\n end\n end\n return ije_field_string\nend", "title": "" }, { "docid": "38b7e8ac5487a04bb82de50f250a9c1c", "score": "0.49705458", "text": "def veteran_invalid_fields\n missing_fields = veteran.errors.details\n .select { |_, errors| errors.any? { |e| e[:error] == :blank } }\n .keys\n\n address_too_long = veteran.errors.details.any? do |field_name, errors|\n [:address_line1, :address_line2, :address_line3].include?(field_name) &&\n errors.any? { |e| e[:error] == :too_long }\n end\n\n address_invalid_characters = veteran.errors.details.any? do |field_name, errors|\n [:address_line1, :address_line2, :address_line3].include?(field_name) &&\n errors.any? { |e| e[:error] == \"invalid_characters\" }\n end\n\n city_invalid_characters = veteran.errors.details[:city]&.any? { |e| e[:error] == \"invalid_characters\" }\n\n city_too_long = veteran.errors.details[:city]&.any? { |e| e[:error] == \"too_long\" }\n\n date_of_birth = veteran.errors.details[:date_of_birth]&.any? { |e| e[:error] == \"invalid_date_of_birth\" }\n\n name_suffix_invalid = veteran.errors.details[:name_suffix]&.any? { |e| e[:error] == \"invalid_character\" }\n\n zip_code_invalid = veteran.errors.details[:zip_code]&.any? { |e| e[:error] == \"invalid_zip_code\" }\n\n pay_grade_invalid = veteran.errors.details[:pay_grades]&.any? { |e| e[:error] == \"invalid_pay_grade\" }\n\n {\n veteran_missing_fields: missing_fields,\n veteran_address_too_long: address_too_long,\n veteran_address_invalid_fields: address_invalid_characters,\n veteran_city_invalid_fields: city_invalid_characters,\n veteran_city_too_long: city_too_long,\n veteran_date_of_birth_invalid: date_of_birth,\n veteran_name_suffix_invalid: name_suffix_invalid,\n veteran_zip_code_invalid: zip_code_invalid,\n veteran_pay_grade_invalid: pay_grade_invalid\n }\n end", "title": "" }, { "docid": "93f310a289dd8f5ef191b9f3ba2a694b", "score": "0.49692035", "text": "def test_should_not_create_invalid_address\n an_address = OrderAddress.new\n \n assert !an_address.valid?\n #assert an_address.errors.invalid?(:order_user_id), \"Should have an error in order_user_id\"\n #assert an_address.errors.invalid?(:country_id), \"Should have an error in country_id\"\n assert an_address.errors.invalid?(:zip), \"Should have an error in zip\"\n assert an_address.errors.invalid?(:telephone), \"Should have an error in telephone\"\n assert an_address.errors.invalid?(:first_name), \"Should have an error in first_name\"\n assert an_address.errors.invalid?(:last_name), \"Should have an error in last_name\"\n assert an_address.errors.invalid?(:address), \"Should have an error in address\"\n \n # An address must have the fields filled.\n assert_equal \"#{ERROR_EMPTY} If you live in a country that doesn't have postal codes please enter '00000'.\", an_address.errors.on(:zip)\n assert_equal ERROR_EMPTY, an_address.errors.on(:telephone)\n assert_equal ERROR_EMPTY, an_address.errors.on(:first_name)\n assert_equal ERROR_EMPTY, an_address.errors.on(:last_name)\n assert_equal ERROR_EMPTY, an_address.errors.on(:address)\n\n an_address.address = \"P.O. BOX\"\n assert !an_address.valid?\n assert_equal \"Sorry, we don't ship to P.O. boxes\", an_address.errors.on(:address)\n \n# TODO: The address is being saved even when not associated with an user or a country.\n# an_address.first_name = \"Colonel\"\n# an_address.last_name = \"Mustard\"\n# an_address.telephone = \"000000000\"\n# an_address.address = \"After Boddy Mansion at right\"\n# an_address.zip = \"00000\"\n\n# TODO: Why try to validate P. O. Boxes?\n\n assert !an_address.save\n end", "title": "" }, { "docid": "98524f3bfd21b60881a15d1b8b5e7a0e", "score": "0.49485078", "text": "def to_region(options = {})\n if self.to_s.length == 3 # an area code\n row = Area.area_codes.find {|row| row.first == self.to_s }\n return row.last if row\n elsif self.to_s.length == 5\n if row = Area.zip_codes.find {|row| row.first == self.to_s }\n if row.first == self.to_s\n if options[:city]\n return row[1]\n elsif options[:state]\n return row[2]\n else\n return row[1] + ', ' + row[2]\n end\n end\n end\n else\n raise ArgumentError, \"You must provide a valid area or zip code\", caller\n end\n end", "title": "" }, { "docid": "b99cbc7fda269f876b204287003c3bc3", "score": "0.49476296", "text": "def valid_attributes\n {'domain' => 'test.com', 'transport' => 'virtual:'}\n end", "title": "" }, { "docid": "34bf4870deeb1b6e42ee30b72715ef2b", "score": "0.494146", "text": "def unclean_address_params\n params.require(:unclean_address).permit(:address_id, :lookup_id, :address_1, :city, :state, :zip, :country, :address_type, :date_added,:errors)\n end", "title": "" }, { "docid": "0de10192365d3034dec6269048e133ff", "score": "0.49399528", "text": "def test_invalid_with_empty_attributes\r\n referal_provider = ReferalProvider.new\r\n assert !referal_provider.valid?, referal_provider.errors.full_messages\r\n assert referal_provider.errors.invalid?(:first_name)\r\n assert referal_provider.errors.invalid?(:last_name)\r\n assert referal_provider.errors.invalid?(:npi)\r\n assert referal_provider.errors.invalid?(:taxonomy)\r\n end", "title": "" }, { "docid": "9887f8cdeb544e648f0a1c97fec77380", "score": "0.49372026", "text": "def region_params\n params.require(:region).permit(:numeric_code, :name)\n end", "title": "" }, { "docid": "bb73cfe64719d895e73b911910d0a544", "score": "0.49355587", "text": "def valid_zip_code\n # TODO: actually check the maps API to make sure zipcode exists... :/\n\n unless self.location.to_s.length == 5\n \n self.errors[:location] << \"Zip Codes must be five digits\"\n end\n end", "title": "" }, { "docid": "0c7ef4940570deafb023f9e1415ef4c9", "score": "0.49243286", "text": "def valid_pincode\n response = Net::HTTP.get(pincode_verification_url)\n data = JSON.parse(response)\n fields = data['records']\n errors.add(:pincode, 'not a valid pincode') if fields.blank?\n end", "title": "" }, { "docid": "6f957dd1c2729f45f45cdf6a76341444", "score": "0.49165165", "text": "def valid_attributes\n {:person_id => 1}\n end", "title": "" }, { "docid": "03af87f701afea025d67c4cd78da1a63", "score": "0.4908598", "text": "def catch_invalid_values(ije_key, ije_field_string, field_properties, data_row, county_mappings, ije_string)\n if ije_field_string == nil\n # If there is no data for this data value, set it to blank.\n ije_field_string = ''\n end\n ije_field_string = check_special_mappings(ije_field_string, field_properties, data_row, county_mappings, ije_string)\n if ije_key == 'INJPL' && ije_field_string != \"\"\n # Injury Place is in a full-phrase and inconsistent format. IJE is expecting a one-character value. Setting to '9' for unknown.\n ije_field_string = \"9\"\n elsif ije_key == 'TOI_HR' && (ije_field_string == \"99\" || ije_field_string == \"0099\")\n # The WA data input unknown \"Time of Injury Hour\" is \"99\" but IJE expects a 4-digit value.\n ije_field_string = \"9999\"\n elsif ije_key == 'TOI_HR' && ije_field_string.include?(\":\")\n # Convert hour data that contains a colon.\n ije_field_string = ije_field_string.split(\":\")[0]\n ije_field_string = ije_field_string[ije_field_string.length()-2, ije_field_string.length()]\n elsif ije_key == 'MARITAL' && ije_field_string == \"P\"\n # \"P\" is not a valid IJE MARITAL value. Set to \"U\" for unknown.\n ije_field_string = \"U\"\n elsif ije_key == 'DPLACE' && ije_field_string == \"8\"\n # \"8\" is not a valid IJE DPLACE value. Set to \"9\" for unknown.\n ije_field_string = '9'\n elsif ije_key == 'DPLACE' && ije_field_string == \"0\"\n # \"0\" is not a valid IJE DPLACE value. Set to \"9\" for unknown.\n ije_field_string = \"9\"\n elsif ije_key == 'DISP' && ije_field_string == \"N\"\n # \"N\" is not a valid IJE DISP value. Set to \"U\" for unknown.\n ije_field_string = \"U\"\n elsif (ije_key == 'DOI_DY' || ije_key == 'DOI_MO') && ije_field_string.include?(\"/\")\n # Sometimes there's a malformed date, set it to \"99\" for unknown.\n # We could remove the \"/\" but there are cases where the dates are further malformed so this is safer.\n ije_field_string = \"99\"\n elsif ije_key == 'DOI_MO' && !is_number?(ije_field_string) && ije_field_string != \"\"\n # Sometimes \"Date of Injury Month\" is in a 2-char form \"Ap\", \"Ma\", etc rather than a number.\n # Use the first 3 chars of the `Injury date` field to convert that month data to valid integer.\n ije_field_string = Date::ABBR_MONTHNAMES.index(data_row['Injury date'][0..4])\n elsif ije_key == 'TOD' && ije_field_string == \"2400\"\n # \"2400\" is not a valid IJE TOD value. Set to \"2359\" for one minute previous.\n ije_field_string = \"2359\"\n elsif ije_key == 'DSTATE' && ije_field_string == \"\"\n # Towards the end of the dataset, it stops including DSTATE.\n # Add it back as \"WA\"\n ije_field_string = \"WA\"\n end\n return ije_field_string\nend", "title": "" }, { "docid": "eeca87baa0fff0c51a4d20277c99c6ce", "score": "0.490856", "text": "def valid_attributes\n { name: \"MyName\",\n preliminary: false}\n end", "title": "" }, { "docid": "37e3b80000002e7092158b0f5a35986d", "score": "0.4907033", "text": "def format_api_error\n { @field => @code }\n end", "title": "" }, { "docid": "da93890192640baeab920b9eeb735a25", "score": "0.49021792", "text": "def validate\n validate_zip && validate_unique_mapping\n end", "title": "" }, { "docid": "f631876f1c0d828d14d60fb0fb8e9e3c", "score": "0.48929006", "text": "def list_invalid_properties\n invalid_properties = Array.new\n if @primary_number.nil?\n invalid_properties.push('invalid value for \"primary_number\", primary_number cannot be nil.')\n end\n\n if @street_predirection.nil?\n invalid_properties.push('invalid value for \"street_predirection\", street_predirection cannot be nil.')\n end\n\n if @street_name.nil?\n invalid_properties.push('invalid value for \"street_name\", street_name cannot be nil.')\n end\n\n if @street_suffix.nil?\n invalid_properties.push('invalid value for \"street_suffix\", street_suffix cannot be nil.')\n end\n\n if @street_postdirection.nil?\n invalid_properties.push('invalid value for \"street_postdirection\", street_postdirection cannot be nil.')\n end\n\n if @secondary_designator.nil?\n invalid_properties.push('invalid value for \"secondary_designator\", secondary_designator cannot be nil.')\n end\n\n if @secondary_number.nil?\n invalid_properties.push('invalid value for \"secondary_number\", secondary_number cannot be nil.')\n end\n\n if @pmb_designator.nil?\n invalid_properties.push('invalid value for \"pmb_designator\", pmb_designator cannot be nil.')\n end\n\n if @pmb_number.nil?\n invalid_properties.push('invalid value for \"pmb_number\", pmb_number cannot be nil.')\n end\n\n if @extra_secondary_designator.nil?\n invalid_properties.push('invalid value for \"extra_secondary_designator\", extra_secondary_designator cannot be nil.')\n end\n\n if @extra_secondary_number.nil?\n invalid_properties.push('invalid value for \"extra_secondary_number\", extra_secondary_number cannot be nil.')\n end\n\n if @city.nil?\n invalid_properties.push('invalid value for \"city\", city cannot be nil.')\n end\n\n if @city.to_s.length > 200\n invalid_properties.push('invalid value for \"city\", the character length must be smaller than or equal to 200.')\n end\n\n if @state.nil?\n invalid_properties.push('invalid value for \"state\", state cannot be nil.')\n end\n\n if @state.to_s.length > 2\n invalid_properties.push('invalid value for \"state\", the character length must be smaller than or equal to 2.')\n end\n\n if @zip_code.nil?\n invalid_properties.push('invalid value for \"zip_code\", zip_code cannot be nil.')\n end\n\n pattern = Regexp.new(/(^$)|(^\\d{5}$)/)\n if @zip_code !~ pattern\n invalid_properties.push(\"invalid value for \\\"zip_code\\\", must conform to the pattern #{pattern}.\")\n end\n\n if @zip_code_plus_4.nil?\n invalid_properties.push('invalid value for \"zip_code_plus_4\", zip_code_plus_4 cannot be nil.')\n end\n\n pattern = Regexp.new(/^(\\d{4})?$/)\n if @zip_code_plus_4 !~ pattern\n invalid_properties.push(\"invalid value for \\\"zip_code_plus_4\\\", must conform to the pattern #{pattern}.\")\n end\n\n if @zip_code_type.nil?\n invalid_properties.push('invalid value for \"zip_code_type\", zip_code_type cannot be nil.')\n end\n\n if @delivery_point_barcode.nil?\n invalid_properties.push('invalid value for \"delivery_point_barcode\", delivery_point_barcode cannot be nil.')\n end\n\n if @address_type.nil?\n invalid_properties.push('invalid value for \"address_type\", address_type cannot be nil.')\n end\n\n if @record_type.nil?\n invalid_properties.push('invalid value for \"record_type\", record_type cannot be nil.')\n end\n\n if @default_building_address.nil?\n invalid_properties.push('invalid value for \"default_building_address\", default_building_address cannot be nil.')\n end\n\n if @county.nil?\n invalid_properties.push('invalid value for \"county\", county cannot be nil.')\n end\n\n if @county_fips.nil?\n invalid_properties.push('invalid value for \"county_fips\", county_fips cannot be nil.')\n end\n\n if @carrier_route.nil?\n invalid_properties.push('invalid value for \"carrier_route\", carrier_route cannot be nil.')\n end\n\n if @carrier_route_type.nil?\n invalid_properties.push('invalid value for \"carrier_route_type\", carrier_route_type cannot be nil.')\n end\n\n invalid_properties\n end", "title": "" }, { "docid": "fde2bb86278bf62dd1f2f7d71cda62cc", "score": "0.48864394", "text": "def invalid_attributes\n %w(id adaptor)\n end", "title": "" }, { "docid": "0480a6e92785c3af09ce100613a333c7", "score": "0.48850924", "text": "def list_invalid_properties\n invalid_properties = Array.new\n if @street_line1.nil?\n invalid_properties.push('invalid value for \"street_line1\", street_line1 cannot be nil.')\n end\n\n if @city.nil?\n invalid_properties.push('invalid value for \"city\", city cannot be nil.')\n end\n\n if @state.nil?\n invalid_properties.push('invalid value for \"state\", state cannot be nil.')\n end\n\n if @zip_code.nil?\n invalid_properties.push('invalid value for \"zip_code\", zip_code cannot be nil.')\n end\n\n if @country.nil?\n invalid_properties.push('invalid value for \"country\", country cannot be nil.')\n end\n\n invalid_properties\n end", "title": "" }, { "docid": "bbb2c5362a8a2c6e979bfd463e419398", "score": "0.488362", "text": "def valid_attributes\n b = FactoryGirl.create(:brand)\n { :pattern => 'some pattern', :brand_id=>b.id, :granularity=>'Variant', :delimiter=>'-' }\n end", "title": "" }, { "docid": "a9462f923b8bed080b51ad67efe47846", "score": "0.48719308", "text": "def parsed_normalized_star_row(row)\n if @district_key == NEW_BEDFORD # translated safelist\n {\n 'SchoolIdentifier' => row['SchoolLocalID'],\n 'StudentIdentifier' => row['StudentLocalID'],\n 'CompletedDate' => parse_star_date_taken_with_v1_format(row['AssessmentDate']),\n 'PercentileRank' => row['PercentileRank'],\n 'GradeEquivalent' => row['GradeEquivalent'],\n 'TotalTimeInSeconds' => row['TotalTime']\n }\n elsif @district_key == SOMERVILLE # passthrough safelist\n {\n 'SchoolIdentifier' => row['SchoolIdentifier'],\n 'StudentIdentifier' => row['StudentIdentifier'],\n 'CompletedDate' => parse_star_date_taken_with_v2_format(row['CompletedDate']), # alt, LaunchDate, CompletedDateLocal\n 'PercentileRank' => row['PercentileRank'],\n 'GradeEquivalent' => row['GradeEquivalent'],\n 'TotalTimeInSeconds' => row['TotalTimeInSeconds']\n }\n else\n raise_not_handled!\n end\n end", "title": "" }, { "docid": "253eb8559f3be3c604b18b8c0667ab29", "score": "0.48591903", "text": "def test_update_location_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:north] = 100\n update_location_error(params)\n end", "title": "" }, { "docid": "025249a29435244fc5dd98894de861ea", "score": "0.4859078", "text": "def valid_attributes\n {\n name: \"Unlimited\",\n position: 2\n }\n end", "title": "" }, { "docid": "88d403df634a1b8743af7bcef8e7d0a8", "score": "0.48580176", "text": "def test_geocode_api_validate_requierd_parameter_component\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?address=santa+cruz&components=country:ES&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 200\n @data = JSON.parse response.body\n #print @data\n #Extract the 'status' from response body\n assert_equal 'OK', @data['status']\n # Should validate data here\n \n end", "title": "" }, { "docid": "2fe80681cfb856a5b7d58b50886e684a", "score": "0.48578668", "text": "def address_info\n (enrichments.latest_created_at.with_address_info.first || self)\n .attributes_before_type_cast\n .slice('address1', 'address2', 'address3', 'address4', 'postcode', 'region_code')\n end", "title": "" }, { "docid": "50a2af4267b335e7c1e924112883aee6", "score": "0.4852342", "text": "def valid_county\n \treturn true unless (self.lat.blank? && self.lng.blank?)\n @state_string ||= \"#{self.name}, USA\"\n \n res= Geokit::Geocoders::GoogleGeocoder.geocode(@state_string, :bias => 'us')\n puts res.success\n puts res.precision.to_sym\n if res.success \n\t self.lat = res.lat\n\t self.lng = res.lng\n else\n errors.add_to_base('Geocode completely failed.')\n end\n\n end", "title": "" }, { "docid": "ee63c31bb137208992d92f1d735baf28", "score": "0.4850256", "text": "def validate_address\n errors.add(:address, I18n.t('profiles.errors.invalid_address')) if !valid_address?\n errors.add(:address, I18n.t('profiles.errors.invalid_zipcode', zipcode: obtained_zipcode)) if !valid_zipcode?\n end", "title": "" }, { "docid": "afff987cf587114a49e2ee17d7c0acfd", "score": "0.48329374", "text": "def map_import_to_model_attrs(record)\n {\n holder_number: record[:holder_number].to_s.strip,\n holder_name: record[:holder_name].to_s.strip,\n address_line_1: record[:address_line_1].to_s.strip,\n address_line_2: record[:address_line_2].to_s.strip,\n address_line_3: record[:address_line_3].to_s.strip,\n address_line_4: record[:address_line_4].to_s.strip,\n address_line_5: record[:address_line_5].to_s.strip,\n postcode: (record[:postos_code] || record[:postcode]).to_s.strip.rjust(4, \"0\"), # NOTE: postcodes are treated as stings. This drops leading zeros. We need to pad them back to 4 digits as strings.\n esioa: (record[:esioa_09c] || record[:esioa]).to_i,\n esiob: (record[:esiob_015c] || record[:esiob]).to_i,\n phone_number: record[:phone_number].to_s.strip,\n work_number: record[:work_number].to_s.strip,\n mobile_number: record[:mobile_number].to_s.strip,\n email_address: record[:email_address].to_s.strip\n }\nend", "title": "" }, { "docid": "1bf5b00f162ed3c3b8d1a6d3b0af014a", "score": "0.48264176", "text": "def normalize\n \tself.phone.delete! \"-\"\n \tif self.phone.length == 8\n \t\tarea_code = \"\"\n \t\tfirst = self.phone[0]\n \t\tif first == \"6\"\n \t\t\tarea_code = \"619\"\n \t\telsif first == \"8\"\n \t\t\tarea_code = \"858\"\n \t\tend\n \t\tself.phone = area_code + self.phone[1..-1]\n \telsif self.phone.length == 10\n \t\t# do nothing for now\n \telse\n \t\t# do nothing for now\n \tend\n end", "title": "" }, { "docid": "d4f8cd2d0df594b25efe4a4a827fe8e0", "score": "0.48227066", "text": "def test_geocode_api_validate_requierd_parameter_component_filter\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?address=Torun&components=administrative_area:TX|country:US&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 200\n @data = JSON.parse response.body\n #print @data\n #Extract the 'status' from response body\n assert_equal 'OK', @data['status']\n # Should validate data here\n \n end", "title": "" }, { "docid": "31ba5f210cf758c6cdd98c0d5a768662", "score": "0.48226124", "text": "def valid_attributes\n { \"hostname\" => \"MyString\" }\n end", "title": "" }, { "docid": "3d3df1d00d0253e783e0566d9c48c497", "score": "0.48214456", "text": "def valid_attributes\n {name: \"db-01\", type: \"postgres\"}\n end", "title": "" }, { "docid": "03c19931bff9a3e56d0a40b3dfb1f5c9", "score": "0.48207405", "text": "def metadata\n super.merge(postal_code: postal_code)\n end", "title": "" }, { "docid": "7c60e92942ce9595ac9fc4cd1e646985", "score": "0.48170465", "text": "def valid_attributes\n{\"river\"=>{\"name\"=>\"Big River\"}, \"trip\"=>{\"leader\"=>\"abc\", \"agency\"=>\"a\", \"agency_contact\"=>\"\", \"start_date(1i)\"=>\"2013\", \"start_date(2i)\"=>\"4\", \"start_date(3i)\"=>\"8\", \"duration\"=>\"1\", \"flow\"=>\"\", \"num_participants\"=>\"\", \"num_guides\"=>\"\", \"report_link\"=>\"\", \"summary\"=>\"\", \"pictures\"=>\"\"}, \"commit\"=>\"Create New Trip\", \"river_id\"=>\"1\"}\n\n\n end", "title": "" }, { "docid": "35e3c17c6de244f440f5b56453a4e8a2", "score": "0.4815946", "text": "def test_zip_code_with_invalid_examples\n spec = @valid_spec\n invalid_zip_codes = %w{OU812 5150 314159}\n invalid_zip_codes.each do |zip_code|\n spec.zip_code = zip_code\n assert !spec.valid?, \"#{zip_code} shouldn't pass validation, but does.\"\n end\n end", "title": "" }, { "docid": "7df7088a27c3303f9a45724ce70f5737", "score": "0.48113596", "text": "def extract_attributes(resource: self.new, fields: [], invalid_attributes: [], id: nil)\n data = {}\n fields.select{ |k| k != invalid_attributes }.each { |k| \n # TODO: confirm resource.respond_to? k prior to assigning\n data[k.to_sym] = resource.public_send(k) if resource.respond_to? k\n }\n if id\n data = data.merge id: id\n end\n data\n end", "title": "" }, { "docid": "e0bf9fb40683416f4fb65d6db077ce67", "score": "0.4809264", "text": "def derive_postal_code(user)\n { postal_code: user.va_profile.address.postal_code }\n end", "title": "" }, { "docid": "09d24809cd78dd53a346bc50f4cb2da0", "score": "0.48050845", "text": "def validate_and_sanitize\n\n r = validate\n return r unless r.success?\n\n # sanitize\n @address = sanitize_address(@address)\n @client_id = @client_id.to_i\n\n unless Util::CommonValidator.is_ethereum_address?(@address)\n return validation_error(\n 'a_s_tm_g_1',\n 'invalid_api_params',\n ['invalid_staker_address'],\n GlobalConstant::ErrorAction.default\n )\n end\n\n success\n end", "title": "" }, { "docid": "d81a011241eb6f11fa949f9932fec5ec", "score": "0.48044327", "text": "def list_invalid_properties\n invalid_properties = Array.new\n if !@address_line1.nil? && @address_line1.to_s.length > 200\n invalid_properties.push('invalid value for \"address_line1\", the character length must be smaller than or equal to 200.')\n end\n\n if !@address_line2.nil? && @address_line2.to_s.length > 200\n invalid_properties.push('invalid value for \"address_line2\", the character length must be smaller than or equal to 200.')\n end\n\n if !@address_city.nil? && @address_city.to_s.length > 200\n invalid_properties.push('invalid value for \"address_city\", the character length must be smaller than or equal to 200.')\n end\n\n if !@address_state.nil? && @address_state.to_s.length > 200\n invalid_properties.push('invalid value for \"address_state\", the character length must be smaller than or equal to 200.')\n end\n\n if !@address_zip.nil? && @address_zip.to_s.length > 40\n invalid_properties.push('invalid value for \"address_zip\", the character length must be smaller than or equal to 40.')\n end\n\n if !@description.nil? && @description.to_s.length > 255\n invalid_properties.push('invalid value for \"description\", the character length must be smaller than or equal to 255.')\n end\n\n if !@name.nil? && @name.to_s.length > 40\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 40.')\n end\n\n if !@company.nil? && @company.to_s.length > 40\n invalid_properties.push('invalid value for \"company\", the character length must be smaller than or equal to 40.')\n end\n\n if !@phone.nil? && @phone.to_s.length > 40\n invalid_properties.push('invalid value for \"phone\", the character length must be smaller than or equal to 40.')\n end\n\n if !@email.nil? && @email.to_s.length > 100\n invalid_properties.push('invalid value for \"email\", the character length must be smaller than or equal to 100.')\n end\n\n pattern = Regexp.new(/UNITED STATES/)\n if !@address_country.nil? && @address_country !~ pattern\n invalid_properties.push(\"invalid value for \\\"address_country\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "title": "" }, { "docid": "80b742bdf4c6f8f2150ab0ebba174c67", "score": "0.47994134", "text": "def format_input\n self.gender = self.gender.strip\n self.floor = self.floor.strip.upcase\n self.location = self.location.strip\n end", "title": "" }, { "docid": "96d6c16e7400528630d155b38086ba9c", "score": "0.47973794", "text": "def verify_city_info(s)\n\n errors = ['Info not enough! ', 'Continent is wrong! ', 'Timezone not in range[-12, 14] or not number!',\n 'Population should be non-negative integer! ', 'Region should be a number! ',\n 'Coordinates wrong, N/S[0-90], E/W[0-180]! ']\n info_arr = s.split('#')\n verified = true\n error_info = Array.new # This contains actually errors.\n if info_arr.size != 9\n return [nil, [errors[0]]]\n end\n info_arr.map!{|e| # map! makes it possible to change elements in place.\n e.rstrip.lstrip\n }\n if info_arr.include?(\"\")\n verified = false\n error_info.push(errors[0])\n else\n code = info_arr[0].upcase\n name = info_arr[1].split.map(&:capitalize).join(' ')\n country = info_arr[2].split.map(&:capitalize).join(' ')\n timezone = info_arr[4]\n longit = info_arr[5].downcase\n lat = info_arr[6].downcase\n pop = info_arr[7]\n region = info_arr[8]\n coordinates = Hash.new()\n range = {'s'=>[0, 90], 'n'=>[0,90], 'e'=>[0, 180],'w'=>[0, 180]}\n continent = info_arr[3].downcase\n # Based on Wikipedia page about continents. One model is 7-continent one. I use it.\n if [\"africa\", \"europe\", \"asia\", \"north america\", \"south america\", \"antarctica\", \"australia\"].include?(continent)\n continent = continent.split.map(&:capitalize).join(' ') # capitalize every word\n else\n verified = false\n error_info.push(errors[1])\n end\n if is_num(timezone) && timezone.to_f >= -12 && timezone.to_f <= 14\n timezone = timezone.to_f\n else\n verified = false\n error_info.push(errors[2])\n end\n if is_int(pop) && pop.to_i >= 0\n pop = pop.to_i\n else\n verified = false\n error_info.push(errors[3])\n end\n if is_int(region)\n region = region.to_i\n else\n verified = false\n error_info.push(errors[4])\n end\n if ['ne','en','nw','wn','se','es','sw','ws'].include?((longit[0]+lat[0]).downcase)\n if is_num(longit[1..-1]) && is_num(lat[1..-1])\n if (longit[1..-1].to_f <= range[longit[0]][1]) && (longit[1..-1].to_f >= range[longit[0]][0]) && (lat[1..-1].to_f <= range[lat[0]][1]) && (lat[1..-1].to_f >= range[lat[0]][0])\n coordinates[longit[0].upcase] = longit[1..-1].to_f\n coordinates[lat[0].upcase] = lat[1..-1].to_f\n else\n verified = false\n error_info.push(errors[-1])\n end\n else\n verified = false\n error_info.push(errors[-1])\n end\n else\n verified = false\n error_info.push(errors[-1])\n end\n info_arr = [code, name, country, continent, timezone, coordinates, pop, region ]\n end\n error_info.uniq! #remove duplicate error messages\n if verified\n\n city = City.new(*info_arr)\n return [city, []]\n else\n return [nil, error_info]\n end\n\nend", "title": "" }, { "docid": "80a00fc65314a0a289f4c9750f7d797b", "score": "0.47904676", "text": "def accuracy_map\n %w{ unknown country state county city zip zip+4 street address }\n end", "title": "" }, { "docid": "be5a39530d808c81be4443c798092d1f", "score": "0.47892356", "text": "def test_geocode_api_validate_requierd_parameter_component_filter\n response = RestClient.get 'https://maps.googleapis.com/maps/api/geocode/json?components=administrative_area:TX|country:FR&key=AIzaSyD8-YaLb0jBegWwfeUVDtDa52zz58D2th8'\n #Ensure the API return 200 OK\n assert_equal response.code, 200\n @data = JSON.parse response.body\n #print @data\n #Extract the 'status' from response body\n assert_equal 'ZERO_RESULTS', @data['status']\n \n \n end", "title": "" }, { "docid": "a0387f4143924d88b4b10245fa956673", "score": "0.47837633", "text": "def insert attributes\n wrap_errors { insert_one(transform.normalize attributes) }\n end", "title": "" }, { "docid": "5223f1df53e4dff961ecef795f30ec48", "score": "0.4782618", "text": "def assert_valid!(response)\n return if response['error_code'].blank?\n case response['error_code']\n when '-1'\n raise Zoopla::DisambiguationError.new(response['error_string'], response)\n when '7'\n raise Zoopla::UnknownLocationError.new(response['error_string'], response)\n else \n raise Zoopla::Error.new(response['error_string'], response)\n end\n end", "title": "" }, { "docid": "610d6f5dcf500015ef9d68afa932ca23", "score": "0.4762996", "text": "def generate_row_location(row, detail_level, county_full_col, county_partial_col, state_col)\n\n if detail_level == \"STATE\"\n\n if county_full_col\n col_name = county_full_col.name\n ans = row[col_name].upcase.strip\n ans = convert_to_fips(ans)\n ans = ans.ljust(5, \"0\")\n return ans\n elsif state_col\n col_name = state_col.name\n ans = row[col_name].upcase\n ans = state_to_fips(ans)\n ans = ans.ljust(5, \"0\")\n return ans\n else\n # ERROR??\n return nil\n end\n \n elsif detail_level == \"COUNTY\"\n\n if county_full_col\n col_name = county_full_col.name\n ans = row[col_name].upcase\n ans = convert_to_fips(ans)\n ans = ans.rjust(5, \"0\")\n return ans\n elsif state_col and county_partial_col\n # TODO: might error if null\n state_name = row[state_col.name]\n county_name = row[county_partial_col.name]\n\n state_name = state_name.upcase\n county_name = county_name.upcase\n \n if self.is_numeric?(state_name) and self.is_numeric?(county_name)\n state_name = state_name.ljust(5, \"0\")[0..1]\n county_name = county_name.rjust(5, \"0\")[2..5]\n return state_name + county_name\n elsif self.is_numeric?(county_name)\n state_name = self.abbrev_to_state(state_name)\n state_name = self.state_to_fips(state_name).ljust(5, \"0\")[0..1]\n county_name = county_name.rjust(5, \"0\")[2..5]\n return state_name + county_name\n elsif self.is_numeric?(state_name)\n state_name = self.fips_to_state(state_name)\n end\n\n key = \"#{county_name}, #{state_name}\"\n ans = convert_to_fips(key)\n return ans\n else\n # ERROR\n return nil\n end\n else\n # ERROR\n return nil\n end \n end", "title": "" }, { "docid": "701735aced22915db806f1e87e4c7e1e", "score": "0.47579893", "text": "def pin_to_site_region\n @attributes[:pin_to_site_region]\n end", "title": "" }, { "docid": "b6ba753ad192d5c6abb58f0a5eef9c01", "score": "0.47529134", "text": "def geocode\n fail\n end", "title": "" }, { "docid": "b03fa8c9b5bbd3fb0e86cdde93b5bec5", "score": "0.47463542", "text": "def validate\r\n #MES- The zip code is required\r\n if user_atts.select{ |att| att.att_id == UserAttribute::ATT_ZIP }.length == 0\r\n errors.add \"Zip code\", \"is required.\"\r\n else\r\n #MES- The timezone is required, but it's typically derived from the zip code, so\r\n # don't warn about the time zone if we're already warning about the zip code\r\n if !time_zone.blank?\r\n #MES- Validate the timezone by trying to open the relevant TZInfo object\r\n begin\r\n tz = TZInfo::Timezone.get(time_zone)\r\n rescue Exception\r\n errors.add \"Timezone\", \"'#{time_zone}' is not recognized.\"\r\n end\r\n else\r\n errors.add \"Timezone\", \"is required.\"\r\n end\r\n end\r\n \r\n end", "title": "" }, { "docid": "bb6125a4cb4c4b2354525a8232a9d7c6", "score": "0.47461456", "text": "def valid_attributes\n { body: \"blah\",\n title: 'Something' }\n end", "title": "" }, { "docid": "c3f033e70cf322538c1ff887788a59f0", "score": "0.4742534", "text": "def valid_attributes\n { state: 'ok', hostname: 'foo.lvh.me'}\n end", "title": "" }, { "docid": "4836f642c905af7403a0176b27c9577e", "score": "0.474176", "text": "def test_uniqueness_of_name_and_isocodes\n country_repeat = Country.new(:name => @valid_country.name,\n :isocode_num => @valid_country.isocode_num,\n :isocode_2let => @valid_country.isocode_2let,\n :isocode_3let => @valid_country.isocode_3let)\n assert !country_repeat.valid?\n assert_equal @error_messages[:taken], country_repeat.errors.on(:name)\n assert_equal @error_messages[:taken], country_repeat.errors.on(:isocode_num)\n assert_equal @error_messages[:taken], country_repeat.errors.on(:isocode_2let)\n assert_equal @error_messages[:taken], country_repeat.errors.on(:isocode_3let)\n end", "title": "" }, { "docid": "20ea3a8a5c2533523a9284910ff21677", "score": "0.47412807", "text": "def test_attributes()\n return\n ds = create_temp_ds('pm1')\n lyr = ds.get_layer(0)\n\n expect = [8901, 8902, 8903, 8904 ]\n \n assert(check_features_against_list( lyr,'PRIME_MERIDIAN_CODE',expect))\n \n lyr.reset_reading()\n\n expect = [ '', 'Instituto Geografico e Cadastral; Lisbon',\n 'Institut Geographique National (IGN), Paris',\n 'Instituto Geografico \"Augustin Cadazzi\" (IGAC); Bogota' ]\n \n assert(check_features_against_list( lyr,'INFORMATION_SOURCE',expect))\n\n # Let go of the temp dataset\n lyr = nil\n ds = nil\n end", "title": "" }, { "docid": "58d8b9e46219b896e42fead543242c65", "score": "0.47379535", "text": "def uppercase_fields\n self.address.upcase! if address.present?\n self.residence.upcase! if residence.present?\n self.geodesic_ns.upcase! if geodesic_ns.present?\n self.geodesic_ew.upcase! if geodesic_ew.present?\n self.code_ine.upcase! if residence.present?\n self.first_entry.upcase! if first_entry .present?\n self.second_entry.upcase! if second_entry.present?\n end", "title": "" }, { "docid": "6cbbeebc98c4fd0b2d5582147e0eeaba", "score": "0.47377056", "text": "def validate_attributes(attributes)\n if !([:name, :address] - attributes.keys).empty?\n raise MissingAttributes.new(\"A :name and an :address are mandatory\")\n end\n end", "title": "" }, { "docid": "8011fc75c86ef3fddd26acf1e113b67b", "score": "0.4735624", "text": "def valid_attributes\n {\"title\" => \"test chore\",\n \"user_id\" => 1,\n \"email_id\" => 1,\n \"choretype_id\" => 1,\n \"context_id\" => 1,\n \"project_id\" => 1\n }\n end", "title": "" }, { "docid": "b2a27a4eecbbe30880f1724825b18bee", "score": "0.4735437", "text": "def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a zone resource\"\n raise BadRequestError, msg\n end\n\n super\n end", "title": "" }, { "docid": "681a25d1699ca4b1a9def94ab49cbdfc", "score": "0.47350362", "text": "def validate_location(*args)\n valid_attributes.update(args.extract_options!)\n validate :validate_location, valid_attributes\n end", "title": "" }, { "docid": "5752cc3344572da7a35d72322962f5d9", "score": "0.47349384", "text": "def test_should_deny_non_integer_city\n user = create_user(:city_id => 'a')\n assert user.errors.invalid?(:city_id), \":city_id should have had an error\"\n assert_invalid user, \"user shouldn't be created\"\n \n user = create_user(:city_id => 1.397)\n assert user.errors.invalid?(:city_id), \":city_id should have had an error\"\n assert_invalid user, \"user shouldn't be created\"\n end", "title": "" }, { "docid": "ffa9cac982a2ae959c1e83b0ce643fca", "score": "0.47302017", "text": "def test_annotation_text_id_range\n annotation_text_id_range = create_text_no_attr(nil)\n\n bad = %w{ 'string', -0.1, -1, 0}\n\n bad.each do |id|\n\n annotation_text_id_range.annotation_text_id = id\n assert !annotation_text_id_range.valid?\n\n end\n\n end", "title": "" }, { "docid": "67270c8d379b874b47b47c1918a559fb", "score": "0.47295913", "text": "def normalize\n raise ValidationError.new unless valid?\n Phony.normalize(@phone.international)\n end", "title": "" }, { "docid": "25e96107eb57595da7bdd8f35425ba68", "score": "0.47261393", "text": "def validate\n \n @result = 404\n \n query_string = '/street-address/?' +\n \t'street=' + CGI::escape(@street) +\n \t'&city=' + CGI::escape(@city) +\n \t'&state=' + @state +\n \t'&zipcode=' + @zip_code.gsub(' ','') +\n \t'&candidates=' + @number_of_candidates.to_s +\n \t'&auth-id=' + Spree::SmartyStreets::Config.auth_id +\n \t'&auth-token=' + Spree::SmartyStreets::Config.auth_token\n\n http = Net::HTTP.new(API_URL)\n request = Net::HTTP::Get.new(query_string)\n response = http.request(request)\n if response.is_a?(Net::HTTPSuccess)\n @response = JSON.parse(response.body)\n # Interpret response - \n if @response.empty?\n # Address cannot be validated, there are zero candidates in the response\n raise ValidationError\n else\n @result = 200\n end\n else\n # Something went wrong with the API call, handle here\n raise ResponseError\n end\n return @result\n \n end", "title": "" }, { "docid": "e725d3305fdb29f510a4cecc7a2a9b39", "score": "0.47239956", "text": "def valid_attributes\n { position: 1}\n end", "title": "" }, { "docid": "b8b75a98b8ff7db8368d359ed57b8657", "score": "0.47122896", "text": "def test_should_deny_non_integer_registration_id\n proposal = create(:registration_id => 'a')\n assert proposal.errors.invalid?(:registration_id), \":registration_id should have had an error\"\n assert_invalid proposal, \"proposal shouldn't be created\"\n \n proposal = create(:registration_id => 1.397)\n assert proposal.errors.invalid?(:registration_id), \":registration_id should have had an error\"\n assert_invalid proposal, \"proposal shouldn't be created\"\nend", "title": "" } ]
de728ae515364865d614b4e8d0c17016
DELETE /competitions/1 DELETE /competitions/1.json
[ { "docid": "433605a78eca7425d983e9ed28957d73", "score": "0.77266276", "text": "def destroy\n @competition = Competition.find(params[:id])\n @competition.destroy\n\n respond_to do |format|\n format.html { redirect_to competitions_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "a5a988a7e83acda9b9c4dbbcc715cee6", "score": "0.7594703", "text": "def destroy\n @mycompetition = Mycompetition.find(params[:id])\n @mycompetition.destroy\n\n respond_to do |format|\n format.html { redirect_to mycompetitions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0ed9a47cbc47e7fd880a23d3dc7f998e", "score": "0.7582918", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to admin_competitions_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1d43aee2d9004cd9fb9bdf95e1b21b9e", "score": "0.7577095", "text": "def destroy\n @content_competition = ContentCompetition.find(params[:id])\n @content_competition.destroy\n\n respond_to do |format|\n format.html { redirect_to content_competitions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90dab8c532affac10e8f850b55d81ffd", "score": "0.75134116", "text": "def destroy\n\t\t@competition = current_user.competitions.find(params[:id])\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3b7de259d5c35346a0d6fc57a7814528", "score": "0.749968", "text": "def destroy\n @petition = Petition.find(params[:id])\n @petition.destroy\n\n respond_to do |format|\n format.html { redirect_to petitions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd8d09ed383ca2c002043e9ea12aeccc", "score": "0.74886394", "text": "def destroy\n @competition = Competition.find(params[:id])\n @competition.destroy\n puts @competition.id\n render json: @competition.id\n end", "title": "" }, { "docid": "e9f6bfef120d9e68b7d49614b333b972", "score": "0.74886036", "text": "def destroy\r\n @petition.destroy\r\n respond_to do |format|\r\n format.html { redirect_to petitions_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "45bde708504bc55a6ed1001589bd7b4e", "score": "0.7488049", "text": "def destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'El concurso fue borrado.' }\n format.json { head :no_content }\n end\n @competition = Competition.find(params[:id]).destroy\n \n puts \"--->id concurso #{@competition.id}\"\n \n end", "title": "" }, { "docid": "61d6df627108efdd5e48de983247e8f5", "score": "0.7435137", "text": "def destroy\n @admin_competition = Admin::Competition.find(params[:id])\n @admin_competition.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_competitions_url, notice: 'Competição apagada com sucesso' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e801c89dbabab11980246800ace570f5", "score": "0.73943245", "text": "def destroy\n @teams_competition.destroy\n respond_to do |format|\n format.html { redirect_to teams_competitions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "040e833f97057002dbffb4e180730e97", "score": "0.73897845", "text": "def destroy\n id_competitor = @competitor.competitions_id\n\n respond_to do |format|\n format.html { redirect_to competitions_url + '/' + id_competitor.to_s, notice: 'Competitor was successfully destroyed.' }\n format.json { head :no_content }\n end\n @competitor.destroy\n end", "title": "" }, { "docid": "c845cd8758e65c3d9e9b894e09e15509", "score": "0.73851204", "text": "def destroy\n check_admin\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2e48a5c8c56468654963402d769a9faa", "score": "0.7378144", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2e48a5c8c56468654963402d769a9faa", "score": "0.7378144", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2e48a5c8c56468654963402d769a9faa", "score": "0.7378144", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b027d0b9c9e21c036ad59e2129fd7f38", "score": "0.73401743", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_admin_path, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8f0938d6e70207064654b043cf9aa36a", "score": "0.7293694", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html do\n redirect_to competitions_url,\n notice: 'Competition was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "79b7374ddd33c1e193b7bda2037b6334", "score": "0.7266297", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to admin_competitions_url, notice: '比赛删除成功.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "79b7374ddd33c1e193b7bda2037b6334", "score": "0.7266297", "text": "def destroy\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to admin_competitions_url, notice: '比赛删除成功.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ec5773596d45e96877fec50d86903a8", "score": "0.7265096", "text": "def destroy\n @petition.destroy\n respond_to do |format|\n format.html { redirect_to petitions_url, notice: 'Petition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ec5773596d45e96877fec50d86903a8", "score": "0.7265096", "text": "def destroy\n @petition.destroy\n respond_to do |format|\n format.html { redirect_to petitions_url, notice: 'Petition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "21ef75a94676d25c27cbf8337ceae21c", "score": "0.7234121", "text": "def destroy\n @competitions_team.destroy\n respond_to do |format|\n format.html { redirect_to competitions_teams_url, notice: 'Competitions team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "68bfe7c4ef50ab8224114c7d07fe3f29", "score": "0.70990014", "text": "def destroy\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5c43807f5c76a1d090ae78e3f3115dd0", "score": "0.70936257", "text": "def destroy\n @petition_client_satisfaction.destroy\n respond_to do |format|\n format.html { redirect_to petition_client_satisfactions_url, notice: 'Petition client satisfaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b881cec7b6ea0c6c2755cebc23900fe8", "score": "0.70934963", "text": "def destroy\n @competence.destroy!\n render json: {status: :ok}\n end", "title": "" }, { "docid": "9e16f3d016b2662dc53d4c8be00e5ae6", "score": "0.708214", "text": "def destroy\n @scholarship_petition.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "678eda9cc81bba3bfa6420e99df63f92", "score": "0.7075405", "text": "def destroy\n @competition_type.destroy\n respond_to do |format|\n format.html { redirect_to competition_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ce9a791d7178aaa7c35a8b2801283cf7", "score": "0.70719755", "text": "def destroy\n @competency.destroy\n respond_to do |format|\n format.html { redirect_to competencies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9716e5e96fff0d2143b16489df033009", "score": "0.7069625", "text": "def destroy\n @competence = Competence.find(params[:id])\n @competence.destroy\n\n respond_to do |format|\n format.html { redirect_to competences_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f99fd8a09a3cf89177fed46f163a08da", "score": "0.7062173", "text": "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f99fd8a09a3cf89177fed46f163a08da", "score": "0.7062173", "text": "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "990b70084ded450b0f2034af63f74852", "score": "0.7048306", "text": "def destroy\n @petition_cat.destroy\n respond_to do |format|\n format.html { redirect_to petition_cats_url, notice: 'Petition cat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "867fbc389f6b0e66636e0bafdde74d86", "score": "0.7042993", "text": "def destroy\n @user_competition.destroy\n respond_to do |format|\n format.html { redirect_to user_competitions_url, notice: 'User competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f59d5701f49e93024f67a243fc570b2b", "score": "0.7030397", "text": "def destroy\n @competition = Competition.find(params[:id])\n @competition.destroy\n\n respond_to do |format|\n format.html { redirect_to list_competition_path }\n format.js { render :layout => false }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c3d16545ff7a67ef12ac45a6f04fab5", "score": "0.70221543", "text": "def destroy\n @room_petition.destroy\n respond_to do |format|\n format.html { redirect_to room_petitions_url, notice: 'Room petition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1d39ea25b785250641df0a5c0d683f37", "score": "0.69723403", "text": "def destroy\n @competition = Competition.find(params[:competition_id])\n @score_type = ScoreType.find(params[:id])\n @score_type.destroy\n\n respond_to do |format|\n format.html { redirect_to @competition }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "56418c0fed3f7e3f2b7d74770a9af8c8", "score": "0.6971864", "text": "def destroy\n @elaboration = Elaboration.find(params[:id])\n @elaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to elaborations_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4e200cb2c2fff74bc432672487403702", "score": "0.6957173", "text": "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e200cb2c2fff74bc432672487403702", "score": "0.6957173", "text": "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e200cb2c2fff74bc432672487403702", "score": "0.6957173", "text": "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0419a1f5168e6d294df09ebc5fa8df08", "score": "0.6937593", "text": "def destroy\n redirect_to answers_path\n @competitiveness.destroy\n respond_to do |format|\n format.html { redirect_to competitivenesses_url, notice: 'Competitiveness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d2ecb4ebc91a2591e94d1bf33e0413db", "score": "0.69372845", "text": "def destroy\n @conjugaison.destroy\n respond_to do |format|\n format.html { redirect_to conjugaisons_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e41953c3ff1cb9def3c3f091ad20256e", "score": "0.6927924", "text": "def destroy\n @account_petition.destroy\n respond_to do |format|\n format.html { redirect_to account_petitions_url, notice: 'Account petition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d99855c5c0f9a09119c2f62c7432be1e", "score": "0.69252914", "text": "def destroy\n @petition_comment = PetitionComment.find(params[:id])\n @petition_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to petition_comments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ef9cfb780434e99426753aba54a1d141", "score": "0.69067013", "text": "def destroy\n @exercice.destroy\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ebeca79251f97708c284e3803657d44c", "score": "0.6900004", "text": "def destroy\n @competitions_pit_form.destroy\n respond_to do |format|\n format.html { redirect_to competitions_pit_forms_url, notice: 'Competitions pit form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1bc03f7cd821eb7ae076e6a908fd9bb5", "score": "0.6877742", "text": "def destroy\n @petition.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(code: Code.first.code) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8d66e60a6c3cf7d90436b5931fd132f", "score": "0.68691826", "text": "def destroy\n @conjugation = Conjugation.find(params[:id])\n @conjugation.destroy\n\n respond_to do |format|\n format.html { redirect_to conjugations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6385caaff03fab444b925d43c8d54951", "score": "0.68594325", "text": "def destroy\n @interview = Interview.find(params[:id])\n\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n \n end", "title": "" }, { "docid": "76b3afc2d837ff13c481701657f1fb91", "score": "0.6856468", "text": "def destroy\n @practice.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e421b1b923c084a396d30f2719bdaec", "score": "0.6846386", "text": "def delete_competition\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if (@user.nil?)\n\t\trender :json=>{:success=>false, :msg=>'Competition ID not specified.'} and return if (!params.has_key?(:id))\n\t\t\n\t\t#Check competition\n\t\tcompetition_id = params[:id]\n\t\tcompetition = Competition.find_by_id(competition_id)\n\t\trender :json=>{:success=>false, :msg=>'Invalid competition'} and return if (competition.nil?)\n\t\t\n\t\t#Is user creator?\n\t\trender :json=>{:success=>false, :msg=>'Only the creator can delete a competition.'} and return if (competition.creator_id != @user.id)\n\t\t\n\t\tcompetition.status = STATUS[:DELETED]\n\t\tcompetition.save\n\t\t\n\t\trender :json=>{:success=>true, :msg=>'Competition deleted.'} and return\n\t\t\n\tend", "title": "" }, { "docid": "ec1ab23fdcb4565490bef719f07c1599", "score": "0.6841022", "text": "def destroy\n @comake_it.destroy\n respond_to do |format|\n format.html { redirect_to comake_its_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c21e93bf02a1595c38ea65259a3be4df", "score": "0.68402493", "text": "def destroy\n @competitorgame.destroy\n respond_to do |format|\n format.html { redirect_to competitorgames_url, notice: 'Competitorgame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "861bd22812949b1f87673a4a1bc9397b", "score": "0.6839883", "text": "def destroy\n @colaborador = Colaborador.find(params[:id])\n @colaborador.destroy\n\n respond_to do |format|\n format.html { redirect_to colaboradores_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "50c8abf92fd0f92e472205455b89c1da", "score": "0.6838449", "text": "def destroy\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "48c3d3f38fffae3f07f34efba66dd0af", "score": "0.68365717", "text": "def destroy\n @collaboration = Collaboration.find(params[:id])\n @collaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to collaborations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e029a892bf20c8f11adf5a526547af79", "score": "0.6832141", "text": "def destroy\n @interview = Interview.find(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e029a892bf20c8f11adf5a526547af79", "score": "0.6832047", "text": "def destroy\n @interview = Interview.find(params[:id])\n @interview.destroy\n\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8b34eba501fe79793a5edff2602a7596", "score": "0.6821697", "text": "def delete\n p \"WE IN DELETE\"\n\n p params[:id] \n\n\n begin\n p \"are we ok?\"\n # will need to change to full delete\n response = RestClient.delete \"https://gtcollab.herokuapp.com/api/meetings/\" + params[:id], {authorization: $token}\n \n p \"are we ok?\"\n objArray = JSON.parse(response.body)\n p objArray\n p \"are we ok?\"\n\n rescue => e\n p \"are we not ok?\"\n p e.response\n p e.response.body\n end\n\n redirect_to course_path(params[:course_id], :name => params[:name], :joined => params[:joined])\n end", "title": "" }, { "docid": "6ec9c666f181e0e61673b99f26665e0f", "score": "0.68166065", "text": "def destroy\n @competency.destroy\n respond_to do |format|\n format.html { redirect_to @referential, notice: 'Competency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e73e37c5e84a39a84aa3f1b467e5e136", "score": "0.6812299", "text": "def destroy\n @competition.destroy\n\n redirect_to competition_setup_path\n end", "title": "" }, { "docid": "4e7bcc5c550741682714a34dfac8dcdb", "score": "0.68061924", "text": "def destroy\n @regiment_exercise.destroy\n respond_to do |format|\n format.html { redirect_to regiment_exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f233b2748a4a7aefefdeb4a604ff9f5b", "score": "0.6804291", "text": "def destroy\n @subject_competency = SubjectCompetency.find(params[:id])\n @subject_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_competencies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "379fcb0a8f9991a84b97a6e3b17e4c01", "score": "0.6800661", "text": "def destroy\n @interview_response = InterviewResponse.find(params[:id])\n @interview_response.destroy\n\n respond_to do |format|\n format.html { redirect_to interview_responses_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "56ea5327bf70f26bb868a5f7435db0e8", "score": "0.67950976", "text": "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4dd79baa056fbcaf51a306e0024d39cb", "score": "0.6794259", "text": "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to my_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4778365af939a5c0cebe458bf3eaacc5", "score": "0.6791929", "text": "def destroy\n\n @compet.destroy\n respond_to do |format|\n format.html { redirect_to compets_path(@compet, egresso_id: @compet.egresso_id), notice: 'Competência adicional excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "882e35ccca74de5cebb4707687d8b162", "score": "0.67800254", "text": "def destroy\n ec = @judge.competition\n\n respond_to do |format|\n if @judge.destroy\n format.html { redirect_to competition_judges_path(ec), notice: \"Judge Deleted\" }\n format.json { head :no_content }\n else\n flash[:alert] = \"Unable to delete judge\"\n format.html { redirect_to competition_judges_path(ec) }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "7fd91ceab7dd95abcc24ce214b425fc1", "score": "0.6779517", "text": "def destroy\n @laboratorio.destroy\n respond_to do |format|\n format.html { redirect_to laboratorios_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1ed95cba48d48a5d7096cfd009e89bae", "score": "0.6778202", "text": "def destroy\n @adjective.destroy\n respond_to do |format|\n format.html { redirect_to adjectives_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d732045d20c1208dcf0cba6303a32826", "score": "0.67780894", "text": "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d732045d20c1208dcf0cba6303a32826", "score": "0.67780894", "text": "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7bbbe44e0bd707f240c24fc49ddab1d4", "score": "0.6774234", "text": "def destroy\n @commute = Commute.find(params[:id])\n @commute.destroy\n\n respond_to do |format|\n format.html { redirect_to commutes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "12f3bc3d792ffac6f366ebeeb23a9a3a", "score": "0.6774077", "text": "def destroy\n @comic_title = ComicTitle.find(params[:id])\n @comic_title.destroy\n\n respond_to do |format|\n format.html { redirect_to comic_titles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b294ff7b818470bb6a28e51fd8cb5ba9", "score": "0.67668986", "text": "def destroy\n @client_pet.destroy\n respond_to do |format|\n format.html { redirect_to client_pets_url, notice: 'Client pet was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8700348b2c8e81717d61bf6c7fbcd43d", "score": "0.6763089", "text": "def destroy\n @competencium.destroy\n respond_to do |format|\n format.html { redirect_to competencia_url, notice: 'Competencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea26d6afe4bd7f0c2f2a2c2473100f3d", "score": "0.67605305", "text": "def destroy\n @competitions_match_form.destroy\n respond_to do |format|\n format.html { redirect_to competitions_match_forms_url, notice: 'Competitions match form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "66f1eeed524b674edc942e837e0d7593", "score": "0.67512065", "text": "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "66f1eeed524b674edc942e837e0d7593", "score": "0.67512065", "text": "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1283a8e4a17ff3bbd70776270aa9f8a9", "score": "0.6748337", "text": "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url, notice: 'Interview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1283a8e4a17ff3bbd70776270aa9f8a9", "score": "0.6748337", "text": "def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url, notice: 'Interview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d07682f642076ecb876129ea6cb92f2b", "score": "0.67477274", "text": "def destroy\n # @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2d3782ce72e8e9f55dc6d3b215f7a82f", "score": "0.67447686", "text": "def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7290eef63bb79038d174d61c8fc9d4ee", "score": "0.67389154", "text": "def destroy\n @jogo = Jogo.find(params[:id])\n @jogo.destroy\n\n respond_to do |format|\n format.html { redirect_to jogos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4630800dcc0578345e184e18b9adfb6b", "score": "0.6737538", "text": "def destroy\n @comite = Comite.find(params[:id])\n @comite.destroy\n\n respond_to do |format|\n format.html { redirect_to comites_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9c0228471ece09a6cff81f239c7e3b40", "score": "0.6736087", "text": "def destroy\r\n @interview = Interview.find(params[:id])\r\n @interview.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to interviews_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "25fa5e056fb5a3a28df14515ec17cf36", "score": "0.673494", "text": "def destroy\n @cute.destroy\n respond_to do |format|\n format.html { redirect_to cutes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "26563890f813bd24a9fd984ee951f7d9", "score": "0.6733964", "text": "def destroy\n @problem_in_contest.destroy\n respond_to do |format|\n format.html { redirect_to problem_in_contests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5cb3468076b8a88a6664a0bd6118278e", "score": "0.6723648", "text": "def destroy\n @competition = @lane_assignment.competition\n @lane_assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_lane_assignments_path(@competition) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5cb3468076b8a88a6664a0bd6118278e", "score": "0.6723648", "text": "def destroy\n @competition = @lane_assignment.competition\n @lane_assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_lane_assignments_path(@competition) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a5f1215d0d4086e875563a2cda0e4bc", "score": "0.67178524", "text": "def destroy\n @pec_complaint = PecComplaint.find(params[:id])\n @pec_complaint.destroy\n\n respond_to do |format|\n format.html { redirect_to pec_complaints_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a3e295f9b3b26ec8f5f1159619b941d9", "score": "0.67141163", "text": "def destroy\n @prepaconcoursecole = Prepaconcoursecole.find(params[:id])\n @prepaconcoursecole.destroy\n\n respond_to do |format|\n format.html { redirect_to prepaconcoursecoles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "699bda24971bfb015e15025d5df74198", "score": "0.67113036", "text": "def destroy\n @reponse = Reponse.find(params[:id])\n @reponse.destroy\n\n respond_to do |format|\n format.html { redirect_to reponses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5d5d8e15c96b6ee2b13ac8497cf2f4db", "score": "0.6710799", "text": "def destroy\n @comit = Comit.find(params[:id])\n @comit.destroy\n\n respond_to do |format|\n format.html { redirect_to comits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e1478b6374ecacf65a748bc22ebdd7c", "score": "0.6708221", "text": "def destroy\n if can_edit?\n @competition.destroy\n respond_to do |format|\n format.html { redirect_to competitions_url, notice: 'Competition was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect :back, alert:\"You cannot do that.\"\n end\n end", "title": "" }, { "docid": "3f3dd5c93c3f59c44b602f6adcd5a654", "score": "0.6707311", "text": "def destroy\n @correspondences = Correspondence.find(params[:id])\n @correspondences.destroy\n\n respond_to do |format|\n format.html { redirect_to correspondences_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ac2bc7cec4a2672f5d97776d1e64c1e", "score": "0.6703417", "text": "def destroy\n @puzzle.destroy\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
9810bb0e3bee8203500ceecfa700a1b9
Test if value is included
[ { "docid": "86f8ac1d4524bca6bc47b8a9fa345095", "score": "0.0", "text": "def matches?(value)\n accepted.include?(value)\n end", "title": "" } ]
[ { "docid": "89ee768efefc77c62688bcf804b917fe", "score": "0.8311925", "text": "def include?(value); end", "title": "" }, { "docid": "f1d7b33c06d5cfe8f81bfb6ac2a199c8", "score": "0.80940056", "text": "def include?(val)\n\n end", "title": "" }, { "docid": "3edb5effc52ebe58eb680de10a524e1d", "score": "0.8035327", "text": "def include?(value)\n not match(value.to_s).nil?\n end", "title": "" }, { "docid": "93886ba604b0fb3987023b6718885a54", "score": "0.7883989", "text": "def include?(value)\n super(normalize_value(value))\n end", "title": "" }, { "docid": "4802fd0673b0a0bb4900c4b78e414214", "score": "0.77821946", "text": "def include?(value)\n @data.include? value\n end", "title": "" }, { "docid": "997ae149d5302b36fa1d397b70570a75", "score": "0.76581603", "text": "def include? elem\n value.include? elem\n end", "title": "" }, { "docid": "2b1cd3c45663569a0b92dee70d90e8ff", "score": "0.75587535", "text": "def include?(value)\n !find(value).nil?\n end", "title": "" }, { "docid": "2576e78de8fb539302e5a7d98bc9a419", "score": "0.75458384", "text": "def include?(value)\n items.include?(value)\n end", "title": "" }, { "docid": "28cb6b5f00dce1986ccd51edc8c1d2c1", "score": "0.7512363", "text": "def include?(value)\n valid_or_optional?(value, &type.method(:include?))\n end", "title": "" }, { "docid": "8fb18886045948c45646e3d22749d1af", "score": "0.7378993", "text": "def include?(value)\n get_array.include?(value)\n end", "title": "" }, { "docid": "ea3fe69ffb17010c7f00357dec88d425", "score": "0.73270905", "text": "def include?(val)\n @list.include?(val)\n end", "title": "" }, { "docid": "eb74987fdb243392d1cb6cbad6e595c5", "score": "0.72027534", "text": "def included?\n within_range? and value_condition\n end", "title": "" }, { "docid": "9d3b980d6f80d3f3df8a8b8bd944ed63", "score": "0.7185636", "text": "def inclusion\n _validate(__method__) {|collection| collection.include?(@value) }\n end", "title": "" }, { "docid": "d3a3be8b1a980a3e0340726237d115b4", "score": "0.716952", "text": "def includes?(val)\n set[val] == true\n end", "title": "" }, { "docid": "b2dd3d99b754e4fc1e833a31e01aa96d", "score": "0.7096186", "text": "def include_x?(x); end", "title": "" }, { "docid": "a06fed682d8a162767e856df61f7267e", "score": "0.7078847", "text": "def include?(object)\n value.include?(object)\n end", "title": "" }, { "docid": "bc94c11d9541c034c984f15216c45217", "score": "0.70426255", "text": "def has_value?(k); orig_include?(k); end", "title": "" }, { "docid": "2fceaf84a072c85c04ded2ce04ca1aee", "score": "0.7031026", "text": "def include?(v)\n @c.get(v.to_s) == v\n end", "title": "" }, { "docid": "74f1187ed9260d53e88635bf90d03d5a", "score": "0.7016228", "text": "def include_condition?(key, value)\n value.respond_to?(:keys) && value.keys.map(&:to_sym) == [:include]\n end", "title": "" }, { "docid": "74f1187ed9260d53e88635bf90d03d5a", "score": "0.7016228", "text": "def include_condition?(key, value)\n value.respond_to?(:keys) && value.keys.map(&:to_sym) == [:include]\n end", "title": "" }, { "docid": "3360f55a66f7acb5843cecb8022058b8", "score": "0.70098585", "text": "def include?(element)\n @values.include? element\n end", "title": "" }, { "docid": "7b4033c88002f885273405956bbdffbd", "score": "0.6963536", "text": "def check_include!(value, expected)\n return if expected.include?(value)\n\n msg = \"#{value} should be included in #{expected}.\"\n raise ApplicationError, msg\n end", "title": "" }, { "docid": "f6522697683c63c099b5be73fc1c3a39", "score": "0.69612104", "text": "def include?(value)\n raise NotImplementedError, \"Missing #{self.class.name}#include?\"\n end", "title": "" }, { "docid": "9f8c6de351ab109081fe64a96d21fba5", "score": "0.69502246", "text": "def include?(x)\n @hash.has_value?(x)\n end", "title": "" }, { "docid": "d01a9b2549520675f884b80a0b436dc9", "score": "0.6894633", "text": "def include?(oth)\n includes(oth)\n end", "title": "" }, { "docid": "2dba2cfccae07010eb8b29c151076c50", "score": "0.68731344", "text": "def include?(value)\n return false if value.class != Hash\n @modified_data.include?(value) || @raw_data.include?(value)\n end", "title": "" }, { "docid": "78aa6d0823b75fd5dc6ad549d0a2dcf5", "score": "0.685369", "text": "def include?(value)\n @lookup ||= Set.new(values)\n @lookup.include?(value)\n end", "title": "" }, { "docid": "4c76e82bb2264e63aeab6bbf7778cae3", "score": "0.6823852", "text": "def include?(_)\n false\n end", "title": "" }, { "docid": "1e5622585a6429b1379caeb51a4f0be6", "score": "0.6778154", "text": "def inclusion\n _validate(__method__) {|collection| collection.include?(value) }\n end", "title": "" }, { "docid": "8838fc651316b2020bd980403e8af4d2", "score": "0.6771833", "text": "def include?(arr, value)\n included = false\n for el in arr\n included = true if el == value\n end\n included\nend", "title": "" }, { "docid": "1fe512e5305cf379197a8a8f54eb9926", "score": "0.6726757", "text": "def include?(items, search_value)\n included = false\n items.each do |item|\n included = true if item == search_value\n end\n included\nend", "title": "" }, { "docid": "d0cdf74e77b5e280aed750cfda645b3a", "score": "0.67164654", "text": "def include?(arr, value)\n arr.each do |el|\n return true if value == el\n end\n return false\nend", "title": "" }, { "docid": "9a3ac06b565e3daa8cd7b7e551e49e04", "score": "0.66910136", "text": "def include?(val)\n if val.is_a?(Hash)\n then val.stringify.each do |k, v|\n unless @data.key?(k) && @data[k] == v\n return false\n end\n end\n\n else\n return @data.include?(\n val\n )\n end\n\n true\n end", "title": "" }, { "docid": "6f556b6170cc57f91f3c6a406c72c451", "score": "0.6691008", "text": "def include?(value)\n driver.page_source.include?(value)\n end", "title": "" }, { "docid": "2b4575eb1c9eb5f55402c62122b9899a", "score": "0.6690889", "text": "def has_value? value\n\n\t\t@inner.each do |k, vals|\n\n\t\t\treturn true if vals.include? value\n\t\tend\n\n\t\tfalse\n\tend", "title": "" }, { "docid": "a450f33262ef812688deaa472a7e199f", "score": "0.66883206", "text": "def include_variable?\n @data.any? {|_, val| val.include_variable?}\n end", "title": "" }, { "docid": "61fb98147a6199dee4a7033d26ea62e8", "score": "0.66860604", "text": "def include?(value)\n connection.sismember key_label, value.to_s\n end", "title": "" }, { "docid": "531c84751f8e93dbe3992dc253515ffc", "score": "0.66596997", "text": "def include?(arr, value)\n puts \"#{arr.include?(value)}\"\nend", "title": "" }, { "docid": "fd976037582f5200b05425151b2c17c7", "score": "0.6647933", "text": "def include?(key)\n\t\tend", "title": "" }, { "docid": "8be25f42e950057889bd7fcb7621abcc", "score": "0.66456807", "text": "def assertInclude collection, value, message = nil\n __assert_include ASSERT_INCLUDE_ERROR, collection, value, message do\n collection.include? value\n end\n end", "title": "" }, { "docid": "42d499187f384e7c6bd8df1c4560b8b5", "score": "0.6611657", "text": "def include?(arr, value)\n boolean_value = false\n arr.each do |ele|\n if ele == value\n return boolean_value = true\n else\n boolean_value = false\n end\n end\n boolean_value\nend", "title": "" }, { "docid": "251eb4dda6188437921e9fc9ec83e729", "score": "0.6598175", "text": "def include? x\n ! ! _set.key?(x)\n end", "title": "" }, { "docid": "b224d3707d4685ee70552e8c65b389b0", "score": "0.6588742", "text": "def include?(item); end", "title": "" }, { "docid": "b224d3707d4685ee70552e8c65b389b0", "score": "0.6588742", "text": "def include?(item); end", "title": "" }, { "docid": "63a0ee556e675a5baf1b106f19a29f09", "score": "0.65859205", "text": "def include?(array,value)\n array.each { |item| return true if item == value } \n false\nend", "title": "" }, { "docid": "ed8ff600ea32c39dc2062ae5f565c4cc", "score": "0.65721965", "text": "def include?(name)\n includes?(name)\n end", "title": "" }, { "docid": "3be4d52f9d958d6dcfbbc6974c4b0f9a", "score": "0.6561225", "text": "def assertInclude collection, value, message = nil\n assertRespondTo collection, :include?, message\n __assert (collection.include? value), ASSERT_INCLUDE_ERROR, message, {:collection=>collection, :value=>value}\n end", "title": "" }, { "docid": "0377bac9d5791e033094b587d17ff147", "score": "0.655289", "text": "def include?(item)\n true\n end", "title": "" }, { "docid": "47fcc68471d94f9ad5ad687cc24a7d7f", "score": "0.6539203", "text": "def include?(array, value)\n array.any?(value)\nend", "title": "" }, { "docid": "d0356d08622ade183459623f1c725a34", "score": "0.65348047", "text": "def include?(x)\n sel = find x\n sel.any?\n end", "title": "" }, { "docid": "f81b9566f1c0f5f0501b1dd6e0e3e2bc", "score": "0.65342015", "text": "def include?(array, value)\n array.each { |element| return true if value == element }\n false\nend", "title": "" }, { "docid": "cd562ab5ba7ebe6df5d4ad7390b11f78", "score": "0.65320915", "text": "def has_value(value); end", "title": "" }, { "docid": "aef83f892147b61e15cb0a7b3cd955b7", "score": "0.65135896", "text": "def value?(value)\n values.include?(value)\n end", "title": "" }, { "docid": "9149242d74875b74d25d81f231fb50f6", "score": "0.64981407", "text": "def include?(field)\n field = field.to_sym\n @set.find {|i| i.field == field} ? true : false\n end", "title": "" }, { "docid": "9149242d74875b74d25d81f231fb50f6", "score": "0.64981407", "text": "def include?(field)\n field = field.to_sym\n @set.find {|i| i.field == field} ? true : false\n end", "title": "" }, { "docid": "8e96372930ac46885996512d78691072", "score": "0.6486869", "text": "def include?(array, value)\n array.each do |val|\n if val == value\n return true\n end \n end \n false\nend", "title": "" }, { "docid": "e76a5ac7581ec219a350349ad5d305f1", "score": "0.64827114", "text": "def include?\n end", "title": "" }, { "docid": "aa155c3aed3d736a545fbd66e738632e", "score": "0.64725", "text": "def include?(item)\n each.to_a.include? item\n end", "title": "" }, { "docid": "b0a755fa4840b73e5f95edd3be550f01", "score": "0.6468329", "text": "def include?(value)\n return false if @_enum_hash.empty?\n @_enum_hash.values.any? { |enum| enum.value == value }\n end", "title": "" }, { "docid": "95d7629b3305e1addbae11fb2a3a9486", "score": "0.6467559", "text": "def include?(arr, val)\n bool = false\n arr.each {|elm| bool = true if elm == val}\n bool\nend", "title": "" }, { "docid": "3dced1eb15a79ebaffed5fb5a5c78120", "score": "0.6462442", "text": "def include?(element)\n end", "title": "" }, { "docid": "3dced1eb15a79ebaffed5fb5a5c78120", "score": "0.6462442", "text": "def include?(element)\n end", "title": "" }, { "docid": "5c62290112d97e3c41d07a51f00ee995", "score": "0.6461765", "text": "def include?(key); end", "title": "" }, { "docid": "5c62290112d97e3c41d07a51f00ee995", "score": "0.6461765", "text": "def include?(key); end", "title": "" }, { "docid": "5c62290112d97e3c41d07a51f00ee995", "score": "0.6461765", "text": "def include?(key); end", "title": "" }, { "docid": "4e82caa3dff61faec9a6c5e8ac79da99", "score": "0.6460205", "text": "def include?(num)\n self[num].include?(num)\n end", "title": "" }, { "docid": "4e82caa3dff61faec9a6c5e8ac79da99", "score": "0.6460205", "text": "def include?(num)\n self[num].include?(num)\n end", "title": "" }, { "docid": "4e82caa3dff61faec9a6c5e8ac79da99", "score": "0.6460205", "text": "def include?(num)\n self[num].include?(num)\n end", "title": "" }, { "docid": "4e82caa3dff61faec9a6c5e8ac79da99", "score": "0.6460205", "text": "def include?(num)\n self[num].include?(num)\n end", "title": "" }, { "docid": "8846e956d26a4f8551ba3f6d276b6d65", "score": "0.64535534", "text": "def include?(value)\n case value\n when Destination then each.any? { |k, v| value.eql?(v) }\n when Regexp then each.any? { |k, v| value === k }\n else each.any? { |k, v| value.to_s.eql?(k) }\n end\n end", "title": "" }, { "docid": "651ed8293919eb0c49da101ce2208c2f", "score": "0.6451335", "text": "def include?(name)\n (@only.nil? && @except.nil?) ||\n (!@only.nil? && @only.include?(name)) ||\n (!@except.nil? && !@except.include?(name))\n end", "title": "" }, { "docid": "77f5e8bd516433a79381294ffd039463", "score": "0.64489245", "text": "def has_value?(value)\n values.include?(value)\n end", "title": "" }, { "docid": "e66ebb9e97744a075908d5f3d1ac3a84", "score": "0.64413184", "text": "def include?(item)\n # FIXME\n end", "title": "" }, { "docid": "f424199c71a0a8db61f9ddb0207a072f", "score": "0.6441315", "text": "def include?(array, value)\n\tinside = false\n\tarray.each do |element|\n\t\tinside = true if element == value\n\tend\n\tinside\nend", "title": "" }, { "docid": "2c904f5429f11ff048231545310f3e3a", "score": "0.64409673", "text": "def include?(arr, value)\n arr.count(value) > 0\nend", "title": "" }, { "docid": "26a9ef7ff5a3bfc319fe0b7fc86d8900", "score": "0.6440828", "text": "def include?(array, test_value)\n array.each do |element|\n return true if (element == test_value)\n end\n false\nend", "title": "" }, { "docid": "26098f65d04b2a1c384671c63924ff42", "score": "0.642502", "text": "def include? item\n return @contained.include?(item)\n end", "title": "" }, { "docid": "37f141418ff6d24f8afa0a4d90a5b974", "score": "0.6422926", "text": "def include?(thing)\n @stuff.flatten(1).include?(thing)\n end", "title": "" }, { "docid": "8408b0876082b33525e3dabd8ab06e40", "score": "0.6422382", "text": "def include?(item)\n self.__contains__(item).rubify\n end", "title": "" }, { "docid": "df3c7cbc2e4672e36dde165e261e9ae8", "score": "0.64209247", "text": "def include?(inc)\n @text.include? inc\n end", "title": "" }, { "docid": "4c875454b552453572b56b8b5515a44a", "score": "0.64194006", "text": "def include?(key)\n !self[key].nil?\n end", "title": "" }, { "docid": "ac2488911253fbed6b39d38bde7d8c57", "score": "0.6418205", "text": "def facet_in_params?(field, value)\n super || (params[:f_inclusive] and params[:f_inclusive][field] and params[:f_inclusive][field].include?(value))\n end", "title": "" }, { "docid": "540b0c435fb4f0bda27ac7db9254c417", "score": "0.6418192", "text": "def contains(value)\n end", "title": "" }, { "docid": "c20c205c252efe10871b7e2e3080ed5e", "score": "0.64090025", "text": "def check_include?(arr, number)\n puts \"#{arr} include #{number}\" if arr.include?(number)\nend", "title": "" }, { "docid": "75241a1fa9bd9b6c7284665998de67a8", "score": "0.64063627", "text": "def include(key)\n hash = Hash['a', 'abc', 'b', 'def', 'c', 'ghi']\n if hash.include?(key)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "fce4cc84b3f9cc5e8bcf460fdc765de5", "score": "0.64023036", "text": "def include?(param)\n @hash.include? param and not @hash[param].nil?\n end", "title": "" }, { "docid": "254a00cd0405007f4975126f1593fc8a", "score": "0.63972276", "text": "def include?(param)\n @target_hash.include? param and not @target_hash[param].nil?\n end", "title": "" }, { "docid": "f753c1c97058223dcb48773dbc10e8a4", "score": "0.639078", "text": "def include?(arr, value)\n if arr.index(value)\n true\n else \n false\n end\nend", "title": "" }, { "docid": "2abe417d5cdb0cc4dbbec3adc11c9134", "score": "0.63907546", "text": "def include?(arr, val)\n arr.count(val) > 0\nend", "title": "" }, { "docid": "2abe417d5cdb0cc4dbbec3adc11c9134", "score": "0.63907546", "text": "def include?(arr, val)\n arr.count(val) > 0\nend", "title": "" }, { "docid": "79e6e6a1f08aeaae3b507bc11cef2ba8", "score": "0.63829803", "text": "def include?(array, value)\n !array.select {|num| num == value}.empty?\nend", "title": "" }, { "docid": "40a1e97db3b2e68e0760d04b36d5fa7d", "score": "0.63826954", "text": "def include?(key)\n key.in? self\n end", "title": "" }, { "docid": "ca7e57b9c18fd233c25dccfb0fb67d58", "score": "0.6373444", "text": "def included(attr, value, &block)\n @conditions << Conditions::Included.new(attr, value, &block)\n end", "title": "" }, { "docid": "c54e334aca1474e5662a6a3664e9efaa", "score": "0.63656515", "text": "def include?(item)\n each.to_a.include?(item)\n end", "title": "" }, { "docid": "fa74326013d4f9b8e3b9818f176e6c51", "score": "0.63640535", "text": "def include?(key)\n if @my_vars.include?(key)\n true\n else\n @coa_vars.find do |coa_vars|\n coa_vars.include?(key)\n end\n end\n end", "title": "" }, { "docid": "fa74326013d4f9b8e3b9818f176e6c51", "score": "0.63640535", "text": "def include?(key)\n if @my_vars.include?(key)\n true\n else\n @coa_vars.find do |coa_vars|\n coa_vars.include?(key)\n end\n end\n end", "title": "" }, { "docid": "6df00c4bc7c5827913620f9a3fc37bd0", "score": "0.63612247", "text": "def include?(flag)\n return true if ( @val & flag ) == flag\n return false\n end", "title": "" }, { "docid": "c2d0a90759d67d9ba3851c53ca95a809", "score": "0.6360249", "text": "def include?(array, value)\n array.each {|element| return true if element == value}\nend", "title": "" }, { "docid": "080c5012e54fad0dc7d26644f1689e77", "score": "0.63598716", "text": "def include_variable?\n true\n end", "title": "" }, { "docid": "f35214d233345c99d85ebbb0abf57544", "score": "0.635924", "text": "def included?(list)\n\nend", "title": "" }, { "docid": "522627c8b6b8bf8cc55d4a9d4227fe56", "score": "0.6357329", "text": "def include?(arg0)\n end", "title": "" } ]
b01940eababd91da2fb253a78f723e05
POST /item_lots POST /item_lots.json
[ { "docid": "e2ec0f77e11a931d4a880cf2f8612b62", "score": "0.68577576", "text": "def create\n @item_lot = ItemLot.new(item_lot_params)\n\n respond_to do |format|\n if @item_lot.save\n format.html { redirect_to @item_lot, notice: 'Item lot was successfully created.' }\n format.json { render json: @item_lot, status: :created, location: @item_lot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "f475d90be6abdacf702aa2e8a437b88f", "score": "0.6731694", "text": "def create\n @lot = Lot.new(lot_params)\n @lot.event_id = @event.id\n # a lot must have at least one item\n # if(params[:item_ids].blank?)\n # redirect_to @lot, notice: 'You must add at least one item to the lot.'\n # return\n # end\n\n if @lot.save\n #update the items with this lot id\n Item.where(id: params[:item_ids]).update_all(lot_id: @lot.id)\n redirect_to event_lot_path(@event, @lot), notice: 'Lot was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "fbfcb277882c17a448208270063e11b8", "score": "0.63606536", "text": "def new\n @item_lot = ItemLot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_lot }\n end\n end", "title": "" }, { "docid": "1a87b6b1a8f3fc007c549688390eae3f", "score": "0.62854016", "text": "def create_item\n item = @list.items.create(:title => params[:title], :details => params[:details], :deadline => params[:deadline], :tags => params[:tags])\n render json: { item: item }\n end", "title": "" }, { "docid": "335f49f678a5233c69e66e7086e4b7ff", "score": "0.6262138", "text": "def create\n @stowed_item_slot = StowedItemSlot.new(stowed_item_slot_params)\n\n respond_to do |format|\n if @stowed_item_slot.save\n format.html { redirect_to @stowed_item_slot, notice: 'Stowed item slot was successfully created.' }\n format.json { render :show, status: :created, location: @stowed_item_slot }\n else\n format.html { render :new }\n format.json { render json: @stowed_item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "79218cfbf2da0de6946ddf6ca4f67d1d", "score": "0.5982929", "text": "def create\n item_types = params[:item_type].downcase.pluralize\n\n if PermissionsService.new(current_user, @lab).can_write?(item_types)\n items = @lab.send(item_types).where(:id => params[:item_ids])\n\n items.each do |item|\n ItemTagService.new(current_user, item).add_tag(params[:name])\n end\n\n render_json_success({\n :items => items.collect { |item| item.as_indexed_json }\n })\n else\n render_permission_error\n end\n end", "title": "" }, { "docid": "663bb8070ceb9ac78192e30451c45b06", "score": "0.59525824", "text": "def create\n @suggested_slot = @studio.suggested_slots.new(params[:suggested_slot])\n\n respond_to do |format|\n if @suggested_slot.save\n format.html { redirect_to edit_studio_path(@studio), :notice => 'Suggested slot was successfully created.' }\n format.json { render :json => @suggested_slot, :event => :created, :location => @suggested_slot }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @suggested_slot.errors, :event => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5ca2f3b5bf56738fc1956a808856b1f", "score": "0.59478647", "text": "def create\n @item_lines = ItemLine.new(item_line_params)\n\n if @item_lines.save\n render json: @item_lines, status: :created, location: @item_lines\n else\n render json: @item_lines.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "aecb81c839fb9e0eb9dba1a6ff3320ef", "score": "0.59380114", "text": "def create\n @slot = Slot.new(params[:slot])\n\n respond_to do |format|\n if @slot.save\n format.html { redirect_to @slot, notice: 'Slot was successfully created.' }\n #format.json { render json: @slot, status: :created, location: @slot }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c69ddde545847efa92b790bde8723e2", "score": "0.5936204", "text": "def create\n @roomslot = Roomslot.new(params[:roomslot])\n\n respond_to do |format|\n if @roomslot.save\n format.html { redirect_to timeslots_path, notice: 'Roomslot was successfully created.' }\n format.json { render json: @roomslot, status: :created, location: @roomslot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roomslot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "496a0af9bcc64678c3bf2a22d89f62cc", "score": "0.5851058", "text": "def create\n @new_item = Item.new(items_params)\n @new_item.list_id = params[:list_id]\n if @new_item.save!\n render :json => @new_item\n else\n render :json => {\n :response => \"Unable to create a new item\",\n :data => @new_item\n }\n end\n end", "title": "" }, { "docid": "75fd5bf14d360177822b17e367e996d4", "score": "0.5846879", "text": "def create\n @table = Table.find(params[:table_id])\n @timeslot = @table.timeslots.build(timeslot_params)\n\n respond_to do |format|\n if @timeslot.save\n format.html { redirect_to table_timeslots_path(@table), notice: \"Timeslot was successfully created.\" }\n format.json { render :show, status: :created, location: @timeslot }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4713e6a813152c956b884bdb3760608", "score": "0.5829994", "text": "def create\n @item = @group.items.new(params[:item])\n \n if @item.save\n item_specs = params[:specs]\n\n @group.group_specs.each do |gspec|\n spec = @item.specs.build\n spec.group_spec_id = gspec.id\n spec.value = item_specs[gspec.id.to_s]\n spec.save\n end if item_specs\n \n @status = \"good\"\n @message = \"Item added!\"\n serve_json_response\n else\n render :json => @item.errors, :status => :unprocessable_entity\n end\n end", "title": "" }, { "docid": "cc29357058be1d5a1cc6cc7331c6666a", "score": "0.5802801", "text": "def create\n @itemmodo = Itemmodo.new(itemmodo_params)\n\n if @itemmodo.save\n render json: @itemmodo, status: :created, location: @itemmodo\n else\n render json: @itemmodo.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "90733efeb5f56406313ddb98a0693260", "score": "0.57925826", "text": "def create\n item = Item.create! params\n \n render :json => item\n end", "title": "" }, { "docid": "079e22a134750daae47032f078224612", "score": "0.5774893", "text": "def create\n @item = Item.new(item_params)\n item_params[:tag_list].present? ? @item.tag_list.add(item_params[:tag_list].split(\", \")) : nil\n if !@item.save\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0434fba9cabe08ffa768688c4efefc91", "score": "0.57569987", "text": "def create\n item = Item.new(item_params)\n if item.save\n render json: {item: item}, status: 200, location: item\n else\n render json: item.errors, status: 422\n end \n end", "title": "" }, { "docid": "f0e6fbe0afbab0c3bda37487b8f444f6", "score": "0.57503504", "text": "def create\n @mostsmallequipslot = Mostsmallequipslot.new(params[:mostsmallequipslot])\n\n respond_to do |format|\n if @mostsmallequipslot.save\n format.html { redirect_to @mostsmallequipslot, notice: 'Mostsmallequipslot was successfully created.' }\n format.json { render json: @mostsmallequipslot, status: :created, location: @mostsmallequipslot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallequipslot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "591990f76a72176ac416f83bb175a856", "score": "0.5745541", "text": "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item, status: :created, location: @item\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f2df82549087826ce26402777b0bb765", "score": "0.5654604", "text": "def create\n @item = @location.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to location_inventory_path(id: @item.id), notice: 'Inventory Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "974fdd0401b95a8c8feef36f83f18053", "score": "0.5650125", "text": "def create\n @item = Item.new(item_params)\n unless params[:tags].blank?\n @item.tags = Tag.find params[:tags]\n end\n lastId = Item.maximum('id')\n @item.id = lastId === nil ? 1 : lastId + 1\n respond_to do |format|\n if @item.save\n format.json { render :show, status: :created, location: @item }\n else\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0854e159acab640da19e2a54c2779e00", "score": "0.5646394", "text": "def create\n @lot = Lot.new(lot_params)\n loop do\n @lot.key = ([*('a'..'z'),*('A'..'Z'),*('0'..'9')]-%w()).sample(8).join\n break unless Lot.exists?(key: @lot.key)\n end\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to farm_lots_path, notice: 'Lote creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @lot }\n else\n format.html { render :new }\n format.json { render json: @lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8615028f2e2248845a3007a275ac61c", "score": "0.56370115", "text": "def create\n @sellable_item = SellableItem.new(params[:sellable_item])\n\n respond_to do |format|\n if @sellable_item.save\n format.html { redirect_to @sellable_item, notice: 'Sellable item was successfully created.' }\n format.json { render json: @sellable_item, status: :created, location: @sellable_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sellable_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17e34425962a1c99a8d6acfa063fcd43", "score": "0.5634325", "text": "def create_item\n props = {\n bibIds: [create_bib],\n itemType: 50,\n location: 'os',\n barcodes: [@data[:item_barcode]],\n }\n props[:callNumbers] = [@data[:call_number]] unless (@data[:call_number] || '').empty?\n\n # Add an internal note identifying the partner item:\n unless @data[:item_nypl_source].nil? or @data[:item_id].nil?\n item_uri = \"#{ENV['PLATFORM_API_BASE_URL']}/items/#{@data[:item_nypl_source]}/#{@data[:item_id]}\"\n props[:internalNotes] = [\"Original item: #{item_uri}\"]\n end\n\n $logger.debug \"Sierra API POST: items #{props.to_json}\"\n response = self.class.sierra_client.post 'items', props\n\n raise SierraVirtualRecordError, 'Could not create temporary item' unless response.success? && response.body.is_a?(Hash) && response.body['link']\n\n @item_id = response.body['link'].split('/').last.to_i\n @item_id\n end", "title": "" }, { "docid": "630a1f9fabeb8855a74179379ffc8a1a", "score": "0.5631182", "text": "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item, status: :created\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6a2a4300de45199f5aae34611eeaeb97", "score": "0.5617309", "text": "def new\n @slot = Slot.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @slot }\n end\n end", "title": "" }, { "docid": "981f190b36e07ebf78a577b1749cd59b", "score": "0.56158334", "text": "def create\n @plot = Plot.new(params[:plot])\n @items = Item.select_list\n @places = Place.select_list\n @item = @plot.item\n respond_to do |format|\n if @plot.save\n @max_position = Plot.maximum(:position, :conditions => ['item_id = ?', @item.id] ) || 0\n @new_plot = Plot.new(\n :publish => true,\n :position => @max_position + 1,\n :item_id => @item.id\n )\n format.html { redirect_to(admin_plot_path(@plot), :notice => 'Plot was successfully created.') }\n format.js { render :template => 'admin/items/add_plot_to_item' }\n format.xml { render :xml => @plot, :status => :created, :location => @plot }\n else\n @new_plot = @plot\n format.html { render :action => \"new\" }\n format.js { render :template => 'admin/items/add_plot_to_item' }\n format.xml { render :xml => @plot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1c9acc6d7130b605adfe617442cd9a7", "score": "0.56138664", "text": "def create\n @pit_lineitem = PitLineitem.new(pit_lineitem_params)\n\n respond_to do |format|\n if @pit_lineitem.save\n format.html { redirect_to @pit_lineitem, notice: 'Pit lineitem was successfully created.' }\n format.json { render :show, status: :created, location: @pit_lineitem }\n else\n format.html { render :new }\n format.json { render json: @pit_lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "821fc036b48aa7281bf6531e16e99fea", "score": "0.56006277", "text": "def create\n @mostsmallequipslotinventory = Mostsmallequipslotinventory.new(params[:mostsmallequipslotinventory])\n\n respond_to do |format|\n if @mostsmallequipslotinventory.save\n format.html { redirect_to @mostsmallequipslotinventory, notice: 'Mostsmallequipslotinventory was successfully created.' }\n format.json { render json: @mostsmallequipslotinventory, status: :created, location: @mostsmallequipslotinventory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallequipslotinventory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d386418fd85935d7e59c6e14547a9794", "score": "0.55939555", "text": "def create\n @shaving_record = ShavingRecord.new(shaving_record_params)\n @shaving_items = params['shave_record'][:item_ids]\n respond_to do |format|\n if @shaving_record.save\n #create loop to add multiple items to shaving items\n @shaving_items.each do |item|\n shaving_item = ShavingItem.new\n @item = Item.find(item)\n shaving_item.shaving_record_id = @shaving_record.id\n shaving_item.item_id = item\n shaving_item.save\n @item.increment!(:uses)\n end\n format.html { redirect_to @shaving_record, notice: 'Shaving record was successfully created.' }\n format.json { render :show, status: :created, location: @shaving_record }\n else\n format.html { render :new }\n format.json { render json: @shaving_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ceb06bd562d369adebc6ccdc3dae0314", "score": "0.55746007", "text": "def create\n @parking_lot = ParkingLot.new(parking_lot_params)\n\n if @parking_lot.save\n render json: @parking_lot, status: :created, location: @parking_lot\n else\n render json: @parking_lot.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "260da2ffea351b654d09db6139622cac", "score": "0.5572317", "text": "def create\n @parking_slot = ParkingSlot.new(parking_slot_params)\n\n respond_to do |format|\n if @parking_slot.save\n format.html { redirect_to @parking_slot, notice: 'Parking slot was successfully created.' }\n format.json { render :show, status: :created, location: @parking_slot }\n else\n format.html { render :new }\n format.json { render json: @parking_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e3f7cbb5a4329ebc004e286c83238bd", "score": "0.55681723", "text": "def create\n\ntimings=slot_params.except('mov_id')\n@mov_id=slot_params['mov_id']\n @slot = Slot.new(timings)\n\n\n\n\n respond_to do |format|\n if @slot.save\n \n format.html { redirect_to book_user_path(:slot_id => @slot.id,:user_id => @user_id, :mov_id=>@mov_id), notice: 'Slot was successfully created.' }\n format.json { render :show, status: :created, location: @slot }\n\n\n else\n format.html { render :new }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5dbe750934e7b9e0a671a96a99967ca0", "score": "0.55660677", "text": "def create\n @booking_slot = BookingSlot.new(booking_slot_params)\n\n if @booking_slot.save\n render json: @booking_slot, status: :created\n else\n render json: @booking_slot.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6716842e721c6088a22104cc63ba0984", "score": "0.555173", "text": "def create\n @time_slot = TimeSlot.new(time_slot_params)\n\n if @time_slot.save\n json_reponse(@time_slot)\n else\n json_repsponse(@time_slot.errors)\n end\n end", "title": "" }, { "docid": "da00424490082cb37166b8e1ba05fcff", "score": "0.55469763", "text": "def create\n # @pantryitem = Pantryitem.new(params[:pantryitem])\n @pantryitem = Pantryitem.new(pantryitem_params)\n\n if @pantryitem.save\n render json: @pantryitem, status: :created, location: @pantryitem\n else\n render json: @pantryitem.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6c180452c374bb24e842fa64c6f9333d", "score": "0.5545443", "text": "def create\n @specific_item = SpecificItem.new(specific_item_params)\n increase_inventory_item(@specific_item)\n # binding.pry\n respond_to do |format|\n if @specific_item.save\n format.html { redirect_to @specific_item, notice: 'Specific item was successfully created.' }\n format.json { render :show, status: :created, location: @specific_item }\n else\n format.html { render :new }\n format.json { render json: @specific_item.errors, status: :unprocessable_entity }\n end \n end \n end", "title": "" }, { "docid": "b4299927ccecb6e3220592cca02d8669", "score": "0.5539334", "text": "def create\n @settlement_slot = Settlement::Slot.new(params[:settlement_slot])\n\n respond_to do |format|\n if @settlement_slot.save\n format.html { redirect_to @settlement_slot, notice: 'Slot was successfully created.' }\n format.json { render json: @settlement_slot, status: :created, location: @settlement_slot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @settlement_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97575bbb5e4cf025bc10fb65598fc0e6", "score": "0.5531329", "text": "def index\n @product = Product.find(params[:product_id])\n @lots = Lot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lots }\n end\n end", "title": "" }, { "docid": "8170cb6c62004374184aa71dcb374fe3", "score": "0.55256987", "text": "def new\n @clinic = Clinic.new\n 5.times do\n @clinic.slots.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @clinic }\n end\n end", "title": "" }, { "docid": "a1d4421975a5506a9960672542f2e48b", "score": "0.5521705", "text": "def create_item\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n @items = Inventory.all || []\n format.html { render action: 'index' }\n format.json { render json: { success: true, item: @inventory }}\n else\n format.html\n format.json { render json: {\n success: false, status: \"Error: #{@inventory.errors.full_messages.join(', ')}\"\n }}\n end\n end\n end", "title": "" }, { "docid": "c7ec4e535afe5a71677982de8699db7e", "score": "0.55213773", "text": "def create\n p_attr = params[:item]\n p_attr[:payload] = params[:item][:payload].first if params[:item][:payload].class == Array\n\n @item = @package.items.new(p_attr)\n\n if @item.save\n respond_to do |format|\n format.html {\n render :json => [@item.to_jq_upload(@package.id)].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@item.to_jq_upload(@package.id)].to_json\n }\n end\n else\n if @item.payload_integrity_error\n render :json => [{:error => @item.payload_integrity_error}], :status => 415\n else\n render :json => [{:error => @item.errors}], :status => 422\n end\n end\n end", "title": "" }, { "docid": "408fdd39d27d6ec7ae5d8295b347e5f0", "score": "0.55212396", "text": "def create\n @itemized_item = ItemizedItem.new(itemized_item_params)\n\n respond_to do |format|\n if @itemized_item.save\n format.html { redirect_to @itemized_item, notice: 'Itemized item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @itemized_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @itemized_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78e439d431bd493592a582f19f45fe51", "score": "0.55157477", "text": "def create\n @lot = Lot.new(lot_params)\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to @lot, notice: 'Lot was successfully created.' }\n format.json { render json: @lot, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8edba8038f088f1d891a81019aba6aa", "score": "0.5510789", "text": "def create\n @order_item = OrderItem.new(order_item_params)\n\n @item_splits = order_item_params[:people]\n @item_splits.delete(\"\")\n @item_splits.each do |person|\n @item = ItemSplit.new\n @item.person_id = person\n @item.order_item = @order_item\n @item.save\n end\n\n respond_to do |format|\n if !@item_splits.empty?\n if @order_item.save\n format.html { redirect_to @order_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @order_item }\n\n @order = @order_item.order\n @order_items = @order.order_items\n format.js\n end\n else\n format.html { render :new }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9069428bd0e84d9bdef7abbc301efcbb", "score": "0.5508029", "text": "def create\n @solitem = Solitem.new(solitem_params)\n\n respond_to do |format|\n if @solitem.save\n format.html { redirect_to @solitem, notice: 'ソリューション課題作成完了。' }\n format.json { render :show, status: :created, location: @solitem }\n else\n format.html { render :new }\n format.json { render json: @solitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a342c784a1bce30e6b4beca0c7f4799b", "score": "0.54983", "text": "def create\n params[:inventory].each do |p|\n Inventory.create(amount: p[:amount].to_d, user_id: p[:user_id].to_i, product_id: p[:product_id].to_i, number: p[:number].to_i)\n end\n respond_to do |format|\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n end\n end", "title": "" }, { "docid": "64424ca51abcf197ee0044e9bb2324d6", "score": "0.5494762", "text": "def create\n @event_slot = @event.event_slots.new(event_slot_params)\n\n respond_to do |format|\n if @event_slot.save\n format.js { render :refresh, status: :created, location: [@team, @event, @event_slot] }\n else\n format.js { render json: @event_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b1d207179267d100342b14c90de90ba", "score": "0.54934907", "text": "def new\n @lin_items = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lin_items }\n end\n end", "title": "" }, { "docid": "0e1298262d6a294586ea1c5402b0bd4b", "score": "0.5491071", "text": "def destroy\n @item_lot = ItemLot.find(params[:id])\n @item_lot.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lots_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c72577dabc5de34d762e25e406b30106", "score": "0.5476417", "text": "def create\n pars = timeslot_params\n @timeslot = Timeslot.new(pars)\n\n respond_to do |format|\n if @timeslot.save\n format.html { redirect_to @timeslot, notice: 'timeslot was successfully created.' }\n format.json { render :show, status: :created, location: @timeslot }\n else\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ee4edef776a5a6ca7ddc3770fa7ee683", "score": "0.54741263", "text": "def new\n @item = @package.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "33ddff222fa67c6255907deaf925061d", "score": "0.547222", "text": "def create\n\t\ttimeslot = Timeslot.new(timeslot_params)\n\t\tif timeslot.save\n \t\t#PeekBooker.register_overlaping\n \t\trender json: timeslot, status: 201\n \tend\n\tend", "title": "" }, { "docid": "d2d7d580ab79c782028e71ac9f41e23c", "score": "0.54704946", "text": "def create\n @time_slot = TimeSlot.new(time_slot_params)\n\n respond_to do |format|\n if @time_slot.save\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully created.' }\n format.json { render :show, status: :created, location: @time_slot }\n else\n format.html { render :new }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2d7d580ab79c782028e71ac9f41e23c", "score": "0.54704946", "text": "def create\n @time_slot = TimeSlot.new(time_slot_params)\n\n respond_to do |format|\n if @time_slot.save\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully created.' }\n format.json { render :show, status: :created, location: @time_slot }\n else\n format.html { render :new }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5d1b51296b5f37ba78c6dd3888bc0fe", "score": "0.54703456", "text": "def create\n @slot = @conference.slots.new(params[:slot])\n\n respond_to do |format|\n if @slot.save\n format.html { redirect_to schedule_conference_path(@conference), notice: 'Slot was successfully created.' }\n format.json { render json: @slot, status: :created, location: @slot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1891df89c91d6ba1918e9ac82b4678a", "score": "0.5464755", "text": "def create\n @booking = Booking.new(params[:booking])\n print @booking\n @booking.slots.reject! { |c| c.empty? }\n print @booking.slots\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, :notice => 'Booking was successfully created.' }\n format.json { render :json => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3c72e087f041ccc22ee61c418bb766a", "score": "0.54603755", "text": "def create\n @conflicted_item = ConflictedItem.new(conflicted_item_params)\n\n if @conflicted_item.save\n render :show, status: :created, location: @conflicted_item\n else\n render json: @conflicted_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "6351ffc4707d313d28247a76657129e0", "score": "0.5453666", "text": "def create\n @slot = Slot.new(params[:slot])\n\t\t@slot.area_id = session[:area_id]\n\n respond_to do |format|\n if @slot.save\n format.html { redirect_to edit_slot_path(@slot), notice: 'Slot was successfully created.' }\n format.json { render json: @slot, status: :created, location: @slot }\n\t\t\t\tformat.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6c89f34d67131455f572f5a0ec14f75", "score": "0.54535", "text": "def create\n @pit_form_lineitem = PitFormLineitem.new(pit_form_lineitem_params)\n\n respond_to do |format|\n if @pit_form_lineitem.save\n format.html { redirect_to @pit_form_lineitem, notice: 'Pit form lineitem was successfully created.' }\n format.json { render :show, status: :created, location: @pit_form_lineitem }\n else\n format.html { render :new }\n format.json { render json: @pit_form_lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "48b9afecf2806bfde5f349288be9f27f", "score": "0.5451463", "text": "def create\n @listing = Listing.new(item_params)\n\n if @listing.save\n render json: @listing\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1b9ffd98597e08508e2a3b5db3c33f14", "score": "0.5447074", "text": "def item_params\n params.require(:item).permit(:uid, :unique_name, :name, :type, :subtype, :npc_price, :slots, :icon)\n end", "title": "" }, { "docid": "64eb5e6f2022162bf841806191df4512", "score": "0.54460984", "text": "def create\n @item = Item.new(params[:item])\n @item.list = @list\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_item_path(@list, @item), notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: list_item_path(@list, @item) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end", "title": "" }, { "docid": "a2d4f53f5b69f0aacd0879d9e921a210", "score": "0.54446805", "text": "def create\n @slot = Slot.new()\n experiment = Experiment.obfuscated(params[:experiment_id])\n page_group(experiment.user.group)\n \n if experiment.nil? or !experiment.can_modify?(current_user)\n access_denied\n return\n end\n @slot.experiment = experiment\n \n @slot.parse_datetime([params[:slot][:date], params[:slot][:time_hour] + \":\" + params[:slot][:time_min],\n params[:slot][:time_12h]].join(\" \"))\n \n if @slot.save\n #respond_with(@slot, :status => :created, :location => @slot) \n respond_to do |format|\n flash.now[:notice] = 'Slot was successfully created.'\n format.html { redirect_to(@slot.experiment) }\n html_snippet = render_to_string(:partial => \"slots/show.html.erb\", \n :locals => {:slot => @slot}, \n :layout => false)\n format.json { render :json => {:html => html_snippet}, :layout => false, :status => :created }\n end\n else\n #respond_with(@slot.errors, :status => :unprocessable_entity) \n respond_to do |format|\n format.json {render :json => @slot.errors, :layout => false, :status => :unprocessable_entity }\n format.html { render :action => \"new\" }\n end\n end\n end", "title": "" }, { "docid": "36f1fa177ea31661827d99e7392f556c", "score": "0.54425263", "text": "def stowed_item_slot_params\n params.require(:stowed_item_slot).permit(:character_id, :item_slot_id)\n end", "title": "" }, { "docid": "4c2d19a40d078b815079281640152745", "score": "0.5441544", "text": "def create\n @lot = Lot.new(lot_params)\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to @lot, notice: 'Lot was successfully created.' }\n format.json { render :show, status: :created, location: @lot }\n else\n format.html { render :new }\n format.json { render json: @lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bfaaae76e33f3d47630ecc0f57dfca79", "score": "0.543986", "text": "def new\n @item = Item.new(item_params)\n render json: @item\n end", "title": "" }, { "docid": "44f43983332e9db08e21dce98bdddfd1", "score": "0.5439783", "text": "def create\n @api_item = Item.new(api_item_params)\n\n if @api_item.save\n @api_items = Item.order(:name)\n render :index, status: :created\n else\n render json: @api_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "37a3af45540c4d1b381c8b2f97c9e1fd", "score": "0.5429494", "text": "def create\n @quest_item = QuestItem.new(quest_item_params)\n\n respond_to do |format|\n if @quest_item.save\n format.html { redirect_to @quest_item, notice: 'Quest item was successfully created.' }\n format.json { render :show, status: :created, location: @quest_item }\n else\n format.html { render :new }\n format.json { render json: @quest_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85583b18964359cf1735eb5a295553ee", "score": "0.5427963", "text": "def create\n @vehicle_slot = VehicleSlot.new(vehicle_slot_params)\n\n respond_to do |format|\n if @vehicle_slot.save\n format.html { redirect_to @vehicle_slot, notice: 'Vehicle slot was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_slot }\n else\n format.html { render :new }\n format.json { render json: @vehicle_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef84430b26ba41b059cffe19055f8a67", "score": "0.5425781", "text": "def create\n @timeslot = Timeslot.new(timeslot_params)\n\n respond_to do |format|\n if @timeslot.save\n format.html { redirect_to @timeslot, notice: 'Timeslot was successfully created.' }\n format.json { render :show, status: :created, location: @timeslot }\n else\n format.html { render :new }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0e741fa6460c5722ad704bb9ff291e6", "score": "0.5425748", "text": "def add_new_item(api, cookie, number, subject, newreq)\n item = nil\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n newitem = { number: number, clause: newreq['clauseno'], date: newreq['date'], standard: newreq['standard'],\n subject: subject }\n res = api[\"items\"].post newitem.to_json, option_hash unless $dryrun\n if res&.code == 201\n item = JSON.parse(res.body)\n reqres = add_request_to_item(api, cookie, item, newreq)\n end\n item\nend", "title": "" }, { "docid": "b1cf131e37a89509ff8ebf368c9d5ebb", "score": "0.5424514", "text": "def create\n @item = @event.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to event_items_path(@event), notice: I18n.t('item.created.successfully') }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a77712f8f57e2e30a36091794c7b104", "score": "0.5421598", "text": "def create\n @drink_item = DrinkItem.new(params[:drink_item])\n @places = Place.all.map { |place| [place.title, place.id] }\n\n respond_to do |format|\n if @drink_item.save\n format.html { redirect_to @drink_item, notice: 'Drink item was successfully created.' }\n format.json { render json: @drink_item, status: :created, location: @drink_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drink_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b85919c6fe372df22786957e3222342d", "score": "0.54189336", "text": "def create\n @sale_item = SaleItem.new(params[:sale_item])\n @sale_item.newitem(params[:sale_item])\n\n respond_to do |format|\n if @sale_item.save\n format.html { redirect_to new_sale_item_path, notice: 'Sale item was successfully posted.' }\n format.json { render json: @sale_item, status: :created, location: @sale_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17fad291ebb22fcc90d0df5698ebc27e", "score": "0.5417985", "text": "def create\n @item = Item.new(params[:item])\n @item.list_id = params[:id]\n @item.save\n\n respond_to do |format|\n if @item.save\n format.js\n else\n format.html { redirect_to list_path(@list), notice: 'Could not add item at the time. Please try again.'}\n end\n end\n end", "title": "" }, { "docid": "5677fe74d46f68bb66be563d1d3547ac", "score": "0.54119974", "text": "def create\n @survey_q_item_list = SurveyQItemList.new(survey_q_item_list_params)\n\n respond_to do |format|\n if @survey_q_item_list.save\n format.html { redirect_to @survey_q_item_list, notice: 'Survey q item list was successfully created.' }\n format.json { render :show, status: :created, location: @survey_q_item_list }\n else\n format.html { render :new }\n format.json { render json: @survey_q_item_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c536066e89533d2a0ec435f615d0fe9", "score": "0.5402604", "text": "def create\n\t\t@item = Item.new(params[:item])\n\t\tset_tag\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff7ad9430269533006df8c29a4cda8cf", "score": "0.5402325", "text": "def create\n\n @item = Item.new(item_params)\n @item.colors = Color.where(id: params[:item][:itemcolors])\n @item.events = Event.where(id: params[:item][:itemevents])\n @item.brands = Brand.where(id: params[:item][:itembrands])\n @item.retailers = Retailer.where(id: params[:item][:itemretailers])\n @item.types = Type.where(id: params[:item][:itemtypes])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edcaac3f6e52fd2fafb8bc4b772edd46", "score": "0.53948826", "text": "def create\n p = Plot.create(plots_params)\n render json: p\n end", "title": "" }, { "docid": "818a2c12e897c30a89de5c0a37137c80", "score": "0.53942114", "text": "def create\n @cardapio = cardapio\n @cardapio_item = CardapioItem.new(params[:cardapio_item])\n cardapio_itens.push( @cardapio_item )\n\n respond_to do |format|\n if @cardapio_item.save\n format.html { redirect_to cardapio_item_path(@cardapio_item, :cardapio => @cardapio.id), notice: 'Cardapio item was successfully created.' }\n format.json { render json: @cardapio_item, status: :created, location: @cardapio_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cardapio_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d141db358d926db7dc156a3a9ab7c23", "score": "0.5390583", "text": "def create\n @user = User.find(session[:user_id])\n @mba = Mba.find_by_user_id(session[:user_id])\n slot_params[:booked]=false;\n @slot=@mba.slots.build(slot_params)\n #@slot = Slot.new(slot_params)\n\n respond_to do |format|\n if @slot.save\n format.html { redirect_to @slot, notice: 'Slot was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2550036c124341a266025777ae64ae6", "score": "0.5386425", "text": "def create\n @list = List.find(params[:list_id])\n @item = @list.items.new(params[:item])\n #@item = Item.new(params[:item])\n \n if @item.save\n flash[:notice] = 'Task created successfully.'\n respond_to do |format|\n format.js\n end\n else\n flash[:notice] = 'Error with saving item.'\n end\n end", "title": "" }, { "docid": "cc618e7485e9f4224fd699da3f024b37", "score": "0.53853786", "text": "def create\n @item = @list.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n @items = @list.items\n format.js\n else\n format.js { render json: @item.errors }\n end\n end\n end", "title": "" }, { "docid": "e83e3e273cacc263a5aba634dbbbd1b3", "score": "0.5381805", "text": "def new\n @item = Item.new(:status => \"1\")\n @item_types = Itemtype.select(\"id,itemtype\")\n @action = \"/items/create\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "a752f3b1e7ea223f8edd6b6e2c401e99", "score": "0.5381701", "text": "def create\n item = Item.new(item_params.to_hash)\n if item.create\n render status: :ok, json: item.data\n else\n render status: :unprocessable_entity, json: { error: item.errors }\n end\n end", "title": "" }, { "docid": "605e54f44c1fb2bc615f99aebef26867", "score": "0.5381681", "text": "def create_item(params = nil, headers = nil)\n post(\"/api/v2/items\", params, headers)\n end", "title": "" }, { "docid": "179e2c4ed0ee7f520c6a89d0a832385d", "score": "0.5379828", "text": "def post_body\n {\n \"item\": {\n \"name\": name\n }\n }.to_json\n end", "title": "" }, { "docid": "1b58bd33202a3723198aa0af2aeefa7e", "score": "0.5377485", "text": "def add_question_items(items) #params is hash of type => value\n new_q_items = create_question_items(items)\n add_q_items(new_q_items)\n end", "title": "" }, { "docid": "78c63519229095cc58942db7ce2ee906", "score": "0.5371014", "text": "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7af56a0fe43031f91903e9fa5d017123", "score": "0.5369362", "text": "def create\n @clothing_item = ClothingItem.new(params[:clothing_item])\n\n respond_to do |format|\n if @clothing_item.save\n format.html { redirect_to @clothing_item, notice: 'Clothing item was successfully created.' }\n format.json { render json: @clothing_item, status: :created, location: @clothing_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clothing_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd973a122b6151d8f484c9d37582522c", "score": "0.5362773", "text": "def create\n @uniform_item = UniformItem.new(uniform_item_params)\n\n respond_to do |format|\n if @uniform_item.save\n format.html { redirect_to @uniform_item, notice: (t 'uniform_items.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @uniform_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @uniform_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa51fe37f9f0b597e452706844d3f3e9", "score": "0.53593606", "text": "def create\n @request_item = RequestItem.new(params[:request_item])\n\n respond_to do |format|\n if @request_item.save\n format.html { redirect_to @request_item, notice: 'Request item was successfully created.' }\n format.json { render json: @request_item, status: :created, location: @request_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb9d846e6f88b8b880a22f84ca8635a1", "score": "0.53591853", "text": "def create\n @admin_parking_lot = City.find(session[:current_city_id]).utility.parking_lots.new(admin_parking_lot_params)\n\n respond_to do |format|\n if @admin_parking_lot.save\n format.html { redirect_to admin_parking_lots_url, notice: 'Parking lot was successfully created.' }\n format.json { render :show, status: :created, location: @admin_parking_lot }\n else\n format.html { render :new }\n format.json { render json: @admin_parking_lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c385c61705761e4fa57d68c3c70e3d1", "score": "0.5358157", "text": "def report_item\n if params['id']\n # Update\n @item = MtCompletedItem.find(params['id'])\n # Verify hash, assignment id, item, and condition\n if @item.code != params['code']\n logger.warn(\"hash mismatch: #{@item.code} expected\")\n fail_JSON_response and return\n elsif @item.mt_assignment_id != @assignment.id\n logger.warn(\"mt_assignment_id mismatch: #{@item.mt_assignment_id} expected\")\n fail_JSON_response and return\n elsif @item.mt_item != params['item']\n logger.warn(\"mt_item mismatch: #{@item.mt_item} expected\")\n fail_JSON_response and return\n elsif @item.mt_condition != params['condition']\n logger.warn(\"mt_condition mismatch: #{@item.mt_condition} expected\")\n fail_JSON_response and return\n else\n @item.data = params['data']\n end\n else\n # Check if there is already item with same assignment\n if @conf and not @conf['allowMultipleItemsPerSession']\n logger.info(\"Checking if item for #{@assignment.mtId}, #{params['item']} exists...\")\n @item = MtCompletedItem.where(mt_assignment_id: @assignment.id, mt_item: params['item']).first\n if @item\n if @item.data == params['data']\n logger.info(\"Item with identical data found for #{@assignment.mtId}, #{params['item']}\")\n # Already submitted\n render json: {\n success: 'success',\n status_code: '200',\n item: {\n id: @item.id,\n code: @item.code\n }\n } and return\n else\n # Different submission\n logger.warn(\"mt_assignment #{@assignment.mtId} and mt_item #{@item.mt_item} pair already exists with id #{@item.id}\")\n #fail_JSON_response and return\n end\n end\n end\n\n # New item\n @item = MtCompletedItem.new(mt_assignment_id: @assignment.id,\n mt_item: params['item'],\n mt_condition: params['condition'],\n data: params['data'])\n end\n\n @item.code = generate_hash(8)\n if params['preview']\n preview_data = params['preview']\n image_data = Base64.decode64(preview_data['data:image/png;base64,'.length .. -1])\n @item.preview = image_data\n @item.preview.name = params['condition'].to_s + '_' + params['item'].to_s + '_' + @assignment.id.to_s + '.png'\n @item.preview.meta = {\n 'name' => @item.preview.name,\n 'time' => Time.now,\n 'task' => @task.name,\n 'condition' => params['condition'],\n 'item' => params['item'],\n 'worker' => @assignment.mt_worker.mtId\n }\n end\n\n if @item.save\n render json: {\n success: 'success',\n status_code: '200',\n item: {\n id: @item.id,\n code: @item.code\n }\n }\n else\n fail_JSON_response\n end\n end", "title": "" }, { "docid": "f1191d99a30a84a7e95e50bd2d191b44", "score": "0.535444", "text": "def create\n @interp_item = InterpItem.new(params[:interp_item])\n\n respond_to do |format|\n if @interp_item.save\n format.html { redirect_to @interp_item, notice: 'Interp item was successfully created.' }\n format.json { render json: @interp_item, status: :created, location: @interp_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interp_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f17b61497a19e6a32b72add99a898f0", "score": "0.5354141", "text": "def create\n @item = Item.new(item_params)\n\n if @item.save\n render :show, status: :created#, location: @item\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "07e66f4a3990fafa84537c06e8233e06", "score": "0.535388", "text": "def new\n @mostsmallequipslotinventory = Mostsmallequipslotinventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallequipslotinventory }\n end\n end", "title": "" }, { "docid": "ad9e4a9715e441b8010d452a6db2b38b", "score": "0.53511083", "text": "def new\n @item = Item.new\n 5.times {@item.assets.build}\n @cart = current_cart\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "9785952c2a1cf052eb9a8a558b186d86", "score": "0.5350472", "text": "def update_item\n @item.title = params[:title]\n @item.deadline = params[:deadline]\n @item.details = params[:details]\n @item.tags = params[:tags]\n @item.save!\n render json: { }\n end", "title": "" }, { "docid": "3d7eddd9f8de1f27fa901d9968ed6abd", "score": "0.53488046", "text": "def create_item(params = nil, headers = nil)\n post(\"/api/v1/items\", params, headers)\n end", "title": "" } ]
6fbda6009923f4d8028c81849558f46d
search = mysql_search_count_all() p search
[ { "docid": "05cb3061518e50f09a6815d1aef2d244", "score": "0.68233615", "text": "def mysql_search_count_info(group_name, search_key)\n records = Counter.where(group_name: group_name)\n records.each do |value|\n if search_key == 'group_name' then\n return value.group_name\n elsif search_key == 'elb_dns_name' then\n return value.elb_dns_name\n elsif search_key == 'count' then\n return value.count\n elsif search_key == 'basic_count' then\n return value.basic_count\n elsif search_key == 'max_count' then\n return value.max_count\n elsif search_key == 'created_date' then\n return value.created_date\n elsif search_key == 'updated_date' then\n return value.updated_date\n end\n end\nend", "title": "" } ]
[ { "docid": "b14b6bdccb2f3b68ff313665f3b13eed", "score": "0.75449747", "text": "def count\n search_results.values.collect(&:size).sum\n end", "title": "" }, { "docid": "c1d885565f9c3fcf394f4f4ca272e671", "score": "0.72960705", "text": "def mysql_search_count_all()\n count = []\n records = Counter.order(\"created_date DESC\")\n records.each do |value|\n count << [value.group_name, value]\n end\n return count\nend", "title": "" }, { "docid": "e918c24e677cc8b5e7c81b53a7b621d9", "score": "0.7110927", "text": "def size_all\n return 0 if illegal_state\n @all_results[search_id_0.sym].size\n end", "title": "" }, { "docid": "4ccb11e21a95d30bd5a489246ce13e2e", "score": "0.7110838", "text": "def count(q, models = nil)\n SimpleSearch.count(q, :models => models)\n end", "title": "" }, { "docid": "7338f0ff2d8ba20aa6185c92236ddb04", "score": "0.7094989", "text": "def search_count(query:)\n command = Command.new(\n command: :SearchCount,\n result: Types::SearchCountResults,\n version: 2,\n parameters: {query: query}\n )\n perform_operation(command)\n end", "title": "" }, { "docid": "9464185ef2720eb05b0bc06db8e3ce36", "score": "0.7086619", "text": "def count\n return [] if insufficient_query\n\n httpResp = httpSession.get( searchPath, nil )\n reDoc = Nokogiri::XML( httpResp.body )\n\n # Confusingly, sometimes\n\t\t\t# this gives us a search results page, and sometimes it gives us\n\t\t\t# a single bib\n \n # single bib?\n if reDoc.at('searchresponse/fullnonmarc/searchresults/results/row/key')\n return 1\n end\n\n # Multiple, get the count\n hits = reDoc.at('searchresponse/yoursearch/hits')\n return hits ? hits.inner_text.to_s.to_i : 0 \n end", "title": "" }, { "docid": "2239e86b02d5cf23714b47a19f9adcbe", "score": "0.70844734", "text": "def count(query)\n count_results(make_query(query)) \n end", "title": "" }, { "docid": "7ffefd0ed3b559e19ca7916d552098fa", "score": "0.70177734", "text": "def count\n connection.get(\"select\", params: { q: query })[\"response\"][\"numFound\"].to_s.to_i\n end", "title": "" }, { "docid": "52b730ab420a362ba3eb29d84185b118", "score": "0.6990439", "text": "def count(jql='')\n result = self.post 'search', {\n :jql => jql,\n :startAt => 0,\n :maxResults => 1,\n :fields => [''],\n }\n return result.total\n end", "title": "" }, { "docid": "7ef6084d981f5dee97cb0412b0801916", "score": "0.6987703", "text": "def search_count(query = \"*\", options = {})\n Escargot.elastic_search_client.count(query, options.merge({:index => self.index_name, :type => elastic_search_type}))\n end", "title": "" }, { "docid": "ce77720f80e15ce6153dc1628bab4efa", "score": "0.6947164", "text": "def count(query: '')\n query(query).count\n end", "title": "" }, { "docid": "8723b723614b5f3e25d8041e924db7f7", "score": "0.6920605", "text": "def count_by_solr(query) \n data = process_query(query)\n data ? data['response']['numFound'] : 0\n end", "title": "" }, { "docid": "ac4ba45e8fff9c2ac02b212f389c9e8e", "score": "0.6912028", "text": "def number_of_stored_documents(db_name, mapping)\n s = Tire.search db_name, :search_type => 'count' do\n query { term :_type, mapping }\n end\n s.results.total\nend", "title": "" }, { "docid": "31e9334fbc810cac39ee8571c317aeb8", "score": "0.69070995", "text": "def count(query)\n count_results(make_query(query))\n end", "title": "" }, { "docid": "e8f0fb381a4f38e0ae628d3fea39e6db", "score": "0.6877154", "text": "def count(query, args = {})\n args = args.merge(rows: 0)\n SolrService.get(query, args)['response']['numFound'].to_i\n end", "title": "" }, { "docid": "e8f7a69fcc7774cf4548932e62a6b2e7", "score": "0.68715304", "text": "def count(query, args={})\n args = args.merge(:raw=>true, :rows=>0)\n SolrService.query(query, args)['response']['numFound'].to_i\n end", "title": "" }, { "docid": "de80c8f5b38139ffdc64425224eac94a", "score": "0.6864064", "text": "def count_all_of_model(model:)\n Valkyrie::Persistence::Solr::Queries::FindAllQuery.new(connection: connection, resource_factory: resource_factory, model: model).count\n end", "title": "" }, { "docid": "fee0452bb1322ce30347825eeb91b4b7", "score": "0.6859705", "text": "def count\n unsorted_query.count\n end", "title": "" }, { "docid": "60571098841a929e40b1e0cfcb758bde", "score": "0.68478143", "text": "def count_by_solr(query, options = {}) \n data = parse_query(query, options)\n data.total_hits\n end", "title": "" }, { "docid": "ff403acc1e0853e53fde967239f6583e", "score": "0.6799704", "text": "def count_by_sql(sql); end", "title": "" }, { "docid": "601e4c6a3009d43c9c35befd394ad9e9", "score": "0.67958707", "text": "def library_search_result_count(doc)\n # This corresponds to the 7 in\n # <a class=\"normalBlackFont2\"><b>7</b> titles matched:...</a>\n el = doc.css('a.normalBlackFont2 b').first\n count = el ? el.content.to_i : 0\nend", "title": "" }, { "docid": "e3e348d62883d29facc4c20ab74b88f2", "score": "0.67480063", "text": "def num_hits\n if object.params[:q]&.!=('*:*') || object.params[:fq]\n I18n.t 'search.index.num_hits_found', count: object.num_hits\n else\n I18n.t 'search.index.num_documents_database', count: object.num_hits\n end\n end", "title": "" }, { "docid": "eaceefe8caf7ef6f5806eb77b6215265", "score": "0.67372185", "text": "def count_query(query)\n @query.solr_query(query, 'id', 0)['response']['numFound'].to_i\n end", "title": "" }, { "docid": "1fb770d1c31fc858a2f53a9c2d07b904", "score": "0.67148316", "text": "def count\n\n #if lib.respond_to?(:qry_count)\n run.free unless @has_run\n lib.qry_count(@query)\n #else\n # @last_resultset ? @last_resultset.size : 0\n #end\n end", "title": "" }, { "docid": "0a331480edfdeaadcd4b98a9a776932a", "score": "0.67004347", "text": "def update_counts\n self.search_term_list = search_terms\n self.search_term_count = search_terms.count\n self.result_entry_count = grep_result_entries.count\n end", "title": "" }, { "docid": "e3e6e6c1b97b301f03fcd2198aa6fa03", "score": "0.66967493", "text": "def count\n query.count\n end", "title": "" }, { "docid": "436f2470dc1c5b777df1412275d424e5", "score": "0.6694516", "text": "def count_query(query)\n @query.solr_query(query, \"id\", 0)[\"response\"][\"numFound\"].to_i\n end", "title": "" }, { "docid": "87d0a1a26e7d14be693c9c12e937d5b3", "score": "0.66942006", "text": "def total_count\n query_results.total_count\n end", "title": "" }, { "docid": "308fbe956b81e939bdac500964a2b5be", "score": "0.66940486", "text": "def count\r\n @query.count\r\n end", "title": "" }, { "docid": "fa142840a3fbb2cb0de29aecc3a08f71", "score": "0.6681508", "text": "def count_matches\n query = <<-SQL\n SELECT COUNT(*) as count FROM #{analysis_table_name};\n SQL\n\n xact.exec(query) do |pg_results|\n return pg_results[0][\"count\"].to_i\n end\n end", "title": "" }, { "docid": "9f098972ac19d117b796f1df63ba441e", "score": "0.6679509", "text": "def count\n pquery.count\n end", "title": "" }, { "docid": "e148b91ef77a05d67829f311452ce6d0", "score": "0.66532344", "text": "def count\n @results.size\n end", "title": "" }, { "docid": "9750ee228414c65ce18d654a0174091b", "score": "0.663044", "text": "def show\n @count = Search.where(query_params: @search.query_params).count\n end", "title": "" }, { "docid": "7b1bca930c4f8b09f32cd5b5466bd5a5", "score": "0.6624782", "text": "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end", "title": "" }, { "docid": "40bd65511804561e415f413d04e05d95", "score": "0.6622876", "text": "def search_result_number\n get_elements(SEARCH_RESULT_SECTION).size\n end", "title": "" }, { "docid": "a3d7989625adc6d659cc74df59e4eba8", "score": "0.6617417", "text": "def count\n @count ||= @query.count\n end", "title": "" }, { "docid": "8fbbf2f8e11ec3e9b3aa3b9b87c1e9da", "score": "0.6609871", "text": "def count_via_solr\n results = limit(1).select(:id).to_a\n @group_value ? results.total_for_all : results.total_entries\n end", "title": "" }, { "docid": "e7da0da675933c153ca37ffa09057496", "score": "0.6582755", "text": "def count(result)\n result['searchInformation']['totalResults']\nend", "title": "" }, { "docid": "d6ac127254035e0d3c8a0adb1cecade9", "score": "0.65770257", "text": "def count\n query.count\n end", "title": "" }, { "docid": "9653f067ca7aa932dfd2771be742be5a", "score": "0.6575008", "text": "def test_count_by_solr\n ['ruby', 'dummy', 'name:ruby', 'name:dummy', 'name:ruby AND author:peter', \n 'author:peter AND ruby'].each do |term|\n assert_equal 1, Book.count_by_solr(term), \"there should only be 1 result for search: #{term}\"\n end\n end", "title": "" }, { "docid": "f8a1ba93fbd0b4ca4c63fd97e1e46d24", "score": "0.65749663", "text": "def test_count_by_solr\n ['ruby', 'dummy', 'name:ruby', 'name:dummy', 'name:ruby AND author:peter', 'author:peter AND ruby'].each do |term|\n assert_equal 1, Book.count_by_solr(term), \"there should only be 1 result for search: #{term}\"\n end\n end", "title": "" }, { "docid": "0cc463c4e0cc4a6e007a59484ef2bf39", "score": "0.6569886", "text": "def category_search_count(query, category_id)\n # JD: I refactored this into the model\n Item.category_search_count(query, category_id)\n end", "title": "" }, { "docid": "f2927bd37441ee8efdc354804dd549dc", "score": "0.6552735", "text": "def student_search_results_count\n results_count student_results_count_element\n end", "title": "" }, { "docid": "4e2b8c205629c24d37d0f9672620118c", "score": "0.6547697", "text": "def count\n @count = current_search.count(model_class.all)\n render json: {count: @count}\n end", "title": "" }, { "docid": "34f89b8cc59ceca7f1871c94e2b6c658", "score": "0.64647454", "text": "def count_all\n result = connection.get(\"/#{database_name}\")\n JSON.parse(result)['doc_count'].to_i\n end", "title": "" }, { "docid": "4cb53ba27ac847536f9c1cc45c5058cb", "score": "0.64642584", "text": "def live_search\n query = params[:query]\n max_results = 15\n @users = User.starts_with(query).limit(max_results)\n @crosswords = Crossword.starts_with(query).limit(max_results)\n @words = Word.starts_with(query).limit(max_results)\n\n split_ways = (@users.any? ? 1 : 0) + (@crosswords.any? ? 1 : 0) + (@words.any? ? 1 : 0)\n split_ways += 1 if split_ways == 0\n split_results = max_results / split_ways\n @users = @users.limit(split_results)\n @crosswords = @crosswords.limit(split_results)\n @words = @words.limit(split_results)\n\n @result_count = @users.count(:all) + @crosswords.count(:all) + @words.count(:all)\n end", "title": "" }, { "docid": "f75e18f8de71d707f8fbd36b296afd86", "score": "0.64627695", "text": "def search_count(path, options={})\n @analytics.post(Path::Analytics::SEARCH, :body=>{\n :select => 'count',\n :from => sanitize_path(path),\n :where => options[:where]\n })\n end", "title": "" }, { "docid": "beebc28639243694fc1e934a769e17e6", "score": "0.64534235", "text": "def count\n hits.count\n end", "title": "" }, { "docid": "97ad59bc51b3cfc3ca4890c042df21f7", "score": "0.64488363", "text": "def count\n find.count\n end", "title": "" }, { "docid": "b59bb4eb758abe120fa52218357bce53", "score": "0.6430951", "text": "def count\n find().count\n end", "title": "" }, { "docid": "ae97c3401aa64019465d9fbea96f2546", "score": "0.64279425", "text": "def num_hits_string\n if result.params[:q]&.!=('*:*') || result.params[:fq]\n I18n.t 'search.index.num_hits_found', count: result.num_hits\n else\n I18n.t 'search.index.num_documents_database', count: result.num_hits\n end\n end", "title": "" }, { "docid": "183476d0baaac46f1f099e3b46743926", "score": "0.6414741", "text": "def count\n @target.count_by @where_clauses, search_parameters\n end", "title": "" }, { "docid": "1a85f3f6ca6f8d08058331724e9c94c9", "score": "0.6407418", "text": "def count(search_request)\n response = execute_get(\"/search/count\", search_request.query_params)\n CountResponse.new(decode(response))\n end", "title": "" }, { "docid": "d508616718a7221b4656d36e95bf7e3a", "score": "0.640137", "text": "def size\n search(rows: 0).num_hits\n end", "title": "" }, { "docid": "f7a9433ae776f72b4de8a6e8642dce9d", "score": "0.639927", "text": "def count_matched_masters(filter_field = \"1\",\n keyword = \"1\")\n \n Master.count(:conditions => [filter_field + \" like ?\" + \" and pj_id=? and master_type = 1\",\n \"%\"+keyword+\"%\",\n PJ_ID])\n end", "title": "" }, { "docid": "5b5546f20fc2ca6402614c5e5cf76d2f", "score": "0.6388823", "text": "def count\n find.count\n end", "title": "" }, { "docid": "f488c8cb2d7970cd2223ad7194032ef0", "score": "0.6385049", "text": "def count(query, opts = {})\n arel_for(query, opts).count\n end", "title": "" }, { "docid": "a974129e19c92d868eaa39fc0f14c360", "score": "0.63786215", "text": "def count(sql)\n query(sql).first[:count]\n end", "title": "" }, { "docid": "3303f08495afe03d994e42c3e06bed52", "score": "0.63729423", "text": "def update_counts\n self.search_term_list = search_terms\n self.search_term_count = search_terms.count\n self.result_entry_count = grep_result_entries.count\n # end\n #\n # def update_line_counts\n self.file_line_count = self.try(:found_lines).try(:count) || 0\n end", "title": "" }, { "docid": "ecc741ee7ca42069c04365b6a140607c", "score": "0.6369738", "text": "def ft_search_count(args)\n ft_search(args).first\n rescue Exception => e\n Rails.logger.error e if defined? Rails\n return e.message\n end", "title": "" }, { "docid": "bb11108c448c3e6f5fcbbab40a247fe0", "score": "0.63654554", "text": "def count\n sql = order_by(nil).to_sql(pagination: false)\n\n @connection.ask(\"SELECT COUNT(*) FROM (#{sql}) _total_count\", *args)\n end", "title": "" }, { "docid": "5f31b6065775a03878ab3898e6efd44c", "score": "0.6353322", "text": "def top_counts(search, count=40)\n binding.pry\n @at_tweet_count = Search.sort_word_count(search.at_tweet_count)\n @content_count = Search.sort_word_count(search.word_count)\n @hashtag_count = Search.sort_word_count(search.hashtag_count)\n @link_count = Search.sort_word_count(search.link_count, 8)\n @username = search.username\n end", "title": "" }, { "docid": "911b49dc26e3a4f77e6c5ab990d3502e", "score": "0.6337955", "text": "def count_similar()\n \treturn Integer(@browser.fetch(\"_sahi._count(\\\"_#{@type}\\\", #{concat_identifiers(@identifiers).join(\", \")})\"))\n end", "title": "" }, { "docid": "cfe810b558e878989c4297f773526b58", "score": "0.63226277", "text": "def count_terms\n\t\tterms = Term.all\n\t\tterms_array = terms.map { |w| w.text.downcase }\n\t\t@num_search = Hash.new(0)\n\t\tterms_array.each { |v| @num_search[v] += 1 }\n\t\t@num_search.sort_by{ |k, v| -v}\n\tend", "title": "" }, { "docid": "44cbaf4dc89cfc3c56bfd69baa42338e", "score": "0.6320526", "text": "def count(query)\n \n # Build the conditions\n conditions = build_conditions(query.conditions)\n \n num_of_docs = 0\n \n num_of_docs, duration_ms = execute_and_chrono do \n with_connection do |connection|\n begin\n database = connection.db(options[:database])\n num_of_docs = database[query.model.storage_name].count({:query => conditions})\n rescue\n Persistence.logger.fatal('Persistence') {\"ERROR COUNTING #{resource.model} #{conditions.inspect if conditions} #{$!}\"} if Persistence.logger\n raise \n end\n end\n end\n \n Persistence.logger.debug('Persistence') {\" (#{'%1.5f' % duration_ms}) COUNTING in #{query.model} #{conditions.inspect if conditions}\"} if Persistence.logger\n \n num_of_docs\n \n end", "title": "" }, { "docid": "a2b5940236e350d0ed66d2ebd9f8e6c3", "score": "0.6320485", "text": "def count\n\n #@query.count\n # not yet implemented by Hirabayashi-san\n run.free unless @has_run\n @last_resultset ? @last_resultset.size : 0\n end", "title": "" }, { "docid": "bea48b08c1596a69e10bf789266688cf", "score": "0.62945384", "text": "def index\n @searches = Search.group(:query_params).all.order(\n case params[:sort]\n when 'query_params'\n { query_params: :asc }\n when 'updated_at'\n { updated_at: :desc }\n else\n { score: :desc }\n end\n ).where(\n if params[:score]\n ['score >= ? AND score < ?', *params[:score]]\n elsif params[:like]\n ['query_params LIKE ?', \"%#{params[:like]}%\"]\n else\n {}\n end\n ).page(params[:page]).per(params[:per_page])\n\n @counts = Search.where(query_params: @searches.map(&:query_params)).group(:query_params).count\n end", "title": "" }, { "docid": "31ff2558caf439e7f513c5c6d24567be", "score": "0.62793344", "text": "def count(query)\n \n #TODO check that the query is valid\n adapter.count(query)\n \n end", "title": "" }, { "docid": "40165573dbafcc1746036c54a2232247", "score": "0.6265368", "text": "def matching_property_count\n inst = self\n inst.adjust_size\n inst.modify_filtered_params\n inst.apply_filters\n inst.modify_query\n count, status = fetch_udprns(true)\n return count, status\n end", "title": "" }, { "docid": "40165573dbafcc1746036c54a2232247", "score": "0.6265368", "text": "def matching_property_count\n inst = self\n inst.adjust_size\n inst.modify_filtered_params\n inst.apply_filters\n inst.modify_query\n count, status = fetch_udprns(true)\n return count, status\n end", "title": "" }, { "docid": "978aed974bad870860216de64974b110", "score": "0.6257079", "text": "def count\n begin\n binding = client.query(\"SELECT COUNT(*) WHERE { ?s ?p ?o }\").first.to_hash\n binding[binding.keys.first].value.to_i\n rescue SPARQL::Client::MalformedQuery => e\n # SPARQL 1.0 does not include support for aggregate functions:\n count = 0\n each_statement { count += 1 } # TODO: optimize this\n count\n end\n end", "title": "" }, { "docid": "cc2c87ba4dadb4e476cb8c5623d9a59d", "score": "0.6233453", "text": "def count(*args)\n find_by,options = build_options(args)\n return self.model.count(options)\n end", "title": "" }, { "docid": "fba6159aaa6a7564b1c0ad9254259883", "score": "0.62128186", "text": "def matched_count\n results.map(&:matched_count).reduce(&:+)\n end", "title": "" }, { "docid": "87d641f86986af737434e9325f85efff", "score": "0.6206775", "text": "def num_results\n self.raw[\"hits\"][\"total\"]\n end", "title": "" }, { "docid": "759eaea29899afff6e4581bf1a272d00", "score": "0.62057334", "text": "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n\n @total = Cookbook.count\n end", "title": "" }, { "docid": "c4e37be989a2b47f4c7357717033668c", "score": "0.6190975", "text": "def word_count\n res = @con.query('SELECT COUNT(*) FROM words WHERE removed = 0')\n count = res.fetch_row[0].to_i\n res.free\n return count\n end", "title": "" }, { "docid": "123b39662263efe31b57ea8ba4c4ce88", "score": "0.61880285", "text": "def count(query)\n raise NotImplementedError, \"#{self.class}#count not implemented\"\n end", "title": "" }, { "docid": "b231ab679a9187f2dd8883b204292eed", "score": "0.61844474", "text": "def count_repeats(mysearch)\n current = @head\n count=0\n while !current.nil?\n count += 1 if current.value == mysearch\n current = current.next\n end\n return count\n end", "title": "" }, { "docid": "27e6c7b19e4f09ff9fe147a3690fa450", "score": "0.6181324", "text": "def total_count\n results.total\n end", "title": "" }, { "docid": "27e6c7b19e4f09ff9fe147a3690fa450", "score": "0.6181324", "text": "def total_count\n results.total\n end", "title": "" }, { "docid": "27e6c7b19e4f09ff9fe147a3690fa450", "score": "0.6181324", "text": "def total_count\n results.total\n end", "title": "" }, { "docid": "6fd52b8d99bc038beaab2852862ee72e", "score": "0.61786836", "text": "def count\n begin\n binding = client.query(\"SELECT (COUNT(*) AS ?count) WHERE { ?s ?p ?o }\").first.to_h\n binding[:count].value.to_i rescue 0\n rescue SPARQL::Client::MalformedQuery => e\n # SPARQL 1.0 does not include support for aggregate functions:\n each_statement.count\n end\n end", "title": "" }, { "docid": "c8aceabc8b63486188e251cf640b08b2", "score": "0.6167489", "text": "def size\n @search_hits.size.to_f\n end", "title": "" }, { "docid": "b2d75ce39b08e2a560a9b71e75cb7b50", "score": "0.6157617", "text": "def counts\n results[\"counts\"]\n end", "title": "" }, { "docid": "c1792af0b9d2550659ae37d316e8b265", "score": "0.6149664", "text": "def count_by_sql(sql)\n sql = sanitize_conditions(sql)\n connection.select_value(sql, \"#{name} Count\").to_i\n end", "title": "" }, { "docid": "c1792af0b9d2550659ae37d316e8b265", "score": "0.6149664", "text": "def count_by_sql(sql)\n sql = sanitize_conditions(sql)\n connection.select_value(sql, \"#{name} Count\").to_i\n end", "title": "" }, { "docid": "7ef97961f7c32d68d23e9e881f31b043", "score": "0.61478275", "text": "def count_by_sql(sql)\n sql = sanitize_conditions(sql)\n connection.select_value(sql, \"#{name} Count\").to_i\n end", "title": "" }, { "docid": "e3dbc380c7c4e7762af3723e068b20fd", "score": "0.6142059", "text": "def count\n client.count(\n index: index_name,\n body: { query: generated_query[:query] }\n )['count']\n end", "title": "" }, { "docid": "cb6b39fba74e2fe3855149b7f71de008", "score": "0.61406285", "text": "def total_count\n users = @client.search_users('language:ruby location:Vietnam')\n return users.total_count\n end", "title": "" }, { "docid": "36a7999b800b200aa7179ba367f2b8e6", "score": "0.6138325", "text": "def count\n design_doc.view('by_subject_predicate_object_context', :key=>\"\\u9999\")['total_rows'] \n end", "title": "" }, { "docid": "0c7ca17436c214aa3bd089f40f16ebf6", "score": "0.61381596", "text": "def count *where\n sql, *binds = SQLHelper.count :table => name, :where => @query_where + where, :prepared => true\n pstmt = prepare :count, sql\n pstmt.query(*binds).to_a[0][0].to_i\n end", "title": "" }, { "docid": "0b9cb3f234be26816fe4df2b32d1b283", "score": "0.613425", "text": "def test_abebooks_total_result_count\n\t\tresp = Abebooks4r::Abe.search(:author => 'Brad Ediger', :title => 'Advanced Rails')\n\t\tassert(resp.total_results == 41) #this varies time to time\n\tend", "title": "" }, { "docid": "4f900c19e368391968bbbc738292a4c1", "score": "0.61252177", "text": "def count ; @count ||= indexes.count end", "title": "" }, { "docid": "96bf4b788848db7993cf7cef8e1cb3d3", "score": "0.6124712", "text": "def get_resultsCount(cat)\n params_local = Params.clone()\n params_local[:pageno] = 1\n params_local[:jcat] = cat\n uri = SearchUri.clone()\n response = makeHttpRequest(uri, Headers, params_local, nil, MaxQps, \"ventureloop_maintenance.php\")\n doc = Nokogiri::HTML(response.body)\n resultsCount = ResultCountRegExPattern.match(doc.xpath(\"//div[@id='formContainer']//div[@class='formLs']\").first.inner_text.to_s)[:resultCount].to_i\n return resultsCount\nend", "title": "" }, { "docid": "6465fc6a7c65f0937528de2720cc7edf", "score": "0.61231107", "text": "def test_count_by_solr_splinter\n ['splinter', 'name:splinter', 'name:splinter AND author:clancy', \n 'author:clancy AND splinter', 'author:clancy cell'].each do |term|\n assert_equal 1, Book.count_by_solr(term)\n end\n end", "title": "" }, { "docid": "c3bcb4fd2c1341c30d8060276236f036", "score": "0.6120849", "text": "def test_count_by_solr_ruby_or_splinter\n ['ruby OR splinter', 'ruby OR author:tom', 'name:cell OR author:peter', 'dummy OR cell'].each do |term|\n assert_equal 2, Book.count_by_solr(term)\n end\n end", "title": "" }, { "docid": "c3bcb4fd2c1341c30d8060276236f036", "score": "0.6120849", "text": "def test_count_by_solr_ruby_or_splinter\n ['ruby OR splinter', 'ruby OR author:tom', 'name:cell OR author:peter', 'dummy OR cell'].each do |term|\n assert_equal 2, Book.count_by_solr(term)\n end\n end", "title": "" }, { "docid": "0c83b173be61e8322b33babcee219926", "score": "0.6113409", "text": "def count\n\t\tall.count\n\tend", "title": "" }, { "docid": "9913041a84b0e664cd31752e1155cc7f", "score": "0.6111106", "text": "def get_results_count\r\n @results_count\r\n end", "title": "" }, { "docid": "91bc0b0d6b22241222c4feb4b6f8782f", "score": "0.6104981", "text": "def test_count_by_solr_splinter\n ['splinter', 'name:splinter', 'name:splinter AND author:clancy',\n 'author:clancy AND splinter', 'author:clancy cell'].each do |term|\n assert_equal 1, Book.count_by_solr(term)\n end\n end", "title": "" } ]
360a8b5c565ca64a16c72389c36d14f2
create path: /sofas from /sofas/2
[ { "docid": "222da09b7982649bde62fd4eb620ef0c", "score": "0.0", "text": "def current_first_path\n \"/#{parse_current_uri.path.split('/')[1]}\"\n end", "title": "" } ]
[ { "docid": "5b6db61dabff4e198300221ac82b71a5", "score": "0.663393", "text": "def create_path(path, value)\n \n end", "title": "" }, { "docid": "3d49fecb75c8116d3b65d63433281bf9", "score": "0.63013256", "text": "def create_path\n unless !self.title || self.title.empty?\n exists = nil\n count = 2\n new_path = self.title.downcase.gsub(/\\s/, '_').gsub(/[^a-z0-9\\_]/, '').gsub(/[\\_]+/, '_')\n exists = path_exists_for_parent?(new_path)\n while exists do\n dupe_path = \"#{new_path}_#{count}\"\n exists = path_exists_for_parent?(dupe_path)\n count+=1\n end\n self.path = dupe_path || new_path\n end\n self.path\n end", "title": "" }, { "docid": "d7368607eb03baec46514caba9bc0e86", "score": "0.62741035", "text": "def create_path(path)\n c_path = ''\n path.split('/').each do |p|\n next if p.empty?\n c_path << p + '/'\n send_request(:mkcol, :path => c_path)\n end\n end", "title": "" }, { "docid": "f158dd5df0b18ec2ee4831f544655e04", "score": "0.6141201", "text": "def add_path(p0) end", "title": "" }, { "docid": "832677015481f480a2aca00bcaa23f4c", "score": "0.6016896", "text": "def create_path(options)\r\n if options[:app_host] == nil\r\n options[:app_host] = @app_host\r\n end\r\n path = \"/#{options[:app_host]}#{options[:path]}/create-path.json\"\r\n get(path)\r\n end", "title": "" }, { "docid": "ec38cbab5907fe46eb4be13ea665222c", "score": "0.5971779", "text": "def mk_path(x,y,z)\n splits = File.dirname(get_path(x,y,z)).split(\"/\")\n start = splits.first\n splits.delete_at(0)\n splits.each do |x|\n start += \"/\" + x\n if ( !File.exists?(start))\n @log.msgdebug(\"mk_path: making #{start}\")\n begin\n Dir.mkdir(start)\n rescue => e\n @log.msgerror(\"mk_path: Something when wrong, probibly allready there..#{e.to_s}\")\n end\n end\n end\n end", "title": "" }, { "docid": "5ffaf53e615ffb772d36c454271341bd", "score": "0.5919536", "text": "def new_path(path, name)\n path + name + '.png'\nend", "title": "" }, { "docid": "54061ccb63cc15e3af9282d7cdd451f6", "score": "0.5913122", "text": "def slink node, p2\n link_dir, link_name = split_path p2\n mkdir link_dir unless link_dir == ''\n link node, link_dir, link_name\n end", "title": "" }, { "docid": "d48ef86c3d9b72d8ff7236388be4c35e", "score": "0.5865781", "text": "def build_path(input); end", "title": "" }, { "docid": "d48ef86c3d9b72d8ff7236388be4c35e", "score": "0.5865781", "text": "def build_path(input); end", "title": "" }, { "docid": "590b9e6c80e6cd3ab3bde02dc8c9b9ef", "score": "0.5864646", "text": "def mkpath(base, name)\n dirs = [base]\n name.split(File::SEPARATOR)[0...-1].each { |dir| dirs << File.join(dirs[-1],dir) }\n dirs.each { |dir| Dir.mkdir(dir) unless File.exist?(dir) }\n end", "title": "" }, { "docid": "a854b962d536ff02f0e7ee3d850f34a1", "score": "0.58608747", "text": "def path\n \"/#{name}\"\n end", "title": "" }, { "docid": "312814753a89fc8ebfbd04e78143e9e4", "score": "0.5843515", "text": "def path\n \"termine/#{id}/#{name.parameterize}\"\n end", "title": "" }, { "docid": "b5a723c6de26131948c01bc52f7a2f42", "score": "0.5835343", "text": "def path\n SEEDS + '/' + name\n end", "title": "" }, { "docid": "0091b5110abfb206d1e13dcc273bed25", "score": "0.57600254", "text": "def path=(new_path); end", "title": "" }, { "docid": "0091b5110abfb206d1e13dcc273bed25", "score": "0.57600254", "text": "def path=(new_path); end", "title": "" }, { "docid": "e2cdad6c03d69423a40f8fa556c4a22c", "score": "0.5746036", "text": "def join_path(str1, str2)\n str1.sub(\"/\", \"\")+ \"/\" + str2.sub(\"/\", \"\")\nend", "title": "" }, { "docid": "6a0207d1a21ec56284367766120b5878", "score": "0.57353896", "text": "def make_path(path)\n return if path.exist?\n UI.message \"- Making path #{UI.path(path)}\" do\n path.mkpath\n end\n end", "title": "" }, { "docid": "a25bbc749b15012f47a15c551b7f00b6", "score": "0.5735182", "text": "def extend_path(path)\n path + [1]\n end", "title": "" }, { "docid": "4a2dad2577f2fdb7e00df2f26e1bd793", "score": "0.57249683", "text": "def join(base, path); end", "title": "" }, { "docid": "b8a8881b0fcc080cef0cd1ffa201660f", "score": "0.569744", "text": "def create_path(full_path, value=nil)\n paths = full_path.split('/')\n # Don't create the child node yet\n paths.pop\n paths.shift\n path = ''\n paths.each do |p|\n path << \"/#{p}\"\n # Ignore errors since it may already exist\n @zookeeper.create(:path => path)\n end\n if value\n @zookeeper.create(:path => full_path, :data => value, :ephemeral => @ephemeral)\n else\n @zookeeper.create(:path => full_path)\n end\n end", "title": "" }, { "docid": "76ea9c62b02647034d8d0c8dc243912a", "score": "0.5696175", "text": "def safe_create(path)\n path_elements = path.split(\"/\").reject{ |x| x==\"\" }\n \n all = []\n while(!path_elements.empty?)\n all << path_elements\n path_elements = path_elements[0..-2]\n end\n\n all.reverse.each do |path_elements|\n path = \"/\" + path_elements.join(\"/\")\n zk.create(:path => path) unless exists?(path)\n end\n end", "title": "" }, { "docid": "acc5c0bde8502997bb7823ac78c6bada", "score": "0.5682142", "text": "def create_dir(name)\n\t\tname += '/' unless name.tail(1) == '/'\n\t\tself[name].create\n\tend", "title": "" }, { "docid": "227a7067461d8103be3d6f49645eb4fd", "score": "0.56817997", "text": "def create pathname\n make pathname, true, true\n end", "title": "" }, { "docid": "5db237b7ee5f148e8c6bf54c3fece578", "score": "0.56815565", "text": "def build_path\n end", "title": "" }, { "docid": "9c2da00b23cbef1821cb9bd0bf3147d1", "score": "0.5648047", "text": "def construct_path(name)\n base_path + name + '.json'\nend", "title": "" }, { "docid": "292c9c94b220e6c01f5abc41def62391", "score": "0.56441575", "text": "def create\n # persist and set ref_ids\n last_path_object = nil\n params[\"sub_path_params\"].each do |sub_path|\n\n if( (sub_path[\"part\"].nil? || sub_path[\"part\"] == \"\") && (sub_path[\"path_id\"].nil? || sub_path[\"path_id\"] == \"\") )\n next\n end\n\n current_path = SubPath.create(sub_path_params(sub_path))\n\n if(current_path.valid?) # save was successful\n # set id_ref if not the first path_\n current_path.update(id_ref: last_path_object.id) unless last_path_object.nil?\n last_path_object = current_path\n else\n render :new \n end\n \n end\n\n # set terninate of lastPath_object to true and update\n if( !last_path_object.nil? && last_path_object.update(terminator: true) )\n path = Path.find(params[:sub_path_params].first[:path_id])\n puts path.name\n redirect_to path, notice: 'Sub pathes were successfully created.'\n else\n render :new \n end \n end", "title": "" }, { "docid": "db0770e9d769f0d695f77a0ddd4e6a73", "score": "0.5634258", "text": "def add_path(station_id1, station_id2, minutes)\n\t\taction = [\"MOVE\", station_id1, station_id2, minutes]\n\t\t@path.push(action)\n\tend", "title": "" }, { "docid": "7903b43d6d1239ee72eb2e0526cee2af", "score": "0.5616024", "text": "def set_path(path, id)\n [path, id].join('/')\n end", "title": "" }, { "docid": "5cf08f324511b2b3f5436f0ad076264d", "score": "0.561431", "text": "def make_path(path=nil)\n path = File.join(*[@location, path].compact)\n unless File.exists? path\n log_action \"create\", path\n FileUtils.mkdir_p(path)\n else\n log_action \"exists\", path\n end\n end", "title": "" }, { "docid": "7f525083e551c664c8e3366ade60d154", "score": "0.5606849", "text": "def get_path_to(from, to)\r\n directories_back = from.count('/')+1\r\n ('../' * directories_back)+to+'/README.md' #/README.md\r\n end", "title": "" }, { "docid": "7f175323a5735e6ef67babd1cf826ed0", "score": "0.56001794", "text": "def create_short_path\n chars = url.gsub(%r{[.\\/:#]}, '').split('')\n Array.new(rand(1..10)).map { chars.sample }.join\n end", "title": "" }, { "docid": "a1de9f92b091c105d71065d07531b320", "score": "0.55876654", "text": "def make_path(path)\n FileUtils.mkdir_p(path)\n end", "title": "" }, { "docid": "99afec04e4ff2b2e6da5188e0af265e6", "score": "0.558707", "text": "def mkpath\n\t\t\t\tFileUtils.mkpath(self.to_s)\n\t\t\tend", "title": "" }, { "docid": "84aeede0fd53515b55d2c2f1b83f48c7", "score": "0.5547749", "text": "def new_object_path; new_object_route('path'); end", "title": "" }, { "docid": "8706826e062ec0b2d6ade86981e7fd12", "score": "0.554019", "text": "def get_path(sha1)\r\n sha1[0...2] + '/' + sha1[2..40]\r\n end", "title": "" }, { "docid": "8706826e062ec0b2d6ade86981e7fd12", "score": "0.554019", "text": "def get_path(sha1)\r\n sha1[0...2] + '/' + sha1[2..40]\r\n end", "title": "" }, { "docid": "c01f200dc3c3b710b2387615aeff8c65", "score": "0.55341375", "text": "def path!(id)\n path(id).dirname.mkpath\n path(id)\n end", "title": "" }, { "docid": "1d3749e1ea567d71fec0e9336ea8a3e3", "score": "0.5530717", "text": "def append_path(path); end", "title": "" }, { "docid": "1d3749e1ea567d71fec0e9336ea8a3e3", "score": "0.5530717", "text": "def append_path(path); end", "title": "" }, { "docid": "189372429d8c234b8467b5cb2f3a1e0e", "score": "0.5529969", "text": "def generate_path(id_based, id, *path)\n path.flatten!\n if id_based\n path.insert(1, \"#{id}\")\n end\n path\n end", "title": "" }, { "docid": "80b246c4d4de358f24f8dd14d514a1a5", "score": "0.55259967", "text": "def rebuild_path\n self.update_column(:url_path, \"/#{path.collect(&:slug).join('/')}\")\n end", "title": "" }, { "docid": "52fca2ee19f79e5e16a68e057df4580f", "score": "0.55094683", "text": "def create_path\n @zk.create(self.class.path(@root_znode))\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "b360542a35b733d57305e0d448593527", "score": "0.5504856", "text": "def new_path(meta = {})\n Path.new(self, meta)\n end", "title": "" }, { "docid": "f969624682c3ac6dac3802ac0a000419", "score": "0.5497552", "text": "def generate_artifactory_standard_path(result)\n uri = []\n uri << endpoint.sub(/\\/$/, \"\")\n uri << result[\"repo\"]\n uri << result[\"path\"]\n uri << result[\"name\"]\n uri.join(\"/\")\n end", "title": "" }, { "docid": "421236191266e2e4bc2c71019a7f31a3", "score": "0.54873174", "text": "def path_name\n \"#{id}-#{firstname}_#{lastname}\".gsub(/[\\s]/, '')\n end", "title": "" }, { "docid": "f4645161e4b9b52730b9615c8da7b247", "score": "0.5486311", "text": "def create_path(page)\n path = page.output_path.chomp('/index.html')\n path = path[1..-1] if path.start_with? '/'\n path\n end", "title": "" }, { "docid": "ca31f65acd305ac456e24f5940c569bc", "score": "0.5478734", "text": "def create_path(path)\n directory = File.dirname(path)\n FileUtils.mkdir_p directory unless Dir.exist?(directory)\n end", "title": "" }, { "docid": "8221146f1fc562c947bd8164ef24d05c", "score": "0.54783577", "text": "def new_object_path(*args); new_object_route('path', args.extract_options!); end", "title": "" }, { "docid": "513ae014f998229e2e17b0a47f66a195", "score": "0.546711", "text": "def path\n @path ||= '/' + pathbuilder.join('/')\n end", "title": "" }, { "docid": "513ae014f998229e2e17b0a47f66a195", "score": "0.546711", "text": "def path\n @path ||= '/' + pathbuilder.join('/')\n end", "title": "" }, { "docid": "faf717244d65e4cf51c0b8ad4ceab320", "score": "0.5465993", "text": "def path_with_base(base, path)\n [base, path].join(\"/\").squeeze(\"/\")\n end", "title": "" }, { "docid": "d5060b8112591d796d58ba72ce1b8157", "score": "0.5456613", "text": "def set_new_path!(name_maker)\n set_new_name! name_maker\n set_new_extension! name_maker\n end", "title": "" }, { "docid": "eac971cf352aaffccf41fb271a5cae0b", "score": "0.54462457", "text": "def /(other)\n Path.new(plus(@path, other.to_s))\n end", "title": "" }, { "docid": "6317a522ea237da6abcfd6e098dff148", "score": "0.54459345", "text": "def prepend_path(path); end", "title": "" }, { "docid": "6317a522ea237da6abcfd6e098dff148", "score": "0.54459345", "text": "def prepend_path(path); end", "title": "" }, { "docid": "5d50e1b5a119dfbcbcf3a69f21fb14a1", "score": "0.54429126", "text": "def create_path_for(form, token)\n public_send(\"#{form}s_path\", token)\n end", "title": "" }, { "docid": "815c401985fa333a710770f654cc1e7d", "score": "0.54364693", "text": "def put_path(path, data)\n (parent, base) = Http::UrlUtil::split_path(path)\n parent_node = @server.tree.node_for_path(parent)\n\n parent_node.create_file(base, data)\n end", "title": "" }, { "docid": "5f73efd39122057e37b9eb79e9a7087b", "score": "0.5426942", "text": "def new_nested_object_path(*args); new_nested_object_route('path', args.extract_options!); end", "title": "" }, { "docid": "e0711324aff038c482c22e30d0d65b21", "score": "0.5408031", "text": "def / path\n by_path(path)\n end", "title": "" }, { "docid": "3f1732d301938569c042148de80675c4", "score": "0.5397522", "text": "def mkpath\n path = self.expand_path\n path = path.dirname if path.file? # Make sure the directory for the file exists\n Pathname(path).mkpath\n end", "title": "" }, { "docid": "3f1732d301938569c042148de80675c4", "score": "0.5397522", "text": "def mkpath\n path = self.expand_path\n path = path.dirname if path.file? # Make sure the directory for the file exists\n Pathname(path).mkpath\n end", "title": "" }, { "docid": "4d3c57dff59cf242ec9620e3cb147f86", "score": "0.5393571", "text": "def for(path)\n [endpoint, version, path].join('/')\n end", "title": "" }, { "docid": "0b589d1f45348f42628cdcdc3f3e90a2", "score": "0.53891623", "text": "def add_paths(name)\n if !@curr_oas[\"paths\"].nil?\n raise StandardError, \"path already added\"\n end\n curr_path_item_objs = {}\n specific_paths = get_specific_path_arr(name) #array of paths in string that the documents wants\n master_path_item_objs = @master_oas_json[\"paths\"]\n specific_paths.each {|path|\n if path.include?(\"*\")\n puts(\"Adding #{path} for #{name.to_s}\")\n path_added_flag = false\n master_path_item_objs.keys.each { |master_path|\n if master_path.include?(path.delete(\"*\"))\n path_added_flag = true\n path_item_obj = copy_obj({master_path => master_path_item_objs[master_path]})\n puts(\"Added path #{master_path} for #{name.to_s}\")\n curr_path_item_objs.merge!(path_item_obj)\n end\n }\n raise StandardError, \"Matser oas does not contain #{path} check if you enter the correct parameter in oas.config\" if !path_added_flag\n next\n end\n if master_path_item_objs[path].nil?\n raise StandardError, \"Matser oas does not contain #{path} check if you enter the correct parameter in oas.config\"\n else\n puts(\"Added path #{path} for #{name.to_s}\" )\n path_item_obj = copy_obj({path => master_path_item_objs[path]})\n curr_path_item_objs.merge!(path_item_obj)\n end\n }\n curr_path_obj = Hash[\"paths\",curr_path_item_objs]\n curr_oas_holder = copy_obj(@curr_oas).merge!(curr_path_obj)\n ParserController.new(@master_oas_json,@oas_config,curr_oas_holder)\n end", "title": "" }, { "docid": "02951a11c4a8db802a8087a7177db81b", "score": "0.53858435", "text": "def create_remote_path(sftp)\n path_parts = []\n remote_path.split(\"/\").each do |path_part|\n path_parts << path_part\n begin\n sftp.mkdir!(path_parts.join(\"/\"))\n rescue Net::SFTP::StatusException; end\n end\n end", "title": "" }, { "docid": "413d5d663dd8489ce48a55ea1599d6b0", "score": "0.5379761", "text": "def by_path(path); end", "title": "" }, { "docid": "413d5d663dd8489ce48a55ea1599d6b0", "score": "0.5379761", "text": "def by_path(path); end", "title": "" }, { "docid": "3ba81c96f08219793ab1de0136f7bb6a", "score": "0.5364665", "text": "def path\n name.gsub('-', '/')\n end", "title": "" }, { "docid": "3ba81c96f08219793ab1de0136f7bb6a", "score": "0.5364665", "text": "def path\n name.gsub('-', '/')\n end", "title": "" }, { "docid": "a6e349d02641addb7fa38cc93e2ba89d", "score": "0.53595966", "text": "def prepare_path path\n if path.end_with?('/')\n path = path[0, path.length-1]\n end\n return path\n end", "title": "" }, { "docid": "856bc724591f93dc3c85151b65508860", "score": "0.53437275", "text": "def shortpath(fullpath); end", "title": "" }, { "docid": "010ff6f767459aa2b0dc52677f01c9ee", "score": "0.53420013", "text": "def handle_301_auto_add_path(path_name)\n path_name =~ /(_path|_url)$/ ? path_name : \"#{path_name}_path\"\n end", "title": "" }, { "docid": "989802c66d793be6a85c454961ec5c4f", "score": "0.5340486", "text": "def copy_to(new_path); end", "title": "" }, { "docid": "b823a62518ae57d159b3ae6189f0fb6d", "score": "0.53364575", "text": "def partialize_path(path)\n return unless path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end", "title": "" }, { "docid": "dbb3720114466cedbf45597512988752", "score": "0.5331915", "text": "def rename(from_path,to_path);end", "title": "" }, { "docid": "dbb3720114466cedbf45597512988752", "score": "0.5331915", "text": "def rename(from_path,to_path);end", "title": "" }, { "docid": "8cb317b92b8336303b86d7f99b9ad445", "score": "0.5328791", "text": "def path_from_nsh_path(path, base_path = nil, path_property = nil)\n result = path\n result = \"/#{result.split(\"/\")[3..-1].join(\"/\")}\" if result.start_with?(\"//\")\n unless path_property.nil?\n result = result.gsub(base_path, \"??#{path_property}??\")\n end\n result\n end", "title": "" }, { "docid": "c0c9ae5bda226e1007d464ed5dceefd8", "score": "0.5327832", "text": "def build_path(name, prefix, partial)\n Path.build(name, prefix, partial)\n end", "title": "" }, { "docid": "aaa80caf21b9222c2808936fd4c38c82", "score": "0.53250307", "text": "def new_modelo_path(o)\n n = \"new_#{self.nombreobj(o)}_path\"\n arr = ruta_responde_1p(n, o)\n if arr != []\n return arr[1]\n end\n\n n = \"new_admin_#{self.nombreobj(o)}_path\"\n arr = ruta_responde_1p(n, o)\n if arr != []\n return arr[1]\n end\n\n raise \"No se encontró ruta para nuevo #{n}\"\n end", "title": "" }, { "docid": "afb9637337ed624e2626f8d1d589ab42", "score": "0.5324035", "text": "def correct_path(str)\nend", "title": "" }, { "docid": "d6a77cfeaff7814831da5b3a657cb455", "score": "0.5317553", "text": "def path_to(*names)\n File.expand_path(layout.expand(*names), base_dir)\n end", "title": "" }, { "docid": "73badb51472f3dca93c37a0c567f5cb0", "score": "0.5314059", "text": "def mkpath(path)\n FileUtils.mkpath\n end", "title": "" }, { "docid": "b978442fa8a4505931739ca52c86340e", "score": "0.53099954", "text": "def path\n \"s/#{slug}\"\n end", "title": "" }, { "docid": "2ee22e7a3e9576a1da305a7cbf329337", "score": "0.5307241", "text": "def destination(path); end", "title": "" }, { "docid": "12b6a8d8d57b45baf43213ab77c0f830", "score": "0.5301558", "text": "def createPath(parent, path)\n el = nil\n path.each {|name|\n if (el = parent.elements[name]) == nil\n el = parent.add_element(name)\n end\n parent = el\n }\n el.add_element(\"current\")\n return el\n end", "title": "" }, { "docid": "bd53365b27843edfa4094f7f8741407b", "score": "0.53014517", "text": "def path src, dest\n src.straight_path_to dest\n end", "title": "" }, { "docid": "d329b270ca9e784940284671cac09c92", "score": "0.52971417", "text": "def to_unc_path(path, server_name)\n return nil if path.nil? || path.empty? || server_name.nil? || server_name.empty?\n path.gsub(/(\\p{L})+(:\\\\)/i) { \"\\\\\\\\#{server_name}\\\\#{Regexp.last_match(1)}$\\\\\" } # replace local paths with network paths\n end", "title": "" }, { "docid": "d329b270ca9e784940284671cac09c92", "score": "0.52971417", "text": "def to_unc_path(path, server_name)\n return nil if path.nil? || path.empty? || server_name.nil? || server_name.empty?\n path.gsub(/(\\p{L})+(:\\\\)/i) { \"\\\\\\\\#{server_name}\\\\#{Regexp.last_match(1)}$\\\\\" } # replace local paths with network paths\n end", "title": "" }, { "docid": "4637666acd51cee06c74a9e0e8128345", "score": "0.52966255", "text": "def create_path_in_home(*path)\n path = File.join(Dir.home, *path)\n FileUtils.mkpath(path)\n end", "title": "" }, { "docid": "8e7cfd549f52d108922dbf17cb27dd80", "score": "0.5292397", "text": "def create_path\n @zk.create(ZNODE_PATH)\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "577fd566705ef59fa296dab5a25af42a", "score": "0.5284791", "text": "def create\n @path = current_user.paths.create(path_params)\n @path.from_room = Room.find(params[:from_room_id])\n @path.game = @path.from_room.game\n @path.to_room.game = @path.game\n respond_to do |format|\n if @path.save\n format.html { redirect_to @path.from_room, notice: 'Path was successfully created.' }\n format.json { render :show, status: :created, location: @path }\n else\n format.html { render :new }\n format.json { render json: @path.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff384c0331f31e9de5f4c324f45f779d", "score": "0.52757967", "text": "def mkpath(path)\n FileUtils.mkpath(path)\n end", "title": "" }, { "docid": "e930d553d6131447139e55d8c1d68995", "score": "0.52545524", "text": "def pair_path(id)\n id.to_s.split(/[-\\/]/).first.split(\"\").each_slice(2).map(&:join).join(\"/\")\n end", "title": "" }, { "docid": "091d54e3245e59234d9400361fa14da0", "score": "0.5250275", "text": "def createFolderAndFile\n #timestamp\n\t\tt = DateTime.now\n\t\t\n\t\t# cria o caminho físico do arquivo\n\t\tfilename = params[:tentativa][:path].original_filename\n\t\tpath = File.join(Rails.root, \"data/concursos\",\"contest-\"+@enunciado.concurso_id.to_s,\"en-\"+@enunciado.id.to_s,\"user-\"+current_user.id.to_s)\n\t\t#completa o path com o nome do ficheiro\n\t\t\n\t\t#cria a pasta caso nao exista (para o user)\n\t\tif !File.exists?(path)\n\t\t\tDir.mkdir(path)\n\t\tend\n\t\t\n\t\tpath = File.join(path,\"tent-\"+t.to_s(:number))\n\t\t#cria a pasta caso nao exista (para a tentativa)\n\t\tif !File.exists?(path)\n\t\t\tDir.mkdir(path)\n\t\tend\n\t\t\n\t\tpath = File.join(path,filename)\n\t\t\n\t\t# escreve o arquivo no local designado\n\t\tFile.open(path, \"wb\") do |f| \n\t\t\tf.write(params[:tentativa][:path].read)\n\t\tend\n\t\t\n\t\t#guarda na @tentativa.path o path onde ficou guardado o ficheiro\n\t\t#params[:tentativa][:path] = path\n\t\treturn path\n end", "title": "" }, { "docid": "86757fe4520c39eaa20979afdf22c598", "score": "0.52460015", "text": "def add_slash(path)\n path + if path[-1..-1] == \"/\" then \"\" else \"/\" end\n end", "title": "" }, { "docid": "9024a74235da0634e9cc1bcfa9b69aef", "score": "0.52421725", "text": "def get_path_to_oz(path='')\n server = 'http://127.0.0.1:8080/oz'\n path = path.strip\n if path\n if path[0] != '/'\n server += '/'\n end\n server += path\n end\n return server\n end", "title": "" }, { "docid": "53891801986564cd3a38a1b59f13c091", "score": "0.52416587", "text": "def create_symlink(dest_path); end", "title": "" }, { "docid": "c9543dbdf88480077eecd63320bd195e", "score": "0.52377963", "text": "def relative_path(from, to); end", "title": "" }, { "docid": "14d2bc648307c4a470339249ebd99898", "score": "0.5236153", "text": "def change_path(str)\n full_path = str.sub(\"n:\",\"\").gsub(\".\",\"/\") \n return full_path, full_path.split(\"/\").last\n end", "title": "" }, { "docid": "1a074f82f0c92eedcf2bc757b1ef293c", "score": "0.5234985", "text": "def url_for original\n (@wuala_dir + \"./#{original.path}\").cleanpath.to_s\n end", "title": "" }, { "docid": "e79c8fff9d624d1b14ff75703ea2e610", "score": "0.5233451", "text": "def path!(id)\n path = path(id)\n FileUtils.mkdir_p(path.dirname, mode: directory_permissions)\n path\n end", "title": "" } ]
657c4e1c7ae0622e1b5c02a5bb2f9878
verify signature with ECDSA
[ { "docid": "46977e35b0545a2f4aaa88df96d84136", "score": "0.7218856", "text": "def verify content, sign\n # raise OpenSSL::PKey::ECError(ECDSA_verify: nested asn1 error) when sign is wrong\n @ec.dsa_verify_asn1 content, Utils::BinUtil.from_hex(sign)\n rescue\n false\n end", "title": "" } ]
[ { "docid": "ce18315391cef135ab0f3c4ee49b541d", "score": "0.769322", "text": "def verify_signature(result); end", "title": "" }, { "docid": "bc406aa8ec579ff326537a5687434336", "score": "0.75848633", "text": "def verify_ecdsa_signature(signature, hash)\n BTC::OpenSSL.ecdsa_verify(signature, hash, self.public_key)\n end", "title": "" }, { "docid": "29e5e13b5ca4c88728dee0654d6b29ad", "score": "0.73347425", "text": "def signature_valid?; end", "title": "" }, { "docid": "10819f1dce3c56517d099c8be72a50e1", "score": "0.7226756", "text": "def signature_is_valid?\n node = @ar.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize\n\n signature = @ar.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end", "title": "" }, { "docid": "a3475dbfeda80164fccbfa521a018913", "score": "0.71234703", "text": "def verify_signature\n @spki.verify(public_key)\n end", "title": "" }, { "docid": "92e748e0210ae6b542d3205ffd751498", "score": "0.7110884", "text": "def check_signature\n signature == \"\\x2a\\x2a\\x00\\x00\"\n end", "title": "" }, { "docid": "c32ac8774757ba9460d134804604a6b5", "score": "0.7106648", "text": "def verify_signatures?; end", "title": "" }, { "docid": "68690676176fe2fa7579592340f246ad", "score": "0.7105727", "text": "def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend", "title": "" }, { "docid": "ef2a4df3d341b72573450bce3c6e0a59", "score": "0.709318", "text": "def check_signature\n signature == \"ElfChnk\\x00\"\n end", "title": "" }, { "docid": "c323450d9a86da04093c665bfc590f0a", "score": "0.7089", "text": "def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end", "title": "" }, { "docid": "2b50ba269ad782915bb43c018da506fe", "score": "0.70860374", "text": "def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end", "title": "" }, { "docid": "796e5272509a173b7e40548d961bb11f", "score": "0.7000981", "text": "def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end", "title": "" }, { "docid": "43380313b1ae58d1cb76d51bc182620b", "score": "0.69734377", "text": "def validate_sig(pkey,sig)\r\n\t\t\t\r\n\t\tend", "title": "" }, { "docid": "e5d4f53c5eac5f54f5dc849099803af9", "score": "0.695467", "text": "def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest::SHA256.digest(timestamped_playload)\n decoded_signature = Base64.decode64(signature)\n public_key.dsa_verify_asn1(payload_digest, decoded_signature)\n rescue StandardError\n false\n end", "title": "" }, { "docid": "14f41b8b043d4d01ff3784058e6a1aed", "score": "0.6930622", "text": "def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n end", "title": "" }, { "docid": "168782d0a688af4553bf770aaa4baff6", "score": "0.68674225", "text": "def validate_signature(test_doc = nil)\n test_doc ||= @prepared_doc\n\n doc_signature = get_document_tag :esigncode, from: test_doc\n doc_salt = get_document_tag :esignuniquecode, from: test_doc\n validate_prepared_doc_digest test_doc\n\n new_pdd = prepared_doc_digest(from: test_doc)\n new_signature = Hashing.sign_with(doc_salt, new_pdd)\n raise ESignatureUserError, 'Document signature is invalid' unless doc_signature == new_signature\n\n true\n end", "title": "" }, { "docid": "d77327f98614ffb6bbdfa4d9d35d5eda", "score": "0.6843924", "text": "def verify_signature(cleartext, signature_string)\n cmd_output = run_verify(cleartext, signature_string)\n cmd_result = analyse_verify_output(*cmd_output)\n\n if cmd_result[:well_formed_pgp_data]\n match_constraints(**cmd_result)\n else\n msg_no_pgg_data(signature_string)\n end\n end", "title": "" }, { "docid": "30178869fd9c0054c8c60004b26ec86b", "score": "0.6836203", "text": "def verify_signature\n @req.verify(public_key)\n end", "title": "" }, { "docid": "1318bb7bbe7093f72981dbf81b3f9712", "score": "0.6824967", "text": "def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end", "title": "" }, { "docid": "a241d6788b0c5b850aef5b1c30f5bd56", "score": "0.6824807", "text": "def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end", "title": "" }, { "docid": "a241d6788b0c5b850aef5b1c30f5bd56", "score": "0.6824807", "text": "def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end", "title": "" }, { "docid": "3554057bbf219a60ea5d37616b4b6fa3", "score": "0.67897123", "text": "def verifySignature _args\n \"verifySignature _args;\" \n end", "title": "" }, { "docid": "6cd82d7ad796f429de885c893f839380", "score": "0.67859364", "text": "def validate_signature(key_public, signature, timestamp)\r\n # RSA Decryption (Formula: M = C^e mod n)\r\n timestamp = timestamp.to_i % key_public[1].to_i\r\n signature = signature.to_i\r\n decipher = signature.to_bn.mod_exp(key_public[0].to_i,key_public[1].to_i)\r\n return true if (decipher == timestamp)\r\n return false\r\nend", "title": "" }, { "docid": "d4e2c64854d5aaf05224c0d75dc3fb4e", "score": "0.6749128", "text": "def verify_compact_signature(signature, hash)\n raise BTCError, \"Not implemented\"\n end", "title": "" }, { "docid": "f4f3b63080e9dcecbf0fefeffa0faadc", "score": "0.67327756", "text": "def verify_signature(url, params)\n submit VerifySignature.new(:url_end_point => url, :http_parameters => params)\n end", "title": "" }, { "docid": "f79250e603b891a9cc13482a9eaf6e8e", "score": "0.6729441", "text": "def verify\n @sigs = []\n @orig_data = request.params['data']\n if @orig_data.nil?\n # XXX: Implement HTTP error here.\n end\n begin\n GPGME::verify(request.params['data'], nil, @plain) do |signature|\n @sigs << signature\n end\n rescue GPGME::Error => e\n @error = \"GPGME Error: #{e.to_s}\"\n #rescue\n # @error = \"Unspecified Error.\"\n end\n end", "title": "" }, { "docid": "b78b55c058d7a234f36178299d28f80b", "score": "0.669435", "text": "def verify(sig,data)\n if rsa?\n @pub.verify( OpenSSL::Digest::SHA1.new, sig, data )\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1.1\n # @pub.verify( OpenSSL::Digest::DSS1.new, sig, data )\n raise StandardError, 'DSA is not supported'\n else\n false\n end\n end", "title": "" }, { "docid": "2029d32df72f8a0674edc62c18da8055", "score": "0.6682882", "text": "def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end", "title": "" }, { "docid": "4adfac2bfa07c24f84afa553a6ffdacf", "score": "0.66670805", "text": "def verify_signature\n return_code, response = send_command(\"verify_signature\", token)\n return_code == \"200\"\n end", "title": "" }, { "docid": "6132a492b7792e1e3a1b2822622265f5", "score": "0.66213745", "text": "def verify(file)\n # Read YAML file and comment\n data = YAML.load(File.open(file + SIGEXT))\n raise KeyfileError, \"Invalid file #{file + SIGEXT} content\" unless data && data.is_a?(Hash)\n\n puts \"Signature in file: #{file + SIGEXT}\" if @options[:verbose]\n clearsg = !File.file?(file)\n\n # Hash data\n start = Time.now\n sha = if clearsg\n raise VerificationError, \"File #{file} does not exist, no signed data\" if data[:data].nil?\n Digest::SHA512.new\n else\n puts \"⚠ Warning: clear sign data found but ignored\" if data.has_key?(:data)\n Digest::SHA512.file(file)\n end\n sha << \"\\0x00\" + data[:comment] unless data[:comment].nil?\n sha << \"\\0x00\" + data[:datetime].to_s\n sha << \"\\0x00\" + data[:data] if clearsg\n\n # Control data\n ctn = Enc.decode(data[:signature])\n pub = Ed25519::VerifyKey.new Enc.decode_key(data[:verifykey])\n puts \"Signed with key: #{abbrev_key(data[:verifykey])}\" if @options[:verbose]\n t = get_trusted_keys.include?(data[:verifykey]) ? \"with trusted key\" :\n \"but the verify key is ✖ not trusted\\n (#{data[:verifykey]})\"\n pub.verify(ctn, sha.digest) || raise(VerificationError, \"BAD signature\")\n if clearsg\n $stderr.puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n $stdout.print data[:data]\n $stderr.puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n else\n puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n puts \"(⏲ #{'%.2f' % ((Time.now - start) * 1000)} ms)\" if @options[:verbose]\n puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n end\nend", "title": "" }, { "docid": "151b852f138b00d28bdeb5438fae3613", "score": "0.66048455", "text": "def valid?\n return false unless given_signature\n Relax::Query.unescape_value(correct_signature) == given_signature\n end", "title": "" }, { "docid": "a53fd1d14eecbc203ef25bb952fe8f0f", "score": "0.65713304", "text": "def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, params)\n\n if sent_signature.nil? || generated_signature.nil? || !safe_equals?(sent_signature, generated_signature)\n raise SignatureException.new(sent_signature, generated_signature)\n end\n end", "title": "" }, { "docid": "3ad5b54d5a0aa65e063626c7988c501b", "score": "0.6556178", "text": "def correct_signature?\n client = RestClient.where(:api_key => @api_key).first\n sign=client.nil? ? \"\" : client.secret + @request_uri.gsub(/\\?.*/,\"\")+@timestamp\n calculated_sign= (Digest::SHA256.new << sign).to_s\n Digest::SHA1.hexdigest(@signature)==Digest::SHA1.hexdigest(calculated_sign)\n end", "title": "" }, { "docid": "e4b2729a9bf005838fd0097e1bb9eb8e", "score": "0.6554502", "text": "def signature_ok?\n generate_md5 == vps_signature\n end", "title": "" }, { "docid": "58c1497cfd70e189c528d7af5771c1ca", "score": "0.651934", "text": "def verify_sig(data, sig, pubkey, algo: :ecdsa)\n case algo\n when :ecdsa\n verify_ecdsa(data, sig, pubkey)\n when :schnorr\n verify_schnorr(data, sig, pubkey)\n else\n false\n end\n end", "title": "" }, { "docid": "31f1b734c4e9bdee4e7756f15cf1e977", "score": "0.65128267", "text": "def valid_signature? signature\n # We create a new XML document in Nokogiri to canonicalize the\n # signature. Nokogiri needs the xmlns:ds tag on the root element to\n # preserve the 'ds:' namespace on all the elements. Not exactly sure\n # why this is needed, but it works if we do it.\n info = signature.find_first('.//ds:SignedInfo', DS)\n\n canon = LibXML::XML::Document.new\n canon.root = canon.import info\n canonicalized = canon.canonicalize\n\n b64_sig = signature.find_first('.//ds:SignatureValue', DS).content\n dec_sig = Base64.decode64 b64_sig\n\n b64_cert = signature.find_first('.//ds:X509Certificate', DS).content\n cert = OpenSSL::X509::Certificate.new(Base64.decode64(b64_cert))\n\n digest = OpenSSL::Digest::SHA1.new\n cert.public_key.verify(digest, dec_sig, canonicalized)\n end", "title": "" }, { "docid": "3d4ade7f83df051fef3d120c44d72a63", "score": "0.6506556", "text": "def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end", "title": "" }, { "docid": "f37557e7ff0d7198d7b9364edf468a62", "score": "0.64953405", "text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end", "title": "" }, { "docid": "f37557e7ff0d7198d7b9364edf468a62", "score": "0.64953405", "text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end", "title": "" }, { "docid": "62ee5408c36cceb9b48c01939735bdbf", "score": "0.6482625", "text": "def createsignature(str)\r\n signature_raw = sign(str)\r\n signature_der = ECDSA::Format::SignatureDerString.encode(signature_raw)\r\n signature_der_b64 = Base64.strict_encode64(signature_der) \r\n digest_raw = Digest::SHA256.digest(str)\r\n digest_b64 = Base64.encode64(digest_raw)\r\n #Base64 encoding was used due to the readablility, and transportability. \r\n puts(\"Signature (b64 encoded der): \"+signature_der_b64)\r\n puts(\"Digest (b64 endoded): \"+digest_b64)\r\n $signature_array.push(signature_der_b64)\r\n $digest_array.push(digest_b64)\r\n #return signature_der_b64\r\nend", "title": "" }, { "docid": "e80ac6acf0b992c98f66d2ba4514b794", "score": "0.6474427", "text": "def ecdsa_signature(hash, normalized: true)\n BTC::OpenSSL.ecdsa_signature(hash, @private_key, normalized: normalized)\n end", "title": "" }, { "docid": "066c21c3c7247ff742c4e9a40d2131dc", "score": "0.6469336", "text": "def test_signed\n mail = Notifier.fufu_signed(\"<destination@foobar.com>\", \"<demo@foobar.com>\")\n\n assert_equal mail.delivery_method.settings[:address], 'smtp.com'\n assert_equal mail.from, [ \"demo@foobar.com\" ]\n\n found = false\n for part in mail.parts do\n if part.content_type =~ /application\\/x-pkcs7-signature/\n found = true\n break\n end\n end\n assert_equal found, true\n\n require 'tempfile'\n\n tf = Tempfile.new('actionmailer_x509')\n tf.write mail.encoded\n tf.flush\n\n comm = \"openssl smime -verify -in #{tf.path} -CAfile #{File.dirname(__FILE__)}/../lib/certs/ca.crt 2>&1\"\n\n success = false\n output = IO.popen(comm)\n while output.gets do\n if $_ =~ /^Verification successful/\n success = true\n end\n end\n assert_equal(success, true)\n end", "title": "" }, { "docid": "b7159b38aa97bdee5005197458b3dbca", "score": "0.6445711", "text": "def verify_signature(params = {})\n version = params[:version]\n webhook_secret = params[:webhook_secret]\n stringified_data = params[:stringified_data]\n request_timestamp = params[:request_timestamp]\n signature = params[:signature]\n\n signature_params = \"#{request_timestamp}.#{version}.#{stringified_data}\"\n digest = OpenSSL::Digest.new('sha256')\n signature_to_be_verified = OpenSSL::HMAC.hexdigest(digest, webhook_secret, signature_params)\n\n signature == signature_to_be_verified\n\n end", "title": "" }, { "docid": "b9736ae9a21f17f736899e0970679d63", "score": "0.64324284", "text": "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, signature_bytes, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "title": "" }, { "docid": "b84f98f2e4a9f9122c21fc0320d2429e", "score": "0.64144325", "text": "def verify_signature(result) # :nodoc:\n response = build_signature_buffer(result)\n\n hash = digester.digest(response.to_s)\n\n server_key = result[:server_key]\n server_sig = result[:server_sig]\n unless connection.host_key_verifier.verify_signature { server_key.ssh_do_verify(server_sig, hash, host_key: algorithms.host_key) }\n raise Net::SSH::Exception, 'could not verify server signature'\n end\n\n hash\n end", "title": "" }, { "docid": "3a961d34c68fb97aba8cc7ca19403e1f", "score": "0.6406289", "text": "def verify!(ha)\n passed_signature = ha[:sig] || ha[\"sig\"]\n raise Tampered, \"No signature given\" unless passed_signature\n raise Tampered, \"Checksum differs\" unless compute_checksum(ha) == passed_signature.to_s\n true\n end", "title": "" }, { "docid": "ae574bf649298fbb69ff2d111fb389a6", "score": "0.6367557", "text": "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "title": "" }, { "docid": "ae574bf649298fbb69ff2d111fb389a6", "score": "0.6367557", "text": "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "title": "" }, { "docid": "ae574bf649298fbb69ff2d111fb389a6", "score": "0.6367557", "text": "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "title": "" }, { "docid": "64d92a93ab5cd455adc30711ccc9119f", "score": "0.6357474", "text": "def validate_signature(doc, certificate, canonicalization_method)\n node = doc.at('xmlns|SignedInfo', xmlns: DSIG)\n\n return false unless node\n\n node = case canonicalization_method\n when :normal\n node.canonicalize\n when :exclusive\n canonicalize_exclusively node\n end\n\n signature = doc.at('xmlns|SignatureValue', xmlns: DSIG).content\n signature = decode(signature)\n\n # Return true or false\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end", "title": "" }, { "docid": "c4076c225788834e8fc65ead555f718b", "score": "0.6343067", "text": "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, NaCl::SIGNATUREBYTES, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "title": "" }, { "docid": "305e2cc5b4fff81a3e0fed99ec78c010", "score": "0.63378143", "text": "def check_for_signature\n if signature_file_name_changed?\n sign if signature.present?\n end\n true\n end", "title": "" }, { "docid": "e29609cc628aabddbb0e65e4574f20d0", "score": "0.6329875", "text": "def verify(app_id)\n # Chapter 4.3 in\n # http://fidoalliance.org/specs/fido-u2f-raw-message-formats-v1.0-rd-20141008.pdf\n data = [\n \"\\x00\",\n ::U2F::DIGEST.digest(app_id),\n ::U2F::DIGEST.digest(client_data_json),\n key_handle_raw,\n public_key_raw\n ].join\n\n begin\n parsed_certificate.public_key.verify(::U2F::DIGEST.new, signature, data)\n rescue OpenSSL::PKey::PKeyError\n false\n end\n end", "title": "" }, { "docid": "e975ebbbecbcc7d132252e3b13e77461", "score": "0.630826", "text": "def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end", "title": "" }, { "docid": "2da941004c15d198b0d5a063fac9c2b5", "score": "0.62923884", "text": "def verify_signature(signature, string, base64=false)\n signature = base64_decode(signature) if base64\n\n @public_key.verify(OpenSSL::Digest.new(\"SHA1\"), signature, string)\n end", "title": "" }, { "docid": "3d49595b3105a876a4ae91f9564aa492", "score": "0.62912834", "text": "def verify_content(body, signature)\n hmac = HMAC::SHA1.hexdigest(@secret, body)\n check = \"sha1=\" + hmac\n check == signature\n end", "title": "" }, { "docid": "d36747e470de73e670c56688ecd529b0", "score": "0.62901473", "text": "def verify_signature(signature, bytes, signer_public_key)\n signature = Validation.check_filled_array_argument!(signature)\n bytes = Validation.check_filled_array_argument!(bytes)\n signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key)\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512)\n signer = Core::VirgilSigner.new(native_algorithm)\n signer.verify(bytes, signature, signer_public_key.raw_key)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n\n end", "title": "" }, { "docid": "d84d560ffd7aebab8401e20d81c2ea31", "score": "0.6277557", "text": "def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end", "title": "" }, { "docid": "eb8fca5bffabbc343ca987a5592dfa9a", "score": "0.62668335", "text": "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number of bytes in the signature is less than the number of bytes of the RSA\n # modulus, prepend the signature with zeros.\n # See https://github.com/openssh/openssh-portable/blob/ac383f3a5c6f529a2e8a5bc44af79a08c7da294e/ssh-rsa.c#L531\n difference = n.num_bytes - raw_sig.bytesize\n raw_sig = \"\\0\" * difference + raw_sig if difference.positive?\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end", "title": "" }, { "docid": "4bfaf6378a9b670a897b116b072497de", "score": "0.62663454", "text": "def match_signature(signature)\n if !signature[:ok]\n msg_mismatch(text)\n elsif expected_signer && signature[:email] != expected_signer\n msg_wrong_signer(signature[:email])\n end\n end", "title": "" }, { "docid": "38c203a5c2ba1c72e6591d18332e413b", "score": "0.62468594", "text": "def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end", "title": "" }, { "docid": "41a15921bd2c58c25dfd71e7a76dfdcb", "score": "0.62452257", "text": "def verify_signature(signature, signed_text, base64_encoded=true)\n sig = base64_encoded ? Base64UrlSafe.decode(signature) : signature\n self.public_key.verify(OpenSSL::Digest::SHA256.new, sig, signed_text)\n end", "title": "" }, { "docid": "52e33a114f690bdbbcb501b5e5a50096", "score": "0.6238642", "text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end", "title": "" }, { "docid": "52e33a114f690bdbbcb501b5e5a50096", "score": "0.62375104", "text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end", "title": "" }, { "docid": "288fbe1526e96263ccd5044c09b5b67e", "score": "0.61687756", "text": "def check_signature\n signature == \"ElfFile\\x00\"\n end", "title": "" }, { "docid": "4f782e5e7e1771d64932bb080792971b", "score": "0.6138214", "text": "def validate_signature\n\t\t::Rails.logger.debug \"--- Realizando comprobación de la firma con PSEIS ---\"\n\t\tdoc = Nokogiri::XML(xmlSigned)\n\t\tdoc.remove_namespaces!\n\t\t\n\t\tcert = doc.xpath('//X509Data/X509Certificate').first.inner_text\n\t\t\n\t\tmyValidation = PSISApi.new\n\t\tmyValidation.validate cert\n\t\treturn myValidation\n\tend", "title": "" }, { "docid": "338184fd8ef12c2bb82da4c9c0b1caec", "score": "0.61180526", "text": "def signature_bytes; NaCl::ED25519_SIGNATUREBYTES; end", "title": "" }, { "docid": "28a37785d8efb222303d22bf956849fa", "score": "0.6115958", "text": "def valid_signature?(params)\n (Time.at(params['ts'].to_i) > 30.minutes.ago) &&\n params['sig'] == signed_request_params(params['ts'])['sig']\n end", "title": "" }, { "docid": "6f152f5d432b5fde5b8a703357696d97", "score": "0.6112219", "text": "def verify_key; end", "title": "" }, { "docid": "6f152f5d432b5fde5b8a703357696d97", "score": "0.6112219", "text": "def verify_key; end", "title": "" }, { "docid": "3414a17bec0c3b45db8ce0ab1b5072b3", "score": "0.6086532", "text": "def valid_signature?(signature, data)\n generate_signature(data) == signature\n end", "title": "" }, { "docid": "c2ccc328acd3a265923461da13cd6bf7", "score": "0.60800564", "text": "def check(params)\n params = params.dup\n\n signature = params.delete('sig')\n\n ::JWT::SecurityUtils.secure_compare(signature, digest(params))\n end", "title": "" }, { "docid": "baed48e510512e69e41331e4e20c8287", "score": "0.6044326", "text": "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end", "title": "" }, { "docid": "2434aa0e1fff5b154745a64b016abacc", "score": "0.60413265", "text": "def verify_signature signature, data, chain, time = Time.now\n Gem.ensure_ssl_available\n cert_class = OpenSSL::X509::Certificate\n exc = Gem::Security::Exception\n chain ||= []\n\n chain = chain.map{ |str| cert_class.new(str) }\n signer, ch_len = chain[-1], chain.size\n opt = Gem::Security::OPT.merge(@opt)\n\n # make sure signature is valid\n if @verify_data\n # get digest algorithm (TODO: this should be configurable)\n dgst = opt[:dgst_algo]\n\n # verify the data signature (this is the most important part, so don't\n # screw it up :D)\n v = signer.public_key.verify(dgst.new, signature, data)\n raise exc, \"Invalid Gem Signature\" unless v\n\n # make sure the signer is valid\n if @verify_signer\n # make sure the signing cert is valid right now\n v = signer.check_validity(nil, time)\n raise exc, \"Invalid Signature: #{v[:desc]}\" unless v[:is_valid]\n end\n end\n\n # make sure the certificate chain is valid\n if @verify_chain\n # iterate down over the chain and verify each certificate against it's\n # issuer\n (ch_len - 1).downto(1) do |i|\n issuer, cert = chain[i - 1, 2]\n v = cert.check_validity(issuer, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain', cert.subject, v[:desc]\n ] unless v[:is_valid]\n end\n\n # verify root of chain\n if @verify_root\n # make sure root is self-signed\n root = chain[0]\n raise exc, \"%s: %s (subject = '%s', issuer = '%s')\" % [\n 'Invalid Signing Chain Root',\n 'Subject does not match Issuer for Gem Signing Chain',\n root.subject.to_s,\n root.issuer.to_s,\n ] unless root.issuer.to_s == root.subject.to_s\n\n # make sure root is valid\n v = root.check_validity(root, time)\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Invalid Signing Chain Root', root.subject, v[:desc]\n ] unless v[:is_valid]\n\n # verify that the chain root is trusted\n if @only_trusted\n # get digest algorithm, calculate checksum of root.subject\n algo = opt[:dgst_algo]\n path = Gem::Security::Policy.trusted_cert_path(root, opt)\n\n # check to make sure trusted path exists\n raise exc, \"%s: cert = '%s', error = '%s'\" % [\n 'Untrusted Signing Chain Root',\n root.subject.to_s,\n \"path \\\"#{path}\\\" does not exist\",\n ] unless File.exist?(path)\n\n # load calculate digest from saved cert file\n save_cert = OpenSSL::X509::Certificate.new(File.read(path))\n save_dgst = algo.digest(save_cert.public_key.to_s)\n\n # create digest of public key\n pkey_str = root.public_key.to_s\n cert_dgst = algo.digest(pkey_str)\n\n # now compare the two digests, raise exception\n # if they don't match\n raise exc, \"%s: %s (saved = '%s', root = '%s')\" % [\n 'Invalid Signing Chain Root',\n \"Saved checksum doesn't match root checksum\",\n save_dgst, cert_dgst,\n ] unless save_dgst == cert_dgst\n end\n end\n\n # return the signing chain\n chain.map { |cert| cert.subject }\n end\n end", "title": "" }, { "docid": "947fd0e2479d3eae8d0e34497127e6a9", "score": "0.6038942", "text": "def process_signature? (signature)\n\t\n\t\tlogger.debug 'Estamos procesando la firma'\t\n\t\t\n\t\tif not signature.signed?\n\n\t\t\t@signature.xmlSigned = Base64.decode64(params[:xmlSigned2])\n\t\t\t\n\t\t\tbegin\n\t\t\t\tvalidation = @signature.validate_signature\n\t\t\trescue\n\t\t\t\tflash[:error] = \"Ha ocurrido un error al intentar validar el certificado\"\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\tif not validation.isValid?\n\t\t\t\tflash[:error] = \"La firma no es válida. Compruebe que el certificado no esté caducado o revocado\"\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\tif validation.psisNIF != signature.dni\n\t\t\t\tflash[:error] = \"El DNI introducido en el formulario no coincide con el DNI del Certificado\"\n\t\t\t\treturn false\t\t\t\n\t\t\tend\n\n\t\t\t@signature.state = 1\n\t\t\t\n\t\t\tif @signature.valid?\n\t\t\t\t@proposal = @signature.proposal\n\t\t\t\t@signature.get_afirma_signature\t\t\n\t\t\t\tshare_texts(@proposal, @signature)\n\t\t\t\tsignature.notifier\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\tflash[:error] = @signature.errors.map {|a,m| \"#{m.capitalize}\"}.uniq.join(\"<br/>\\n\")\n\t\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\tflash[:error] = \"Este identificador de firma ya ha sido firmado\"\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "d4725aa84d6975239818e2b730b9fc84", "score": "0.60241985", "text": "def valid?\n verify\n rescue InvalidDigest, InvalidSignedValue\n return false\n end", "title": "" }, { "docid": "d4725aa84d6975239818e2b730b9fc84", "score": "0.6022302", "text": "def valid?\n verify\n rescue InvalidDigest, InvalidSignedValue\n return false\n end", "title": "" }, { "docid": "d81d043c15f37302d8fb17e110fa21d9", "score": "0.60186666", "text": "def valid_hashes? signature\n refs = signature.find('.//ds:Reference', DS).map{ |r| r['URI'][1..-1] }\n\n without_signature = LibXML::XML::Document.document(signature.doc)\n without_signature.find_first('//ds:Signature', DS).remove!\n # The XML digested must be canonicalized as per the W3's specification\n # at http://www.w3.org/TR/xml-c14n\n c14n = without_signature.canonicalize\n digest = Base64.encode64(Digest::SHA1.digest(c14n)).chomp\n\n refs.all? do |ref|\n hashed_element = @doc.find_first(\"//*[ID='#{ref}']\")\n digest_listed = signature.find_first('.//ds:DigestValue', DS).content\n\n digest == digest_listed\n end\n end", "title": "" }, { "docid": "6bcbe837698a65281a00aabaeb1ce03b", "score": "0.6007629", "text": "def test_not_signed\n mail = Notifier.fufu(\"<destination@foobar.com>\", \"<demo@foobar.com>\")\n\n found = false\n for part in mail.parts do\n puts part.content_type\n if part.content_type =~ /application\\/x-pkcs7-signature/\n found = true\n break\n end\n end\n assert_equal found, false\n end", "title": "" }, { "docid": "0f6d1b7c8400a40ba76e626b76b34b40", "score": "0.5993841", "text": "def secure?\n self.generated_signature == self.signature\n end", "title": "" }, { "docid": "44c8893aef391e7ea950b203a8eb17d0", "score": "0.59895", "text": "def verify(payload, header, tolerance: nil)\n begin\n timestamp, signatures = get_timestamp_and_signatures(header)\n rescue StandardError\n raise InvalidSignature, \"Unable to extract timestamp and signatures from header\"\n end\n\n if signatures.empty?\n raise InvalidSignature, \"No signatures found with expected version #{@version}\"\n end\n\n expected_sig = generate(payload, timestamp)\n unless signatures.any? { |s| secure_compare(expected_sig, s) }\n raise InvalidSignature, \"No signatures found matching the expected signature for payload\"\n end\n\n if tolerance && timestamp < Time.now - tolerance\n raise InvalidSignature, \"Timestamp outside the tolerance zone (#{Time.at(timestamp)})\"\n end\n\n true\n end", "title": "" }, { "docid": "7cafa2bd645d67f8d2e5665f6dff46bf", "score": "0.59871143", "text": "def verified? key\n Nelumba::Crypto.emsa_verify(@plaintext, @signature, key)\n end", "title": "" }, { "docid": "f301c5905365d4c7a5a43d3dbaaa4cb8", "score": "0.598665", "text": "def verify_iss; end", "title": "" }, { "docid": "f301c5905365d4c7a5a43d3dbaaa4cb8", "score": "0.598665", "text": "def verify_iss; end", "title": "" }, { "docid": "a8afd824182eb4bfbe0b95fc022c54e6", "score": "0.5986291", "text": "def check_signature(body)\n received_signature = request.env['HTTP_X_HUB_SIGNATURE'] || ''\n signature = 'sha1=' + hmac_sha1(settings.github_secret, body)\n\n if !Rack::Utils.secure_compare(signature, received_signature)\n build_failed('signature mismatch')\n end\nend", "title": "" }, { "docid": "19b962b39afe3463978b90cea4b5d9a4", "score": "0.5983335", "text": "def validate(url, params, signature)\r\n params_hash = params.to_unsafe_h\r\n expected = build_signature_for(url, params_hash)\r\n ActiveSupport::SecurityUtils.secure_compare(expected, signature)\r\n end", "title": "" }, { "docid": "a8fa429224602c963494d5f6450bf4e3", "score": "0.5970359", "text": "def validate_signature!(signature, data)\n raise InvalidSignature unless valid_signature?(signature, data)\n end", "title": "" }, { "docid": "1296eead8ccab93d31cc49c961ea7187", "score": "0.5957034", "text": "def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end", "title": "" }, { "docid": "1296eead8ccab93d31cc49c961ea7187", "score": "0.5957034", "text": "def fetch_signature(params)\n sig = params.fetch(\"sig\", nil) || params.fetch(\"s\", nil)\n sig && sig.first\n end", "title": "" }, { "docid": "9988758ff46fa778cd7692d7193094e1", "score": "0.59522283", "text": "def verify_hmac(sid)\n return unless sid\n digest, ver_sid = sid.split(\"--\")\n return false unless ver_sid\n digest == generate_hmac(ver_sid, @config.secret_key)\n end", "title": "" }, { "docid": "8f942e83857cadc6b58fc55a9da23eda", "score": "0.59455305", "text": "def verify(key)\n plaintext = plaintext_sig(body, type, encoding, alg)\n key.public_key.verify(digest, sig, plaintext)\n rescue BadError\n false\n end", "title": "" }, { "docid": "58e5a25f6594e70d7b5fe8a6972148d4", "score": "0.59192336", "text": "def is_signature_valid?\n @params['ps'] == generate_preview_signature\n end", "title": "" }, { "docid": "cf7874cebbb3afd4d8b52ed23c7a1104", "score": "0.59121555", "text": "def verify_signature\n begin\n signature = OAuth::Signature.build(request) do |token, consumer_key|\n self.current_application = find_application_by_key(consumer_key)\n self.current_token = find_token(token)\n\n token_secret = self.current_token ? self.current_token.secret : nil\n app_secret = self.current_application ? self.current_application.secret : nil\n \n self.oauth_logger.debug \"Signature build: application-secret: #{app_secret}; token-secret: #{token_secret}\"\n \n [token_secret, app_secret]\n end\n # Rescue requests made with unacceptable signature methods. \n # OAuth::Signature.available_methods holds a Hash of acceptable\n # signature methods. Provide a sane error message to the Consumer.\n rescue OAuth::Signature::UnknownSignatureMethod => e\n throw :halt, render(\"Unknown Signature Method: #{e.message}. Accepts: #{OAuth::Signature.available_methods.keys.join(', ')}\", :status => 401, :layout => false)\n end\n \n if signature.verify\n remember_request(signature)\n else\n self.oauth_logger.debug(\"Signature verify fail: Base: #{signature.signature_base_string}. Signature: #{signature.signature}\")\n \n throw :halt, render(\"Invalid OAuth Request. Signature could not be verified. Base: #{signature.signature_base_string}. Signature: #{signature.signature}\", :status => 401, :layout => false)\n end\n end", "title": "" }, { "docid": "74a25bf1806cc045483973d26df06cba", "score": "0.5898777", "text": "def check_for_verify_plugin_signatures_option(hash); end", "title": "" }, { "docid": "c24ffe0a6098a52481f0501c67ab63ff", "score": "0.58937156", "text": "def signature_valid?\n hmac.validate_url_signature(request.url, secret)\n end", "title": "" }, { "docid": "00c3c7ee56f1283e92253b0a736d883c", "score": "0.58902633", "text": "def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signature_parts = request_signature.split('sha1=')\n request_signature = signature_parts[1]\n calculated_signature = OpenSSL::HMAC.hexdigest('sha1', @secret, body)\n calculated_signature == request_signature\n end", "title": "" }, { "docid": "7e70d0953a35b6790a84190ed9f841c9", "score": "0.58821714", "text": "def signature?\n SIGNATURES.include?(@simplified.downcase)\n end", "title": "" }, { "docid": "eca665c2570a998eb02e831787a96997", "score": "0.58746636", "text": "def verify_callback(_, cert)\n pem = cert.current_cert.public_key.to_pem\n sha256 = OpenSSL::Digest::SHA256.new\n hash = sha256.digest(pem).unpack(\"H*\")\n\n hash[0].casecmp(@hash).zero?\n end", "title": "" }, { "docid": "e41bd5411102a313a4b81b8e2dc57680", "score": "0.58632714", "text": "def recover_priv(msg1, msg2, sig1_b64, sig2_b64)\r\n #WIP!\r\n public_key = recoverpub_b64(msg1, sig1_b64)\r\n public_key2 = recoverpub_b64(msg2, sig2_b64)\r\n\r\n msghash1 = Base64.decode64(msg1)\r\n msghash2 = Base64.decode64(msg2)\r\n sig1 = ECDSA::Format::SignatureDerString.decode(Base64.decode64(sig1_b64))\r\n sig2 = ECDSA::Format::SignatureDerString.decode(Base64.decode64(sig2_b64))\r\n\r\n puts 'public key x: %#x' % public_key.x\r\n puts 'public key y: %#x' % public_key.y\r\n\r\n raise 'R values are not the same' if sig1.r != sig2.r\r\n \r\n r1 = sig1.r\r\n r2 = sig2.r\r\n \r\n r = sig1.r\r\n #puts 'sig1 r: '+r1.to_s()\r\n #puts 'sig2 r: '+r2.to_s()\r\n #puts 'sig1 s: '+sig1.s.to_s()\r\n #puts 'sig2 s: '+sig2.s.to_s()\r\n puts 'r = %#x' % r1\r\n puts 's1 = %#x' % sig1.s\r\n puts 's2 = %#x' % sig2.s\r\n \r\n # Step 1: k = (z1 - z2)/(s1 - s2)\r\n field = ECDSA::PrimeField.new($group.order)\r\n z1 = ECDSA::Format::IntegerOctetString.decode(msghash1)\r\n puts 'z1 = %#x' % z1\r\n puts(Base64.strict_encode64(msghash1))\r\n z2 = ECDSA::Format::IntegerOctetString.decode(msghash2)\r\n puts 'z2 = %#x' % z2\r\n puts(Base64.strict_encode64(msghash2))\r\n k_candidates = [\r\n field.mod((z1 - z2) * field.inverse(sig1.s - sig2.s)),\r\n field.mod((z1 - z2) * field.inverse(sig1.s + sig2.s)),\r\n field.mod((z1 - z2) * field.inverse(-sig1.s - sig2.s)),\r\n field.mod((z1 - z2) * field.inverse(-sig1.s + sig2.s)),\r\n ]\r\n \r\n private_key = nil\r\n k_candidates.each do |k|\r\n next unless $group.new_point(k).x == r\r\n private_key_maybe = field.mod(field.mod(sig1.s * k - z1) * field.inverse(r))\r\n if public_key == $group.new_point(private_key_maybe)\r\n private_key = private_key_maybe\r\n end\r\n end\r\n print(\"Privatekey:\")\r\n puts (private_key)\r\n puts 'Private Key: %#x' % private_key\r\n puts\r\n end", "title": "" }, { "docid": "e1659c5ec731c45622f0f471831e86b9", "score": "0.58625716", "text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['WEBHOOK_SECRET_TOKEN'], payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend", "title": "" } ]
506b38d77d19dd775014f555e8fb1249
GET /razas/new GET /razas/new.xml
[ { "docid": "e4133b06cc05305fc781c2cf1d7e8aa3", "score": "0.0", "text": "def new\n @raza = Raza.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" } ]
[ { "docid": "2ebebea6740cc061a1f955e86667c2f9", "score": "0.76684046", "text": "def new\n @revista = Revista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revista }\n end\n end", "title": "" }, { "docid": "dd438f93f734b054d088dffbc32ba19e", "score": "0.74528205", "text": "def new\n @era = Era.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @era }\n end\n end", "title": "" }, { "docid": "b2afd38a6b76c6874ad0f3da475b1a4d", "score": "0.74344426", "text": "def new\n @receta = Receta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receta }\n end\n end", "title": "" }, { "docid": "20260395ed78ac63dc7c8411d6637778", "score": "0.73807544", "text": "def new\n @tipos = Tipo.all\n @raca = Raca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raca }\n end\n end", "title": "" }, { "docid": "bc8d2e25721a210d56d3e2f1e77c5896", "score": "0.7313462", "text": "def new\n @historia = Historia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historia }\n end\n end", "title": "" }, { "docid": "73335341f9269b7dfd59853fc5b5a5b0", "score": "0.72982734", "text": "def new\n @reserva = Reserva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reserva }\n end\n end", "title": "" }, { "docid": "81152aa36a88830f2b0f60c0dc7bbd65", "score": "0.7290051", "text": "def new\n @raga = Raga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raga }\n end\n end", "title": "" }, { "docid": "41650db805ea0751d4314f77d3199296", "score": "0.7284514", "text": "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "title": "" }, { "docid": "41650db805ea0751d4314f77d3199296", "score": "0.7284514", "text": "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "title": "" }, { "docid": "701b5c3210563f2d5ecf68a256dd8d3e", "score": "0.72800857", "text": "def new\n @servico = Servico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @servico }\n end\n end", "title": "" }, { "docid": "0550152e8c9656f2977413dcd6c1236c", "score": "0.7278898", "text": "def new\n @roteiro = Roteiro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @roteiro }\n end\n end", "title": "" }, { "docid": "7f32e452f0aeea9d06f50b24aaf4c03b", "score": "0.7257347", "text": "def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @livro }\n end\n end", "title": "" }, { "docid": "a8fabf617b3c56fd3c46d537358befc8", "score": "0.7256511", "text": "def new\n @obrasproyecto = Obrasproyecto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @obrasproyecto }\n end\n end", "title": "" }, { "docid": "e5fe7f0c4c8d23d95af63a2816ec2476", "score": "0.72541684", "text": "def new\n @ata = Ata.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ata }\n end\n end", "title": "" }, { "docid": "fcc9a65abd0fc31db1a1b160a44871fc", "score": "0.72535855", "text": "def new\n @asiento = Asiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asiento }\n end\n end", "title": "" }, { "docid": "a60d8ad4fc2aa169dd3617312d7c0f6a", "score": "0.7244974", "text": "def new\n @bolsista = Bolsista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bolsista }\n end\n end", "title": "" }, { "docid": "5faddf05c376a3081810308a9be738e2", "score": "0.72354937", "text": "def new\n @aetapa = Aetapa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aetapa }\n end\n end", "title": "" }, { "docid": "63103473671d5520305a00d82b1b309f", "score": "0.7222526", "text": "def new\n @escola = Escola.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @escola }\n end\n end", "title": "" }, { "docid": "4eb61bde64f146566746c1cc0f3363d6", "score": "0.72156554", "text": "def new\n @notaria = Notaria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notaria }\n end\n end", "title": "" }, { "docid": "09659b5e0a0b570d5c8019b81ae00efa", "score": "0.7212655", "text": "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "title": "" }, { "docid": "eb119fa510a74fb8ca6e16c5b8bb57dc", "score": "0.72116154", "text": "def new\n @vaga = Vaga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "title": "" }, { "docid": "eb119fa510a74fb8ca6e16c5b8bb57dc", "score": "0.72116154", "text": "def new\n @vaga = Vaga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "title": "" }, { "docid": "4c1ebbaf071800019ec1edffa1d50b33", "score": "0.7203373", "text": "def new\n @aluno = Aluno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aluno }\n end\n end", "title": "" }, { "docid": "8b0daaa30a15afe32df8eca14177d309", "score": "0.7202468", "text": "def new\n @naciona = Naciona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @naciona }\n end\n end", "title": "" }, { "docid": "2cde3c7ff6b8e5f3523a148049afb39f", "score": "0.7190097", "text": "def new\n @resenha = Resenha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resenha }\n end\n end", "title": "" }, { "docid": "9ff6d7538257efb0d510593d5faf821c", "score": "0.7189531", "text": "def new\n @ruolo = Ruolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ruolo }\n end\n end", "title": "" }, { "docid": "cd20dcc528cb15f83bbf2c8218318404", "score": "0.7187532", "text": "def new\n @vaga_crianca = VagaCrianca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vaga_crianca }\n end\n end", "title": "" }, { "docid": "b1d3eefad6358929666f31e67b589a96", "score": "0.7186179", "text": "def new\n @topogra = Topogra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topogra }\n end\n end", "title": "" }, { "docid": "256ea301b1e8ff8426b8e27c4c412298", "score": "0.7181186", "text": "def new\n @carrera = Carrera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @carrera }\n end\n end", "title": "" }, { "docid": "dfaddde1a482eec0a1cb1e211f78b18a", "score": "0.71756387", "text": "def new\n @prioridad = Prioridad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prioridad }\n end\n end", "title": "" }, { "docid": "b71b24eb611303022916fac2c83212e7", "score": "0.7169093", "text": "def new\n @zakaz = Zakaz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @zakaz }\n end\n end", "title": "" }, { "docid": "c6948fbb865ae330b76380416f7b238f", "score": "0.7168135", "text": "def new\n @appunto_riga = AppuntoRiga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appunto_riga }\n end\n end", "title": "" }, { "docid": "0734f6823fefa0ee899a1ae92c8998f5", "score": "0.71646243", "text": "def new\n @tconexion = Tconexion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tconexion }\n end\n end", "title": "" }, { "docid": "427eb113bf981a0a6e4ba5f422e18713", "score": "0.7163327", "text": "def new\n @notka = Notka.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notka }\n end\n end", "title": "" }, { "docid": "52a6f7f1f0967944abd60eefebb4fd6f", "score": "0.7156163", "text": "def new\n @bairro = Bairro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bairro }\n end\n end", "title": "" }, { "docid": "b4a8af7a2869712e8b42f88dd154241d", "score": "0.7155567", "text": "def new\n @rubro = Rubro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rubro }\n end\n end", "title": "" }, { "docid": "e7fe247cd77e7f3826c46958a31eb53e", "score": "0.71523327", "text": "def novo\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @turma }\n end\n end", "title": "" }, { "docid": "5c12e41ed8791dcb20125f9046e62363", "score": "0.7150109", "text": "def new\n @registro = Registro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registro }\n end\n end", "title": "" }, { "docid": "0c9cd1c18424889757fd4bbf03506191", "score": "0.7149069", "text": "def new\n @legajo = Legajo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @legajo }\n end\n end", "title": "" }, { "docid": "ce463ed159de381069bdc9f6edbbd946", "score": "0.71387947", "text": "def new\n @nome = Nome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nome }\n end\n end", "title": "" }, { "docid": "144fdc61f3f1eb6a3efa50bcf93f1daf", "score": "0.713702", "text": "def new\n @ausencia = Ausencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ausencia }\n end\n end", "title": "" }, { "docid": "dc5353d150cf106f0105b445482fe465", "score": "0.7133535", "text": "def new\n @lcotiza = Lcotiza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lcotiza }\n end\n end", "title": "" }, { "docid": "01193c45bedf34d781e3976475f80e6d", "score": "0.7124636", "text": "def new\n @estagiario = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiario }\n end\n end", "title": "" }, { "docid": "6181e4904cdbd41cca0aa9e1a2f233ce", "score": "0.7123667", "text": "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "title": "" }, { "docid": "98b45775841fa3dafa1eecb36642458e", "score": "0.71200246", "text": "def new\n @porra = Porra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @porra }\n end\n end", "title": "" }, { "docid": "1e748ec0da783fda673cebee51de7f95", "score": "0.71167934", "text": "def new\n @placa = Placa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @placa }\n end\n end", "title": "" }, { "docid": "7f6602e3bba5316c79ed8d046de804ec", "score": "0.7111239", "text": "def new\n @comentario = Comentario.new\n respond_to do |format| \n format.xml { render xml: @comentario }\n end\n end", "title": "" }, { "docid": "3298210dd6c0435d77e5dc4395e0685c", "score": "0.711017", "text": "def new\n @generomidia = Generomidia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @generomidia }\n end\n end", "title": "" }, { "docid": "5c0d35f120a60348c8433c90ae266baf", "score": "0.7106314", "text": "def new\n @trabajo = Trabajo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trabajo }\n end\n end", "title": "" }, { "docid": "e59ec9e9f87c111b31115ba1e9e2e7a2", "score": "0.710612", "text": "def new\n @nada = Nada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nada }\n end\n end", "title": "" }, { "docid": "6290211819de3f0f66090bc7b0faa32f", "score": "0.7105965", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asesoria }\n end\n end", "title": "" }, { "docid": "a6901c694bbb6e9dad5dbe9451f388c6", "score": "0.70997447", "text": "def novo\n @aluno = Aluno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aluno }\n end\n end", "title": "" }, { "docid": "5c071f2d26c7abd049e355aa44f969f6", "score": "0.70992076", "text": "def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @respuesta }\n end\n end", "title": "" }, { "docid": "6db7f4a70df70f23bba4e6e2210a4c65", "score": "0.70928496", "text": "def new\n @transportista = Transportista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transportista }\n end\n end", "title": "" }, { "docid": "6e014d37b973d9e95c17cf3d951c9d0d", "score": "0.70924073", "text": "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "title": "" }, { "docid": "6e014d37b973d9e95c17cf3d951c9d0d", "score": "0.70924073", "text": "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "title": "" }, { "docid": "7cc47459ddd11f164112dfef52c36515", "score": "0.7092287", "text": "def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @livro }\n end\n end", "title": "" }, { "docid": "fa6be069d5014bf1fe4582c0b1cf7387", "score": "0.7089408", "text": "def new\n @transferencia = Transferencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transferencia }\n end\n end", "title": "" }, { "docid": "79c766a084106c29dbfa85b40cdc77c5", "score": "0.7086805", "text": "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "title": "" }, { "docid": "701d3722642b910790f85c5606a3eba2", "score": "0.70838726", "text": "def new\n @reltramovano = Reltramovano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reltramovano }\n end\n end", "title": "" }, { "docid": "cd5b80abaa0af95086236d2daf9bfea7", "score": "0.7082986", "text": "def new\n @entrega = Entrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrega }\n end\n end", "title": "" }, { "docid": "e1e645f774343086f9448bfcfebee75b", "score": "0.70793414", "text": "def new\n @archivo = Archivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @archivo }\n end\n end", "title": "" }, { "docid": "8b3e0819d32195d413827ad547663eba", "score": "0.70740366", "text": "def new\n @spiga = Spiga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiga }\n end\n end", "title": "" }, { "docid": "daab9f354143c0c39208a567f5fd19fe", "score": "0.7072588", "text": "def new\n @premisa = Premisa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @premisa }\n end\n end", "title": "" }, { "docid": "d3536ed4e0dbbf3e71d0f4b7cd0f5814", "score": "0.7064883", "text": "def new\n @saidas = Saida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saidas }\n end\n end", "title": "" }, { "docid": "580f3acf432f845fe7ab2959dade816d", "score": "0.7064588", "text": "def new\n @weekly_rota = WeeklyRota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weekly_rota }\n end\n end", "title": "" }, { "docid": "e5e4770d9d9768b09e6d373e590b22e6", "score": "0.7060233", "text": "def new\n @naic = Naic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @naic }\n end\n end", "title": "" }, { "docid": "36d38baedca8944ed55b9979f29a5cda", "score": "0.70599276", "text": "def new\n @tipo_osexterna = TipoOsexterna.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_osexterna }\n end\n end", "title": "" }, { "docid": "359bb93db38a09e1df0036535af889a7", "score": "0.70595556", "text": "def new\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @turma }\n end\n end", "title": "" }, { "docid": "cb03d0216f464675629e0c39a71284d9", "score": "0.7059372", "text": "def new\n @anketa = Anketa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @anketa }\n end\n end", "title": "" }, { "docid": "405b3aa117ccabd4bafe376e8202ae1f", "score": "0.7057087", "text": "def new\n @destaque = Destaque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @destaque }\n end\n end", "title": "" }, { "docid": "a32956928f961632506764184a58a306", "score": "0.7056206", "text": "def new\n @tlectura = Tlectura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tlectura }\n end\n end", "title": "" }, { "docid": "dc8ad0097ccdb54bb39fa8494629ff16", "score": "0.7055817", "text": "def new\n @rt = Rt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rt }\n end\n end", "title": "" }, { "docid": "6329fa44073651f9d84c7dfb828af897", "score": "0.7051209", "text": "def new\n @carona = Carona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @carona }\n end\n end", "title": "" }, { "docid": "8ffd837e3cfc8131952ec866935d91aa", "score": "0.7049895", "text": "def new\n @solicitante = Solicitante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitante }\n end\n end", "title": "" }, { "docid": "c398295cde2752a838d41d91ea0f3863", "score": "0.70457095", "text": "def new\n @especialista = Especialista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especialista }\n end\n end", "title": "" }, { "docid": "d1a3306d541151406a8a9ff9abff8300", "score": "0.70449924", "text": "def new\n load_data\n @admin_obra = Admin::Obra.new\n @page_title = 'Nueva Obra'\n @action = 'Crear Obra'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @admin_obra }\n end\n end", "title": "" }, { "docid": "55d640b9204aaa8b7ef501c6a85391a5", "score": "0.7043259", "text": "def new\r\n @lancamento = Lancamento.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lancamento }\r\n end\r\n end", "title": "" }, { "docid": "f2e02562f05351c8d1f1b6f0af6538b0", "score": "0.70417535", "text": "def new\n @pagocompra = Pagocompra.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagocompra }\n end\n end", "title": "" }, { "docid": "2a238180fe8dff34313e589d4979222b", "score": "0.7041662", "text": "def new\n @pagina = Pagina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagina }\n end\n end", "title": "" }, { "docid": "c2ede1db0251daf39cad5940e27955a7", "score": "0.70397", "text": "def new\n @contratista = Contratista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contratista }\n end\n end", "title": "" }, { "docid": "b5d61e99736035bc631cb8267e3b3581", "score": "0.7039276", "text": "def new\n @societe = Societe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @societe }\n end\n end", "title": "" }, { "docid": "807fdb312a5efde3bccda04504faf72c", "score": "0.7033136", "text": "def new\n @enquete = Enquete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @enquete }\n end\n end", "title": "" }, { "docid": "09c14897eabaf519e4299b158e379e60", "score": "0.7025374", "text": "def new\n @prova = Prova.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prova }\n end\n end", "title": "" }, { "docid": "4273130498cfdc1fb4be661e81c2ff0c", "score": "0.70247144", "text": "def new\n @scrap_xml = ScrapXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "title": "" }, { "docid": "cf2e483a3d66271b69626a73d0a7a0a6", "score": "0.70246494", "text": "def new\n @acceso = Acceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acceso }\n end\n end", "title": "" }, { "docid": "86fcfdf9f4074ff969972da640c6f27e", "score": "0.70220214", "text": "def new\n @genero = Genero.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @genero }\n end\n end", "title": "" }, { "docid": "38b73a16120f9792f113e0331449f987", "score": "0.7020236", "text": "def new\n @orc_reserva = OrcReserva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_reserva }\n end\n end", "title": "" }, { "docid": "91103870e312ff18e208ac8deeb3bac7", "score": "0.7019552", "text": "def new\n @raichand = Raichand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raichand }\n end\n end", "title": "" }, { "docid": "1500ccb71ca5036ea9862ec08eb66b1d", "score": "0.70163316", "text": "def new\n @rest_test = RestTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rest_test }\n end\n end", "title": "" }, { "docid": "6c1239123b69702de920ef4c6d4df325", "score": "0.7015606", "text": "def new\n @avaliacao = Avaliacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @avaliacao }\n end\n end", "title": "" }, { "docid": "fa50a6ea1e19a5b29bb64801a1335cab", "score": "0.7013077", "text": "def new\n @instancia = Instancia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia }\n end\n end", "title": "" }, { "docid": "94ceaaf9250cdc3d062aeb18bbab1a52", "score": "0.7012595", "text": "def new\n @newstuff = Newstuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newstuff }\n end\n end", "title": "" }, { "docid": "ee0589c67abd56d0504bb4d7bb6a00df", "score": "0.70111763", "text": "def new\n @pessoa = Pessoa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "title": "" }, { "docid": "f02cd0b080fff5fee9aed8dbeb0243db", "score": "0.7009738", "text": "def new\n @canva = Canva.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @canva }\n end\n end", "title": "" }, { "docid": "f820d3db32efc19fa3f0f149ef171b1e", "score": "0.70088476", "text": "def new\n @apto = Apto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apto }\n end\n end", "title": "" }, { "docid": "6468533c2e42c97ae0a61163e1c0d9b1", "score": "0.7002535", "text": "def new\n @tipos = Tipo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipos }\n end\n end", "title": "" }, { "docid": "8de19ca86fa68451f2d2a529e23978be", "score": "0.7002355", "text": "def new\n @empresa = Empresa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empresa }\n end\n end", "title": "" }, { "docid": "a3147e096b98c39298ffa78eaf7cc46f", "score": "0.69976854", "text": "def new\n @tah = Tah.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tah }\n end\n end", "title": "" }, { "docid": "c8e2607e9763289932ae2d28aad9837c", "score": "0.69939834", "text": "def new\n @prueba = Prueba.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prueba }\n end\n end", "title": "" }, { "docid": "f6e731c3f58737a772b558c35e8ebd83", "score": "0.69904923", "text": "def new\n @generacion = Generacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @generacion }\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3972b78ceebf7718d951985dd4a39f17", "score": "0.0", "text": "def weather_test_params\n params.require(:weather_test).permit(:date_a)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67419964", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.674013", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6734356", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6591046", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6502396", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6496313", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6480641", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64565", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6438387", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63791263", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.63740575", "text": "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", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.6364131", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.63192815", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.62991166", "text": "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", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62978333", "text": "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", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6292148", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6290449", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6290076", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62894756", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283177", "text": "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", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6242471", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62382483", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217549", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214457", "text": "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", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.6209053", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6193042", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6177802", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.6174604", "text": "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", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61714715", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6161512", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151757", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6150663", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61461", "text": "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", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61213595", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6106206", "text": "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", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6105114", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6089039", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081015", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071004", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6019971", "text": "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", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.601788", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6011056", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6010898", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6001556", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6001049", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59943926", "text": "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", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992201", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59909594", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5990628", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980841", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59669393", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59589154", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.5958826", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5957911", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957385", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5953072", "text": "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", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.59526145", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5943361", "text": "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", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59386164", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933856", "text": "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", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.59292704", "text": "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", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.59254247", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5924164", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59167904", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59088355", "text": "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", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5907542", "text": "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", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.59064597", "text": "def url_whitelist; end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.5906243", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5898226", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589687", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5896091", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5894501", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5894289", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5891739", "text": "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", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.58860534", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.5882406", "text": "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", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.587974", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58738774", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5869024", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58679986", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.5867561", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865932", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5864461", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58639693", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.58617616", "text": "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", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5861436", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5860451", "text": "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", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58602303", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854586", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.58537364", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5850427", "text": "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", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.5850199", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
6741eb8f79ec6a9ccb02dadc0fa09765
compares each reservation to date range in question and returns an array of rooms available for the given period.
[ { "docid": "5051d7bcd8a0182d44bdfc464c644f11", "score": "0.7745492", "text": "def availability_by_date_range(check_in, check_out)\n occupied_rooms = []\n range = (check_in...check_out)#.to_a\n @reservation_list.each do |reservation|\n if (range.include? reservation.check_in) || (range.include? reservation.check_out - 1)\n occupied_rooms << reservation.assigned_room\n end\n end\n\n available_rooms = []\n ROOMS.each do |room|\n if !(occupied_rooms.include? room)\n available_rooms << room\n end\n end\n return available_rooms\n end", "title": "" } ]
[ { "docid": "660892a9764b959257cf44e4f0db62ac", "score": "0.8139814", "text": "def available_rooms(date_range)\n available_rooms = Array.new(21, true) # Setting all rooms to available\n @list_of_reservations.each do |r|\n if (r.does_reservation_overlap?(date_range)) # if date_ranges intersects\n available_rooms[r.room_number] = false # the room at that index becomes unavailable\n end\n end\n # returns an array of true (available) rooms\n result = []\n available_rooms.each_with_index do | is_available, room_number|\n if room_number != 0 && is_available && !reserved_by_any_block?(date_range, room_number)\n result << room_number\n end\n end\n return result\n end", "title": "" }, { "docid": "9c3ea85aaeaa40250c198c0e9c27a213", "score": "0.8100274", "text": "def reservations_for_room(date_range, room)\n result = []\n reservations.each do |reservation|\n if reservation.date_range.overlap?(date_range) && room.room_nr == reservation.room.room_nr\n result << reservation\n end\n end\n return result\n end", "title": "" }, { "docid": "9f441e34575ddc39f4a1a2b382089372", "score": "0.80493224", "text": "def find_rooms_available(start_date, end_date)\n\n rooms_available = []\n\n reserv_range = DateRange.new(start_date, end_date)\n x = reserv_range.get_date_range\n\n @rooms.each do |room|\n if room.room_reservations.empty?\n rooms_available << room\n elsif room.room_reservations.each do |reservation|\n if reservation.date_range.check_overlap?(x) == false\n rooms_available << room\n end\n end\n end\n end\n return rooms_available\n end", "title": "" }, { "docid": "a73c4cf5ebee2f28242d69933d092407", "score": "0.80153286", "text": "def check_availability(start_date, end_date)\n desired_dates = DateRange.new(start_date, end_date).reservation_range\n \n rooms = []\n rooms_and_reservations.each do |room, calendar|\n room_num = room if room_available?(calendar, desired_dates) \n rooms << room_num \n end\n return rooms.compact\n end", "title": "" }, { "docid": "c15a96061343b53888db4228220fb024", "score": "0.79696643", "text": "def find_available_rooms(start_date, end_date)\n found_rooms = @rooms.clone\n @reservations.each do |reservation|\n if (start_date >= reservation.start_date && end_date < reservation.end_date) ||\n (start_date < reservation.start_date && end_date < reservation.end_date) ||\n (start_date < reservation.end_date && end_date > reservation.end_date)\n found_rooms.reject! do |room|\n room.room_num == reservation.room.room_num\n end\n end\n end\n return found_rooms\n end", "title": "" }, { "docid": "c02b66908c3198c3cbe8c17dfb6e7c8f", "score": "0.7929805", "text": "def get_available_rooms(start_year, start_month, start_day, end_year, end_month, end_day)\n #initialize available_rooms\n available_rooms = @room_numbers.dup\n blocked_rooms = []\n\n # make start_date and end_date objects\n start_date = Date.new(start_year, start_month, start_day)\n end_date = Date.new(end_year, end_month, end_day)\n\n #create keys for hash\n date_key = start_date\n\n # loops through dates\n while date_key < end_date\n\n # loop through room numbers\n available_rooms.each do |room|\n #remove reserved rooms from available rooms array\n if @date_reservation_hash[date_key] == nil\n available_rooms = available_rooms\n elsif @date_reservation_hash[date_key].include?(room)\n available_rooms.delete(room)\n end\n\n #put blocked rooms in an array\n if @date_block_hash[date_key] == nil\n blocked_rooms = blocked_rooms\n elsif @date_block_hash[date_key].include?(room) == true && blocked_rooms.include?(room) == false\n blocked_rooms << room\n end\n end\n\n date_key += 1\n end\n\n return [available_rooms, blocked_rooms]\n end", "title": "" }, { "docid": "db32db79ae5b86e9fe9ca5eab1bb4a68", "score": "0.78748316", "text": "def get_available_rooms(start_date,end_date)\n\n rooms_available_range = []\n\n rooms_available_range = @list_of_rooms\n (start_date...end_date).each do |date|\n @all_reservations.each do |res|\n list =[]\n if res.start_date <= date && res.end_date > date\n list << res.room_number\n end\n rooms_available_range = rooms_available_range - list\n end\n end\n return rooms_available_range\n end", "title": "" }, { "docid": "a4496106b3bbd2b784c4df4549046633", "score": "0.7851825", "text": "def find_room_available(start_date, end_date)\n\n check_input_dates(start_date, end_date)\n dates_available_rooms = []\n\n @rooms.each do |room|\n dates_needed = []\n start_d = start_date\n\n while start_d < end_date\n dates_needed << {room_n: room, unbooked_date: start_d}\n start_d += 1\n end\n\n if (@room_unbooked_dates & dates_needed) == dates_needed\n dates_available_rooms << room\n end\n end\n return dates_available_rooms\n end", "title": "" }, { "docid": "3c8141f39dca052fe6df8c251637bcf7", "score": "0.7849588", "text": "def list_reservations_for_room(room, start_date, end_date)\n list = [] # returns an array of reservations that falls within the date range\n @reservations.each do |reservation|\n if room == reservation.room_number\n if reservation.date_range.overlap?(start_date, end_date)\n list << reservation\n end\n end\n end\n return list\n end", "title": "" }, { "docid": "831704b8ed4a3f1337745045168e5f57", "score": "0.7847046", "text": "def room_available(date_range)\n rooms_not_available_res = @reservations.select{|bookings|bookings.date_range.overlap(date_range)}\n rooms_num_not_available = rooms_not_available_res.map{|bookings|bookings.room_num}\n available_rooms = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] - rooms_num_not_available\n return available_rooms.sort!\n end", "title": "" }, { "docid": "d7b3dc39cb3d7c3da4de71048fbb2795", "score": "0.78456944", "text": "def booked_rooms\n booked_rooms = []\n unless @@reservations.nil?\n @@reservations.each do |reservation|\n if !(@start_date < reservation.start_date && @end_date <= reservation.start_date || @start_date >= reservation.end_date)\n booked_rooms << reservation.room\n # binding.pry\n end\n end\n end\n # binding.pry\n return booked_rooms\n end", "title": "" }, { "docid": "05617f2c6b831d42e6476da312977a89", "score": "0.7819727", "text": "def reservations_by_date(year, month, day)\n requested_date = Date.new(year, month, day)\n reservations_by_date = []\n @rooms.each do |room| \n if valid_date_res = room.reservations.find {|res|res.date_range.range.include?(requested_date)}\n reservations_by_date << valid_date_res\n end \n end \n return reservations_by_date\n end", "title": "" }, { "docid": "143927d636e4569ed9f865229f940dcd", "score": "0.7817228", "text": "def show_available_rooms(start_date, end_date)\n starting_date = format_date(start_date)\n ending_date = format_date(end_date)\n\n if is_date_range_valid(starting_date, ending_date)\n available_rooms = []\n\n date_to_check = starting_date\n @all_rooms.each do |room|\n room_status = []\n\n # This loop will examine each room instance's @dates_booked collection (using Room.is_available?) and check if it is booked for each date that is being iterated through (using date_to_check += 1). If the room is NOT booked for the specified date then 'true' is pushed into room_status. If the room IS booked then 'false' is pushed into room_status.\n until date_to_check == ending_date\n check = room.is_available?(date_to_check)\n if check\n room_status << true\n else\n room_status << false\n end\n date_to_check += 1\n end\n\n # If the specific room instance is NOT booked (available) for all of the dates checked, then the room is pushed into available_rooms.\n if room_status.all?\n available_rooms << room\n end\n end\n # returning room instances NOT room numbers\n return available_rooms\n end\n end", "title": "" }, { "docid": "d137e8e9135c02b73d1f6d2215236e68", "score": "0.7740244", "text": "def check_availability(start_date, end_date)\n available_rooms = []\n NUM_OF_ROOMS.times do |num|\n available_rooms << num + 1\n end\n\n\n # @rooms.each do |room|\n # if room.booked_dates.empty? #&& room.blocked_dates.empty?\n # available_rooms << room\n # elsif room.booked_dates.length > 0\n # room.booked_dates.each do |range|\n # if !(range.include? (end_date - 1)) || !(range.include? start_date)\n # available_rooms << room\n # end\n # end\n # end\n # end\n\n @reservations.each do |reservation|\n range = (reservation.start_date...reservation.end_date)\n num = reservation.room_num\n if (range.include? (end_date - 1)) || (range.include? (start_date))\n available_rooms.delete(num)\n end\n end\n\n if available_rooms.empty?\n raise ArgumentError.new(\"No available rooms for those dates.\")\n end\n\n return available_rooms\n end", "title": "" }, { "docid": "ff4ab7df28d88d95849b6d1e0b401176", "score": "0.76900136", "text": "def reservations_list_room_and_date(given_room, given_date_range)\n reservations_list_of_given_room_date_range = reservations.select do |res|\n res.date_range.overlap?(given_date_range) && res.room == given_room \n end\n return reservations_list_of_given_room_date_range\n end", "title": "" }, { "docid": "6f14b0eecbbddacf15f19624fb6daafb", "score": "0.76547337", "text": "def check_reserved(start_date, end_date)\n check_against = DateRange.new(start_date, end_date).nights_arr\n\n not_available_reservations = @all_reservations.any? do |booking|\n booking.date_range.overlap?(check_against)\n end\n\n not_available = []\n not_available_reservations.each do |booking|\n booking.rooms.each do |room|\n not_available << room\n end\n end\n return not_available\n end", "title": "" }, { "docid": "6293513651ea8e5be1126701183c3656", "score": "0.76391184", "text": "def reserve_available_rooms(start_date,end_date)\n\n rooms_reserved_date = []\n rooms_available_range = []\n # to store list of all rooms\n rooms_available_range = @list_of_rooms\n # to find the rooms that are reserved for a given date in the range\n (start_date...end_date).each do |date|\n # to check which room is reserved for \"date\"\n @all_reservations.each do |res|\n list =[]\n if res.start_date <= date && res.end_date > date\n # Storing the reserved rooms in the \"list\" array\n list << res.room_number\n end\n # remove the reserved rooms from all rooms\n rooms_available_range = rooms_available_range - list\n end\n end\n\n if rooms_available_range.empty?\n raise Exception.new(\"No rooms are available\")\n else\n\n availability = rooms_available_range[0]\n reservation = Hotel::Reservation.new(start_date,end_date,availability)\n @all_reservations << reservation\n return @all_reservations\n end\n\n end", "title": "" }, { "docid": "33252ee877ece937c7c93623b7c81ea2", "score": "0.76354575", "text": "def available_rooms(date_range:)\n available_rooms_list = []\n @rooms.each do |room_number| # loops through all 20 rooms to check availability\n if is_room_available(date_range: date_range, room_number: room_number) == true\n available_rooms_list << room_number # puts available rooms into available_rooms_list\n end\n end\n return available_rooms_list # see all rooms availablef or given date range\n end", "title": "" }, { "docid": "813b0fdf4ca6e586e9252c8a55a98c77", "score": "0.75754184", "text": "def check_reservations_in_date_range(start_date, end_date) \n date_range = Hotel::DateRange.new(start_date, end_date)\n lists = []\n @reservations.each_value do |reservations_of_each_room| \n reservations_of_each_room.each do |reservation|\n if reservation.date_range.overlap_include_last? date_range\n lists << reservation\n end\n end\n end\n return lists\n end", "title": "" }, { "docid": "d2ed9ff6e37bd96499068560068a6be5", "score": "0.7551219", "text": "def find_all_res_for_room(room_num, start_date, end_date)\n found_reservations = []\n @reservations.each do |reservation| \n next if reservation.room.room_num != room_num\n if ((start_date > reservation.start_date && start_date < reservation.end_date) ||\n (end_date > reservation.start_date && start_date < reservation.end_date)) || \n (reservation.start_date < start_date && reservation.end_date > end_date)\n found_reservations << reservation\n end\n end\n return found_reservations\n end", "title": "" }, { "docid": "027a3410934b3a8f446c8accac14adfc", "score": "0.75321", "text": "def reservations_by_room(start_date, end_date, room)\n range = Hotel::DateRange.new(start_date, end_date)\n return @reservations.select do |reservation| # which reservations have an overlap with range passed\n reservation.range.overlap?(range) && reservation.room == room\n end\n end", "title": "" }, { "docid": "bb1ffeaca43d1d3ca10ae5554fe917d8", "score": "0.74860823", "text": "def get_availbale_rooms(date)\n available_rooms = @rooms.find_all { |room| room.availability == true }\n # rooms_date_range = available_rooms.find_all { |room| (date >= room.reservation.duration.start_date && date <= room.reservation.duration.end_date) }\n return available_rooms\n end", "title": "" }, { "docid": "d86d63f52db5eb20c6c280fa8f258968", "score": "0.74786484", "text": "def available_rooms(requested_dates)\n occupied_rooms = []\n select_res = range_reservations(requested_dates)\n\n select_res.each do |reservation|\n occupied_rooms << reservation.room \n end \n\n empty_rooms = [] \n @rooms.each do |room|\n unless occupied_rooms.include?(room)\n empty_rooms << room\n end \n end \n empty_rooms = empty_rooms.uniq\n\n # User: I want an exception raised if I try to reserve a room during a date range when all rooms are reserved, so that I cannot make two reservations for the same room that overlap by date\n if empty_rooms.length > 0\n return empty_rooms\n else \n raise ArgumentError.new(\"Sorry, there are no rooms available. Please try other dates.\") \n end\n \n end", "title": "" }, { "docid": "0bdb9bc76d9428f625d1a8fa0ae42a09", "score": "0.74783283", "text": "def list_rooms_available(start_date,end_date)\n rooms.select {|room| room_available?(start_date, end_date, room) }\n end", "title": "" }, { "docid": "5dab0347a7fea0b772034145cd48cde2", "score": "0.7456036", "text": "def available_rooms(start_date, end_date)\n all_rooms.select { |room| available?(start_date, end_date, room) } \n end", "title": "" }, { "docid": "62259790cb4bf29b1ec5512894c5e725", "score": "0.74040174", "text": "def public_avail_rooms(daterange)\n validate(:daterange, daterange)\n a = conflicting_reservations(daterange).map { |reservation|\n reservation.room_number }\n b = conflicting_blocks(daterange).flat_map { |block| block.rooms }\n available_rooms = hotel.room_numbers - a - b\n return available_rooms\n end", "title": "" }, { "docid": "0ce81e50226ccfa955a1f94feaa994be", "score": "0.7334232", "text": "def availability(check_in, check_out)\n reserved_rooms = []\n blocked_rooms = []\n date_range = DateRange.new(check_in, check_out)\n @reservations.each do |reservation|\n if date_range.overlap?(reservation.dates.start, reservation.dates.end)\n reserved_rooms << reservation.room\n end\n end\n\n @blocks.each do |block|\n if date_range.overlap?(block.dates.start, block.dates.end)\n block.rooms.each do |room|\n blocked_rooms << room\n end\n end\n end\n\n available_rooms = @rooms - reserved_rooms - blocked_rooms\n return available_rooms\n end", "title": "" }, { "docid": "9bab3520817d5de2f191b21268b63639", "score": "0.72801006", "text": "def available_rooms(start_date, end_date)\n given_date_range = Hotel::DateRange.new(start_date, end_date)\n\n # get all the room that have been reserved for the given date range \n all_reserved_rooms = reserved_rooms_list(start_date, end_date)\n # get all rooms that are in the hotel blocks\n all_rooms_hotel_block = rooms_list_for_hotel_block(start_date, end_date) \n\n # get the aviable_rooms_list\n available_rooms_list = rooms.reject do |room|\n all_reserved_rooms.any? {|res_room| res_room.id == room.id} || all_rooms_hotel_block.any? {|block_room| block_room.id == room.id} \n end\n return available_rooms_list\n end", "title": "" }, { "docid": "a15015019af1d306907182e7aaa5be78", "score": "0.7261257", "text": "def reservations_by_date(date)\n valid_reservations = []\n reservations.each do |reservation|\n if reservation.range.include? (date)\n valid_reservations << reservation\n end\n end\n return valid_reservations\n end", "title": "" }, { "docid": "a70f9019d7ec664229af590be8fdf3da", "score": "0.7258861", "text": "def find_available_rooms(start_date, end_date)\n unless start_date.instance_of?(Date) && end_date.instance_of?(Date)\n raise ArgumentError.new(\"Dates must be entered as a date (ex. yyyy, mm, dd. Got start date: #{start_date} and end_date: #{end_date}.\")\n end\n \n available_rooms = []\n \n rooms.each do |room|\n if room.available(start_date, end_date) == true\n available_rooms << room\n end\n end\n \n if available_rooms.length == 0\n raise AvailabilityError.new(\"There are no available rooms for this date.\")\n else\n return available_rooms\n end\n end", "title": "" }, { "docid": "b676638832dc01d5dcc5f36e450e660a", "score": "0.72530836", "text": "def room_availability(check_in, check_out)\n booked_rooms = []\n @reservations.each do |reservation|\n if reservation.date_range.dates_overlap?(check_in, check_out)\n booked_rooms << reservation.room\n end\n end\n # check date overlaps for blocks\n @block_reservations.each do |block|\n if block.date_range.dates_overlap?(check_in, check_out)\n booked_rooms << reservation.room\n end\n end\n # available rooms minus already booked rooms\n return hotel_rooms - booked_rooms\n end", "title": "" }, { "docid": "c79a9a515fb5805154a328a02f12ae80", "score": "0.72153014", "text": "def get_block_room(start_date,end_date)\n room_list = []\n (start_date...end_date).each do |date_record|\n @block_reservation.each do |room_record|\n\n if room_record.start_date <= date_record && room_record.end_date > date_record\n room_list << room_record.room_number\n end\n end\n end\n return room_list\n end", "title": "" }, { "docid": "b91d6a83bc815e38022a945369f2cefa", "score": "0.7207541", "text": "def reserve_available_rooms(start_date,end_date)\n\n rooms_available_range = get_available_rooms(start_date,end_date)\n\n if rooms_available_range.empty?\n raise Exception.new(\"No rooms are available\")\n else\n list_room_block = get_block_room(start_date,end_date)\n rooms_available_range = rooms_available_range - list_room_block\n availability = rooms_available_range[0]\n\n reservation = Hotel::Reservation.new(start_date,end_date,availability)\n @all_reservations << reservation\n return @all_reservations\n end\n end", "title": "" }, { "docid": "6b1d932e2ba288f373846f08a0d6d864", "score": "0.7178722", "text": "def rooms_not_reserved(check_in_date, check_out_date)\n # if the reservations array is empty, this returns an array of available room numbers. If there are no reservations, all rooms can be reserved.\n return @rooms.map { |room| room.room_number } if @reservations.empty?\n unreserved_rooms = @rooms.map { |room| room.room_number }\n # if @reservation.empty? is not empty\n @reservations.each { |reservation|\n if (reservation.check_in_date >= check_in_date && reservation.check_in_date <= check_out_date) || (reservation.check_out_date >= check_in_date && reservation.check_out_date <= check_out_date)\n unreserved_rooms.delete(reservation.room_number)\n end\n }\n\n @blocks.each { |block|\n if (block.check_in_date >= check_in_date && block.check_in_date <= check_out_date) || (block.check_out_date >= check_in_date && block.check_out_date <= check_out_date)\n unreserved_rooms - block.rooms\n end\n }\n # unreserved_rooms returns an empty array if nothing is availible in the given date range or it will return an array of available room numbers in date range given.\n # for use in the reserve_room method\n return unreserved_rooms\n end", "title": "" }, { "docid": "45668a88c6ddb75fc36137b94ce56806", "score": "0.7153299", "text": "def reservation(date)\n result = []\n @reservations.each do |reservation|\n if reservation.date_range.include?(date)\n result << reservation\n end\n end\n return result\n end", "title": "" }, { "docid": "914862fb31217450b4a97273ad0dd7d6", "score": "0.7147508", "text": "def reservations_list_by_date_range(start_date, end_date)\n given_date_range = Hotel::DateRange.new(start_date, end_date)\n # Get the reservations_list for the given date range\n reservations_list_by_date_range = reservations.select do |res|\n res.date_range.overlap?(given_date_range)\n end\n end", "title": "" }, { "docid": "0bce9d24e340eb25afd15190b6924727", "score": "0.7111611", "text": "def find_available_rooms(check_in_date:, check_out_date:)\n date_range = Hotel::DateRange.new(check_in_date, check_out_date)\n overlap_reservations = date_range.overlap_blocks_reservations(@reservations, check_in_date, check_out_date)\n overlap_room_ids_reservations = overlap_reservations.map { |reservation| reservation.room_id }\n\n # Given a specific date, and that a room is set aside in a hotel block for that specific date, I cannot reserve or create a block for that specific room for that specific date\n overlap_blocks = date_range.overlap_blocks_reservations(@blocks, check_in_date, check_out_date)\n overlap_room_ids_blocks = []\n overlap_blocks.each do |block|\n block.room_ids.each do |i|\n overlap_room_ids_blocks << i\n end\n end\n\n overlap_room_ids = (overlap_room_ids_blocks + overlap_room_ids_reservations).uniq\n return available_rooms = @rooms.reject do |room|\n overlap_room_ids.include?(room.room_id)\n end\n end", "title": "" }, { "docid": "c506bbd8c197bc04f7d41315aea71108", "score": "0.7109593", "text": "def available_rooms(req_range)\n available_rooms_array = []\n rooms.each do |curr_room|\n if curr_room.is_available(req_range)\n available_rooms_array << curr_room\n end \n end \n return available_rooms_array\n end", "title": "" }, { "docid": "16101697feac262552d56c2e1c80e2c1", "score": "0.7076841", "text": "def available_rooms(start_date, end_date)\n no_reservation = @rooms.select { |room| is_room_available?(start_date, end_date, room) }\n # Cannot reserve specific room, for specific date, if room already in a block for that specific date\n no_blocks = no_reservation.select { |room| is_room_unblocked?(start_date, end_date, room) }\n return no_blocks\n end", "title": "" }, { "docid": "6a8163557deb4e8ad7d8c7a16c766640", "score": "0.706126", "text": "def available_rooms_of_hotel_blocks(start_date, end_date)\n hotel_blocks_for_specific_date_range = hotel_blocks_for_specific_date_range(start_date, end_date)\n if hotel_blocks_for_specific_date_range.empty? \n raise ArgumentError.new (\"no hotel_block for the given date range.\")\n end\n available_rooms_of_hotel_blocks = hotel_blocks_for_specific_date_range.map do |hotel_block|\n hotel_block.rooms\n end\n all_available_rooms_of_hotel_blocks = available_rooms_of_hotel_blocks.flatten\n end", "title": "" }, { "docid": "aef26086893a23cce633761553136f12", "score": "0.70029", "text": "def range_reservations(requested_dates)\n range_resv = []\n requested_dates.dates.each do |date|\n if @calendar.key?(date)\n range_resv.push(*@calendar[date])\n end\n end\n range_resv = range_resv.uniq\n \n return range_resv\n end", "title": "" }, { "docid": "b25a70dcc05ecfd15eae6ea6147367b0", "score": "0.70024025", "text": "def rooms_available(aReservationRequest)\n if aReservationRequest.class != Hotel::Reservation\n raise ArgumentError.new(\"Invalid input of a Reservation Request.\")\n end\n\n rooms_available = []\n #loop through the array of rooms\n @rooms.each do |room|\n #get reservations by room \n confirmed_reservations = self.find_reservations_by_room(room)\n #check if reservationrequest overlaps with confirmed reservations (are_res_overlapped)\n if aReservationRequest.are_reservations_overlapped(confirmed_reservations) \n next #go to next room\n else\n # add to rooms_available []\n rooms_available.push(room) \n end\n end\n return rooms_available\n end", "title": "" }, { "docid": "a0241ad36c3be08586aba78685152e87", "score": "0.6966318", "text": "def reservations_list(date)\n reservation_list = reservations.select do |res|\n res.date_range.include?(date)\n end \n return reservation_list\n end", "title": "" }, { "docid": "7918ab3a32fe87871f2bb4c2e7abdfd9", "score": "0.69596344", "text": "def is_room_available(date_range:, room_number:)\n room_match = @reservation_list.select {| reservation|reservation.room_number == room_number && ((date_range.check_out <= reservation.date_range.check_out && date_range.check_out > reservation.date_range.check_in) || (date_range.check_in < reservation.date_range.check_out && date_range.check_in >= reservation.date_range.check_in))}\n if room_match.length > 0\n return false\n else \n return true\n end\n end", "title": "" }, { "docid": "7d3c16e80bca42068501aa9748d426b4", "score": "0.6944872", "text": "def check_block_availability(date_range, rooms)\n available_rooms = list_available_rooms(date_range)\n\n raise ArgumentError.new(\"Not all rooms have availability\") if !(rooms - available_rooms).empty?\n\n return rooms\n end", "title": "" }, { "docid": "51ca8012123957a73175165156d70d08", "score": "0.69358957", "text": "def reservations_by_date(date)\n reservations_on_date = []\n @reservation_list.each do |reservation|\n if reservation.date_range.include? date\n reservations_on_date << reservation\n end\n end\n return reservations_on_date\n end", "title": "" }, { "docid": "6eec714be97e593e9647109c762fd62b", "score": "0.6923766", "text": "def check_availability(start_date, end_date)\n # WILL NEED TO ADD CHECK IN AND CHECK OUT ARGUMENTS IN ORDER TO CALL HM2 OVERLAP\n available_rooms = ROOM_LIST.dup\n room_id = nil\n # Checking if there are no previous reservations\n if @reservations.length == 0\n room_id = ROOM_LIST.sample\n return room_id\n else\n # checking if there are no rooms available\n @reservations.each do |reservation|\n # FIXME:\n if reservation.overlap?(start_date, end_date)\n available_rooms.delete(reservation.room_id)\n end\n end\n if available_rooms.length == 0\n raise ArgumentError.new(\"All rooms are currently booked at this time #{start_date} - #{end_date}.\")\n else\n room_id = available_rooms.sample\n return room_id\n end\n end\n end", "title": "" }, { "docid": "fcb3c5ee294a43ac14a78af243829b9c", "score": "0.6911694", "text": "def room_available?(room, start_date, end_date) \n reservations.each do |item|\n if item.room == room\n while start_date != end_date\n if item.date_range.include?(start_date)\n return false\n else\n start_date += 1\n end\n end\n end\n end\n return true\n end", "title": "" }, { "docid": "db11977de0706e9e6c77e219d1650d78", "score": "0.690764", "text": "def book_avail_room_w_date_range(room_number, start_date, end_date)\n available_rooms = find_available_rooms(start_date, end_date)\n # if room is NOT available - throw error\n if (available_rooms.all? { |room_object| room_number != room_object.room_num })\n raise ArgumentError, \"The room number you entered is unavailable on the dates you entered.\"\n # .any returns true if at least one element meets the condition\n elsif (available_rooms.any? { |room_object| room_number == room_object.room_num })\n # .find returns the first element that satisfies the condition\n found_room = available_rooms.find { |room_object| room_object.room_num == room_number }\n new_reservation = Hotel::Reservation.new(start_date: start_date, end_date: end_date, room: found_room)\n @reservations << new_reservation\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "339b1d98cdd7a7cf01de78ae6fcb0302", "score": "0.68818873", "text": "def available_rooms\n return @available_rooms if @available_rooms\n @available_rooms = []\n @all_rooms = {}\n inventories.group_by {|r| r.room_type_id }.each do |room_type_id, inv|\n catch :missing_date do\n range.each do |date|\n throw :missing_date unless inv.any? {|i| i.date == date}\n end\n @available_rooms << first_or_average_inventory(inv)\n @all_rooms[room_type_id] = inv\n end\n end\n @available_rooms\n end", "title": "" }, { "docid": "ab98b47c684ae2eb5e7459971c8a3d99", "score": "0.68805456", "text": "def available(start_date, end_date)\n reservations.select {| reservation| reservation.available(start_date, end_date)} == reservations\n end", "title": "" }, { "docid": "8ea4670750a07ab14517533952d2bb19", "score": "0.6876631", "text": "def available?(start_date, end_date, room)\n room.reservations.each do |reservation|\n\n first_day = Date.parse(start_date)\n last_day = Date.parse(end_date)\n\n # Check that there is no overlap in date\n while first_day != last_day\n return false if (reservation.start_date...reservation.end_date).include?(first_day)\n first_day += 1 \n end\n end\n return true\n end", "title": "" }, { "docid": "74f3d4b52dcf59bbf59e61f4f4fd815a", "score": "0.6870848", "text": "def reservations_by_date(search_date)\n reservation_list = []\n \n reservations.each do |reservation|\n if search_date >= reservation.start_date && search_date < reservation.end_date\n reservation_list << reservation\n end\n end\n return reservation_list\n end", "title": "" }, { "docid": "1030330c01d3f01c8c9607aa0634825f", "score": "0.68385655", "text": "def check_avail_rooms_for(next_check_in, next_check_out) # WAVE 2\n next_reservation = DateRange.new(next_check_in, next_check_out)\n next_reservation.valid_dates?\n existing_booked_rooms = next_reservation.overlap(@all_reservations)\n existing_booked_rooms.empty? ? @rooms : @rooms - existing_booked_rooms\n end", "title": "" }, { "docid": "efec9d45c746d4616c6ea8be13fa1118", "score": "0.6827066", "text": "def find_all_reservations(date)\n all_reservations_by_date = []\n @reservations.each do |reservation|\n if (date >= reservation.start_date && date < reservation.end_date)\n all_reservations_by_date << reservation\n end\n end\n return all_reservations_by_date\n end", "title": "" }, { "docid": "060a80fba7ffbad2b0562274285e1513", "score": "0.6803725", "text": "def list_available_rooms(check_in, check_out)\n available_rooms = []\n \n new_range = Hotel::DateRange.new(check_in, check_out)\n \n available_rooms = @rooms.reject do |room|\n room.reservations.any? do |reservation|\n reservation.date_range.overlap?(new_range) == true\n end\n end\n \n return available_rooms\n end", "title": "" }, { "docid": "182942285fa905e2d8424ebb39974795", "score": "0.67963564", "text": "def reservations_by_date(date)\n return @reservations.select do |reservation|\n reservation.range.include?(date)\n end\n end", "title": "" }, { "docid": "83f69facd386c6ca9fbae9d42b68efbb", "score": "0.6779358", "text": "def reservations\n group.reservations.between(start_time, end_time)\n end", "title": "" }, { "docid": "ba91ac6204078b7d04ad2be659a65583", "score": "0.6768883", "text": "def list_reservations(date)\n reservations_by_date = []\n @reservations.each do |reservation|\n if reservation.date_range.include?(date)\n reservations_by_date << reservation\n end \n end\n \n if reservations_by_date.empty?\n raise ArgumentError, \"No reservations for this date.\"\n end\n return reservations_by_date\n end", "title": "" }, { "docid": "4c9ce9c9078cc5d37bfc47e49bece363", "score": "0.67515403", "text": "def available_rooms_in(block)\n return block.rooms.select { |room| is_room_available?(block.range.start_date, block.range.end_date, room)}\n end", "title": "" }, { "docid": "f2d5634f068e190ee5ea142aab0f1abf", "score": "0.6742218", "text": "def print_reservations(date_range)\n reservation_list = []\n @collection_of_reservations.each do |reservation|\n if reservation.date_range.date_include?(date_range)\n # refactor: create new method for reservation date range in reservation class and call it in print reservation.\n reservation_list << reservation\n end\n end\n return reservation_list\n end", "title": "" }, { "docid": "4a4952c2491f68f100d5cd501b8a6fdd", "score": "0.67387795", "text": "def list_reservations(date)\n list = []\n @reservations.each do |reservation|\n if reservation.date_range.check_include?(date)\n list << reservation\n end\n end\n return list\n end", "title": "" }, { "docid": "d31f7248eeed270bd8f94693112c1875", "score": "0.6732954", "text": "def get_reservations(date)\n\n if date.class!= Date\n raise ArgumentError.new(\"invalid date\")\n end\n\n @all_reservations.each do |res|\n list =[]\n if res.start_date <= date && res.end_date > date\n list << res\n end\n return list\n end\n\n end", "title": "" }, { "docid": "d31f7248eeed270bd8f94693112c1875", "score": "0.6732954", "text": "def get_reservations(date)\n\n if date.class!= Date\n raise ArgumentError.new(\"invalid date\")\n end\n\n @all_reservations.each do |res|\n list =[]\n if res.start_date <= date && res.end_date > date\n list << res\n end\n return list\n end\n\n end", "title": "" }, { "docid": "1766409745ff4e4bbeb79b7a66f73197", "score": "0.6731128", "text": "def list_of_available_rooms(date)\n if date.class!= Date\n raise ArgumentError.new(\"invalid date\")\n end\n\n reserved_list = get_reservations(date)\n reserved_rooms = []\n reserved_list.each do |reservation|\n reserved_rooms << reservation.room_number\n end\n return @list_of_rooms - reserved_rooms\n #return @available_rooms\n end", "title": "" }, { "docid": "d48798911c721271d3a49abf97b5710a", "score": "0.6726298", "text": "def search_reserved_by_date(search_date)\n search_date = Date.parse(search_date)\n results = []\n\n @reservations.each do |reservation|\n if reservation.start_date <= search_date && search_date < reservation.end_date\n results << @reservations\n end\n end\n\n @block_reservations.each do |reservation|\n if reservation.start_date <= search_date && search_date < reservation.end_date\n results << @block_reservations\n end\n end\n\n return results\n end", "title": "" }, { "docid": "1c5364f4babf52ec84fe3399e2256df0", "score": "0.6707373", "text": "def list_reserved_rooms(date)\n list_rooms(list_reservations(date))\n end", "title": "" }, { "docid": "27066ce013c517f3ba2b0e28f0d6e10a", "score": "0.6696022", "text": "def list_of_available_rooms(date)\n if date.class!= Date\n raise ArgumentError.new(\"invalid date\")\n end\n\n reserved_list = get_reservations(date)\n reserved_rooms = []\n reserved_list.each do |reservation|\n reserved_rooms << reservation.room_number\n end\n return @list_of_rooms - reserved_rooms\n end", "title": "" }, { "docid": "01cd44887b50f5ecb1a39c31bcf669b9", "score": "0.66906434", "text": "def view_vacant_rooms(start_date, end_date)\n # I am editing the rooms! it's not making a copy\n # I am just creating a new pointer that points to the same data as what rooms points to\n vacant_rooms = @rooms\n target_range = create_hotel_range(start_date, end_date)\n vacant_rooms.each do |room|\n ranges = room.ranges\n ranges.each do |range|\n # nil means no intersection\n if intersection(target_range, range) != nil # there was a overlap\n vacant_rooms.delete(room)\n break # where does this go? it goes to the next room, if one range conflicts, I do not have to check if the others conflicts\n end\n end\n end\n\n\n # remove rooms that have a block in them\n vacant_rooms_result = vacant_rooms.select do | room |\n if room.blocks.empty?\n room.blocks.empty?\n else\n intersection(target_range, room.blocks.first[:range]) == nil\n end\n end\n\n return vacant_rooms_result\n\n # QUEstion for later: how come this does not work without using select: Can't escape from eval with next\n\n # vacant_rooms.each do |room|\n # if room.blocks.empty? == false\n # if intersection(target_range, room.blocks.first[:range]) != nil # there was a overlap\n # vacant_rooms.delete(room)\n # end\n # else # it does not have a block\n # next # go to the next room\n # end\n # end\n end", "title": "" }, { "docid": "d436640f6faa5be518df9fce681de304", "score": "0.6656846", "text": "def view_vacant_rooms_in_block(range)\n available_rooms = []\n block_rooms = find_block(range)\n block_rooms.each do |room|\n #blocks variable is an array\n blocks = room.blocks\n blocks.each do |block|\n if block[:status] == \"available\"\n available_rooms << room\n end\n end\n end\n return available_rooms\n end", "title": "" }, { "docid": "ffee81089190e61791653b24dc381d96", "score": "0.6648684", "text": "def overlapping_reservations_for_person\n conditions = [['(start_date < :start_date AND end_date > :end_date)'],\n ['(start_date < :end_date AND end_date > :end_date)'],\n ['(start_date < :start_date AND end_date > :end_date)'],\n ['(start_date > :start_date AND end_date < :end_date)']]\n @overlapping_reservations ||= person.equipment_reservations.find(:all, \n :conditions => [\"submitted = true \n AND id != #{self.id}\n AND submitted = 1 \n AND (#{conditions.join(\" OR \")})\", \n { :start_date => start_date, :end_date => end_date }])\n end", "title": "" }, { "docid": "a438088c4f9cde8de007b732cea4718e", "score": "0.66309744", "text": "def room_reservations_and_date(room_num,date_range)\n display = \"\"\n res_room_date_range = @reservations.select {|bookings| bookings.room_num == room_num && date_range.overlap(bookings.date_range)}\n res_room_date_range.map do |bookings|\n display += \"Reservation_id = #{bookings.reservation_id} Start date = #{bookings.date_range.start_date} End_date =#{bookings.date_range.end_date} Room Number = #{bookings.room_num}\\n\"\n end \n return display\n end", "title": "" }, { "docid": "be5bafc9af2c3a236c5795cbb0a983b2", "score": "0.6607472", "text": "def res_by_date(date)\n booked_reservations = @reservations.find_all do |reservation|\n reservation.date_range.date_check(date)\n end\n if booked_reservations.empty?\n return []\n else\n return booked_reservations\n end\n end", "title": "" }, { "docid": "e3f8ff871e99bcf48f50582e860dab82", "score": "0.6591057", "text": "def vacant?(start_date, end_date)\n reservations.collect do |r|\n reserved_dates = r.checkin..r.checkout\n desired_date_range = start_date..end_date\n if reserved_dates != desired_date_range\n true\n else\n false\n end\n end\n end", "title": "" }, { "docid": "f0a1da3c3be51a3bc6c44134ded2faa4", "score": "0.6578676", "text": "def existing_reservations\n if !self.start_dt.blank? && !self.end_dt.blank? && !self.room.blank?\n start_dt = self.start_dt.to_datetime.change(:offset => \"+0000\")\n end_dt = self.end_dt.to_datetime.change(:offset => \"+0000\")\n is_block = self.is_block?\n room_id = self.room.id\n results_size = (self.is_block?) ? 1000 : 1\n\n existing_reservations = Reservation.tire.search do\n query do\n filtered do\n filter :term, :is_block => false if is_block\n filter :range, :end_dt => { :gte => Time.zone.now.to_datetime.change(:offset => \"+0000\") } if is_block\n filter :term, :room_id => room_id\n filter :term, :deleted => false\n filter :or,\n { :and => [\n { :range => { :start_dt => { :gte => start_dt } } },\n { :range => { :start_dt => { :lt => end_dt } } }\n ]},\n { :and => [\n { :range => { :end_dt => { :gt => start_dt } } },\n { :range => { :end_dt => { :lte => end_dt } } }\n ]},\n { :and => [\n { :range => { :start_dt => { :lte => start_dt } } },\n { :range => { :end_dt => { :gte => end_dt } } }\n ]}\n end\n end\n size results_size\n end\n\n return existing_reservations.results\n end\n []\n end", "title": "" }, { "docid": "c57be249d579a4ffa87ec6dfd0d0ef3c", "score": "0.65539485", "text": "def city_openings(start_date,end_date)\n ed = Date.parse(end_date)\n sd = Date.parse(start_date)\n\n self.listings.select do |listing|\n #need to loop through all reservations\n listing.reservations.all? do |res|\n #is any reservation within the date range\n # (StartDate1 <= EndDate2) and (StartDate2 <= EndDate1)\n res.checkin <= ed && res.checkout <= sd\n end\n end\n end", "title": "" }, { "docid": "012c5f58f05760fa56daf857a90af45f", "score": "0.6545313", "text": "def empty_rooms(date)\n reservation_list = list_reservations(date)\n reserved_rooms = []\n\n reservation_list.each do |reservation|\n reserved_rooms << reservation.room\n end\n return @rooms - reserved_rooms\n end", "title": "" }, { "docid": "1c201e7e8d639c89054a979bbe98d0e7", "score": "0.6542061", "text": "def overlapping_reservations\n \n Reservation.where(\"listing_id = ?\", self.listing_id).where.not(id: self.id).each do |r|\n if overlaps?(r)\n return errors.add(:overlapping_dates, message:\"These dates are unavailable.\")\n end\n end\n end", "title": "" }, { "docid": "309c12f9e28dfe33bc76e80d6a647dd2", "score": "0.6537555", "text": "def list_reservations(date_selected)\n return @reservations.select {|reserve| reserve.dates_booked.include? date_selected}\n\n end", "title": "" }, { "docid": "59b56a9f9ccecb6018033a14e5dc482a", "score": "0.6531066", "text": "def reserved_dates\n days = reservations.all.map do |x|\n if x.aasm_state != \"canceled\"\n (x.checkin_date...x.checkout_date).map{|d| d}\n end\n end\n days.compact.flatten\n end", "title": "" }, { "docid": "5e0a3d95944e97647b1ec8537250292a", "score": "0.65174043", "text": "def blocks_by_room(start_date, end_date, room)\n range = Hotel::DateRange.new(start_date, end_date)\n return @blocks.select do |block| # which blocks have an overlap with the range passed\n block.range.overlap?(range) && block.rooms.include?(room)\n end\n end", "title": "" }, { "docid": "5f46c9d84c67b7a6918fa7eae9091626", "score": "0.6508072", "text": "def unreserved_rooms(check_in, check_out)\n reserved_rooms = []\n unreserved_block_rooms = []\n reserved_block_rooms = []\n new_range = range(check_in, check_out)\n\n @reservations.each do |reservation|\n if reservation.date_range.overlaps?(new_range)\n reserved_rooms << reservation.room\n end\n end\n\n @unreserved_block.each do |reservation|\n if reservation.date_range.overlaps?(new_range)\n unreserved_block_rooms << reservation.room\n end\n end\n\n @reserved_block.each do |reservation|\n if reservation.date_range.overlaps?(new_range)\n reserved_block_rooms << reservation.room\n end\n end\n\n unreserved = @rooms - reserved_rooms - unreserved_block_rooms - reserved_block_rooms\n\n return unreserved\n end", "title": "" }, { "docid": "187f99a8d76ccedc7d9d67c54370c1ae", "score": "0.6473769", "text": "def available_rooms(checkin, checkout = nil)\n date_range = []\n Hotels::Dates.add_dates(date_range, checkin, checkout, 1)\n available = []\n date_range.each do |date|\n available_rooms = list_available_rooms(date)\n available << available_rooms\n end\n available\n end", "title": "" }, { "docid": "36bd1a1046285cbd14373df00e6600c2", "score": "0.6444329", "text": "def reserve_room(start_date, end_date)\n start_date = Time.parse(start_date)\n end_date = Time.parse(end_date)\n range = create_hotel_range(start_date, end_date) # for hotel\n e_date = end_date - 1 # rooms do not keep track of last night\n vacant_rooms = view_vacant_rooms(start_date, e_date)\n if vacant_rooms.nil?\n # REFACTOR idea: begin rescue block, exception handleing\n raise StandardError, \"no rooms are available\"\n else\n room = vacant_rooms.first\n room.add_range(range)\n input_data = {}\n input_data[:start_time] = start_date\n input_data[:end_time] = end_date\n input_data[:room_num] = room.number\n reservations << Reservation.new(input_data)\n end\n end", "title": "" }, { "docid": "eace5603b86577cb3821dfce4dc7dcf3", "score": "0.64440554", "text": "def available_rooms\n begin\n @booking_dates = get_booking_dates_params\n @category = Category.find_by(category_type: @booking_dates[:room_type])\n @rooms = @category.rooms\n @room = @rooms.select do |room|\n room if room.available?(@booking_dates[:check_in],@booking_dates[:check_out])\n end\n render json: {:room_type => @category.category_type, :amount => @category.price, :count => @room.count, :available_rooms => @room, :status=> 200 }\n rescue Exception => e\n # render :nothing => true, :status => 503\n render json: {:error => [\"please check params\"]}, status: 422\n end\n end", "title": "" }, { "docid": "de4ae07d2da6d1e5c4bad7a293ccf074", "score": "0.6436774", "text": "def available_list_at(date)\n reservations = Reservation.where(date: date.beginning_of_day..date.end_of_day, space_id: self)\n list = 48.times.map{ true }\n reservations.each{ |r| list.fill(false, r.start_time_block..r.end_time_block) }\n list\n end", "title": "" }, { "docid": "421e4dc48c9ee0b859b56efa519cbe4d", "score": "0.6412736", "text": "def build_available_slots(non_recurring_slots, recurring_slots, blocked_slots)\n availability = []\n loop do\n week_day = @date.wday\n availability << {\n date: @date.to_date,\n slots: non_recurring_slots[week_day] + recurring_slots[week_day] - blocked_slots[week_day]\n }\n break if (@date += 1.day) > @end_date\n end\n availability\n end", "title": "" }, { "docid": "17f5d609412af163829b0e37a468a8d7", "score": "0.6405722", "text": "def list_by_nights(date)\n validate(:date, date)\n return reservations.select {|reservation|\n reservation.range.include?(date) }\n end", "title": "" }, { "docid": "d7accc20652fa36b9a741b60a53e9f46", "score": "0.64006263", "text": "def build_reservations\n @bookings.map do |booking|\n Reservation.new(booking).take_matching_resell\n end\n end", "title": "" }, { "docid": "eb21910a60df839acc73131bcc4d3a92", "score": "0.6390816", "text": "def check_overlapping_dates\n \t#check if new bookings overlapped with any existing bookings \n \tlisting.reservations.each do |older_reservation|\n \t\tif overlap?(self, older_reservation)\n \t\t\treturn errors.add(:overlapping_dates, \"Dates choosen are not available\")\n \t\tend\n \tend\n end", "title": "" }, { "docid": "dcc65d36469028c910889fde07c6b4a7", "score": "0.6390082", "text": "def show_reservations_for_date(date)\n # go through reservations and add the ones whose range include the given date\n list = []\n @reservations.each do |reservation|\n if reservation.date_range.include?(date)\n list << reservation\n end\n end\n return list\n end", "title": "" }, { "docid": "a03b58198a22afc8e725d6ee021c0466", "score": "0.63890094", "text": "def booking_date_slots\n\t\tresource = @company.resources.find_by_name(params[:resource])\n\t\t@slot_array = resource.available_time_slot params[:date_of_booking]\n\tend", "title": "" }, { "docid": "1df08185a353c4ae7fe6c1abad24c1c4", "score": "0.637592", "text": "def find_possible_rooms(check_in, check_out, view_type, room_type)\n possible_rooms = []\n possible_rooms_date = []\n\n # convertir les params en dates\n arrival = check_in\n depart = check_out\n\n # Touver toutes les chambres ayant le bon ViewType et RoomType\n possible_rooms = Room.view_types(view_type).room_types(room_type)\n\n # Verif simple de la date de debut de réservation / A RETRAVAILLER!!!!\n possible_rooms.each do |possible_room|\n chambre_dispo = true\n\n # Si le nombre de réservation accrocher à la chambre est plus grand que 0\n if possible_room.room_reservations.count > 0\n possible_room.room_reservations.each do |rr|\n\n # si la date d'arrivée est plus tard que les dates de réservation de la chambre\n chambre_dispo = date_validation_room_selection(rr, arrival, depart)\n end\n\n # Si la chambre est disponible (voir CHECK DATE)\n if chambre_dispo == true\n possible_rooms_date.push(possible_room)\n end\n\n else\n possible_rooms_date.push(possible_room)\n end\n end\n\n # Retourne un tableau de plusieurs chambres valides\n return possible_rooms_date\n end", "title": "" }, { "docid": "7f4d143608c6259905a8c500e87b88c2", "score": "0.63683075", "text": "def overlapping_reservations\n \t\n \tReservation.where(\"listing_id =? AND id<> ?\", self.listing_id, self.id).each do |r|\n \t\tif overlaps?(r)\n \t\t\treturn errors.add(:overlapping_dates, message:\"These dates are unavailable.\")\n \t\tend\n \tend\n end", "title": "" }, { "docid": "09294a2b9b78e711faca39c5c293f761", "score": "0.63621354", "text": "def list_available_rooms(date)\n @rooms - list_unavailable_rooms(date)\n end", "title": "" }, { "docid": "386f84028e695648d385cfb43f804fec", "score": "0.6339729", "text": "def find_reservations_by_date(check_in, check_out)\n by_date = @reservations.select { |reservation| reservation.dates.overlap?(check_in, check_out)}\n end", "title": "" }, { "docid": "b4d1c7c0124e45c37dc478a6bb70c949", "score": "0.6335439", "text": "def view_available(partyname: nil, date1: nil, date2: nil)\n available = []\n @rooms.each do |room|\n if is_available?(room, date1, date2)\n available << room\n end\n end\n return available\n end", "title": "" }, { "docid": "a3ad6ec41d17f973f4e7289831c97377", "score": "0.632774", "text": "def booked_dates\n @booked_dates = []\n\n self.reservations.each do |reserved|\n reserved.start_date.upto(reserved.end_date) do |date|\n @booked_dates << date.strftime(\"%m-%d-%Y\") end\n end\n @booked_dates\n end", "title": "" }, { "docid": "94a7f3c9f70d8add77849170fe483e12", "score": "0.6326724", "text": "def find_reservations_by_date(aDate, aRoom_number = nil) \n if aDate.class != Date\n raise ArgumentError.new(\"Invalid date, must be Date.\")\n end\n\n if (aRoom_number != nil) && (aRoom_number.class != Integer)\n raise ArgumentError.new(\"Invalid, room number must be nil or an Integer.\")\n end \n\n reservations = []\n # search through reservations\n @reservations.each do |reservation|\n # check if requested aRoom_number is same as reservation's room id\n # and requested date is within the reservation's checkin to checkout timeframe\n if aRoom_number != nil\n if (aRoom_number == reservation.room_number) && (reservation.is_within_stay(aDate))\n # if both are true, save the reservation \n reservations.push(reservation)\n end\n else\n #checking rooms with this date only\n if (reservation.is_within_stay(aDate))\n reservations.push(reservation)\n end\n end\n end\n return reservations\n end", "title": "" }, { "docid": "4ea07bfb10dffb0e4292aeb0645de580", "score": "0.63194036", "text": "def make_reservation(start_date,end_date)\n room_number = @list_of_rooms.sample\n reservation = Hotel::Reservation.new(start_date,end_date,room_number)\n @all_reservations << reservation\n return @all_reservations\n end", "title": "" } ]
0aaffe0901c73e3b88d49538ad76b060
PATCH/PUT /carts/1 PATCH/PUT /carts/1.json
[ { "docid": "f85feebc59238c7cda8e0728df5c8aa4", "score": "0.62940913", "text": "def update\n if @cart.update(cart_params)\n redirect_to @cart, notice: 'Корзина изменена.'\n else\n render :edit\n end\n end", "title": "" } ]
[ { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.7168711", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.7161747", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.7161747", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.7161747", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.7161747", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.7161747", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "040e3ebf1f535a95e15770845b75d0b9", "score": "0.7156407", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: I18n.t('carts.name') + I18n.t('messages.success') + I18n.t('messages.actions.update')}\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b279e7a69c0b4779a61d9bb2ee7dd787", "score": "0.71527904", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.71316725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f18273aeecf28863f729cb3e5501f908", "score": "0.7130174", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: \"Cart was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba9bc1f82e85719d677d83f8cd1c2e54", "score": "0.69990516", "text": "def update\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n if @carts_product.update_attributes(params[:carts_product])\n format.html { redirect_to @cart, notice: 'Carts product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a55a3f033958458db6c4a7fc813e97c5", "score": "0.6990255", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.js\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1b0f5fdc3efe95eb36259d8d4e42a24", "score": "0.6971822", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to show_cart_path, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { redirect_to show_cart_path, alert: @cart.errors.full_messages.to_sentence }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69269f774efe31aa2842f2ca1fdd58ee", "score": "0.6887805", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n if @cart_item.update(cart_item_params)\n head :no_content\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "030a95a1ce7e100a438e0c9f3003a849", "score": "0.6885992", "text": "def update\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78bb711378d223c15b044084a9aa8d3b", "score": "0.68385005", "text": "def update\n respond_to do |format|\n if @retail_cart.update(retail_cart_params)\n format.html { redirect_to @retail_cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @retail_cart }\n else\n format.html { render :edit }\n format.json { render json: @retail_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f2714764bbb2e738e12c2ba0b745cd5", "score": "0.6811085", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eea74c2a06ef4527aeb07fa8d9af27cc", "score": "0.6788838", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, success: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Cart updated by user \\n\")\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aed1291c8f254034244ac1d953d4e666", "score": "0.6784946", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aed1291c8f254034244ac1d953d4e666", "score": "0.6784946", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f5809498cfe2568a030cffd009f4917", "score": "0.6741069", "text": "def update \n\t\t@cart_item = CartItem.find(params[:id])\n\n\t\tif @cart_item.update( cart_item_params )\n\t\t head :no_content\n\t\telse\n\t\t render json: @cart_item.errors, status: :unprocessable_entity\n\t\tend\n\tend", "title": "" }, { "docid": "9b467f4a308ea8e3b5fabcbf477786b4", "score": "0.6734052", "text": "def update\n respond_to do |format|\n if @carts_product.update(carts_product_params)\n format.html { redirect_to carts_products_url, notice: 'Quantity was successfully updated.' }\n format.json { render :show, status: :ok, location: @carts_product }\n else\n format.html { render :edit }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be6ee9957632aca2a3f951bb5d9ca186", "score": "0.6719242", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be6ee9957632aca2a3f951bb5d9ca186", "score": "0.6719242", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa3f449bf0dda59cde02cdaf66329c71", "score": "0.67051023", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a61910aa4c9849870bcc30c07c746c5b", "score": "0.6684728", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a61910aa4c9849870bcc30c07c746c5b", "score": "0.6684728", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c913673423f09bc3f3af76353b63438b", "score": "0.66730314", "text": "def update\n @cartum = Cartum.find(params[:id])\n\n respond_to do |format|\n if @cartum.update_attributes(params[:cartum])\n format.html { redirect_to @cartum, notice: 'Cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c9c4a955a786e16c34080efccc99213", "score": "0.6662672", "text": "def update\n respond_to do |format|\n if @shopping_cart.update(shopping_cart_params)\n format.html { redirect_to @shopping_cart, notice: 'Shopping cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shopping_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a851033544ba2589903b71b46188cec8", "score": "0.66331005", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to :back, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :back, alert: 'Error, quanity was not updated.' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24c591641cb3104eac5f9fbaef747ee4", "score": "0.6608741", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Expense Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efe3d767b0b0569289beebaf36a73e6d", "score": "0.65317804", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart])\n format.html { redirect_to(@cart_item, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7f482321fbc9459989365a001a23d78", "score": "0.6501155", "text": "def update\n respond_to do |format|\n if @mycart.update(mycart_params)\n format.html { redirect_to @mycart, notice: \"Mycart was successfully updated.\" }\n format.json { render :show, status: :ok, location: @mycart }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @mycart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acaf6167c14c8057efbbdb663952cc5f", "score": "0.6444442", "text": "def update\n cart_item = current_user.cart.cart_items.where(\"item_id = ?\", cart_items_params[:item_id]).first\n cart_item.quantity += cart_items_params[:quantity].to_i\n if cart_item.quantity < 1\n if cart_item.delete\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: :desc)\n render 'carts/show'\n else\n render json: ['no such product in the cart'], status: 404\n end\n else\n if cart_item.save\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: :desc)\n render 'carts/show'\n else\n render cart_item.errors.full_messages, status: 422\n end\n end\n end", "title": "" }, { "docid": "6b2bff4515209f9ac5ca03bc1dcd4c52", "score": "0.6440199", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to(@cart_item, :notice => 'Line item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53633316c70348d35805874e640772d6", "score": "0.64180267", "text": "def update\n respond_to do |format|\n if cart_product_params[:quantity].to_i > 0\n if @cart_product.update(cart_product_params)\n format.html { redirect_to request.referrer, notice: \"Cart product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart_product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cart_product.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to request.referrer, notice: \"Quantity cannot be 0 or less!.\" }\n end\n end\n end", "title": "" }, { "docid": "ca586a0cee2e650874bd788a3f2c681a", "score": "0.6373602", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Информация о заказаном диске обновлена .' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5335655e242cd36314bd1d6d1864a079", "score": "0.63654673", "text": "def update\n @cart = current_cart\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daf88b95b6a86589146568f0703f75b8", "score": "0.63347906", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to(@cart_item, :notice => 'Cart item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25a1358728755c7a4787ba0e382f50ec", "score": "0.63065606", "text": "def update\n respond_to do |format|\n if @shopping_cart_item.update(shopping_cart_item_params)\n format.html { redirect_to @shopping_cart_item, notice: 'Shopping cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shopping_cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0989ef7fdfa8ddf69f77e5b8dddffce3", "score": "0.6306386", "text": "def update\n # if @cart_item.update(cart_item_params)\n # render :show, status: :ok, location: @cart_item\n # else\n # render json: @cart_item.errors, status: :unprocessable_entity\n # end\n\n if params[:cart_item][:quantity].to_i.zero?\n destroy\n elsif @cart_item.update(cart_item_params)\n @cart = @cart_item.cart\n build do\n message 'Изменение количества'\n view 'carts/show'\n end\n # render :show, status: :ok, location: @item\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "299037a132c1c7f877f63aef5dbd089f", "score": "0.62860316", "text": "def update\n respond_to do |format|\n if @cartel.update(cartel_params)\n format.html { redirect_to @cartel, notice: 'Cartel was successfully updated.' }\n format.json { render :show, status: :ok, location: @cartel }\n else\n format.html { render :edit }\n format.json { render json: @cartel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a9f8fab6bca22e016bc42bcb58b7942", "score": "0.6257161", "text": "def update\n cart = Cart.find(session[:cart_id])\n respond_to do |format|\n if @cartship.update(cartship_params)\n format.html { redirect_to cart, notice: 'Cartship atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @cartship }\n else\n format.html { render :edit }\n format.json { render json: @cartship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14a7e8cbee3a7d0881d7606e02cb9291", "score": "0.62509507", "text": "def update\n if @in_shopping_cart.update(in_shopping_cart_params)\n render :show, status: :ok, location: @in_shopping_cart\n else\n render json: @in_shopping_cart.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8a9f9366403fd5ffabc764b410305c8e", "score": "0.6109281", "text": "def update\n @cartucho = Cartucho.find(params[:id])\n\n respond_to do |format|\n if @cartucho.update_attributes(params[:cartucho])\n format.html { redirect_to @cartucho, notice: 'Cartucho was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartucho.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24c2a080dadb6ff18a8aad7a4d90bb00", "score": "0.6082809", "text": "def update\n\n respond_to do |format|\n if @order.update(order_params)\n\n if params[:commit] == \"save\"\n format.html { redirect_to edit_order_path(@order) }\n format.json { head :no_content }\n else\n format.html { redirect_to @cart }\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "207e1fa4808f91b883eee815023863b6", "score": "0.608189", "text": "def cart_params\n { cart: { } }\n end", "title": "" }, { "docid": "7d9737949023c1a2491af032ccbbadf3", "score": "0.6065574", "text": "def update\n @usuario_cartum = UsuarioCartum.find(params[:id])\n\n respond_to do |format|\n if @usuario_cartum.update_attributes(params[:usuario_cartum])\n format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f891739c08eb329f8ddacd4e23e95d65", "score": "0.6063665", "text": "def update\n # byebug\n current_cart_copy=Cart.where(user_id:current_user.id).first\n newps=params.require(:cart_item).permit(:cart_id, :product_id, :item_quantity)\n current_cart=Cart.find(newps[:cart_id].to_i)\n if current_cart_copy.id==newps[:cart_id].to_i && current_cart.user_id==current_user.id\n product=params[:product];\n unit_product_cost=Product.find(newps[:product_id]).product_cost\n new_total_price=newps[:item_quantity].to_i*unit_product_cost\n newps[:total_price_item]=new_total_price\n respond_to do |format|\n if @cart_item.update(newps)\n format.html { redirect_to carts_url, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n Cart.new_subtotal_price current_cart\n else\n # byebug\n # byebug\n render_404\n end\n end", "title": "" }, { "docid": "94a2a78d13b88c31a95a618a38cf7a6c", "score": "0.6055699", "text": "def update_quantity\n @id=params[:id]\n @quantity=params[:quantity]\n CartItem.where(:cart_id =>@@cartId ,:product_id => @id).limit(1).update_all(:quantity => @quantity) \n redirect_to \"/carts\"\n end", "title": "" }, { "docid": "a8d01e8571696f32cd4e928bbc264040", "score": "0.60548913", "text": "def update\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n if @caracteristica_cartum.update_attributes(params[:caracteristica_cartum])\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04ff223c3492564ce0f4a99ff46167d7", "score": "0.60516495", "text": "def update\n respond_to do |format|\n if @shopping_cart_entry.update(shopping_cart_entry_params)\n format.html { redirect_to shoppingcard_path, notice: 'Shopping cart entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @shopping_cart_entry }\n else\n format.html { render :edit }\n format.json { render json: @shopping_cart_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a6c330cb420eebbcaf9f6f5f804b50d", "score": "0.6046101", "text": "def update\n respond_to do |format|\n if @item.update(item_params)\n itemid = @item.id\n @cartitems = CartItem.where(\"item_id = #{itemid}\")\n @cartitems.each do |cartitem|\n cartitem.available = @item.quantity\n cartitem.save\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f62c61041dbbe76c0b8132110fc7a4d1", "score": "0.60319966", "text": "def update(stuff, quantity, options={})\n if stuff.is_a?(MerchantSidekick::ShoppingCart::LineItem)\n self.update_cart_line_item(stuff, quantity, options)\n else\n self.update_product(stuff, quantity, options)\n end\n end", "title": "" }, { "docid": "513f86468cb7135facd80f493395f437", "score": "0.6027384", "text": "def update\n respond_to do |format|\n if @barcart.update(barcart_params)\n format.html { redirect_to @barcart, notice: 'Barcart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barcart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc30dad73497718dc5bc1f192ccbebe2", "score": "0.6027352", "text": "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "title": "" }, { "docid": "0d350d9a6cf86d1017fecfdc3158ebda", "score": "0.60139006", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Add new item in your cart:' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0be3981beb9509087662f4afe2fee274", "score": "0.6012633", "text": "def update\n @cart = current_cart\n @line_item = LineItem.find(params[:id])\n \n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n flash[:notice] = \"Successfully updated item.\"\n format.html { redirect_to(current_cart_url) }\n format.js # update.rjs\n else\n format.html { redirect_to current_cart_url }\n format.js # update.rjs\n end\n end\n end", "title": "" }, { "docid": "bd72d54dd037692261dd6b565c9415a7", "score": "0.6004763", "text": "def update_quantities\n if params[:quantities]\n params[:quantities].each do |id, num|\n li = @cart.update_quantity(id, num)\n\n if !li\n p = @cart.line_items.find(id) rescue nil\n if p\n (flash[:notice] ||= '') << \"Unable to change quantity of \" +\n \"#{p.name} to #{num}, there are not \"+\n \"enough available at this time.\"\n end\n else #updated quantity\n # update any coupon generated lines for this line\n if cl = li.coupon_line\n cl.coupon.update_quantity_of_coupon_line(cl)\n end \n end\n end\n\n # if any master lines for coupon lines were destroyed,\n # remove their coupon lines as well\n @cart.line_items.select{|x| x.custom_double_line_id}.each do |cl|\n unless @cart.line_items.find_by_id(cl.custom_double_line_id)\n cl.destroy\n end\n end\n\n # (and their coupons)\n @cart.coupons.each do |x|\n @cart.coupons.delete(x) unless x.applies_to?(@cart)\n end\n\n end\n\n # update comments as well\n if params[:cart] and params[:cart][:comments]\n @cart.comments = params[:cart][:comments]\n end\n\n # build the redirect Url Options based on submitted action and\n # what already exists in the session\n uo = {}\n if params[:commit] == 'Checkout'\n uo = build_url_options_for_checkout\n else # just update\n uo = {:controller => 'cart', :action => 'show'}\n end\n\n # save the cart, so we know when the last action was taken on it\n unless @cart.save\n flash[:warning] = \"Unable to save cart: <ul><li>\" +\n \"#{@cart.errors.full_messages.join('</li><li>')}\" + \n \"</li></ul>\"\n end\n\n redirect_to uo\n end", "title": "" }, { "docid": "1cf7526c3e8f80fe311462af20ea8f14", "score": "0.5973617", "text": "def update\n item_quantities = Array.new\n item_quantities = params[:shopping_cart]\n item_list = Hash.new\n @shopping_cart = ShoppingCart.find(params[:id])\n shopping_cart_hash = eval(@shopping_cart.item_list)\n counter = 0\n shopping_cart_hash.each do |item_id, quantity|\n item_list[item_id] = Integer(item_quantities[counter])\n counter += 1\n end\n params[:shopping_cart] = Hash[\"item_list\" => item_list.to_s]\n respond_to do |format|\n if @shopping_cart.update_attributes(params[:shopping_cart])\n format.html { redirect_to @shopping_cart, notice: 'Shopping cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0f4cd97cf4d553045f309a039e85b89", "score": "0.596813", "text": "def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end", "title": "" }, { "docid": "16836f11fe99dd80ea0178f06ce2efd3", "score": "0.59659487", "text": "def update\n respond_to do |format|\n #update consider_cart if current_pet changed\n if @consider_cart.update(consider_cart_params)\n #redirect to the instance variable include parameter\n format.html { redirect_to @consider_cart, notice: 'Consider cart was successfully updated.' } \n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @consider_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5466c3c4445eeee1f10d9c9c59c6d21", "score": "0.5965629", "text": "def edit\n @cart = Cart.find(params[:id])\n end", "title": "" }, { "docid": "192f32157158e9a3e2b63b8248464bd7", "score": "0.59593153", "text": "def update\n respond_to do |format|\n if @cartridge.update(cartridge_params)\n format.html { redirect_to @cartridge, notice: 'Cartridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cartridge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a01a49bb124031c9e5e49f936576f879", "score": "0.59547335", "text": "def update\n respond_to do |format|\n if @join_table_carts_item.update(join_table_carts_item_params)\n format.html { redirect_to @join_table_carts_item, notice: \"Join table carts item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @join_table_carts_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @join_table_carts_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.59205574", "text": "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", "title": "" }, { "docid": "87081cdb9be01516dfd400fcb6c762b6", "score": "0.59015405", "text": "def update\n if @shopping_carts_product.nil?\n # Shopping card product doesn't exist, add to the cart\n product_params = {\n shopping_cart_id: params[:shopping_cart_id],\n product_id: params[:id],\n quantity: 1\n }\n @shopping_carts_product = ShoppingCarts::Product.new(product_params)\n\n if @shopping_carts_product.save\n render_success\n else\n render_error\n end\n else\n # Shopping card product exists, increase quantity by one\n new_quantity = @shopping_carts_product.quantity + 1\n if @shopping_carts_product.update(quantity: new_quantity)\n render_success\n else\n render_error\n end\n end\n\n end", "title": "" }, { "docid": "61ffd2c0ac46f8833bc2b181d70903bf", "score": "0.5875373", "text": "def update\n @call = Call.find(params[:id])\n\n respond_to do |format|page.replace_html('cart', render(@cart))\n\n if @call.update_attributes(params[:call])\n format.html { redirect_to(@call, :notice => 'Call was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @call.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db3d0532756eda3da11f2060700b0c84", "score": "0.5875319", "text": "def set_cart\n render json: {cart: nil} and return if session[:cart_id].nil?\n @cart = Cart.find(session[:cart_id])\n end", "title": "" }, { "docid": "ca854d3ce7bfa3595997b719b5127104", "score": "0.5848629", "text": "def update\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n if @quantity.update_attributes(params[:quantity])\n format.html { redirect_to @quantity, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quantity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca854d3ce7bfa3595997b719b5127104", "score": "0.5848629", "text": "def update\n @quantity = Quantity.find(params[:id])\n\n respond_to do |format|\n if @quantity.update_attributes(params[:quantity])\n format.html { redirect_to @quantity, notice: 'Quantity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quantity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "939213d9663059bf0d64fe1ce04983ed", "score": "0.58337945", "text": "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "title": "" }, { "docid": "789be97e496b6eab272d607886d61253", "score": "0.5833098", "text": "def set_cart\n @cart = current_api_v1_user&.products&.find(params[:id])\n end", "title": "" }, { "docid": "a348e07d860ebbc6692559ee758027c7", "score": "0.582684", "text": "def update\n @basket.set_price\n respond_to do |format|\n if @basket.update(basket_params)\n format.html { redirect_to @basket, notice: 'Basket was successfully updated.' }\n format.json { render :show, status: :ok, location: @basket }\n else\n format.html { render :edit }\n format.json { render json: @basket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "115a5d6c4bf5a1b9e44e607bb201b40e", "score": "0.58260703", "text": "def update\n respond_to do |format|\n if @line_item.update(line_item_params)\n format.html { redirect_to @line_item, notice: 'Line item was added to your cart' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "394800140b93e907f04bcde900accae5", "score": "0.58260626", "text": "def update\n @basket = Basket.find(params[:id])\n\n respond_to do |format|\n if @basket.update_attributes(params[:basket])\n format.html { redirect_to @basket, notice: 'Basket was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f96009e0d50ac8ae269df56e6715351", "score": "0.5820318", "text": "def update\n respond_to do |format|\n if @basket.update(basket_params)\n format.html { redirect_to root_path, notice: 'Basket was successfully updated.' }\n format.json { render :show, status: :ok, location: root_path }\n else\n format.html { render :edit }\n format.json { render json: @basket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "842e33eba4237b4b331a0794542fa05f", "score": "0.5812431", "text": "def set_carts_product\n @carts_product = CartsProduct.find(params[:id])\n end", "title": "" }, { "docid": "4e0e59715d19dce2a47fccc2c67326dd", "score": "0.5805596", "text": "def patch!\n request! :patch\n end", "title": "" }, { "docid": "fec7868deca7132d35e8e74b120e30a8", "score": "0.5797241", "text": "def update\n logger.debug \"***Updating Line Item #{params[:id]} quantity to #{params[:cart_line_item][:quantity]}\"\n @cart_line_item = CartLineItem.find(params[:id])\n @cart_line_item.quantity = params[:cart_line_item][:quantity]\n if @cart_line_item.save\n flash[:success] = \"Cart Item successfully updated\"\n else\n flash[:error] = \"Cart Item update unsuccessful\"\n end\n redirect_to cart_path(session[:cart_id])\n end", "title": "" }, { "docid": "946fdd6f7f3c489446781d0cc856c1f9", "score": "0.57929015", "text": "def update\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n @line_item = @cart.delete_product(product.id)\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a807d9722ab653aa503807c0c6d8dca1", "score": "0.5784985", "text": "def update\n if current_user\n @cart = OrderProduct.find(params[:id])\n product = Product.find(@cart.product_id)\n quantity = params[:quantity].to_i\n total = product.price * quantity\n\n respond_to do |format|\n if @cart.update(quantity: quantity, total: total)\n format.html { redirect_to carts_path}\n # format.json { render :show, status: :ok, location: @order_product }\n format.js {}\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n else\n x = JSON.parse(cookies[:add_to_cart])\n x.each do |item|\n if item[\"product_id\"] == params[:id]\n item[\"quantity\"] = params[:quantity]\n end\n end\n cookies[:add_to_cart] = JSON.generate(x)\n respond_to do |format|\n format.html { redirect_to carts_path }\n format.js {}\n end\n end\n end", "title": "" }, { "docid": "e7663d0348b74542ff1d2f4fd96156fe", "score": "0.5763151", "text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "title": "" }, { "docid": "a7d90374eb77ad8dd9b96ee24a3a1b3a", "score": "0.57584983", "text": "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "title": "" }, { "docid": "50dc6223fd0048592e503bb1883ee75b", "score": "0.57368565", "text": "def update\n respond_to do |format|\n if @catalog_item.update(name: params[:name], description: params[:description])\n format.json { render json: @catalog_item }\n end\n end\n end", "title": "" }, { "docid": "1036fcf706774855c118390255eba7f1", "score": "0.5729749", "text": "def update\n respond_to do |format|\n if @rice3.update(rice3_params)\n format.html { redirect_to @rice3, notice: 'Rice3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @rice3 }\n else\n format.html { render :edit }\n format.json { render json: @rice3.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "370b9e158fb10f3aebacab9230248484", "score": "0.0", "text": "def order_params\n params.require(:order).permit\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
090ae95bb17b06512eeeb4f8010132fe
Read a &39;niatelemetry.PodTimeServerPolicies&39; resource.
[ { "docid": "765ed6985de7c57e2d3a73e887f582d3", "score": "0.44692025", "text": "def get_niatelemetry_pod_time_server_policies_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_pod_time_server_policies_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling NiatelemetryApi.get_niatelemetry_pod_time_server_policies_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/PodTimeServerPolicies/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryPodTimeServerPolicies'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_pod_time_server_policies_by_moid\",\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: NiatelemetryApi#get_niatelemetry_pod_time_server_policies_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "1fecf9b626da1e26d3ec44897995b820", "score": "0.6530546", "text": "def get_niatelemetry_pod_time_server_policies_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_pod_time_server_policies_list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "fbdcb02d1b3e5209243dd6459c2ad5e0", "score": "0.5885025", "text": "def get_niatelemetry_pod_time_server_policies_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_pod_time_server_policies_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/PodTimeServerPolicies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryPodTimeServerPoliciesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_pod_time_server_policies_list\",\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: NiatelemetryApi#get_niatelemetry_pod_time_server_policies_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b483982517cd633b2bafc449b3fd7cd8", "score": "0.53843063", "text": "def access_policy(server)\n settings = JSON.parse(server[:settings] || '{}')\n\n policies = {\n '1' => {\n whitelist: (settings['whitelist'] || '').split\n },\n '2' => {\n blacklist: (settings['blacklist'] || '').split\n }\n }\n\n policy = policies[0]\n if policy_id = server[:access_policy_id]\n policy = policies[policy_id.to_s]\n end\n policy\n end", "title": "" }, { "docid": "b507a99c0d796bcd83fd608e8edf42c5", "score": "0.53296", "text": "def get_niatelemetry_pod_time_server_policies_by_moid(moid, opts = {})\n data, _status_code, _headers = get_niatelemetry_pod_time_server_policies_by_moid_with_http_info(moid, opts)\n data\n end", "title": "" }, { "docid": "7671d5ffc293cf578222ff919728304c", "score": "0.5252616", "text": "def replication_policies_get(opts = {})\n data, _status_code, _headers = replication_policies_get_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "2d500ddc6f5adb5b197b062a602ea82d", "score": "0.504884", "text": "def session_policy\n if provider.nil?\n File.read(read_only_policy)\n end\n end", "title": "" }, { "docid": "889cf8d7759abe92ae090832e7410db7", "score": "0.5029419", "text": "def get_policy\n get_named_policy('p')\n end", "title": "" }, { "docid": "21194eb6f306a86a1a3f3ffcc2048ed4", "score": "0.501537", "text": "def policies\n @policies ||= load_model('Policies')\n end", "title": "" }, { "docid": "8d388d4a9c5a67303b6693c8f27bfc2d", "score": "0.50098956", "text": "def list\n response = @client.get 'policies'\n verify response,\n internal_server_error: 'Internal server error occurred.'\n end", "title": "" }, { "docid": "fe52949a34c4497f4ba8340fecec2af7", "score": "0.4995444", "text": "def read\n @iam.managed_policies.each do |item|\n return item if item.name == @options[:name]\n end\n end", "title": "" }, { "docid": "ad6f459023756886060e29c601ef210f", "score": "0.49811828", "text": "def get_niatelemetry_pod_snmp_policies_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_pod_snmp_policies_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/PodSnmpPolicies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryPodSnmpPoliciesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_pod_snmp_policies_list\",\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: NiatelemetryApi#get_niatelemetry_pod_snmp_policies_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "9904780ed6e115e988d802b51570d839", "score": "0.49795696", "text": "def get_policy(sec, ptype)\n model[sec][ptype].policy\n end", "title": "" }, { "docid": "79f51f23fef6e7b85f8286663cf5bf7c", "score": "0.4958643", "text": "def get_policy(policy_arn)\n request({\n 'Action' => 'GetPolicy',\n 'PolicyArn' => policy_arn,\n :parser => Fog::Parsers::AWS::IAM::SinglePolicy.new\n })\n end", "title": "" }, { "docid": "a6981ae8b6334859755ddf4b4602c82a", "score": "0.494199", "text": "def get_niatelemetry_pod_snmp_policies_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_pod_snmp_policies_list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "b3f1b21d6dbadc9834c9b2601fead2d2", "score": "0.49362865", "text": "def alert_policies\n nr_api.get(url('alerts_policies')).body['policies']\n rescue NoMethodError\n []\n end", "title": "" }, { "docid": "b5ad8d65f66fe3831e19e8729ccbdf56", "score": "0.49266055", "text": "def get_policies(opts = {})\n data, _status_code, _headers = get_policies_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "e0746f132b054facccd1ecb06f81cd26", "score": "0.4921617", "text": "def policy\n load_balancer.policies.get(policy_names.first)\n end", "title": "" }, { "docid": "054c0e58b5137f1c409a3f8540fdf688", "score": "0.49211285", "text": "def get_policy(policy, opts = {})\n raise ArgumentError unless policy.is_a? String\n c = @client[\"#{@account}/policies/#{policy}\"]\n headers = gen_headers(opts)\n attempt(opts[:attempts]) do\n do_get(c, headers)\n end\n\n end", "title": "" }, { "docid": "dfe04d94f3e273b1cd9c60ce8f46f34a", "score": "0.4914628", "text": "def policy_rules\n policy.try(:policy_rules)\n end", "title": "" }, { "docid": "cca58e480d1724707068f2c73db8cda5", "score": "0.4914558", "text": "def policy\n @version ||= policy_base['default_version_id']\n @policy ||= @client.get_policy_version(policy_arn:@arn,version_id:@version).policy_version\n end", "title": "" }, { "docid": "ebc2fa714180f027cd77a4dfc1f03e42", "score": "0.49125898", "text": "def properties\n request = Net::HTTP::Get.new URI.join(\n @base_uri.to_s,\n \"/cloudlets/api/v2/policies/#{@policy_id}/properties\"\n ).to_s\n response = @http_host.request(request)\n response.body\n end", "title": "" }, { "docid": "441683ff2d51f0b4648e325f18cd8569", "score": "0.49005455", "text": "def [] name\n resp = get_policy(:policy_name => name)\n Policy.from_json(URI.unescape(resp.policy_document))\n rescue Errors::NoSuchEntity => e\n nil\n end", "title": "" }, { "docid": "d946b370dc9c5e8ed1b4fb9b4765c017", "score": "0.4894914", "text": "def get_policy\n policy = @bucket_policy.data.policy\n policy.respond_to?(:read) ? policy.read : policy\n rescue Aws::Errors::ServiceError => e\n puts \"Couldn't get the policy for #{@bucket_policy.bucket.name}. Here's why: #{e.message}\"\n nil\n end", "title": "" }, { "docid": "c435e5d7c2a7ccdaaa9077a8540963e8", "score": "0.48328868", "text": "def list_policies\n http_get(uri: '/policies', fields: x_cookie)\n end", "title": "" }, { "docid": "6611832855abc11aeb66f8256d76cab2", "score": "0.48278436", "text": "def get_policies\n grantor.get_policies\n end", "title": "" }, { "docid": "063201a3c348208f4a840a24cd4a799d", "score": "0.48263124", "text": "def policies\n # XXX: ugly multiline regexp to parse the certificate policies and\n # their qualifiers.\n @policies ||= value.scan(/^Policy: [^\\n]+\\n(?: [^:]+: [^\\n]+\\n)*/m).map do |text|\n policy = text.match(/^Policy: ([^\\n]+)/)[1]\n\n cps = if (match = text.match(/^ CPS: ([^\\n]+)/m))\n URI.parse(match[1])\n end\n\n user_notice = if (match = text.match(/^ User Notice: ([^\\n]+)/m))\n match[1]\n end\n\n Policy.new(policy, cps: cps, user_notice: user_notice)\n end\n end", "title": "" }, { "docid": "9154c554281acb449593769f394d051a", "score": "0.48169053", "text": "def get_network_access_policies(network_id)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => network_id\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/accessPolicies'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => network_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "title": "" }, { "docid": "4631738c243978909c4ad1fdb69af02a", "score": "0.48140433", "text": "def list_policies(opts= {})\n c = @client[\"#{@account}/policies\"]\n headers = gen_headers(opts)\n attempt(opts[:attempts]) do\n do_get(c, headers)\n end\n end", "title": "" }, { "docid": "86cc589ddb6bd0e555019e823462e6fc", "score": "0.47867674", "text": "def password_policies\n request_get('/utils/policies')\n end", "title": "" }, { "docid": "0ff97d0d7a4b77aac01904563fd2a9dd", "score": "0.4769259", "text": "def get_policy(policy_arn)\n policy = @iam_resource.policy(policy_arn)\n puts(\"Got policy '#{policy.policy_name}'. Its ID is: #{policy.policy_id}.\")\n rescue Aws::Errors::ServiceError => e\n puts(\"Couldn't get policy '#{policy_arn}'. Here's why:\")\n puts(\"\\t#{e.code}: #{e.message}\")\n raise\n else\n policy\n end", "title": "" }, { "docid": "2d97034b9aefb8856dcefb0b4d827d06", "score": "0.47331125", "text": "def policy\n service.try(:policy)\n end", "title": "" }, { "docid": "a5c3aceea2ff7954db339cdb002a77bb", "score": "0.47140625", "text": "def returnAllPerfPolicies(transport)\n $token=Facter.value('token')\n allPolicies = Array.new\n totalPolicies = doGET(transport['server'], transport['port'], \"/v1/performance_policies\", {\"X-Auth-Token\" => $token})\n\n startRow = 0\n endRow = totalPolicies[\"endRow\"]\n totalRows = totalPolicies[\"totalRows\"]\n\n # Do pagination\n begin\n policies = doGET(transport['server'], transport['port'], \"/v1/performance_policies?startRow=\"+startRow.to_s, {\"X-Auth-Token\" => $token})[\"data\"]\n policies.each do |policy|\n allPolicies.push(policy)\n end\n startRow = startRow + policies.size\n end while (allPolicies.size < totalRows)\n return allPolicies\nend", "title": "" }, { "docid": "0131107ca2debb17b3d02e04e92bb027", "score": "0.46922332", "text": "def get_policies(opts)\n policies = []\n\n if opts[:user].is_a?(User)\n if opts[:query][\"type\"] == 'group'\n policies = opts[:user].group_policies\n else\n policies = opts[:user].policies + opts[:user].group_policies\n end\n end\n\n produce_rest_list(opts[:uri], opts[:rules], opts[:query], policies, \"policies\", [], opts[:user])\nend", "title": "" }, { "docid": "b32f9ad2167b00ffaf84edf06843c235", "score": "0.4690533", "text": "def policy_file_path\n return nil unless has_policy_file?\n File.join(path, \"config/policy.json\")\n end", "title": "" }, { "docid": "66fa498f62aa11ff30492f8497dd5730", "score": "0.466032", "text": "def policy\n unless !topic_attributes['Policy'] || topic_attributes['Policy'].length == 0\n JSON.parse(topic_attributes['Policy'])\n end\n end", "title": "" }, { "docid": "354ae8cf34201f5620d75b0e1ddc85cb", "score": "0.46222582", "text": "def get_policy_all\n # Get all policy instances and print/return\n @command_array.unshift(@last_arg) unless @last_arg == 'default'\n policy_all = get_object(\"policies\", :policy)\n print_object_array @policies.get, \"Policies\", :style => :table\n end", "title": "" }, { "docid": "a924e15463ecad114e15e86116988b35", "score": "0.46058258", "text": "def load_policy_file(policy_file)\n if policy_file\n Log.info('Loading policy file %s' % policy_file)\n begin\n return YAML.load_file(policy_file)\n rescue ArgumentError => e\n deny('Cannot parse policy file. Reason - %s' % e)\n end\n end\n end", "title": "" }, { "docid": "bf6154ec339414f9444c4befaefee103", "score": "0.45990574", "text": "def policies\n return @policies\n end", "title": "" }, { "docid": "bf6154ec339414f9444c4befaefee103", "score": "0.45990574", "text": "def policies\n return @policies\n end", "title": "" }, { "docid": "218796b453b897c5ab5e9dbae0c318fd", "score": "0.45804387", "text": "def get_all_policies\n @command = :get_all_policies\n # if it's a web command and the last argument wasn't the string \"default\" or \"get\", then a\n # filter expression was included as part of the web command\n @command_array.unshift(@prev_args.pop) if @web_command && @prev_args.peek(0) != \"default\" && @prev_args.peek(0) != \"get\"\n # Get all policy instances and print/return\n #puts \"get_all_policies\"\n print_object_array @client.get_all_policies, \"Policies\"\n #print_object_array get_object(\"policies\", :policy), \"Policies\", :style => :table\n end", "title": "" }, { "docid": "5ec2278de71c6c1e1bb069c030ca9d4d", "score": "0.45355612", "text": "def get_policy_templates\n @command = :get_policy_templates\n if @web_command && @prev_args.peek(0) != \"templates\"\n not_found_error = \"(use of aliases not supported via REST; use '/policy/templates' not '/policy/#{@prev_args.peek(0)}')\"\n raise ProjectRazor::Error::Slice::NotFound, not_found_error\n end\n # We use the common method in Utility to fetch object templates by providing Namespace prefix\n # print_object_array get_child_templates(ProjectRazor::PolicyTemplate), \"\\nPolicy Templates:\"\n print_object_array @client.get_policy_templates\n end", "title": "" }, { "docid": "ec681984d2e581a3d3675dcb9e16735b", "score": "0.4533329", "text": "def get_server_properties\n http_get(uri: '/server/properties', fields: x_cookie)\n end", "title": "" }, { "docid": "fcbdf129543d7ede634343de199307a1", "score": "0.45239687", "text": "def get_policy\n request = get_policy_request\n request.send\n end", "title": "" }, { "docid": "b4efed17fc63f1a7840209103d3f0cd9", "score": "0.45238715", "text": "def list_policies(options={})\n request({\n 'Action' => 'ListPolicies',\n :parser => Fog::Parsers::AWS::IAM::ListManagedPolicies.new\n }.merge(options))\n end", "title": "" }, { "docid": "b4efed17fc63f1a7840209103d3f0cd9", "score": "0.45231533", "text": "def list_policies(options={})\n request({\n 'Action' => 'ListPolicies',\n :parser => Fog::Parsers::AWS::IAM::ListManagedPolicies.new\n }.merge(options))\n end", "title": "" }, { "docid": "590e7245e058b61455676a198010490b", "score": "0.4510989", "text": "def policy\n @policy\n end", "title": "" }, { "docid": "198b7493379a6feff4c6ca950c322000", "score": "0.45091456", "text": "def list_policies(count)\n policy_arns = []\n @iam_resource.policies.limit(count).each_with_index do |policy, index|\n puts(\"\\t#{index + 1}: #{policy.policy_name}: #{policy.arn}\")\n policy_arns.append(policy.arn)\n end\n rescue Aws::Errors::ServiceError => e\n puts(\"Couldn't list policies for the account. Here's why:\")\n puts(\"\\t#{e.code}: #{e.message}\")\n raise\n else\n policy_arns\n end", "title": "" }, { "docid": "de3b4dee5302fb3fc45f39ddb8d0e89d", "score": "0.44967064", "text": "def _get_policy(policy_type)\n raise ::CORBA::NO_IMPLEMENT\n end", "title": "" }, { "docid": "90c0d786786c7e06e93a4c5bed1c7825", "score": "0.4469682", "text": "def read_policy_service(opts = {})\n data, _status_code, _headers = read_policy_service_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "4a910036602673d9a5dacc3126e02c9c", "score": "0.44677743", "text": "def read_namespaced_pod(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_pod_with_http_info(name, namespace, opts)\n return data\n end", "title": "" }, { "docid": "bd881761dfddd29166e437b1b137a5c1", "score": "0.4467078", "text": "def get_niatelemetry_pod_comm_policies_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_pod_comm_policies_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/niatelemetry/PodCommPolicies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'NiatelemetryPodCommPoliciesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"NiatelemetryApi.get_niatelemetry_pod_comm_policies_list\",\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: NiatelemetryApi#get_niatelemetry_pod_comm_policies_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "1f44b02668967a8c8429a4a4c3956c00", "score": "0.44641384", "text": "def list request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::ListResourcePoliciesRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/resourcePolicies\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::ResourcePolicyList.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "title": "" }, { "docid": "5523cb4c1c0eb08cc5b63431a7730dc8", "score": "0.4458936", "text": "def fetch_policy(options = {})\n if @policy.nil? || options[:no_caching] then\n mech = Mechanize.new\n mech.auth(@user, @pass)\n page = mech.get(\"https://#{@host}:#{@port}/Policy/Current\")\n @policy = page.parser.xpath('/html/body/pre').inner_text\n end\n @policy\n end", "title": "" }, { "docid": "50e089323a48f7286794212d3debc603", "score": "0.44447786", "text": "def show\n @policy.mark_as_read! for: current_user\n @unread_policy_ids = Policy.unread_by(current_user).map(&:id)\n end", "title": "" }, { "docid": "303f87b97ae18a3ff4d4aa929dfcbbea", "score": "0.4433258", "text": "def activity_based_timeout_policies\n return @activity_based_timeout_policies\n end", "title": "" }, { "docid": "95d386656d41e2e611d270c4d7bcc6ac", "score": "0.44301435", "text": "def get_policy_templates\n # We use the common method in Utility to fetch object templates by providing Namespace prefix\n print_object_array get_child_templates(ProjectRazor::PolicyTemplate), \"\\nPolicy Templates:\"\n end", "title": "" }, { "docid": "88a463350f11375680b7aa813378c2b6", "score": "0.44270885", "text": "def access_policy\n if @options[:acl].to_s == \"public\"\n \"public-read\"\n else\n \"private\"\n end\n end", "title": "" }, { "docid": "cb7f6a140fcb7cb27d264bf3036cf01c", "score": "0.4424872", "text": "def get_iam_policy request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::GetIamPolicyResourcePolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/resourcePolicies/#{request_pb.resource}/getIamPolicy\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Policy.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "title": "" }, { "docid": "faa73e88e5bbb24f590965af2e3eb309", "score": "0.44231215", "text": "def get request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::GetResourcePolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/resourcePolicies/#{request_pb.resource_policy}\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::ResourcePolicy.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "title": "" }, { "docid": "350aa0e4eb43c90e89c3ff4560b8bd2a", "score": "0.44146773", "text": "def policy\n return @policy\n end", "title": "" }, { "docid": "dd9ddf545fe7741eba5c3d85bf897298", "score": "0.44083244", "text": "def existing_rules\n request = Net::HTTP::Get.new URI.join(@base_uri.to_s, \"cloudlets/api/v2/policies/#{@policy_id}/versions/#{@version_id}?omitRules=false&matchRuleFormat=1.0\").to_s\n response = @http_host.request(request)\n response.body\n end", "title": "" }, { "docid": "b6d31673b23a5f2241cad954eed40f40", "score": "0.44011837", "text": "def get_policy(uuid, opts = {})\n data, _status_code, _headers = get_policy_with_http_info(uuid, opts)\n data\n end", "title": "" }, { "docid": "0e2122fd8b82cb42fd8ab0ac3ea5f676", "score": "0.43975192", "text": "def token_lifetime_policies()\n return MicrosoftGraph::ServicePrincipals::Item::TokenLifetimePolicies::TokenLifetimePoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "946ccc50a4923da6837baac575853c37", "score": "0.4393552", "text": "def get_policy(project_name, preheat_policy_name, opts = {})\n data, _status_code, _headers = get_policy_with_http_info(project_name, preheat_policy_name, opts)\n data\n end", "title": "" }, { "docid": "c4673c6c9360e59e01b964f0f4209489", "score": "0.43921128", "text": "def replication_policies_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProductsApi.replication_policies_get ...'\n end\n # resource path\n local_var_path = '/replication/policies'\n\n # query parameters\n query_params = {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<ReplicationPolicy>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsApi#replication_policies_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d3ea409472cd59346b8606b1aff0abe9", "score": "0.43773043", "text": "def policy\n @options[:policy]\n end", "title": "" }, { "docid": "364271c74edd531022f39662b404f6df", "score": "0.43762517", "text": "def policy\n Organization.get_typed_organization(organization).get_policy\n end", "title": "" }, { "docid": "fee384cc34a2ee8995d0dcd00feb351f", "score": "0.43732855", "text": "def policies\n end", "title": "" }, { "docid": "cdaa3709c7268b0c160a57ce31b742d2", "score": "0.4371428", "text": "def policies()\n return MicrosoftGraph::Identity::ConditionalAccess::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "a29b7a18326c37861d4d6ac4aea390d9", "score": "0.43709296", "text": "def policy_name(node)\n return unless repo_has_policyfile?(node)\n policy = nil\n File.foreach(repo_path(node, 'Policyfile.rb')) do |l|\n m = /^\\s*name ['\"]([a-zA-Z0-9_-]+)[\"']/.match(l)\n if m\n policy = m[1]\n break\n end\n end\n policy\n end", "title": "" }, { "docid": "2fa6c064f1ca6d5754110e19f2fc7bee", "score": "0.43707082", "text": "def policy\n request uri(\"/\", query: \"policy\")\n end", "title": "" }, { "docid": "8186198fe8ef4e14253e7c20d503a568", "score": "0.43456462", "text": "def get_network_client_policy(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'client_id' => options['client_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/clients/{clientId}/policy'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'clientId' => options['client_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "title": "" }, { "docid": "626568915ef0e3eab7f9c0061b1ab5da", "score": "0.4333483", "text": "def get_policy_from_bundle(bundle)\n @policies[policy_name_from_bundle(bundle)]\n end", "title": "" }, { "docid": "d734249a690e5680b412f0569d619a9d", "score": "0.43273664", "text": "def termination_policies\n data[:termination_policies]\n end", "title": "" }, { "docid": "570d750b9a3c818b2354179be90a3d9e", "score": "0.430721", "text": "def podlingStatus\n incubator_content = ASF::SVN['incubator-podlings']\n resource_yml = File.join(incubator_content, \"#{@resource}.yml\")\n if File.exist?(resource_yml)\n rawYaml = Psych.load_file(resource_yml, permitted_classes: [Date, Symbol])\n hash = { }\n hash[:sga] = rawYaml[:sga].strftime('%Y-%m-%d') if rawYaml[:sga]\n hash[:asfCopyright] = rawYaml[:asfCopyright].strftime('%Y-%m-%d') if rawYaml[:asfCopyright]\n hash[:distributionRights] = rawYaml[:distributionRights].strftime('%Y-%m-%d') if rawYaml[:distributionRights]\n hash[:ipClearance] = rawYaml[:ipClearance].strftime('%Y-%m-%d') if rawYaml[:ipClearance]\n hash[:sourceControl] = rawYaml[:sourceControl]\n hash[:wiki] = rawYaml[:wiki]\n hash[:jira] = rawYaml[:jira]\n hash[:proposal] = rawYaml[:proposal]\n hash[:website] = rawYaml[:website]\n hash[:news] = []\n rawYaml[:news]&.each do |ni|\n newsItem = {}\n newsItem[:date] = ni[:date].strftime('%Y-%m-%d')\n newsItem[:note] = ni[:note]\n hash[:news].push(newsItem)\n end\n hash\n else\n {news: [], website: \"http://#{self.resource}.incubator.apache.org\"}\n end\n end", "title": "" }, { "docid": "ae1bd2b44b11bf665cb8c8c87bd7b91d", "score": "0.43070146", "text": "def server_selector\n warn '[Deprecated] Use #policy instead of #server_selector'\n policy\n end", "title": "" }, { "docid": "4136b9b9b05ed18fdeb56c7ff7d6820b", "score": "0.43035066", "text": "def parse_ttl_timeout\n File.readlines(AWS_SUDO_FILE).each do |line|\n return line.split('=')[1].chomp if line.include?('AWS_TOKEN_TTL')\n end\n end", "title": "" }, { "docid": "e0f3fa22d09a3d36c544b7855bdbf79b", "score": "0.43013126", "text": "def get_policies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyApi.get_policies ...'\n end\n # resource path\n local_var_path = '/api/3/policies'\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'scannedOnly'] = opts[:'scanned_only'] if !opts[:'scanned_only'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;charset=UTF-8'])\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 => 'PageOfPolicy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyApi#get_policies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "500f7fd27a159b3518749b73128500e6", "score": "0.42989054", "text": "def details(policy_id)\n response = @client.get \"policies/#{policy_id}\"\n verify response,\n not_found: 'Could not find a policy with that ID.'\n end", "title": "" }, { "docid": "cd6aafa4ad010349f447b70ae34fe670", "score": "0.42964944", "text": "def pod\n return @pod\n end", "title": "" }, { "docid": "4c41e13599264919d700bf882cd67207", "score": "0.42838985", "text": "def read_policyfile_lock(dir)\n lock = File.join(dir, 'Policyfile.lock.json')\n raise \"File #{lock} does not exist\" unless File.exist?(lock)\n content = JSON.parse(File.read(lock))\n raise 'Policyfile.lock empty' if content.empty?\n content\n end", "title": "" }, { "docid": "4f9a5968c367dfb972c1887b90173a52", "score": "0.42768648", "text": "def index\n @olympics = policy_scope(Olympic)\n end", "title": "" }, { "docid": "d021a61fb01cb4018b73a79200cf4477", "score": "0.42753962", "text": "def get_container_network_policy(network_policy_id, opts = {})\n data, _status_code, _headers = get_container_network_policy_with_http_info(network_policy_id, opts)\n data\n end", "title": "" }, { "docid": "60bd7c02d35586d4df0d40170bcefa8a", "score": "0.42746198", "text": "def policyfile_loaded(policy); end", "title": "" }, { "docid": "d8b39c85aa885da0f038a983b00d6387", "score": "0.42725432", "text": "def policy_type\n data[:policy_type]\n end", "title": "" }, { "docid": "89a6e9665cb7dcd40aded4f41bedd6c0", "score": "0.42652684", "text": "def get_policy(policy_id, opts = {})\n data, _status_code, _headers = get_policy_with_http_info(policy_id, opts)\n data\n end", "title": "" }, { "docid": "064c69911243c8269a3966002c04b2da", "score": "0.42595848", "text": "def policy_time_out\n @policy_time_out ||= (Time.new.utc+(policy_expiration*60)).strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n end", "title": "" }, { "docid": "95df69f6f2821365ad4050c46dfeffc0", "score": "0.42548168", "text": "def read_endpoint_policy_0_with_http_info(domain_id, endpoint_policy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecurityEndpointProtectionRulesApi.read_endpoint_policy_0 ...'\n end\n # verify the required parameter 'domain_id' is set\n if @api_client.config.client_side_validation && domain_id.nil?\n fail ArgumentError, \"Missing the required parameter 'domain_id' when calling PolicySecurityEndpointProtectionRulesApi.read_endpoint_policy_0\"\n end\n # verify the required parameter 'endpoint_policy_id' is set\n if @api_client.config.client_side_validation && endpoint_policy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'endpoint_policy_id' when calling PolicySecurityEndpointProtectionRulesApi.read_endpoint_policy_0\"\n end\n # resource path\n local_var_path = '/global-infra/domains/{domain-id}/endpoint-policies/{endpoint-policy-id}'.sub('{' + 'domain-id' + '}', domain_id.to_s).sub('{' + 'endpoint-policy-id' + '}', endpoint_policy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EndpointPolicy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecurityEndpointProtectionRulesApi#read_endpoint_policy_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "59c559b6bb8a8b644c52fb2f342fbc6c", "score": "0.42524737", "text": "def describe_policies(options = {})\n if policy_names = options.delete('PolicyNames')\n options.merge!(AWS.indexed_param('PolicyNames.member.%d', [*policy_names]))\n end\n request({\n 'Action' => 'DescribePolicies',\n :parser => Fog::Parsers::AWS::AutoScaling::DescribePolicies.new\n }.merge!(options))\n end", "title": "" }, { "docid": "07c53208df49a83158bf41b27f772e4c", "score": "0.4252193", "text": "def get_policy\n # stub method\n puts 'call get_policy'\n end", "title": "" }, { "docid": "b02af0ee5976198db4624188f15b794c", "score": "0.42451143", "text": "def policy\n @property_hash[:policy] || nil\n end", "title": "" }, { "docid": "036ba981dc545eb5095ce5047174a7d1", "score": "0.42446136", "text": "def policies\n @elb.policies\n end", "title": "" }, { "docid": "0e90fd6a070c6e29045dd93b033c9396", "score": "0.42426097", "text": "def current_epli_policy\n policies.where(business_product: Business::Product.find_by(name: 'EPLI')).order(policy_year: :desc).first\n end", "title": "" }, { "docid": "822431354ec8e1189b5ab7971cbd46fc", "score": "0.424183", "text": "def read_princesses\n JSON.parse(File.read(\"princesses.json\"))\nend", "title": "" }, { "docid": "6175396fa53f0504ced04c15018c1daa", "score": "0.42395496", "text": "def download_cloud_workload_policy_file(opts = {})\n data, _status_code, _headers = download_cloud_workload_policy_file_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "04a0fd48849bb86c8adca197c99a4f47", "score": "0.42369258", "text": "def list_policies\n unless @config.policies\n command = Bolt::Util.powershell? ? 'New-BoltPolicy -Name <NAME>' : 'bolt policy new <NAME>'\n\n raise Bolt::Error.new(\n \"Project configuration file #{@config.project.project_file} does not \"\\\n \"specify any policies. You can add policies to the project by including \"\\\n \"a 'policies' key or creating a new policy using the '#{command}' \"\\\n \"command.\",\n 'bolt/no-policies-error'\n )\n end\n\n { policies: @config.policies.uniq, modulepath: pal.user_modulepath }\n end", "title": "" }, { "docid": "7fae8b3e76b045e1043fff7e02fb565a", "score": "0.42261383", "text": "def policy_arn\n data[:policy_arn]\n end", "title": "" }, { "docid": "9819f10d1cec770dc99fae44d37b7b6c", "score": "0.4223264", "text": "def index\n @timeslots = Timeslot.where(course_id: @course)\n @timeslots = policy_scope(Timeslot).order(created_at: :desc)\n end", "title": "" }, { "docid": "79e7e02a13433e53af5bd0741127cce5", "score": "0.42213482", "text": "def privacy_policy\n @policy = Policy.where(name: 'privacy_policy').first\n respond_to do |format|\n format.html {render 'policies/show'}\n end\n end", "title": "" }, { "docid": "782e5a2c3f4f8418321202227cde8ed9", "score": "0.42139867", "text": "def policy_type\n data.policy_type\n end", "title": "" } ]
b46a08f3ac72645e28f0c4444cc21663
DELETE /customer_relationships/1 DELETE /customer_relationships/1.json
[ { "docid": "76457991d9fe56f5a1800409ba15ac2d", "score": "0.73220056", "text": "def destroy\n @customer_relationship.destroy\n respond_to do |format|\n format.html { redirect_to @business_model_canvase }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "c82c02a37824d0a5c7e310717574cf87", "score": "0.7108075", "text": "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "title": "" }, { "docid": "42934bbd294d5c8147727043f7f0db99", "score": "0.6780105", "text": "def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end", "title": "" }, { "docid": "d8870607fb825842c2d9e1c8cc8d051c", "score": "0.67664415", "text": "def delete_relationship(id)\n return @client.raw(\"delete\", \"/config/relationships/#{id}\")\n end", "title": "" }, { "docid": "55c60a5237d1cf2a7c13c3cc7535e7c1", "score": "0.67616886", "text": "def destroy\n @dependent_relationship = DependentRelationship.find(params[:id])\n @dependent_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to dependent_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "274179a919c01ca8a790878446138763", "score": "0.67610437", "text": "def destroy\n @vendor_relationship = VendorRelationship.find(params[:id])\n @vendor_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to vendor_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6383d4a9142205c254c772b5223316c1", "score": "0.6685182", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8ec9299020aec1ad3eba9195b30ec45", "score": "0.66746634", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "376c8027a40aa9a5b06f498e6c56d945", "score": "0.66738623", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "316db473129bc832a7eeffc058ea2764", "score": "0.6670696", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "316db473129bc832a7eeffc058ea2764", "score": "0.6670696", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "950c3a2989cbd482a749b70a68f6c143", "score": "0.6636869", "text": "def destroy\n @relationships = Relationship.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @relationship = Relationship.find(params[:id])\n @error = nil\n\n begin\n @relationship.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n @error = e.message\n end\n end", "title": "" }, { "docid": "702f1a8954555822e4f1722204673ed3", "score": "0.663087", "text": "def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6bf2afd5b59da9701fb9aa0438a0dab", "score": "0.6611135", "text": "def destroy\n @customer.destroy\n end", "title": "" }, { "docid": "f5c7cbb7441829c3ccd573a137264d2b", "score": "0.66062444", "text": "def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "e7815f4166a547a6ef2bf1de885a7311", "score": "0.6599828", "text": "def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d69f26f13eb0d3491bc26f7073dd6af8", "score": "0.6596094", "text": "def destroy\n @reach_out_to_customer.destroy\n respond_to do |format|\n format.html { redirect_to reach_out_to_customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6bdd118c92efde6c62e9c08dc4c35300", "score": "0.6593719", "text": "def delete\n @relationship = Relationship.find(params[:relationship_id])\n end", "title": "" }, { "docid": "344565db8cff4719e91bb3388b62474d", "score": "0.65932465", "text": "def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3b04c30b4a7627161d9397171cfb6019", "score": "0.6570181", "text": "def destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8573f087a6a715dca09ac7a31ffe4ee7", "score": "0.65693504", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "1f29527e28fe9ae78aaa62f06ed8d113", "score": "0.65641713", "text": "def destroy\n @relationship = Relationship.find(params[:id])\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(relationships_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "331a48c5557bc710ee294ed5f282f7bd", "score": "0.65326947", "text": "def destroy\n @customer_set.destroy\n respond_to do |format|\n format.html { redirect_to customer_sets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8bf65d305e24cd23238dd62838db081", "score": "0.6515486", "text": "def destroy\n @relationship = @assembly.relationships.find(params[:id])\n child = @relationship.child\n child.used = false\n child.save\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "88af12f202c164397ce706b1702b5686", "score": "0.6502353", "text": "def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "title": "" }, { "docid": "1ba38443dfce0ca2ad5dc72a34f59fb5", "score": "0.6496355", "text": "def destroy\n @campaign_user_relationship = CampaignUserRelationship.find(params[:id])\n @campaign_user_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to @campaign_user_relationship.campaign }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5d02d8a690bd63e8ea25acecf79ed6f6", "score": "0.6483892", "text": "def destroy\n @customer_customer.destroy\n respond_to do |format|\n format.html { redirect_to customer_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "40747d5ca3875742cfe7176da2f2e114", "score": "0.64704555", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f2557c99840c6f2a7ac90874162e4a46", "score": "0.6467195", "text": "def destroy\n @agency_relationship = AgencyRelationship.find(params[:id])\n @agency_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(agency_relationships_url) }\n end\n end", "title": "" }, { "docid": "b3bd22cfbecd82feb323e08b61ed311a", "score": "0.6463944", "text": "def destroy\n @self_service_customer = SelfService::Customer.find(params[:id])\n @self_service_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(self_service_customers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "740435dec00149dee153963c068bb798", "score": "0.64609003", "text": "def destroy\n @single_customer.destroy\n respond_to do |format|\n format.html { redirect_to single_customers_url, notice: 'Single customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "11549c587c0bbccb64190833fd93b6e0", "score": "0.64569074", "text": "def destroy\n @potential_customer = PotentialCustomer.find(params[:id])\n @potential_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to potential_customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "459090fb7388f2c2bdfd66d41ff251a5", "score": "0.6445339", "text": "def destroy\n @customer.destroy\n redirect_to customers_url\n end", "title": "" }, { "docid": "8d2fcdeb757770c63383fff3fc4d5d24", "score": "0.644192", "text": "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "12398b23c2fb57a555edefeb34f488c6", "score": "0.6437938", "text": "def destroy\n @creator_accession_relationship = CreatorAccessionRelationship.find(params[:id])\n @creator_accession_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_accession_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "253386726154381843e18033edfc597c", "score": "0.6437829", "text": "def destroy\n @expression_relationship = ExpressionRelationship.find(params[:id])\n @expression_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f179b551de2cb8935f6088914606345", "score": "0.64358383", "text": "def destroy\n @comment_relationship = CommentRelationship.find(params[:id])\n @comment_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95b068ab06522673b9f5111416fc72c7", "score": "0.6426822", "text": "def destroy\n @relationship.destroy\n respond_to do |format|\n format.html { redirect_to relationships_url, notice: 'Relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95b068ab06522673b9f5111416fc72c7", "score": "0.6426822", "text": "def destroy\n @relationship.destroy\n respond_to do |format|\n format.html { redirect_to relationships_url, notice: 'Relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73bace07b3c459670328570e165c56e4", "score": "0.6411305", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c35f79e5baccc44a89806f07f57d9df7", "score": "0.64083576", "text": "def delete_customer_by_id(customer_id)\n host = Swagger.configuration.host\n api_key = Swagger.configuration.private_api_key\n\n conn = Faraday.new\n resp = conn.delete do |req|\n req.url \"https://#{host}/api/customer/#{customer_id}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = 'Basic ' + [\"#{api_key}:\"].pack('m').delete(\"\\r\\n\")\n end\n body = JSON.parse(resp.body)\n Swagger::Response.new(resp.status, body)\n return body\n end", "title": "" }, { "docid": "b552a39abb8a7de6568cdf4e585a4263", "score": "0.6401717", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15c9f8681a5d1424cb2be780c9ff8480", "score": "0.6392093", "text": "def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "652aeef89bfc76acff7a25100c15c0d4", "score": "0.63889915", "text": "def destroy\n requires :customer_gateway_id\n \n service.delete_customer_gateway(customer_gateway_id)\n true\n end", "title": "" }, { "docid": "a48f212e53c0aa914f29253c898d759f", "score": "0.63868463", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2d2930e6b0e31546de500e8f3fb024a7", "score": "0.6383215", "text": "def destroy\n @my_customer.destroy\n respond_to do |format|\n format.html { redirect_to my_customers_url, notice: 'My customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f45ec5db21e588967e40f20fe0635d4d", "score": "0.6379177", "text": "def destroy\n @cust = Cust.find(params[:id])\n @cust.destroy\n\n respond_to do |format|\n format.html { redirect_to custs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.63765085", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3cbde696ab960aaea2a064284c5f6a2", "score": "0.6376182", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "99144fd5c19b18cfd0b94f3024c96778", "score": "0.6372662", "text": "def destroy\n @custo = Custo.find(params[:id])\n @custo.destroy\n\n respond_to do |format|\n format.html { redirect_to custos_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "387c179473eb331bb4caea9063c569ef", "score": "0.6372177", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "387c179473eb331bb4caea9063c569ef", "score": "0.6372177", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d05387283c02f99a62e721ee6e3b0f22", "score": "0.63709587", "text": "def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e260fca51725c0a3a52cb82177a80d5d", "score": "0.6363545", "text": "def destroy\n begin\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t('messages.deleted', model:Customer.model_name.human) }\n format.json { head :no_content }\n end\n rescue ActiveRecord::InvalidForeignKey => e\n flash[:error] = t 'errors.messages.delete_fail.being_used', model:@customer.name\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n rescue ActiveRecord::StatementInvalid => e\n flash[:error] = t 'errors.messages.ops'\n flash[:error_details] = e\n redirect_to [:admin, @customer]\n end\n end", "title": "" }, { "docid": "8f99fee5b513b685a605e6c91ea61d0b", "score": "0.6353569", "text": "def destroy\n @wx_relationship.destroy\n respond_to do |format|\n format.html { redirect_to wx_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b7a4cf63aaac4cfbd3267ece6210574a", "score": "0.6352748", "text": "def destroy\n @medicine_patient_relationship = MedicinePatientRelationship.find(params[:id])\n @medicine_patient_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to medicine_patient_relationships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6f2fb514f90ae43ceb0b68cd18aeaa7f", "score": "0.63356704", "text": "def destroy\n # @customer.destroy\n # respond_to do |format|\n # format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "title": "" }, { "docid": "2ff51bf5afd9fed3e112c78a24da25b4", "score": "0.63335735", "text": "def destroy\n @user_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_relationships_url, notice: 'User relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eb1d6e78db1748caa964dd0c0dc1cab4", "score": "0.6325961", "text": "def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3f1cdf9eba66a325cdc3707f55c806cf", "score": "0.632419", "text": "def destroy\n @customer_account.destroy\n respond_to do |format|\n format.html { redirect_to customer_accounts_url, notice: 'Customer account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0477c2fab51fc204c2b353df3ee9b8bf", "score": "0.63188237", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc1e005bc3aafd621456123dd15eae93", "score": "0.6318822", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "bc1e005bc3aafd621456123dd15eae93", "score": "0.6318822", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "bc1e005bc3aafd621456123dd15eae93", "score": "0.6318822", "text": "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "95b96aa82d06b329d22d83ba3d76fe38", "score": "0.6290665", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Person wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8424ad7e2fa17c4b46166373a4d2f1e1", "score": "0.62788624", "text": "def destroy\n @relationship = @character.relationships.find_by_permalink!(params[:id])\n @relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(character_relationships_url(@character)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a8bb37be324968d7636fef42d8baab5e", "score": "0.6275658", "text": "def destroy\n @customer.destroy\n respond_to do |format|\n format.html {\n redirect_to campaign_customers_path\n #redirect_to :controller => 'reviews', :action => 'show', :id => @customer.campaign_id\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4a3b0714ea96d4adc405d8396bc16b3", "score": "0.62747705", "text": "def destroy\n @customer_segment.destroy\n respond_to do |format|\n format.html { redirect_to @business_model_canvase }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.6264964", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "342547f94f55dd4ee3d6de958468b8c5", "score": "0.6262277", "text": "def destroy\n authorize @customer, :destroy?\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "630b9008de4c4b33e228e88c003c0015", "score": "0.6260912", "text": "def destroy\n @customers_address = CustomersAddress.find(params[:id])\n @customers_address.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_addresses_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
84e9fe838590c13dabfad4a2e1492f46
If navigationcontact selected, redirect back to contactcontact
[ { "docid": "097c2d3c3412ab447fa9e3126e4e371c", "score": "0.7960989", "text": "def contact\n redirect_to navigation_contact_path\n end", "title": "" } ]
[ { "docid": "351ea15a9d1e55978895035bfc5c301a", "score": "0.64472336", "text": "def index\n redirect_to :new_contact\n end", "title": "" }, { "docid": "6cfbf17984d499032e6aafa48b5602dc", "score": "0.64176047", "text": "def redirect_user_to_dashboard\n redirect_to dashboard_path if current_contact\n end", "title": "" }, { "docid": "be229773f62798df936511fd147223ef", "score": "0.62210566", "text": "def index\n redirect_to new_contact_path\n end", "title": "" }, { "docid": "be229773f62798df936511fd147223ef", "score": "0.62210566", "text": "def index\n redirect_to new_contact_path\n end", "title": "" }, { "docid": "a6a650f922f18463c008bff8f74fed34", "score": "0.5980509", "text": "def contact_to(a)\n if user_signed_in?\n link_to contact_status(a),\n edit_contact_path(current_subject.contact_to!(a)),\n :title => t(\"contact.new.title\",\n :name => a.name)\n else\n link_to t(\"contact.new.link\"), new_user_session_path\n end\n end", "title": "" }, { "docid": "6ee116c9368a4e7b777880adb0f5524e", "score": "0.59273887", "text": "def set_contact\n @contact = Contact.find_by_id(params[:id])\n if(@contact == nil)\n redirect_to(contacts_path,notice: 'Ingen kontakt hittades.')\n end\n end", "title": "" }, { "docid": "e3e8bebd0071bae534789e34052e6418", "score": "0.5865554", "text": "def contact_to(a)\n if user_signed_in?\n contact_link current_subject.contact_to!(a)\n else\n link_to t(\"contact.new.link\"), new_user_session_path\n end\n end", "title": "" }, { "docid": "e3e8bebd0071bae534789e34052e6418", "score": "0.5865554", "text": "def contact_to(a)\n if user_signed_in?\n contact_link current_subject.contact_to!(a)\n else\n link_to t(\"contact.new.link\"), new_user_session_path\n end\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.5852057", "text": "def contact\n end", "title": "" }, { "docid": "d7ccf148abd59ea39e2b159b34df69dd", "score": "0.58481234", "text": "def redirectToContactDetail\n url = @driver.current_url();\n #puts url\n newUrl = url.split('/003')\n #puts newUrl\n @driver.get \"#{newUrl[0]}\" + \"/#{@@contactCreation[0][\"Id\"]}\"\n end", "title": "" }, { "docid": "cbadea63f041cf3d90398a62469caad3", "score": "0.58323705", "text": "def contact\n\n end", "title": "" }, { "docid": "cbadea63f041cf3d90398a62469caad3", "score": "0.58323705", "text": "def contact\n\n end", "title": "" }, { "docid": "537bd6fa77549be3f686c3c368e27526", "score": "0.582524", "text": "def contact_select\n $testCaseID = \"VT229-0013\"\n con_remove\n createContact 20\n @contact = Rho::RhoContact.find(:all, :select => [\"id\", \"last_name\"], :conditions => {:phone => 'not_nil'})\n puts @contact\n redirect :action => :index\n end", "title": "" }, { "docid": "30924d555fb86212da5d55b519b6b1f7", "score": "0.5820717", "text": "def contact\n\t\trender \"dashboard/contact\"\n\tend", "title": "" }, { "docid": "e4a1f43acd76b12c95d174f64d0a97a7", "score": "0.5768116", "text": "def go_back\n \n if current_user.google\n @access_token = current_user.google.client\n \n # TODO: move the url to a configuration file YAML\n @string = @access_token.get('https://www.google.com/m8/feeds/contacts/default/full?max-results=1000');\n \n doc = REXML::Document.new(@string.body.to_s)\n \n @suggestions = []\n \n doc.elements.each('feed/entry') do |e|\n if e.elements['gd:email']\n email = e.elements['gd:email'].attributes['address']\n title = e.elements['title'].text || email\n \n # TODO: make the function return the value to be added to suggestions \n # and use inject not each\n process_contact_email title, email\n end\n end \n\n redirect_to :controller => 'friendships', :action => 'index', :finding_people => @suggestions.join(\"-\")\n end\n \n end", "title": "" }, { "docid": "1f2251b73b266f1dfc9cc6ad23339379", "score": "0.5761289", "text": "def go_back\n redirect_to '/account/property-syndication'\n end", "title": "" }, { "docid": "3f7ba385b0306b94ef94f172a13a2396", "score": "0.573048", "text": "def contact \n\n end", "title": "" }, { "docid": "5954b84fd543887bc4a8b773e30e347a", "score": "0.5700543", "text": "def show\n if @part.nil?\n redirect_url = if Rails.env == 'development'\n \"http://www.#{request.domain}:#{request.port}/contact_us?part_number=#{request.subdomain}\"\n else\n \"http://www.#{request.domain}/contact_us?part_number=#{request.subdomain}\"\n end\n return redirect_to redirect_url\n end\n render layout: false\n end", "title": "" }, { "docid": "54de6ef7447144853d314cbd60f7496e", "score": "0.5695051", "text": "def show\n authorize @contact\n\n session[:ret_url] = contact_path(@contact, @shared_user)\n end", "title": "" }, { "docid": "4561e9dad29ac0d67f7b860d97ba5e7d", "score": "0.5689989", "text": "def choose\n @customers = current_user.customers\n if current_customer && CustomerUser.linked?(current_customer, current_user)\n redirect_back_or_default root_url(:subdomain => current_customer.subdomain), :subdomain => current_customer.subdomain\n elsif !@customers || @customers.count == 0\n logger.warn(\"Ouch! #{current_user.email} has no customers\")\n redirect_back_or_default(secure_subdomain(:action => \"new\"), secure_subdomain)\n elsif @customers.count == 1\n if !CustomerUser.linked?(@customers[0], current_user)\n logout_keeping_session!\n access_denied\n else\n redirect_back_or_default root_url(:subdomain => @customers[0].subdomain), :subdomain => @customers[0].subdomain\n end\n else\n # Render choice page\n end\n end", "title": "" }, { "docid": "15761dd91623c6a5c5cc9f580a294c93", "score": "0.568245", "text": "def redirect_back \n\t\tredirect_to request.env['HTTP_REFERER']\n\tend", "title": "" }, { "docid": "12467ef3e4948f4a1d1d16b884dc99e0", "score": "0.56070054", "text": "def contactus\r\n end", "title": "" }, { "docid": "9c34337948bfc7dcc1ee7225ac86d532", "score": "0.5564971", "text": "def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end", "title": "" }, { "docid": "245983ba6af7e5b977ee060a9b45ead2", "score": "0.55522853", "text": "def redirect_back_or(default)\n #forwarding_url = session[:forwarding_url] if \"#{session[:forwarding_url]}\".include? \"users/#{@user.id}/edit\" #URL CONTAINS MANY NUMBERS REMMEBER!\n if !session[:forwarding_url].nil? \n forwarding_url = edit_user_path @user #session[:forwarding_url] chenged from this to redirec to edit no matter what edit one was trying to access\n end\n redirect_to(forwarding_url || default) # review this notation; nill if previous statement false (goes to default)\n delete_store\n end", "title": "" }, { "docid": "141ade93b6d5fffbb20b7c44959fd86f", "score": "0.5541792", "text": "def contact_confirmation(contact)\n @contact = contact\n\n mail to: \"hello@meme.menu\", subject: \"New Contact Submission\"\n end", "title": "" }, { "docid": "dac7cb8f8b36b44d455a030d04d547cc", "score": "0.55415696", "text": "def contactus\n end", "title": "" }, { "docid": "33a3b715a53adc54310b09cf2c3b837b", "score": "0.55408484", "text": "def set_contact\n contact_group = ContactGroup.find( session[:contact_group_id] )\n @contact = contact_group.contacts.find(params[:id])\n rescue\n @contact = current_user.contacts.find(params[:id])\n #@contact = current_user.contact_group.find(params[:id])\n end", "title": "" }, { "docid": "a291f030b624e1baabfc4671e460ca36", "score": "0.5532115", "text": "def org_contact\n wizard_step(STEPS) { { next_step: :org_contact_next_step } }\n end", "title": "" }, { "docid": "f6fd55ba0002ffdef3fe439463f6f80d", "score": "0.5525944", "text": "def go_to_agencies\n if params[:back]\n session[:back] = true\n else\n session[:back] = false\n redirect_to agencies_url(:clear=>true)\n end\n end", "title": "" }, { "docid": "ca80e2884775eb7750dddb054ac88def", "score": "0.55064255", "text": "def return_to_previous_page\n\n if params[:from_view]\n\n redirect_to(\n :controller => \"workitem\", :action => \"view\", :id => params[:id])\n\n else\n\n redirect_to :controller => \"stores\"\n end\n end", "title": "" }, { "docid": "11c29e3e8df2a4295efdd1d0a9dc1b00", "score": "0.5492159", "text": "def redirect_for_inactive\n if @connection.contact.deactivated?\n flash[:error] = \"Invalid connection request: person deactivated\"\n redirect_to home_url\n end\n end", "title": "" }, { "docid": "4d2b996f061e7287bb1d55922665f546", "score": "0.54911786", "text": "def add_to_contact_list\n logger.debug \"**** ADD TO CONTACT LIST FROM SELN ****\"\n show_params(params)\n session[:list_contacts] = nil\n \n if session[:saved_contact_list_id] != nil\n saved_contact_list_id = session[:saved_contact_list_id]\n redirect_to( :controller => \"saved_contact_lists\", \n :action => \"add_search_results_contacts_to_list\", \n :id => saved_contact_list_id )\n else\n if session[:saved_contact_list_id] == nil\n flash[:notice] = \" A session has expired, try again\"\n redirect_to( :controller => 'saved_contact_lists', :action => 'list' )\n end\n end\n end", "title": "" }, { "docid": "d523bb1741bd221a5110a4cf2d4dd45b", "score": "0.54778856", "text": "def after_save(cc)\n redirect_to :controller => 'home', :action => 'index' if cc\n end", "title": "" }, { "docid": "792033356684246c81f8c4dd58247d97", "score": "0.54561925", "text": "def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end", "title": "" }, { "docid": "8c1046f3e106444ab0375abdd825d5a7", "score": "0.54501706", "text": "def redirect_to_back_or(default, opts = {:match => true})\n redirect_to(back_or_default_path(default, opts)) and return false\n end", "title": "" }, { "docid": "d10c40fb4eb8bb0a7e145849ab336365", "score": "0.54427195", "text": "def add_to_contact_list\n session[:list_contacts] = nil \n if session[:saved_contact_list_id] != nil\n saved_contact_list_id = session[:saved_contact_list_id]\n redirect_to( :controller => \"saved_contact_lists\", \n :action => \"add_search_results_contacts_to_list\", \n :id => saved_contact_list_id )\n else\n if session[:saved_contact_list_id] == nil\n flash[:notice] = \" A session has expired, try again\"\n redirect_to( :controller => 'saved_contact_lists', :action => 'list' )\n end\n end\n end", "title": "" }, { "docid": "670b2a036184a5d0874846832ce1ed32", "score": "0.5433115", "text": "def contact_action_links(contact)\n msg,confirm=contact.checkassociation(t(:label_Account))\n if msg.present? && confirm.blank?\n link=link_to('Delete',\"#\", :onclick=> \"alert(#{msg.to_json})\")\n elsif msg.blank? && confirm.blank?\n link=link_to('Delete',deactivate_contact_contact_path(contact.id,:mode_type=>params[:mode_type],:per_page=>params[:per_page],:page=>params[:page],:letter=>params[:letter],:search=>params[:search],:search_items=>params[:search_items],:col=>params[:col],:dir=>params[:dir],:contact_type =>params[:contact_type]), :confirm => 'Are you sure you want to delete this Contact?')\n elsif confirm.present?\n link=link_to('Delete',deactivate_contact_contact_path(contact.id,:mode_type=>params[:mode_type],:per_page=>params[:per_page],:page=>params[:page],:letter=>params[:letter],:search=>params[:search],:search_items=>params[:search_items],:col=>params[:col],:dir=>params[:dir],:contact_type =>params[:contact_type]), :confirm => confirm)\n end\n # As per feature 8879 : ACTIVATE - DEACTIVATE CODE NEEDS TO BE REMOVED\n # THIS CODE INCREASES CONDITIONS WHICH ARE NOT NECESSARY\n return %Q{\n <div class=\"icon_action mt3\"><a href=\"#\"></a></div>\n <div id=\"liquid-roundAP\" class=\"tooltip\" style=\"display:none;\"> \n <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n #{action_pad_top_blue_links({:edit_path=>\"#{edit_contact_path(contact,extra_parameters(params))}\",\n :deactivate_path=>\"NO\",\n :deactivate_link=>link,\n :deactivate_text => \"contact\",\n :comment_path=>\"#{add_comment_with_grid_comments_path(:id=>contact.id,:commentable_type=>'Contact',:path=> contacts_path,:height=>190,:width=>800)}\",\n :comment_title => contact.name,\n :document_path=>\"#{upload_document_document_homes_path(:mappable_id => contact.id,:mode_type=>params[:mode_type],:per_page=>params[:per_page],:page=>params[:page],:letter=>params[:letter],:search=>params[:search],:contact_type =>params[:contact_type], :from=>'contacts')}\",\n :history_path=>\"#{history_comments_path(:id=>contact.id,:commentable_type=>'Contact' ,:height=>153,:width=>600)}\",\n :history_title => \"#{t(:text_contact_history)} #{contact.name}\"})}\n <tr>\n <td class=\"ap_middle_left\"><div class=\"ap_pixel\"></div></td>\n <td style=\"background: #fff;\">\n <table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n <tr><td colspan=\"5\"><div class=\"ap_pixel15\"></div></td></tr>\n <tr>\n <td width=\"7%\" align=\"left\" valign=\"middle\"><div class=\"ap_child_action\"></div></td>\n <td width=\"40%\" align=\"left\" valign=\"middle\" nowrap> #{link_to('<span>Change Stage</span>', \"#\", :onclick=>\"tb_show('Change Stage for #{escape_javascript(contact.full_name)}', '#{change_status_contact_path(contact.id,:mode_type=>params[:mode_type],:per_page=>params[:per_page],:page=>params[:page],:letter=>params[:letter],:search=>params[:search],:q=>params[:q],:col=>params[:col],:dir=>params[:dir],:contact_type =>params[:contact_type],:height=>'190',:width=>'500')}', '' ); return false\")} </td>\n <td width=\"10%\" align=\"center\" valign=\"middle\"><div class=\"ap_child_action\"></div></td>\n <td width=\"40%\" align=\"left\" valign=\"middle\">#{link_to('<span>Create Opportunity</span>', \"#\", :onclick => \"tb_show('#{t(:text_new_opportunity)}', '#{create_opportunity_contact_path(contact.id)}?height=210&width=520','')\")}</td>\n </tr>\n <tr><td colspan=\"5\"><div class=\"ap_pixel10\"></div></td></tr>\n <tr><td colspan=\"5\"><div class=\"ap_pixel10\"></div></td></tr>\n </table>\n </td>\n <td class=\"ap_middle_right\"><div class=\"ap_pixel13\"></div></td>\n </tr>\n <tr>\n <td valign=\"top\" class=\"ap_bottom_curve_left\"></td>\n <td class=\"ap_bottom_middle\"><div class=\"ap_pixel13\"></div></td>\n <td valign=\"top\" class=\"ap_bottom_curve_right\"></td>\n </tr>\n </table>\n </div>\n }\n # As per feature 8879 : ACTIVATE - DEACTIVATE CODE NEEDS TO BE REMOVED\n # THIS CODE INCREASES CONDITIONS WHICH ARE NOT NECESSARY\n end", "title": "" }, { "docid": "fd40fe9c079baa72397c6dc0e2baef23", "score": "0.5424966", "text": "def set_contact\n @contact = Contact.find(params[:property_contact_id] || params[:development_contact_id] || params[:id])\n end", "title": "" }, { "docid": "6bc7e4a2d29b254e52d757e57d954967", "score": "0.54220456", "text": "def redirect_for_inactive\n if @connection.contact.deactivated?\n flash[:error] = t('connections.flash.error.invalid')\n redirect_to home_url\n end\n end", "title": "" }, { "docid": "71222ebeab0ddaf50835e9070bc7dbe7", "score": "0.5415188", "text": "def after_sign_in_path(resource)\n \t# Find user contact information which is stored in OrgContact by finding the\n \t# user id or in other words the org_person_id (Which we retrieve through) the\n \t# login process and store it in local var has_contact_info\n \thas_contact_info = OrgContact.find_by(org_person_id: current_org_person.id)\n \t# If the person contact info is NOT nil, then we want to check if this person\n \t# has a return to page. This basically is return the user back to the original page\n \t# that forced him to sign in in the first place. Else it forces the user\n \t# to the edit page of his info\n \tif !has_contact_info.nil?\n \t if !session[:return_to].nil?\n \t \tsession[:return_to]\n \t \tsession.delete[:return_to]\n \t else\n \t \tedit_org_person_path(current_org_person.id)\n \t end\n \telse\n \t edit_org_person_path(current_org_person.id)\n \tend\n end", "title": "" }, { "docid": "504a664c5d9500b7baf0234ed5aec7c3", "score": "0.5413358", "text": "def contact_form(contact)\n @contact = contact\n @url = \"http://#{APP_CONFIG['host']}#{rails_admin.show_path('contacts', @contact.id)}\"\n mail(\n subject: \"StudyHall Contact Form from [#{@contact.name.titleize}]\",\n from: 'noreply@studyhall.com',\n to: APP_CONFIG['contact_form_recipient'],\n date: Time.now\n )\n end", "title": "" }, { "docid": "ac59dae965cb48394a03b9466ab6c940", "score": "0.54110104", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n return true\n end", "title": "" }, { "docid": "d518faeafcc96b11ba9d484d1f70eecb", "score": "0.5410266", "text": "def set_primary_contact\n company = Company.find(params[:company_id]) if params[:company_id].present?\n @log_msg = \"Contact \" + company.contact.to_s + \" marked/unmarked as Primary Contact by user \" + current_user.id.to_s if company.present? && params[:primary_contact].present? && company.update_attributes(:contact => params[:primary_contact])\n \n return render :partial => \"contacts\", :locals => {:company_contacts => company.contacts, :company => company} \n end", "title": "" }, { "docid": "ccabd24a8f6acc1c95db47c95b0ffdcd", "score": "0.54097354", "text": "def contact\n @voucher.customer.nil? ? nil : ContactDrop.new(@voucher.customer.main_contact)\n end", "title": "" }, { "docid": "1cc7c5295aed4b8eb01c6bf35eebfef7", "score": "0.5407522", "text": "def find_contacts_menu\n if session[SELECTED_CONTACTS] == nil\n session[SELECTED_CONTACTS] = []\n end\n @contacts = session[SELECTED_CONTACTS] \n end", "title": "" }, { "docid": "63989431e79db387597b5e56691449be", "score": "0.5402631", "text": "def contact_page_notification(contact)\n logger.debug(contact.inspect) #contact = params[:contact]\n @contact_info = contact\n mail(:to => \"info@venuedog.com\", :subject => \"New Contact Form Submission\")\n end", "title": "" }, { "docid": "82671018cc5f8c9295fc5ad9917eb2a9", "score": "0.54006356", "text": "def contact\n\t\t@contact\n\tend", "title": "" }, { "docid": "82671018cc5f8c9295fc5ad9917eb2a9", "score": "0.54006356", "text": "def contact\n\t\t@contact\n\tend", "title": "" }, { "docid": "ef310d3f16116fc859839e0ea7a73ecf", "score": "0.53628755", "text": "def redirect_back_path(default = projects_path)\n (!request.env[\"HTTP_REFERER\"].blank? and request.env[\"HTTP_REFERER\"] != request.env[\"REQUEST_URI\"]) ? :back : default\n end", "title": "" }, { "docid": "7b045b085b6be7f054f2b330954016ef", "score": "0.5359405", "text": "def redirect_path\r\n if !(@target =~ /invoice/i).nil?\r\n redirect_to new_invoice_path\r\n else\r\n redirect_to @account\r\n end\r\n end", "title": "" }, { "docid": "37e64210dcd318f54b90293437f2aa7b", "score": "0.5359257", "text": "def create\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save \n format.html { redirect_to params[:tab_page].present? ? {action: \"show\",id: @contact.id,tab_page: 1} : contacts_url, notice: 'Contact was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new', tab_page: params[:tab_page] }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76f6b4bf7094eb89f3fa31b71fef71aa", "score": "0.5353623", "text": "def go_to_home\n if current_customer\n if params[:controller] == \"support_admin/base\"\n redirect_to controller: 'customer_portal/base', action:'index'\n end\n elsif current_support_admin\n if params[:controller] == \"customer_portal/base\"\n redirect_to controller: 'support_admin/base', action:'index'\n end\n end\n end", "title": "" }, { "docid": "41ba12ef52137bdd6e8bb85fb163afb0", "score": "0.5350274", "text": "def set_contact_page\n @contact_page = ContactPage.find(params[:id])\n end", "title": "" }, { "docid": "41ba12ef52137bdd6e8bb85fb163afb0", "score": "0.5350274", "text": "def set_contact_page\n @contact_page = ContactPage.find(params[:id])\n end", "title": "" }, { "docid": "41ba12ef52137bdd6e8bb85fb163afb0", "score": "0.5350274", "text": "def set_contact_page\n @contact_page = ContactPage.find(params[:id])\n end", "title": "" }, { "docid": "41ba12ef52137bdd6e8bb85fb163afb0", "score": "0.5350274", "text": "def set_contact_page\n @contact_page = ContactPage.find(params[:id])\n end", "title": "" }, { "docid": "e099edb9af76ced85e40d37ed6d83dbe", "score": "0.5348426", "text": "def suggest_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Suggested store inquiry\")\n end", "title": "" }, { "docid": "f5ac97d922f4e732736cd2b068c6428a", "score": "0.5342889", "text": "def contact_us\n #\n if request.get?\n @page_title = \"Contact Us\"\n @page = Page.find_by_title(@page_title)\n end\n\t \n if request.post?\n # TODO\n pass = true\n error = \"Please check the name, email and note fields are not empty.\"\n\t \n name = params[:contact][:name] \n email = params[:contact][:email]\n phone = params[:contact][:phone]\n note = params[:contact][:note]\n\t \n pass = false if name.blank?\n pass = false if email.blank?\n pass = false if note.blank?\n\t \n\t \n #email = OrderMailer.create_sent(params[:contact][:name],params[:contact][:email],params[:contact][:phone],params[:contact][:note])\n #email.set_content_type(\"text/html\")\n \n if pass\n OrderMailer.deliver_formmessage(name,email,phone,note)\n flash[:notice] = \"Thank you! Your message has been sent, we will contact you shortly.\"\n redirect_to :action=>'contact_us', :controller=>'go'\n else\n flash[:notice] = error\n redirect_to :action=>'contact_us', :controller=>'go'\n end \n end \n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => true)\n end", "title": "" }, { "docid": "97aed5bd8ae836fbe938b114f5dc31b1", "score": "0.5334374", "text": "def wholesale_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"feyacandle@gmail.com\", :subject => \"Wholesale inquiry\")\n end", "title": "" }, { "docid": "0bb4e2373ceae260ef4d4e5879452a6c", "score": "0.53310865", "text": "def redirect_back_or_to(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "title": "" }, { "docid": "786fbee7849aaf4518aba2b55935b79c", "score": "0.532728", "text": "def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n\t session.delete(:forwarding_url)\n\tend", "title": "" }, { "docid": "43a0b12e14b4294766cb1b2fc4447436", "score": "0.5326399", "text": "def set_contact\n @contact = Contact.find(params[:contact_id])\n end", "title": "" }, { "docid": "5b50f513b537998af6936806d827d934", "score": "0.531892", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "title": "" }, { "docid": "5b50f513b537998af6936806d827d934", "score": "0.531892", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "title": "" }, { "docid": "6b2809de4200f10b6cc2835b5277bbd0", "score": "0.5317954", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarind_url)\n end", "title": "" }, { "docid": "c1e158f8f8db283727d00a1d80fa8521", "score": "0.5315581", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end", "title": "" }, { "docid": "22cf585010a99efb192cc6b58f1a07f5", "score": "0.5310005", "text": "def request_contact\n #Gets form values that user has typed in:\n name = contact_params[\"name\"]\n email = contact_params[\"email\"]\n telephone = contact_params[\"telephone\"]\n message = contact_params[\"message\"]\n\n #If user has not typed in an email, alert them that\n #they should type one in:\n if email.blank?\n flash[:alert] = I18n.t('home.request_contact.no_email')\n else\n #Send an email:\n ContactMailer.contact_email(email, name, telephone, message).deliver_now\n flash[:notice] = I18n.t('home.request_contact.email_sent')\n end\n #Go back to home page, where the appropriate prompt will be shown:\n redirect_to root_path\n end", "title": "" }, { "docid": "0038dc7c41e6519bd96d53b55823a420", "score": "0.53084177", "text": "def return_path\n if contact.from_organization?\n dashboard_path(tab: :cops)\n else\n admin_organization_path(coe.organization, tab: :cops)\n end\n end", "title": "" }, { "docid": "5a15f2b4cc55cad09c40b7bd5ddb3476", "score": "0.5303118", "text": "def app_contact\n end", "title": "" }, { "docid": "c5fcec1d129c418dd998bf0ea8a0c8de", "score": "0.5297587", "text": "def set_contact\n @contact = Contact.find(params[:contact_id])\n end", "title": "" }, { "docid": "02f17eef1431ea189198270d1be51fd3", "score": "0.529468", "text": "def redirect_back_to\n if !session[:return_to].blank?\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end", "title": "" }, { "docid": "ace518753478345df3f1c5ceec9a252c", "score": "0.5291683", "text": "def contact; end", "title": "" }, { "docid": "d295274dad74052a863d667697db194c", "score": "0.52914584", "text": "def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n \tsession.delete(:forwarding_url)\n end", "title": "" }, { "docid": "3a480e3b9ac3ae0edd3088b9ae4f95a8", "score": "0.5290007", "text": "def navigation_select( link_name, options = {} )\n if navigation_builder[options[:in]] == true\n raise RuntimeError, \"The #{options[:in]} navigation block has already been rendered. You cannot call navigation_select if navigation_for has already been called.\"\n else\n options.reverse_merge!( :in => :main )\n navigation_builder[options[:in]] = link_name\n end\n end", "title": "" }, { "docid": "421784e14ca801411840d55a5cf32010", "score": "0.5290001", "text": "def request_contact\n name = params[:name]\n email = params[:email]\n telephone = params[:telephone]\n message = params[:message]\n if email.blank?\n flash[:alert] = I18n.t('contact.no_email')\n else\n ContactMailer.contact_email(email,name,telephone,message).deliver_now\n flash[:notice] = I18n.t('contact.yes_email')\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "0a55190faff70d4cbd0c6f770fb3c24b", "score": "0.5287904", "text": "def set_contact\n @contact = current_user.contacts.find(params[:id])\n end", "title": "" }, { "docid": "74a66d6d52d4e2a06faed5dd1e16a284", "score": "0.5286381", "text": "def redirect_to_back(default = root_url)\n if request.env[\"HTTP_REFERER\"].present? and request.env[\"HTTP_REFERER\"] != request.env[\"REQUEST_URI\"]\n redirect_to :back\n else\n redirect_to default\n end\n end", "title": "" }, { "docid": "45374872c92f67445b14fa4805bd2b85", "score": "0.5285965", "text": "def contact\n render 'contact/form'\n end", "title": "" }, { "docid": "63c67d6662becb16bc4e142c38f74b28", "score": "0.52828205", "text": "def redirect_back_or( default )\n\t\tredirect_to( session[:forwarding_url] || default )\n\t\tsession.delete( :forwarding_url )\n\tend", "title": "" }, { "docid": "710ff03eabdc49ea7e9c7a6b98534882", "score": "0.5281143", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "title": "" }, { "docid": "8b928c7dc69ece90cd94e3d29f57c914", "score": "0.5280844", "text": "def request_popup_callback\n id = @params['button_id']\n if id == \"Contact MacoTec\"\n WebView.navigate url_for :controller => :Menu, :action => :contact\n end\n # WebView.navigate Rho::RhoConfig.start_path\n end", "title": "" }, { "docid": "66d2c9e1c2bbef461aa34aa380f183e8", "score": "0.528056", "text": "def display_one_contact\n contact = retrieve_contact_by_email\n end", "title": "" }, { "docid": "fb98a5cfad19ba346ea9a62f3ca190ff", "score": "0.52801365", "text": "def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end", "title": "" }, { "docid": "c904d62da2b2cdf72480c6bf2c68f932", "score": "0.5270565", "text": "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) #delete what is stored.\n end", "title": "" }, { "docid": "e5c1995a30090b661ff34d32712ea00f", "score": "0.5263436", "text": "def primary_contact?\n primary_contact.present?\n end", "title": "" }, { "docid": "6c37f72c83b3395f0610131fb3459165", "score": "0.52632457", "text": "def correct_comite\n @comite = Comite.find(params[:id])\n redirect_to \"/comites\" unless @comite.id == current_comite.id\n end", "title": "" }, { "docid": "b69eaca44ec721720d6bf5b67ae90523", "score": "0.52611756", "text": "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default )\n\t\tsession.delete(:forwarding_url)\n\tend", "title": "" } ]
f74bb17356d4598036163d948208fba0
proof of concept for TB 2 trees
[ { "docid": "ba89393159348096721bc4f58c776d38", "score": "0.0", "text": "def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end", "title": "" } ]
[ { "docid": "211423f8f625b21c12099488da42cd92", "score": "0.6371427", "text": "def leaf?; false end", "title": "" }, { "docid": "6d4f6a517b676827f3f263eb5b86e1e9", "score": "0.6344008", "text": "def produce_tree(ary); end", "title": "" }, { "docid": "ac621869e0a6d6fc445a78dc8f196200", "score": "0.62748766", "text": "def build_tree(arr)\n\tend", "title": "" }, { "docid": "6f7b2e1a3ec304c42eec89b9807f3d57", "score": "0.6242192", "text": "def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end", "title": "" }, { "docid": "aa902922ff8647cf6246a5bd809e3615", "score": "0.624093", "text": "def is_leaf\n true\n end", "title": "" }, { "docid": "aa902922ff8647cf6246a5bd809e3615", "score": "0.624093", "text": "def is_leaf\n true\n end", "title": "" }, { "docid": "9c17ef1165a46c9f1503492e5a8d4d06", "score": "0.62174475", "text": "def is_valid_tree(tree)\n\nend", "title": "" }, { "docid": "9af3ed4587fa7a633deb093b96970ab8", "score": "0.61631584", "text": "def tes_gettree\n tree = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree { |b| tree.push b.rev_index }\n }\n tree_d = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree_debug { |b| tree_d.push b.rev_index }\n }\n\n assert_equal 389, tree.count\n assert_equal 389, tree_d.count\n end", "title": "" }, { "docid": "d040d8ab06ecff5d2f90cc25d617f57a", "score": "0.61514497", "text": "def build_server_tree(tree, options= {})\n result = ''\n tree = Array.wrap tree\n opts = {\n # node and base node params\n :id => :id, # node id field\n :title => :title, # name of title fileld\n :node => nil, # node\n\n # base options\n :type => :tree, # tree type\n :root => false, # is it root node?\n :level => 0, # recursion level\n :namespace => [], # :admin\n\n # BOOST! hash\n :boost => {}\n }.merge!(options)\n\n # Basic vars\n root = opts[:root]\n node = opts[:node]\n\n # namespace prepare [Rails require]\n opts[:namespace] = Array.wrap opts[:namespace]\n\n # Module with **Render** class\n opts[:render_module] = TREE_RENDERERS[opts[:type]] unless opts[:render_module]\n\n # Define tree class\n opts[:klass] = define_class_of_elements_of(tree) unless opts[:klass]\n\n # BOOST PATCH (BUILD ONCE)\n # solution of main perfomance problem\n # magick index-hash, which made me happy!\n\n # Performance comparison\n # Boost OFF: 8000 nodes, 3 levels => (Views: 176281.9ms | ActiveRecord: 189.8ms)\n # Boost ON: 8000 nodes, 3 levels => (Views: 8987.8ms | ActiveRecord: 141.6ms)\n\n if opts[:boost].empty?\n tree.each do |item|\n num = item.parent_id || -1\n opts[:boost][num.to_s] = [] unless opts[:boost][num.to_s]\n opts[:boost][num.to_s].push item\n end\n end\n\n unless node\n # RENDER ROOTS\n roots = opts[:boost]['-1']\n\n # Boost OFF\n # roots = tree.select{ |node| node.parent_id.blank? }\n\n # define roots, if it's need\n if roots.nil? && !tree.empty?\n # Looks like the new algo really does what we need (28 sept. 2016)\n # Thanks to: https://github.com/patrick-nits\n #\n ids = tree.map(&:id)\n opt_ids = opts[:boost].keys.map(&:to_i)\n candidate_ids = (ids + opt_ids).uniq - (ids & opt_ids) # xor\n roots = candidate_ids.map {|c| opts[:boost][c.to_s]}.compact.flatten\n end\n\n # children rendering\n if roots\n roots.each do |root|\n _opts = opts.merge({ :node => root, :root => true, :level => opts[:level].next, :boost => opts[:boost] })\n result << build_server_tree(tree, _opts)\n end\n end\n else\n # RENDER NODE'S CHILDREN\n children_res = ''\n children = opts[:boost][node.id.to_s]\n\n # Boost OFF\n # children = tree.select{ |_node| _node.parent_id == node.id }\n\n opts.merge!({ :has_children => children.blank? })\n\n unless children.nil?\n children.each do |elem|\n _opts = opts.merge({ :node => elem, :root => false, :level => opts[:level].next, :boost => opts[:boost] })\n children_res << build_server_tree(tree, _opts)\n end\n end\n\n result << build_tree_html(self, opts[:render_module], opts.merge({ :root => root, :node => node, :children => children_res }))\n end\n\n raw result\n end", "title": "" }, { "docid": "c810b3b2f186f91baf1eaf2a088f8343", "score": "0.61460364", "text": "def test_delete_node_tree_l_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [10, 8]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end", "title": "" }, { "docid": "65b6bd5a8cbd496cfea5c61e500040d7", "score": "0.61395603", "text": "def check_tree\n unless @trees\n @trees = {}\n @blobs = {}\n @base.ls_tree(@objectish).each do |hash|\n if hash[:type] == 'tree'\n @trees[hash[:path]] = TinyGit::Object::Tree.new(@base, hash[:sha], hash[:mode])\n elsif hash[:type] == 'blob'\n @blobs[hash[:path]] = TinyGit::Object::Blob.new(@base, hash[:sha], hash[:mode])\n end\n end\n end\n end", "title": "" }, { "docid": "ce18aaa7e8d2bf02d5f114c996393f52", "score": "0.6136149", "text": "def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend", "title": "" }, { "docid": "777a899a436cfa3974827a8b2ac6691b", "score": "0.61354053", "text": "def test_max_2_nodes_one_to_left\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal \"b\", @tree.max\n end", "title": "" }, { "docid": "2d088633ebbf08ee44b52a1c4a8c8171", "score": "0.61314696", "text": "def check_subtree(tree1, tree2)\n # due to the depth of T1 being much larger than T2 a BFS seems more logical\n bfs(tree1.head, tree2,head)\nend", "title": "" }, { "docid": "f7c538ca8544e8fb73aad24ea7edef99", "score": "0.61201435", "text": "def valid_tree?\n false\n end", "title": "" }, { "docid": "8d2132b622285299a18df57710ab83ec", "score": "0.61106867", "text": "def is_bst?(node)\nend", "title": "" }, { "docid": "4e40e3fa7198f4d0566fda69315570e0", "score": "0.6103422", "text": "def test_nested_quote3\n t = build_tree_on('t022-3.txt')\n assert_equal 3, t.array.size\n assert_equal 1, t.array[2].array.size\n end", "title": "" }, { "docid": "a1c2cb181c145ed6cbb0fac7e98de666", "score": "0.609332", "text": "def make_quadtree(pixels, width, height)\n $count = 0\n def make_quadtree_r(pixels, x, y, w, h)\n sum = 0\n (0..w-1).each do |x_off|\n (0..h-1).each do |y_off|\n sum += pixels[x+x_off][y+y_off]\n end\n end\n # all black or white test\n if sum == 0\n $count += 1\n sides = [\n CP::Shape::Segment.new($static_body, CP::Vec2.new(x,y), CP::Vec2.new(x+w,y), 0.1),\n CP::Shape::Segment.new($static_body, CP::Vec2.new(x+w,y), CP::Vec2.new(x+w,y+h), 0.1),\n CP::Shape::Segment.new($static_body, CP::Vec2.new(x+w,y+h), CP::Vec2.new(x,y+h), 0.1),\n CP::Shape::Segment.new($static_body, CP::Vec2.new(x,y+h), CP::Vec2.new(x,y), 0.1),\n ]\n sides.each{|x| x.e = 1.0; $space.add_static_shape(x)}\n Quadtree.new(0, nil, nil, nil, nil)\n elsif sum == 255*w*h\n $count += 1\n Quadtree.new(1, nil, nil, nil, nil)\n else\n Quadtree.new(nil, \n make_quadtree_r(pixels, x, y, w/2, h/2),\n make_quadtree_r(pixels, x+w/2, y, w/2, h/2),\n make_quadtree_r(pixels, x, y+h/2, w/2, h/2),\n make_quadtree_r(pixels, x+w/2, y+h/2, w/2, h/2))\n end\n end\n tree = make_quadtree_r(pixels, 0, 0, width, height)\n puts \"Number of nodes: #{$count} vs #{width*height} for full data (#{$count.to_f/(width*height)*100}%)\"\n tree\nend", "title": "" }, { "docid": "aad8b230756b78e61374f157d4e370f5", "score": "0.6088485", "text": "def random_tree\n\t\t#range of possible angle separations between branches\n\t\t#big range seems to be ok, 30 to 60 works nice\n\t\t$angle_of_separation = (30..60).to_a\n\t\t#range of possible shrinkage values, will have a decimal in front of it\n\t\t#shrink determines how short each branch is\n\t\t$shrink_range = (4..6).to_a\n\t\t#split determines how many levels of branches there are\n\t\t#below 5 makes a pretty weak tree\n\t\t#above 7 makes a big blob of black\n\t\t$split_range = (5..7).to_a\n\t\t\n\t\t#Determines how many branches the current one splits off into\n\t\t$num_splits = rand(4)+2\n\t\t\n\t\t#how long the \"trunk\" is, height is 600\n\t\t#this gets ugly above 250\n\t\t$trunk = (150..250).to_a\n\t\t\n\t\t#pick a random number from the split range to be used as the number of splits\n\t\t$split_range = $split_range[rand($split_range.length)]\n\t\t#as a decimal, find the factor we will multiply future branches by\n\t\t@shrink = \"0.#{$shrink_range[rand($shrink_range.length)]}\".to_f\n\t\t#pick a random value for the angle of separation from the range\n\t\t$angle_of_separation = $angle_of_separation[rand($angle_of_separation.length)]\n\t\t\n\t\t#make a multidimensional array for branches\n\t\t@branches = []\n\t\t#start at the bottom, but not all the way down\n\t\t#move @x to the top of the trunk, ready for next branches\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[rand($trunk.length)]]] ] \n\t\t\n\t\tputs \"This output is from Random Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t\t\n\t end", "title": "" }, { "docid": "49297b9a640058bc4243a7fbafba3aff", "score": "0.60794127", "text": "def test_delete_node_tree_r_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [8, 10]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end", "title": "" }, { "docid": "6135debbf5533e45c877166728d1d38b", "score": "0.6078756", "text": "def test_branch_chain2\n #puts \"---------------test_branch_chain2-----------------\"\n\n t1= t2 = t11 = t12 = t21 = t23 = t31 = t32 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do\n b.chain do\n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n b.chain do\n b.branch do\n t21 = b.add(Thing21.new)\n b.chain do\n t31 = b.add(Thing31.new)\n t32 = b.add(Thing32.new)\n end\n end\n t23 = b.add(Thing23.new)\n end\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12,t21,t23,t31,t32])\n assert r.include? [t1,t11]\n assert r.include? [t1,t21]\n assert r.include? [t1,t31]\n\n assert r.include? [t11,t12]\n assert r.include? [t12,t2]\n\n assert r.include? [t21,t23]\n assert r.include? [t23,t2]\n\n assert r.include? [t31,t32]\n assert r.include? [t32,t23]\n\n assert_equal 9, r.size\n end", "title": "" }, { "docid": "032c6006c271ba0803607944fe80f7be", "score": "0.60603434", "text": "def valid_tree?\n true\n end", "title": "" }, { "docid": "032c6006c271ba0803607944fe80f7be", "score": "0.60603434", "text": "def valid_tree?\n true\n end", "title": "" }, { "docid": "47443935f2f3f2adb3e27414bd2d1f03", "score": "0.60535485", "text": "def estimateMLBranchLengths(tree, alignFile, tmpdir)\n required_programs ['puzzle']\n outgroup = tree.taxa.sort.last\n tree.reroot(tree.findNode(outgroup))\n bClades = tree.clades(true)\n fasta2Phylip(alignFile, \"#{tmpdir}/infile\")\n tree.write(\"#{tmpdir}/intree\")\n treepuzzle = \"puzzle infile intree\"\n system(\"cd #{tmpdir};echo \\\"y\\\" | #{treepuzzle} > /dev/null\")\n tree = NewickTree.fromFile(\"#{tmpdir}/intree.tree\")\n tree.reroot(tree.findNode(outgroup))\n tree.addBootStrap(bClades)\n File.unlink(tmpdir+\"/intree\", tmpdir+\"/intree.tree\", tmpdir+\"/infile\")\n File.unlink(tmpdir+\"/intree.dist\", tmpdir+\"/intree.puzzle\")\n return tree\nend", "title": "" }, { "docid": "f3ef93200107f2518eb8816cf0fc2b40", "score": "0.60415953", "text": "def tree(capa = 1)\n R3::Tree.new(capa)\nend", "title": "" }, { "docid": "efda0880f51f6219554ee76e4a36a4ac", "score": "0.60170674", "text": "def buildTree(node,arr)\n node.value = arr.shift\n size = (arr.size/2.0).round\n if size > 0\n left, right = arr.each_slice( size ).to_a\n if left and left.count > 0\n node.left = TreeNode.new\n buildTree(node.left, left)\n end\n if right and right.count > 0\n node.right = TreeNode.new\n buildTree(node.right, right)\n end\n end\nend", "title": "" }, { "docid": "3b6fe118bbe1f0bd51801e43b7380d72", "score": "0.6014085", "text": "def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend", "title": "" }, { "docid": "8f2b7ef3c57cbb8f97dd8fba94d6ee88", "score": "0.6009047", "text": "def test_max_3_nodes_one_on_both_sides_of_root\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n @tree.insert(\"c\")\n assert_equal \"c\", @tree.max\n end", "title": "" }, { "docid": "a4c13da4029c487e4829fe239ae75bef", "score": "0.6001015", "text": "def tree\n @tree ||= build_tree\n end", "title": "" }, { "docid": "c91ee6c58cb6d72ad52a5799f6acdc78", "score": "0.59728926", "text": "def func(node,subtree_node_index_in_array,subtree_begin_index,subtree_end_index)\n\tif subtree_begin_index == subtree_end_index\n\t\t#puts \"leaf node begin #{subtree_begin_index} and end #{subtree_end_index}\"\n\t\t#puts $inorder_array[subtree_begin_index]\n\telse\n\t\t$preorder_index = $preorder_index + 1\n\t\tleft_subtree_node_value = $preorder_array[$preorder_index]\n\t\tleft_subtree_node_index_in_array = find_index_of_value_in_in_array(left_subtree_node_value,subtree_begin_index,subtree_node_index_in_array - 1)\n\t\tleft_node = Btnode.new($inorder_array[left_subtree_node_index_in_array])\n\t\tnode.left = left_node\n\t\tfunc(left_node,left_subtree_node_index_in_array,subtree_begin_index,subtree_node_index_in_array - 1 )\n\t\t#puts \"subtree node at #{$inorder_array[subtree_node_index_in_array]}\"\n\t\t#puts $inorder_array[subtree_node_index_in_array]\n\t\t$preorder_index = $preorder_index + 1\n\t\tright_subtree_node_value = $preorder_array[$preorder_index]\n\t\tright_subtree_node_index_in_array = find_index_of_value_in_in_array(right_subtree_node_value,subtree_node_index_in_array + 1,subtree_end_index)\n\t\tright_node = Btnode.new($inorder_array[right_subtree_node_index_in_array]) \n\t\tnode.right = right_node\n\t\tfunc(right_node,right_subtree_node_index_in_array,subtree_node_index_in_array + 1,subtree_end_index)\n\tend\nend", "title": "" }, { "docid": "7cc4d144c81bd4e21d147ed8f17ae471", "score": "0.5966141", "text": "def test_breadth_each\n j = Tree::TreeNode.new(\"j\")\n f = Tree::TreeNode.new(\"f\")\n k = Tree::TreeNode.new(\"k\")\n a = Tree::TreeNode.new(\"a\")\n d = Tree::TreeNode.new(\"d\")\n h = Tree::TreeNode.new(\"h\")\n z = Tree::TreeNode.new(\"z\")\n\n # The expected order of response\n expected_array = [j,\n f, k,\n a, h, z,\n d]\n\n # Create the following Tree\n # j <-- level 0 (Root)\n # / \\\n # f k <-- level 1\n # / \\ \\\n # a h z <-- level 2\n # \\\n # d <-- level 3\n j << f << a << d\n f << h\n j << k << z\n\n # Create the response\n result_array = Array.new\n j.breadth_each { |node| result_array << node.detached_copy }\n\n expected_array.each_index do |i|\n assert_equal(expected_array[i].name, result_array[i].name) # Match only the names.\n end\n end", "title": "" }, { "docid": "fe8b5d02d07574d6924586203eeba0c7", "score": "0.5958378", "text": "def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend", "title": "" }, { "docid": "88ac2b52e90688d550a138062ef6b7fa", "score": "0.59459794", "text": "def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend", "title": "" }, { "docid": "a567d9589d718f09946caf0030f21755", "score": "0.5935446", "text": "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "title": "" }, { "docid": "0d361e40a05b64bd1ce15da232dce776", "score": "0.5929663", "text": "def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end", "title": "" }, { "docid": "d51d5107b297a0ec640d3d73ba054ead", "score": "0.59271854", "text": "def main8()\n t = Tree.new()\n arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n t.createBinarySearchTree(arr)\n print(t.ancestor(1, 10).value,\"\\n\")\n # 5\n print(t.ceilBST(5.5),\"\\n\")\n\t# 6\n print(t.floorBST(5.5),\"\\n\")\n\t# 5\n arr1 = [5, 2, 4, 6, 9, 10]\n arr2 = [5, 2, 6, 4, 7, 9, 10]\n print(t.isBSTArray(arr1),\"\\n\")\n print(t.isBSTArray(arr2),\"\\n\")\n # true\n # false\nend", "title": "" }, { "docid": "5f32b5d26456ee7d413b6422eb0c70bf", "score": "0.5926868", "text": "def check_subtree(t1, t2)\n # Pre-compute sizes of each subtree in t1 and t2\n t1_sizes = compute_subtree_sizes(t1)\n t2_sizes = compute_subtree_sizes(t2)\n\n # Check if t2 is subtree of t1\n check_subtree_helper(t1, t2, t1_sizes, t2_sizes)\nend", "title": "" }, { "docid": "86a1408bf3591164ef157658e678248a", "score": "0.5918887", "text": "def build_tree(s)\n bytes = s.bytes\n uniq_b = bytes.uniq\n nodes = uniq_b.map { |byte| Leaf.new(byte, bytes.count(byte)) }\n until nodes.length == 1\n node1 = nodes.delete(nodes.min_by(&:count))\n node2 = nodes.delete(nodes.min_by(&:count))\n nodes << Node.new(node1, node2, node1.count + node2.count)\n end\n nodes.fetch(0)\nend", "title": "" }, { "docid": "12ca225d9dc9279deced94653a40f387", "score": "0.5917811", "text": "def leaf?\n true\n end", "title": "" }, { "docid": "c03ddfb7e0b466963acf4ee4121f85e7", "score": "0.5915669", "text": "def unit_test_binary_tree\n node_a = Node.new('A', nil, nil, nil)\n node_b = Node.new('B', nil, nil, nil)\n node_c = Node.new('C', nil, nil, nil)\n node_d = Node.new('D', nil, nil, nil)\n node_e = Node.new('E', nil, nil, nil)\n node_f = Node.new('F', nil, nil, nil)\n node_g = Node.new('G', nil, nil, nil)\n node_h = Node.new('H', nil, nil, nil)\n node_i = Node.new('I', nil, nil, nil)\n node_j = Node.new('J', nil, nil, nil)\n\n tree = Tree.new(nil)\n\n p \"-------------------- BEGIN CONSTRUCTING TREE -------------------- \"\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \"\n p \" C E H \"\n\n p \"-------------------- END CONSTRUCTING TREE -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN INRODER TREE WALK -------------------- \"\n p inorder_tree_walk(tree.root)\n p \"-------------------- END INRODER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN PREORDER TREE WALK -------------------- \"\n p preoder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN POSTORDER TREE WALK -------------------- \"\n p postorder_tree_walk(tree.root)\n p \"-------------------- END PREORDER TREE WALK -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN RECURSIVE TREE SEARCH -------------------- \"\n p tree_search(tree.root, 'I')\n p \"-------------------- END RECURSIVE TREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN ITERATIVE TREE SEARCH -------------------- \"\n p iterative_tree_search(tree.root, 'I')\n p \"-------------------- END ITERATIVETREE SEARCH -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR TREE MIN -------------------- \"\n p tree_minimum(tree.root)\n p \"-------------------- END SEARCHING FOR TREE MIN -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING TREE MAX -------------------- \"\n p tree_maximum(tree.root)\n p \"-------------------- END SEARCHING TREE MAX -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR SUCCESSOR -------------------- \"\n p tree_successor(node_g)\n p \"-------------------- END SEARCHING FOR SUCCESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN SEARCHING FOR PREDECESSOR -------------------- \"\n p tree_predecessor(node_g)\n p \"-------------------- END SEARCHING FOR PREDECESSOR -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE INSERTION -------------------- \"\n tree_insert(tree, node_j)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A D I \"\n p \" // \\\\ // \\\\ \"\n p \" C E H J \"\n p \"-------------------- END NODE INSERTION -------------------- \"\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (SUCCESSOR) -------------------- \"\n tree_delete(tree, node_d)\n p \" F \"\n p \" // \\\\ \"\n p \" B G \"\n p \" // \\\\ \\\\ \"\n p \" A E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (SUCCESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n\n print \"\\n\"\n\n p \"-------------------- BEGIN NODE DELETION (PREDECESSOR) -------------------- \"\n tree_delete_predecessor(tree, node_b)\n p \" F \"\n p \" // \\\\ \"\n p \" A G \"\n p \" \\\\ \\\\ \"\n p \" E I \"\n p \" // // \\\\ \"\n p \" C H J \"\n p \"-------------------- END NODE DELETION (PREDECESSOR) -------------------- \"\n preoder_tree_walk(tree.root)\n end", "title": "" }, { "docid": "7c49df3ea4050dbae0330d9160d8c646", "score": "0.58917296", "text": "def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end", "title": "" }, { "docid": "7077fd6ecc0fd143f66299419f3e3d96", "score": "0.5889469", "text": "def validate_bst(tree)\n\n return validate_bst_helper(tree, - 1.0 / 0, 1.0 / 0)\n\nend", "title": "" }, { "docid": "05fc78d72ac60ea460873eaaffa29b1e", "score": "0.5879922", "text": "def test_breadth\n assert_equal(1, @root.breadth, \"A single node's breadth is 1\")\n\n @root << @child1\n assert_equal(1, @root.breadth, \"This should be of breadth 1\")\n\n @root << @child2\n assert_equal(2, @child1.breadth, \"This should be of breadth 2\")\n assert_equal(2, @child2.breadth, \"This should be of breadth 2\")\n\n @root << @child3\n assert_equal(3, @child1.breadth, \"This should be of breadth 3\")\n assert_equal(3, @child2.breadth, \"This should be of breadth 3\")\n\n @child3 << @child4\n assert_equal(1, @child4.breadth, \"This should be of breadth 1\")\n end", "title": "" }, { "docid": "4c3d5407a00db06ab534bc72a7863c94", "score": "0.5879407", "text": "def build_tree_2(data_array)\n root = nil\n \n data_array.each do |elem|\n node = insert_node(root, nil, elem) \n\troot ||= node\n end\n \n root\nend", "title": "" }, { "docid": "ecaa7083a358f18953006afd625a5bbf", "score": "0.5872714", "text": "def trim_tree\n\t\t@corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n\tend", "title": "" }, { "docid": "a0797dd929de743a7de8737a71136915", "score": "0.58725804", "text": "def test_tree_representation\n e =\n'ROOT (0.94)\n outlook => rainy (0.694)\n windy => TRUE (0.0)\n play => no (0.0)\n windy => FALSE (0.0)\n play => yes (0.0)\n outlook => overcast (0.694)\n play => yes (0.0)\n outlook => sunny (0.694)\n humidity => normal (0.0)\n play => yes (0.0)\n humidity => high (0.0)\n play => no (0.0)\n'\n assert_equal e, @tree.to_s\n end", "title": "" }, { "docid": "a5dd24b867bd0ca5ead7b3de5e153e23", "score": "0.5871372", "text": "def leaf?; @leaf; end", "title": "" }, { "docid": "df8a80aab5d14e38c3bf350fd0e40373", "score": "0.5848302", "text": "def test_depth_three_levels\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal 2, @tree.depth_of?(\"a\")\n end", "title": "" }, { "docid": "91d8e4df495c25e4c0dbf2b44e83f923", "score": "0.584066", "text": "def custom_tree\n\t\t#if they haven't made a shrink range/trunk yet, make one for them\n\t\tif $shrink_range.empty?\n\t\t\t$shrink_Range = (4..6).to_a\n\t\tend\n\t\tif $trunk.empty?\n\t\t\t$trunk = (175..250).to_a\n\t\tend\n\t\t\n\t\t@shrink = \"0.#{$shrink_range[0]}\".to_f\n\t\t#Height is 600, so y is in (0,600)\n\t\t$angle_of_separation = (@window.mouse_y / 10).to_i #this gives max of 60 degree angle, min of 0 (line)\n\t\t\n\t\t@branches = []\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[0]]] ]\n\t\t#Width is 800, so x is in (0,800)\n\t\t$num_splits = (((@window.mouse_x) / 100).to_i)+2 #this gives max of 8+2=10 splits, min of 2\n\t\t\n\t\tputs \"This output is from Custom Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\t\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\t\t\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t end", "title": "" }, { "docid": "25b44dc3aade4003f94e58a3f494ebda", "score": "0.5822591", "text": "def convert_binary_tree_to_double_linked_list(root)\nend", "title": "" }, { "docid": "7a58d21194683f3482283b5c721b415f", "score": "0.5819897", "text": "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "title": "" }, { "docid": "39ca4bb5db1dc517cd03c159a13232cd", "score": "0.5818724", "text": "def merge_trees(t1, t2)\n return t2 if t1 == nil\n return t1 if t2 == nil\n value = t1.val += t2.val\n new = TreeNode.new(value)\n new.left = merge_trees(t1.left, t2.left)\n new.right = merge_trees(t1.right, t2.right)\n return new\nend", "title": "" }, { "docid": "e01bbf28da6ec63699395cda05c5c6be", "score": "0.5801694", "text": "def test_children\n #puts \"---------------test_children-----------------\"\n t= {}\n\n batch11 = MyResource.new :batch11\n batch12 = MyResource.new :batch12\n batch21 = MyResource.new :batch21\n batch22 = MyResource.new :batch22\n pos1 = MyResource.new :pos1, [ batch11, batch12 ]\n pos2 = MyResource.new :pos2, [ batch21, batch22 ]\n order = MyResource.new :order, [pos1, pos2]\n\n GraphBuilder::Builder.build do |b|\n t[:order] = [ b.add(Thing0.new(order)) ]\n \n b.children do |pos|\n t[pos.name] = b.add Thing1.new(pos)\n b.children do |batch|\n b1 = b.add Thing11.new(batch)\n b2 = b.add Thing12.new(batch)\n t[batch.name] = [b1, b2]\n end\n end\n t[:order] << b.add( Thing2.new(order))\n end\n\n r = Thing.links(t.values.flatten)\n assert_instance_of Thing0, t[:order].first\n assert_instance_of Thing2, t[:order].last\n assert_instance_of Thing1, t[:pos1]\n assert_instance_of Thing1, t[:pos2]\n assert_instance_of Thing11, t[:batch11].first\n assert_instance_of Thing12, t[:batch12].last\n assert_instance_of Thing11, t[:batch21].first\n assert_instance_of Thing12, t[:batch22].last\n\n assert r.include? [t[:order].first,t[:pos1]]\n assert r.include? [t[:order].first,t[:pos2]]\n assert r.include? [t[:pos1],t[:batch11].first]\n assert r.include? [t[:pos1],t[:batch12].first]\n assert r.include? [t[:pos2],t[:batch21].first]\n assert r.include? [t[:pos2],t[:batch22].first]\n assert r.include? [t[:batch11].first,t[:batch11].last]\n assert r.include? [t[:batch12].first,t[:batch12].last]\n assert r.include? [t[:batch21].first,t[:batch21].last]\n assert r.include? [t[:batch22].first,t[:batch22].last]\n assert r.include? [t[:batch11].last,t[:order].last]\n assert r.include? [t[:batch12].last,t[:order].last]\n assert r.include? [t[:batch21].last,t[:order].last]\n assert r.include? [t[:batch22].last,t[:order].last]\n\n assert_equal 14, r.size\n end", "title": "" }, { "docid": "8e92a62ccf8ea1f9d79db5396a27a009", "score": "0.57989526", "text": "def diff_subtree(tree1, tree2, path)\n ret = []\n\n # compatible classes\n if tree1.class == tree2.class\n # both subtrees are Hash\n if tree1.is_a? Hash\n keys = (tree1.keys + tree2.keys).uniq\n\n keys.each do |key|\n if tree1.key?(key) && tree2.key?(key)\n ret << diff_subtree(tree1[key],\n tree2[key],\n path + [key])\n\n elsif tree1.key?(key)\n # delete hash key\n ret << {\n 'path' => path,\n 'key' => key,\n 'old' => tree1[key],\n 'state' => 'rm',\n 'extra' => {}\n }\n else\n # insert new hash key\n ret << {\n 'path' => path,\n 'key' => key,\n 'value' => tree2[key],\n 'state' => 'ins',\n 'extra' => {}\n }\n end\n end\n\n # both subtrees are Array\n elsif tree1.is_a? Array\n if @strict\n idx = 0\n idx1 = 0\n idx2 = 0\n\n while (idx1 < tree1.length) || (idx2 < tree2.length)\n val1 = tree1[idx1]\n val2 = tree2[idx2]\n\n # We need to be sure we are comparing values\n # still inside the arrays and not valid nil\n # value with item outside the array range.\n if (idx1 < tree1.length) && (idx2 < tree2.length)\n if OneCfg::Config::Utils.deep_compare(val1,\n val2,\n @strict)\n idx += 1\n idx1 += 1\n idx2 += 1\n else\n # Inserting values:\n # 1 = A, B, C, D, E, F\n # 2 = A, B, X, C, Y, D, E, F\n # INSERT X, idx 2\n # INSERT X, idx 4\n # when on pos 2, forward lookup for 'C'\n # in tree2, find on pos 3, so add new\n # 'X' on pos 2, idx2++\n #\n # Deleting values:\n # 1 = A, B, C, D, E, F\n # 2 = A, B, E, F\n # DELETE C, idx 2\n # DELETE D, idx 2\n # when on pos 2, forward lookup for 'C'\n # in tree, don't find any, so delete\n # 'C' from pos 2, idx1++\n\n # forward lookup for val1\n fwd_found = false\n fwd_idx2 = idx2 + 1\n\n # rubocop:disable Layout/LineLength\n while (fwd_idx2 < tree2.length) && !fwd_found\n if OneCfg::Config::Utils.deep_compare(tree2[fwd_idx2], val1, @strict)\n fwd_found = true\n else\n fwd_idx2 += 1\n end\n end\n # rubocop:enable Layout/LineLength\n\n if fwd_found\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val2,\n 'old' => val1,\n 'state' => 'ins',\n 'extra' => { 'index' => idx }\n }\n\n idx += 1\n idx2 += 1\n\n else\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val1,\n 'state' => 'rm',\n 'extra' => { 'index' => idx }\n }\n\n idx1 += 1\n end\n end\n\n # Process remaining array items on tree1\n # by dropping them (not found on tree2)\n elsif idx1 < tree1.length\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val1,\n 'state' => 'rm',\n 'extra' => { 'index' => idx }\n }\n\n idx1 += 1\n\n # Process remaining new array items on tree2\n # by creating them.\n else\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val2,\n 'old' => val1,\n 'state' => 'ins',\n 'extra' => { 'index' => idx }\n }\n\n idx += 1\n idx2 += 1\n end\n end\n else\n values = (tree1 + tree2).uniq\n\n values.each do |val|\n di1 = OneCfg::Config::Utils.deep_include?(\n tree1, val, @strict\n )\n\n di2 = OneCfg::Config::Utils.deep_include?(\n tree2, val, @strict\n )\n\n if di1 && di2\n # skip\n nil\n\n elsif di1\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val,\n 'state' => 'rm',\n 'extra' => {}\n }\n else\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val,\n 'state' => 'ins',\n 'extra' => {}\n }\n end\n end\n end\n\n # both subtrees are Nil\n elsif tree1.is_a? NilClass\n # skip\n nil\n\n # both subtrees are of some other type\n else\n unless OneCfg::Config::Utils.deep_compare(tree1,\n tree2,\n @strict)\n # set new value\n ret << {\n 'path' => path[0..-2],\n 'key' => path[-1],\n 'value' => tree2,\n 'old' => tree1,\n 'state' => 'set',\n 'extra' => {}\n }\n end\n end\n\n # Tree1 and tree2 are not same classes. We can't compare\n # them so we take tree2 as new value to set as-is.\n else\n # set new value\n ret << {\n 'path' => path[0..-2],\n 'key' => path[-1],\n 'value' => tree2,\n 'old' => tree1,\n 'state' => 'set',\n 'extra' => {}\n }\n end\n\n ret\n end", "title": "" }, { "docid": "0a8953822d58d20b93bba59d4a06ada4", "score": "0.57989216", "text": "def ascii_tree; end", "title": "" }, { "docid": "0553676213fa84f35338b9bae9decb89", "score": "0.5798479", "text": "def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end", "title": "" }, { "docid": "8583f7809d0f7143ba111b7e607c49c3", "score": "0.57979906", "text": "def parsed_tree; end", "title": "" }, { "docid": "c2a2affe191205efc27ba9d9d61eb97f", "score": "0.57852286", "text": "def test_sort_by_ancestry_with_block_full_tree\n AncestryTestDatabase.with_model :extra_columns => {:rank => :integer} do |model|\n n1, n2, n3, n4, n5, n6 = build_ranked_tree(model)\n\n records = model.sort_by_ancestry(model.all.order(:id => :desc), &RANK_SORT)\n assert_equal [n1, n5, n3, n2, n4, n6].map(&:id), records.map(&:id)\n end\n end", "title": "" }, { "docid": "fbcf9790d0b27e12936805a93446f05d", "score": "0.57752526", "text": "def is_subtree(root)\n\nend", "title": "" }, { "docid": "dbb7d6b52ac9418619f06efb797ec6f6", "score": "0.57667345", "text": "def build_tree(data, node=self)\n data = data.sort\n build_bin_tree(data, 0, data.length - 1, node)\n end", "title": "" }, { "docid": "0339d9b8bc5af6f58439d8bac323b085", "score": "0.5765554", "text": "def build_tree(array, left=0, right=array.length-1)\n \n# base case\n return if left > right\n\n# from smallest to largest\n array = merge_sort(array)\n\n# middle index, make this the first node\n index_mid = left + (right-left) / 2 \n node = Node.new(array[index_mid]) \n \n# i think it's making the left node (smaller), & right (larger)\n# looks like it is recursion\n node.left_child = build_tree(array, left, index_mid-1) \n node.right_child = build_tree(array, index_mid+1, right) \n\n @tree = node\n @tree\n end", "title": "" }, { "docid": "7aab4bf50ddda3ed64aa16f531165529", "score": "0.57572013", "text": "def test_return_sorted_array_two_nodes\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal [\"ab\"], @tree.sort\n end", "title": "" }, { "docid": "98df446f60d75c2b31379ffdbc3a088f", "score": "0.57523483", "text": "def test_save_tree\n end", "title": "" }, { "docid": "4f918ddc998be67a0c3ddcdbb6d3120b", "score": "0.57433724", "text": "def test_max_1_node\n @tree.insert(\"a\")\n assert_equal \"a\", @tree.max\n end", "title": "" }, { "docid": "91a927a350730f14f4068487a4bd47b4", "score": "0.57430553", "text": "def super_balanced(tree)\n if !tree\n return true\n end\n \n depths = []\n nodes = []\n nodes.push([tree, 0])\n \n while !nodes.empty?\n node, depth = nodes.pop\n \n if !node.left && !node.right\n if !depths.include? depth\n depths.push(depth)\n \n if (depths.length > 2) || (depths.length == 2 && (depths[0] - depths[1]).abs > 1)\n return false\n end\n \n end\n else\n if node.left\n nodes.push([node.left, depth+1])\n end\n if node.right\n nodes.push([node.right, depth+1])\n end\n end\n end\n \n return true \nend", "title": "" }, { "docid": "eb5a85eda3799ac0bd0557e34e54354c", "score": "0.5742497", "text": "def help_two(tree,key,value,compare)\n if tree == nil\n tree_ = Kickup.new([key,value])\n else\n tree_ = tree.insert_help(key,value)\n end\n if tree_.kick?\n if compare==-1\n Node3.new(tree_.val,@val,tree_.left,tree_.right,@right)\n else\n Node3.new(@val,tree_.val,@left,tree_.left,tree_.right)\n end\n else\n replace(tree_,compare)\n end\n end", "title": "" }, { "docid": "963e7d24f3e6162bea393e80186dc73c", "score": "0.573377", "text": "def testInitialize_2SW_1NE_depth2\n ps = [UniquePoint3.new(0,0,0), UniquePoint3.new(3,3,0), UniquePoint3.new(8,8,8)]\n q = QuadTreeAccelerator.new(ps)\n assert_equal(\n\"(0,[[0,0,0],[8,8,8]],[])\n SW\n (1,[[0,0,0],[4.0,4.0,8]],[])\n SW\n (2,[[0,0,0],[2.0,2.0,8]],[[0,0,0]])\n NE\n (2,[[2.0,2.0,0],[4.0,4.0,8]],[[3,3,0]])\n NE\n (1,[[4.0,4.0,0],[8,8,8]],[[8,8,8]])\n\", q.to_s)\n end", "title": "" }, { "docid": "971dd5b625afcfcdc3a2ada88840d378", "score": "0.5732114", "text": "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "title": "" }, { "docid": "0789fcb5883591fd2dd90d0aa2455f42", "score": "0.573124", "text": "def test_sort_by_ancestry_missing_parent_middle_of_tree\n AncestryTestDatabase.with_model do |model|\n n1, _, _, n4, n5, _ = build_tree(model)\n\n records = model.sort_by_ancestry([n5, n4, n1])\n if CORRECT\n assert_equal [n1, n4, n5].map(&:id), records.map(&:id)\n else\n assert_equal [n1, n5, n4].map(&:id), records.map(&:id)\n end\n end\n end", "title": "" }, { "docid": "94f88fda008db6da1c0c7d89b3bbf88a", "score": "0.573051", "text": "def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end", "title": "" }, { "docid": "a991c94d42c2f0ac3cc4a34546163647", "score": "0.57289094", "text": "def test_branch_chain\n #puts \"---------------test_branch_chain-----------------\"\n\n t1= t2 = t11 = t12 = t21 = t22 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do\n b.chain do\n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n b.chain do\n t21 = b.add(Thing21.new)\n t22 = b.add(Thing22.new)\n end\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12,t21,t22])\n assert r.include? [t1,t11]\n assert r.include? [t11,t12]\n assert r.include? [t12,t2]\n\n assert r.include? [t1,t21]\n assert r.include? [t21,t22]\n assert r.include? [t22,t2]\n\n assert_equal 6, r.size\n end", "title": "" }, { "docid": "5d489d850884d0b0da5e31a6f3f20d3b", "score": "0.5727448", "text": "def main7()\n t = Tree.new()\n arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n t.createBinarySearchTree(arr)\n t.printInOrder()\n t.printInRange(4, 7)\n t.trimOutsideRange(4, 7)\n t.printInOrder()\nend", "title": "" }, { "docid": "64951de6ceca4499a452924aa2e7108c", "score": "0.5725903", "text": "def run_tests\n desc = 'valid full tree'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(30)\n right = tree.insert_right(70)\n left.insert_left(10)\n left.insert_right(40)\n right.insert_left(60)\n right.insert_right(80)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\n\n desc = 'both subtrees valid'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(30)\n right = tree.insert_right(80)\n left.insert_left(20)\n left.insert_right(60)\n right.insert_left(70)\n right.insert_right(90)\n result = binary_search_tree?(tree)\n assert_false(result, desc)\n\n desc = 'descending linked list'\n tree = BinaryTreeNode.new(50)\n left = tree.insert_left(40)\n left_left = left.insert_left(30)\n left_left_left = left_left.insert_left(20)\n left_left_left.insert_left(10)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\n\n desc = 'out of order linked list'\n tree = BinaryTreeNode.new(50)\n right = tree.insert_right(70)\n right_right = right.insert_right(60)\n right_right.insert_right(80)\n result = binary_search_tree?(tree)\n assert_false(result, desc)\n\n desc = 'one node tree'\n tree = BinaryTreeNode.new(50)\n result = binary_search_tree?(tree)\n assert_true(result, desc)\nend", "title": "" }, { "docid": "4f87d80e34f1345cb2195f00acb8593d", "score": "0.5725024", "text": "def leaf_similar(root1, root2)\n leaves1 = []\n leaves2 = []\n\n dfs(root1, leaves1)\n dfs(root2, leaves2)\n\n leaves1 == leaves2\nend", "title": "" }, { "docid": "d11a44fb26593cc399ef74cddb7a4a6e", "score": "0.57249117", "text": "def valid_tree?\n true\n end", "title": "" }, { "docid": "39d9e2b09eb449e0e6ccd7f226fe2084", "score": "0.57202536", "text": "def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n else\n q = MyQueue.new\n end\n current_tree = q.dequeue()\n end\nend", "title": "" }, { "docid": "d45fedf882fe3f9edcf913401c6e0f7c", "score": "0.57187873", "text": "def prune_from_tree\n return if self.right.nil? || self.left.nil?\n diff = self.right - self.left + 1\n\n #TODO: implemente :dependent option\n # delete_method = acts_as_nested_set_options[:dependent] == :destroy ?\n # :destroy_all : :delete_all\n\n #TODO: implement prune method\n # self.class.base_class.transaction do\n # nested_set_scope.send(delete_method,\n # [\"#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?\",\n # left, right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)\", diff],\n # [\"#{quoted_left_column_name} >= ?\", right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)\", diff],\n # [\"#{quoted_right_column_name} >= ?\", right]\n # )\n # end\n end", "title": "" }, { "docid": "58932e5b0fe905c9a6b3fa9f23b2f07a", "score": "0.5708449", "text": "def structure_reform(curNode, addNode)\n # reset branches for reform\n @branches = []\n @branch_count = 0\n # puts 'before cleanup'\n # lNode.print_tree\n # rNode.print_tree\n # rNode.print_tree\n # remove_PH_node(lNode)\n # remove_PH_node(rNode)\n # remove_PH_node(curNode)\n # puts 'after cleanup'\n # curNode.print_tree\n # addNode.print_tree\n # rNode.print_tree\n curChildren = curNode.children.count == 0 ? [curNode] : curNode.children\n addChildren = addNode.children.count == 0 ? [addNode] : addNode.children\n count = 0\n # p 'lnode'\n # pp lChildren\n # p 'rnode'\n curChildren.each do |ln|\n curNode.remove!(ln)\n addChildren.each do |rn|\n # p '--------------'\n # p 'ln'\n # ln.print_tree\n # p 'rn'\n # rn.print_tree\n # binding.pry\n # phName=\"PH#{@branch_count}\"\n # ph =Tree::TreeNode.new(phName, '')\n ln_append = ln.detached_subtree_copy\n # p 'ln_append before'\n # ln_append.print_tree\n append_to_end(ln_append, rn)\n # p 'ln_append'\n # ln_append.print_tree\n # ph<<ln_append #unless curNode==newNode\n ln_append = add_branch(ln_append)\n # p 'ln_append after'\n # ln_append.print_tree\n curNode << ln_append\n # p 'ph'\n # ph.print_tree\n # p 'curNode'\n # curNode.print_tree\n end\n end\n end", "title": "" }, { "docid": "4a87d305ca7b084af0f9bdd39e1fb44d", "score": "0.5705356", "text": "def build_tree\n index = 0\n @ignore_list.each do |attribute|\n #puts \"Attribute: #{attribute}\"\n #puts \"Result: #{@max_result_array[index]}\"\n #puts \"Count: #{@max_class_count_array[index]}\"\n\n @max_class_count_array[index].each do |label, count|\n isLeaf = false\n result = nil\n #puts \"Label: #{label}, Count: #{count}\"\n c1_count = count['<=50K.']\n c2_count = count['>50K.']\n ratio_a = c1_count.to_f / c2_count.to_f\n ratio_b = c2_count.to_f / c1_count.to_f\n #puts \"ratio_a: #{ratio_a} || ratio_b: #{ratio_b} || c1: #{c1_count} || c2: #{c2_count}\"\n if ratio_a >= 30 or ratio_b >= 30 then\n # Have a high ratio, thus we can declare a class\n if c1_count > c2_count\n # declare class 1\n #puts \"Ratio is HIGH, #{ratio_a}, declare any #{attribute} with a #{label} to be class <=50K.\"\n isLeaf = true\n result = '<=50k'\n else\n #puts \"Ratio B is HIGH, #{ratio_b}, declare any #{attribute} with a #{label} to be class >50K.\"\n isLeaf = true\n result = '>50k'\n end\n else\n #puts \"Ratio is too LOW for #{attribute} with label #{label}.\"\n end\n\n if index == 0 then parent = nil else parent = @ignore_list[index-1] end\n\n if isLeaf then\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => nil, 'parent' => parent]\n else\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => @ignore_list[index+1], 'parent' => parent]\n end\n\n end\n index += 1\n end\n\n @tree.each { |node| puts node }\n end", "title": "" }, { "docid": "b759d6c6d53b4950b530b23b58210a22", "score": "0.5704848", "text": "def is_same_tree(p, q)\n\tif (p == nil) ^ (q == nil) \n\t\treturn false\n\tend\n\tq1 = []\n\tq2 = []\n\tq1.push p\n\tq2.push q\n\twhile q1 != [] and q2 != []\n\t\tc1 = q1.shift\n\t\tc2 = q2.shift\n\t\tif c1 == nil and c2 == nil\n\t\telsif (c1 == nil) ^ (c2 == nil)\n\t\t\treturn false\n\t\telsif c1.val != c2.val\n\t\t\treturn false\n\t\telse\n\t\t\tq1.push c1.left\n\t\t\tq1.push c1.right\n\t\t\tq2.push c2.left\n\t\t\tq2.push c2.right\n\t\tend\n\tend\n\tif q1 != [] or q2 != []\n\t\treturn false\n\tend\n\treturn true\n \nend", "title": "" }, { "docid": "846e385012616a13bcc6797fb2eb76a2", "score": "0.5699339", "text": "def build_tree(array)\n first_node = Node.new(nil, nil, array[0])\n this_node = first_node\n i = 1\n\n finished = false\n while !finished\n if array[i] == nil\n finished = true\n elsif array[i] < this_node.data\n if this_node.left_child == nil\n this_node.left_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.left_child\n end\n elsif array[i] > this_node.data\n if this_node.right_child == nil\n this_node.right_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.right_child\n end \n elsif array[i] == this_node.data\n i += 1\n end\n end\n return first_node\nend", "title": "" }, { "docid": "7cd42e1d66c454b2c76acbb3fa0139d4", "score": "0.569584", "text": "def rebalance\n order = self.level_order\n return build_tree(order)\n end", "title": "" }, { "docid": "54779fe5d0c6dfa816d57688bd776f09", "score": "0.56950474", "text": "def build_tree(arr)\n #take array, turn into bt with node objs\n return nil if arr.empty?\n\n mid = (arr.size - 1)/2\n current_node = Node.new(arr[mid])\n\n current_node.left = build_tree(arr[0...mid])\n current_node.right = build_tree(arr[(mid+1)..-1])\n \n current_node\n end", "title": "" }, { "docid": "be24791b513c49a054f7a986cb75542e", "score": "0.56902236", "text": "def build_tree_helper(arr)\n\treturn Node.new(arr[0]) if arr.size == 1\n\tnode = Node.new(arr.slice!(arr.size / 2))\n\ttree = build_tree(arr)\n\tuntil (node.value > tree.value && tree.right_child.nil?) || (node.value <= tree.value && tree.left_child.nil?)\n\t\ttree = node.value > tree.value ? tree.right_child : tree.left_child\n\tend\n\tif node.value > tree.value\n\t\ttree.right_child = node\n\t\tnode.parent = tree\n\telse\n\t\ttree.left_child = node\n\t\tnode.parent = tree\n\tend\nend", "title": "" }, { "docid": "30b2a5879ef6f07c5de68432aa10b01f", "score": "0.56874734", "text": "def second_chk(obj)\n lft = self.left * obj\n if lft != nil\n return Prod.new(lft,self.right).reduce\n else\n rht = self.right * obj\n if rht != nil\n return Prod.new(self.left,rht).reduce\n else\n return nil unless self.top\n return Prod.new(self,obj).reduce\n end\n end\n # return nil\n end", "title": "" }, { "docid": "f2d0a5c0259c7cac2659d04e37b54ee9", "score": "0.5675012", "text": "def verify\n 1.upto(@leaf_count - 1) do |node|\n next if @nodes[node] ==\n HashTree.node_hash(node, @nodes[HashTree.left_child(node)],\n @nodes[HashTree.right_child(node)])\n raise \"Tree integrity verification failed\" \n end\n self\n end", "title": "" }, { "docid": "cc4bf721b5d78980acd1188d35290501", "score": "0.5672703", "text": "def construct_tree(arr)\n root = TreeNode.new(arr.shift)\n xtd = [root]\n while !xtd.empty? && !arr.empty?\n cur_node = xtd.shift\n a, b = arr.shift(2) # doesn't matter if arr.size < 2. in this case, a, b might be nil\n cur_node.left = a.nil? ? nil : TreeNode.new(a)\n cur_node.right = b.nil? ? nil : TreeNode.new(b)\n xtd << cur_node.left unless cur_node.left.nil?\n xtd << cur_node.right unless cur_node.right.nil?\n end\n root\nend", "title": "" }, { "docid": "7ab6d5b96003d577d30228a56c0b442e", "score": "0.5672602", "text": "def build_tree(array)\n array.sort!.uniq!\n left = 0\n right = array.length\n\n return build_driver(array, left, right)\n end", "title": "" }, { "docid": "01041d69d6bbef44370c74ab9f28c09e", "score": "0.5664321", "text": "def is_balanced_binary_tree?(root)\n is_balanced_rec(root) != -1\nend", "title": "" }, { "docid": "89e864bd80e66f4c9819c99faec41cb0", "score": "0.56638986", "text": "def build_tree(arr)\n\ntree = []\n\ntree.push(Node.new(arr[0]))\n\n arr[1..-1].each do |i|\n new_node = Node.new(i)\n\n condition = false\n current = tree[0]\n until condition == true\n if i > current.value && current.find_right_child.count == 0\n new_node.create_parent(current)\n current.create_right_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i < current.value && current.find_left_child.count == 0\n new_node.create_parent(current)\n current.create_left_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i > current.value && current.find_right_child.count == 1\n current = current.find_right_child[0]\n elsif i < current.value && current.find_left_child.count == 1\n current = current.find_left_child[0]\n end\n end\n end\n tree\nend", "title": "" }, { "docid": "45b66cbc647273b0538483ec40c5fd6f", "score": "0.56629133", "text": "def test_sort_by_ancestry_no_parents_same_level\n AncestryTestDatabase.with_model do |model|\n _, _, n3, n4, n5, _ = build_tree(model)\n\n records = [n5, n4, n3]\n # records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc).offset(3).take(3))\n assert_equal [n5, n4, n3].map(&:id), records.map(&:id)\n end\n end", "title": "" }, { "docid": "077498cb7e9c810e4f7d50b1fe83cb4d", "score": "0.5662143", "text": "def possible_branch_nodes\r\n max_depth = max_category_depth\r\n article_categories.select {|ac| ac.parent_id.nil? || (ac.depth < max_depth)}\r\n end", "title": "" }, { "docid": "dea3e27a17a44dbac20a10749960aaaf", "score": "0.5661283", "text": "def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend", "title": "" }, { "docid": "243c35a25511043059f6da615b76a1bb", "score": "0.565391", "text": "def tree(name, finder, partial = T.unsafe(nil), seen = T.unsafe(nil)); end", "title": "" }, { "docid": "35c62bf83a8df45c3e2010b9f0132fc2", "score": "0.565169", "text": "def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend", "title": "" }, { "docid": "18fcf856b189c543db945122edad03db", "score": "0.5647843", "text": "def find_breadth_traversal_tree(in_order,post_order,level, h)\n # level => 0F 0T 1F 1T etc\n if in_order.size == nil || in_order.size == 0\n puts \"finish\"\n elsif in_order.size == 1\n # finish\n yield(level, in_order[0])\n puts \"#{level} \\t #{in_order[0]}\"\n else \n # this is not finished yet\n max_index_in_post = 0\n max_index_in_in = 0\n in_order.each_with_index do |in_ele,in_index|\n post_index = post_order.index(in_ele)\n\n if post_index > max_index_in_post\n max_index_in_post = post_index\n max_index_in_in = in_index\n end\n\n end\n current_root = in_order[max_index_in_in]\n yield(level, current_root)\n puts \"#{level} \\t #{current_root}\"\n\n level[0] = (Integer(level[0])+1).to_s\n next_level_f = level+\"F\"\n next_level_t = level+\"T\"\n front_of_in = in_order[0...max_index_in_in]\n tail_of_in = in_order[(max_index_in_in+1)...in_order.size]\n \n #\n find_breadth_traversal_tree(front_of_in,post_order,next_level_f, h) {|level,ele| h[level] = ele}\n find_breadth_traversal_tree(tail_of_in,post_order,next_level_t, h) {|level,ele| h[level] = ele}\n\n #\n end # end of else\n\n\nend", "title": "" }, { "docid": "f4a3c77dd519a9e56cc0482202b39d26", "score": "0.5647279", "text": "def test_sort_by_ancestry_full_tree\n AncestryTestDatabase.with_model do |model|\n n1, n2, n3, n4, n5, n6 = build_tree(model)\n\n records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc))\n assert_equal [n1, n5, n6, n2, n4, n3].map(&:id), records.map(&:id)\n end\n end", "title": "" }, { "docid": "1875822cca8151fa937670298c1040dc", "score": "0.5646861", "text": "def test_return_array_root_node\n @tree.insert(\"f\")\n assert_equal [\"f\"], @tree.sort\n end", "title": "" }, { "docid": "da4399d6c9ad0f1e7f65da69f5f83124", "score": "0.564376", "text": "def make_tree(pre, inord)\n return if pre.size == 0\n root_node = Node.new(pre[0])\n idx = inord.index(pre[0])\n root_node.left = make_tree(pre[1..idx], inord[0...idx])\n root_node.right = make_tree(pre[idx+1...pre.size], inord[idx+1...inord.size])\n return root_node\nend", "title": "" }, { "docid": "37df8759693470f69dace03b19ebbdb4", "score": "0.5643602", "text": "def test_load_ignores_duplicates\n tree = BinarySearchTree.new\n tree.load\n target = tree.load\n assert_nil target\n end", "title": "" }, { "docid": "51a6ef9a5da8519723141325c3afeaff", "score": "0.56414795", "text": "def test_add_third_node_to_left\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(40, \"movie b\")\n movie_c = tree.insert(30, \"movie c\")\n assert_equal 2, tree.root.left_node.left_node.depth\n end", "title": "" } ]
adabf54d2e30cac84972b7cb442a92e2
Sets the name of the worker. Setting the name to nil will reset the default worker name
[ { "docid": "cc27f664ffd61a7437601f51178def1b", "score": "0.0", "text": "def name=(val)\n @name = val\n end", "title": "" } ]
[ { "docid": "79a4ed97f8e53b1623cb5385af64bd5c", "score": "0.70488185", "text": "def worker_name\n @parameters[:worker_name]\n end", "title": "" }, { "docid": "8cf89d18bbebd5f02aa186e3f6c28f22", "score": "0.6964408", "text": "def name(value=nil)\n @name = value unless value.nil?\n @name ||= File.basename(worker_def)\n @name\n end", "title": "" }, { "docid": "b4cc2ee4524e38ee4ed835c445054c4e", "score": "0.65165854", "text": "def name= value\n\t\t\t\t@thread.name = value\n\t\t\tend", "title": "" }, { "docid": "63251e5061e866bccaf7eae40c5fe416", "score": "0.64372826", "text": "def name= value\n\t\t\t\t\t@thread.name = value\n\t\t\t\tend", "title": "" }, { "docid": "e8a163068a64a79347c1b26b093b2475", "score": "0.6372086", "text": "def name=(name)\n @name ||= name.to_s\n end", "title": "" }, { "docid": "ab4b0a512eb6697dd0a5e43f0bedd4dc", "score": "0.6371737", "text": "def set_name\n @name = name\n end", "title": "" }, { "docid": "7cd704d3c168b69fd50bed4b05d1807a", "score": "0.63162065", "text": "def queue_name(name)\n @queue_name = name\n end", "title": "" }, { "docid": "b7b745cd4ffbecdcbee4a372e5f95b35", "score": "0.63061297", "text": "def set_name(name)\n event(:_set_name, :name => name)\n end", "title": "" }, { "docid": "ed44b768c54fee8c7099ccb4635091c1", "score": "0.627221", "text": "def queue_name(name)\n @queue_name = name\n end", "title": "" }, { "docid": "f9c8a1c1264a55c6a063b1740d60df44", "score": "0.62476265", "text": "def _name=(value)\n @name = value\n end", "title": "" }, { "docid": "491b98004b29f6ce7986865477aea5bc", "score": "0.6228541", "text": "def name=(name)\n @ws.setName(name)\n end", "title": "" }, { "docid": "d1c6bfcdfe16f7ec4b8483194d66a3d5", "score": "0.6219183", "text": "def set_name(name)\n if name != @name\n @name = name\n end\n end", "title": "" }, { "docid": "b7f652d72a0a466c0919e90fa7bcbf97", "score": "0.6215322", "text": "def set_name(name)\n @name = name\n end", "title": "" }, { "docid": "5452e26040a36ec126a35bd5aca0a390", "score": "0.6181191", "text": "def name=(name)\n @original_name ||= @name\n @name = name\n end", "title": "" }, { "docid": "08c8d5a1aea4eae91d1987489c2a4fa2", "score": "0.61714727", "text": "def set_name(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "08c8d5a1aea4eae91d1987489c2a4fa2", "score": "0.61714727", "text": "def set_name(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "08c8d5a1aea4eae91d1987489c2a4fa2", "score": "0.61714727", "text": "def set_name(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "c5d1e468ec9fd1021f7fcd56719faa2a", "score": "0.6168426", "text": "def name\n ['worker', self.class.kname, workerid].flatten.join '-'\n end", "title": "" }, { "docid": "9a6b6544680425dd166657b2f5004742", "score": "0.6145944", "text": "def set_name(name)\n end", "title": "" }, { "docid": "3b6f208168de4d4b598033bf8eb886c0", "score": "0.6117807", "text": "def setname(name)\n @name = mkname(name)\n end", "title": "" }, { "docid": "bd0b912ddaee63360320123b4e963f68", "score": "0.6109835", "text": "def name=(value)\n @name = value ? value.to_s.freeze : nil\n end", "title": "" }, { "docid": "42d5fa74879858dfa1bc6fafc5c5829b", "score": "0.60757124", "text": "def name=(v)\n DataTypeValidator.validate \"Worksheet.name\", String, v\n raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % v) if v.size > 31\n sheet_names = @workbook.worksheets.map { |s| s.name }\n raise ArgumentError, (ERR_DUPLICATE_SHEET_NAME % v) if sheet_names.include?(v)\n @name=v\n end", "title": "" }, { "docid": "b5ca79983da7fdabed8e7a25dac1b705", "score": "0.6054044", "text": "def set_name(name)\n\t\t@name = name\n\tend", "title": "" }, { "docid": "2606311b4c70745284e44a899cf35901", "score": "0.60512066", "text": "def set_name(new_name)\n @name=new_name\n end", "title": "" }, { "docid": "0d3408901fd3be4a536e43dd2a363edf", "score": "0.60499555", "text": "def name=(name)\n @name = name.to_s.parameterize.underscore\n reset!\n end", "title": "" }, { "docid": "f9ae0f32e9925c91f6edf510cfdf422d", "score": "0.60415787", "text": "def name=(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "f9ae0f32e9925c91f6edf510cfdf422d", "score": "0.60415787", "text": "def name=(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "80f9e99f9736f731d995ad283af2f269", "score": "0.602747", "text": "def name(name = nil)\n @name = name if name\n @name\n end", "title": "" }, { "docid": "648c387572efc41468721383661eee9e", "score": "0.6013558", "text": "def name=(value)\n if value == \"\"\n raise \"Name can't be blank\"\n end\n @name = value\n end", "title": "" }, { "docid": "2ec6211fa5bdfc8ee9caaa697e1e292e", "score": "0.6012815", "text": "def program_name(name = nil)\n @program_name = name || @program_name\n end", "title": "" }, { "docid": "e44177549f8ab66f5d101b6382430f95", "score": "0.6012635", "text": "def set_name\n self.update(name: \"Xtra-Large Washer ##{self.id}\") unless self.name\n end", "title": "" }, { "docid": "b4a90fb7c0e2ad0a7aad63db6e7fa64d", "score": "0.59849256", "text": "def name=(str)\n self.clear\n @name = str\n end", "title": "" }, { "docid": "b240e2993feaa1c6978122bc8e383aa4", "score": "0.5977086", "text": "def name=(value)\n\t\tif value == \"\"\n\t\t\traise \"Name can't be blank!\"\n\t\tend\n\t\t@name = value\n\tend", "title": "" }, { "docid": "68b3a06c87a80370acb8df024a92a8a1", "score": "0.59756976", "text": "def name=(name)\n @connection.rename(@name, name)\n @name = name\n # TODO Check for subscription change?\n end", "title": "" }, { "docid": "bdc4ca531b20327c364f93823b067840", "score": "0.59711415", "text": "def set_name\n self.update(name: \"Small Washer ##{self.id}\" ) unless self.name\n end", "title": "" }, { "docid": "4dbebb0286aabde86514b113f1c5c258", "score": "0.5967324", "text": "def name=(name)\n @label = nil\n set_hash_value('name', name)\n end", "title": "" }, { "docid": "e0bd6d37a45e01c7439a8b1cdaa8e60d", "score": "0.59669036", "text": "def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\"\n\t\tend\n\t\t@name = name\n\tend", "title": "" }, { "docid": "e0bd6d37a45e01c7439a8b1cdaa8e60d", "score": "0.59669036", "text": "def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\"\n\t\tend\n\t\t@name = name\n\tend", "title": "" }, { "docid": "001d146e3c5b7baf205bde7e56cab2df", "score": "0.59438187", "text": "def name=(new_name)\n raise ArgumentError if new_name.nil?\n end", "title": "" }, { "docid": "eb71cf7f69f4b9275418b4539be7b3e1", "score": "0.5939042", "text": "def name=(name)\n update_server_data(name: name)\n end", "title": "" }, { "docid": "eb71cf7f69f4b9275418b4539be7b3e1", "score": "0.5939042", "text": "def name=(name)\n update_server_data(name: name)\n end", "title": "" }, { "docid": "eb71cf7f69f4b9275418b4539be7b3e1", "score": "0.5939042", "text": "def name=(name)\n update_server_data(name: name)\n end", "title": "" }, { "docid": "ac601c91df4fd7f8488785ac2d8e2edd", "score": "0.59336776", "text": "def name_setter(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "66bb424e84987262b145f3d8fee20d43", "score": "0.59331334", "text": "def set_name(new_name)\n update(name: new_name)\n end", "title": "" }, { "docid": "f3d0175f9240ee5e401391a97e3d8610", "score": "0.59220505", "text": "def setProgramName(name)\n end", "title": "" }, { "docid": "4fb6a7e951fe92f42c1331e0885e7f98", "score": "0.59173226", "text": "def name= value\n\t\t\t\t\tif @name = value\n\t\t\t\t\t\t::Process.setproctitle(@name)\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "1e69d6389e3d86a8d7972c217f26a3a6", "score": "0.591541", "text": "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "title": "" }, { "docid": "c52db8a8fc2524e35ec08564ee377f30", "score": "0.5907447", "text": "def set_program_name(name)\n\n\t\t@program_name = name\n\tend", "title": "" }, { "docid": "d8fe5abc6c1577e5fa25659e9e92d478", "score": "0.5905973", "text": "def name=(name)\n @name = name.to_s\n end", "title": "" }, { "docid": "2202d93bb156166ac14acbf45c86e52e", "score": "0.59002036", "text": "def name=(n)\n @name = n\n end", "title": "" }, { "docid": "2202d93bb156166ac14acbf45c86e52e", "score": "0.59002036", "text": "def name=(n)\n @name = n\n end", "title": "" }, { "docid": "10f7346fc1e63f983879826084a3e757", "score": "0.5889319", "text": "def set_name(new_name)\r\n update(name: new_name)\r\n end", "title": "" }, { "docid": "7266cebe1cab6db8bcaef071585b3564", "score": "0.58849967", "text": "def set_name(name)\n @name = name\n refresh\n end", "title": "" }, { "docid": "e2f6290db3f07fbf513d4aad63ac5566", "score": "0.5862581", "text": "def name(new_name = nil)\n @name = new_name.to_s unless new_name.nil?\n @name\n end", "title": "" }, { "docid": "2093609ce711e94a585e703f94e17462", "score": "0.58589095", "text": "def set_name=(name)\n @name = name\n end", "title": "" }, { "docid": "2093609ce711e94a585e703f94e17462", "score": "0.58589095", "text": "def set_name=(name)\n @name = name\n end", "title": "" }, { "docid": "2093609ce711e94a585e703f94e17462", "score": "0.58589095", "text": "def set_name=(name)\n @name = name\n end", "title": "" }, { "docid": "2093609ce711e94a585e703f94e17462", "score": "0.58589095", "text": "def set_name=(name)\n @name = name\n end", "title": "" }, { "docid": "2093609ce711e94a585e703f94e17462", "score": "0.58589095", "text": "def set_name=(name)\n @name = name\n end", "title": "" }, { "docid": "8ad090c0533dff0c7bad3d7a6a28fc2e", "score": "0.5855291", "text": "def set_name(name)\n\t\tend", "title": "" }, { "docid": "1a1ccb38a65c64bca202ea49d89b9410", "score": "0.5854357", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "ca4bee7e43cf0b08862fd0f66dfa8c3b", "score": "0.5846989", "text": "def set_name=(name)\n\t\t@name = name\n\tend", "title": "" }, { "docid": "386a9f716a7ea260dda4307fa974298f", "score": "0.5846358", "text": "def name_setter(new_name)\n @name = new_name\n\n end", "title": "" }, { "docid": "c5b896f5e0e35ee717a632933eaa438c", "score": "0.5845842", "text": "def initialize(worker_name:, **opts)\n @worker_name = worker_name\n super(**opts)\n end", "title": "" }, { "docid": "e789dfb487252db5a5c3007643f1736c", "score": "0.5842432", "text": "def name=(name)\n if !name.nil? && name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end", "title": "" }, { "docid": "e789dfb487252db5a5c3007643f1736c", "score": "0.5842432", "text": "def name=(name)\n if !name.nil? && name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end", "title": "" }, { "docid": "162d2ac1f5e52663c9beadc366a9466e", "score": "0.5841327", "text": "def name=(name)\n @name = name && name.to_s\n end", "title": "" }, { "docid": "84c8b59808fca025c36b8ed0ee6ce059", "score": "0.5837854", "text": "def name\n # Initialize a nil value to something meaningful\n @name ||= ''\n @name\n end", "title": "" }, { "docid": "4287ae3ed3fe34f2742406fc0cf9f0b7", "score": "0.5833347", "text": "def name=(value)\n @name = value.to_s\n end", "title": "" }, { "docid": "9411c6364823202c2b1254783ce19780", "score": "0.58269054", "text": "def name=(value)\n raise \"Name can't be blank.\" if value == ''\n\n @name = value\n end", "title": "" }, { "docid": "01dc8970e1341093541aeda6dadcf961", "score": "0.5805265", "text": "def name_setter(new_name)\n\t\t@name = new_name\n\n\tend", "title": "" }, { "docid": "1ed1a0af36be08e2587d676ddaaf4a10", "score": "0.5804796", "text": "def change_name(new_name)\n @name = new_name\n end", "title": "" }, { "docid": "a759ec2a55062004610dac82c907e429", "score": "0.58026356", "text": "def name=(name)\n if !name.nil? && name.to_s.length > 100\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 100.'\n end\n\n @name = name\n end", "title": "" }, { "docid": "184087645751d14665a7b180b91b17d6", "score": "0.57961226", "text": "def set_name=(new_name)\r\n @name = new_name\r\n end", "title": "" }, { "docid": "5345d890f2c4d00b6a76f93ce312240d", "score": "0.57949245", "text": "def name(name) # rubocop:disable Style/TrivialAccessors\n @name = name\n end", "title": "" }, { "docid": "eaadf59f817a872b64d8d23d9bf4bfe7", "score": "0.57917386", "text": "def name=(name)\n write_attribute(:name, name)\n self.update_url_name\n end", "title": "" }, { "docid": "613191f239d269d4eac9c571db936df2", "score": "0.57899886", "text": "def process_name=(value)\n @process_name = value\n end", "title": "" }, { "docid": "8f2c31681e6ad57c3747fdb7cda21ee1", "score": "0.5787173", "text": "def name= (new_name)\n @name = new_name\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5786718", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5786718", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5786718", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5786718", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5786718", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.578628", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.578628", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.578628", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.578628", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.578628", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "15f7fd249cf7f4b4ab34345a016ff766", "score": "0.57855016", "text": "def set_name n\n @controller_name = n\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5785248", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5785248", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5785248", "text": "def name=(value)\n @name = value\n end", "title": "" }, { "docid": "4b3f6a4b0c931070915e77d454da7bcd", "score": "0.5785248", "text": "def name=(value)\n @name = value\n end", "title": "" } ]
89671590601a274f2310c8ad40451d42
I worked on this challenge with Ian Wudarski. I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented. 0. Pseudocode What is the input? An Array of numbers of strings. What is the output? An array of the most frequent values. What are the steps needed to solve the problem? =begin Iterate through the array and count the instance of each object. create a new Hash add each object in the array as a key add one to the value of the key if it repeats Identify the largest value or values. Create an array from the values of the most occurring object or objects. Return said array. =end 1. Initial Solution
[ { "docid": "e8c86abcc2b088b2658ce2fcfbf09195", "score": "0.0", "text": "def mode (array)\n newhash=Hash.new\n array.each do |x|\n newhash[x] = newhash[x].to_i + 1\n end\n modevalue = newhash.values.max\n modearray= Array.new\n newhash.each do |x, y|\n if y == modevalue\n modearray.push(x)\n end\n end\n return modearray\nend", "title": "" } ]
[ { "docid": "c15139d84fc481c33dfbf07305e95b8c", "score": "0.7803973", "text": "def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld hash.\n arr.each do |ele|\n \t hashld[ele] += 1\n end\n \n #3. Hold max count in variable.\n maxd = hashld.values.max\n \n #4. Create new hash containing keys with more than 1 count.\n fnlhsh = (hashld.select {|key,value| value == maxd})\n \n #5. Return array if size == 1, else return nil. \n if fnlhsh.size == 1\n final_val = fnlhsh.keys.join.to_i\n else \n final_val = nil\n end\n \n return final_val\nend", "title": "" }, { "docid": "71d88f3b95193aad89314a722d4ee096", "score": "0.7765087", "text": "def find_most_frequent_integer(arr)\n empty = {}\n max = {}\n num = nil\n \n i = 0 \n while i < arr.length\n if empty.has_key?(arr[i]) == true\n empty[arr[i]] += 1\n else\n empty[arr[i]] = 1\n end\n i+=1\n end\n \n empty.each do |key,value|\n if value == empty.values.max\n max[key] = value\n num = key\n end\n end\n \n max.length > 1 ? nil : num\n \nend", "title": "" }, { "docid": "86401d577b2077f536d68f6a6c6589a2", "score": "0.7738651", "text": "def find_most_frequent_integer(arr)\n #use a Hash to keep track of the number of duplicates\n new_hash = Hash.new(0)\n #iterate through each element in the array\n arr.each do |element|\n #add all elements to the new_hash and add one to the key's value if there's a duplicate\n new_hash[element] += 1\n end\n #make sure that the Array passed in contained something\n if new_hash.empty?\n return nil\n end\n #create empty array to add the key(s) with the \"highest value\" value(s)\n comparison_array = []\n #iterate through each key and value in new_hash\n new_hash.each do |x, y|\n #compare each value to the \"max\" value of the hash\n if y == new_hash.values.max\n #add any keys that match the \"highest value\" value in the \n #hash to the new array\n comparison_array.push(x)\n end\n end\n #check if more than one key was added to the new array\n if comparison_array.count > 1\n #if the array contains more than one element then there was more than one\n #repeated integer\n return nil\n else\n #if the array contains only one element then that element is the most\n #frequent integer\n return comparison_array[0]\n end\nend", "title": "" }, { "docid": "c5dd4db95cd6c08a1141390cd7d0ae9a", "score": "0.76785", "text": "def find_most_frequent_integer(arr)\n highest_value = Hash.new(0)\n store_integer = Array.new\n arr.each do |x|\n highest_value[x] += 1\n end\n highest_value.each do |key,value|\n if value == highest_value.values.max \n store_integer.push(key) #need to put the highest value somewhere, so an array it will have to be! This was the hardest step for me. I could figure out how to return the key from the above step, but that wasn't helpful since one couldn't directly compare the keys (but putting them in an array worked.)\n end\n end \n if store_integer.length == 0 or store_integer.length >= 2 #This will return nil if there is no most frequent integer (like in the case of an empty hash), or if there are several of the most frequent integer amount\n return nil\n else\n return store_integer[0] \n end \n \nend", "title": "" }, { "docid": "395d479d4141ed6e6706925c87193ce8", "score": "0.76529264", "text": "def appears_most_times(array)\n hash = {}\n max = 0\n key_max = array[0]\n array.each do |num|\n if hash[num].nil?\n hash[num] = 1\n else\n hash[num] += 1\n end\n if hash[num] > max\n max = hash[num]\n key_max = num\n end\n end\n key_max\nend", "title": "" }, { "docid": "92feda546b68b8d2e06eb1c48253354e", "score": "0.76350033", "text": "def mode (array)\n # -make a hash to keep track of each item's frequecy\n tracker = {}\n# -iterate through the input array\n array.each do |x|\n# -create a key for each different thing in the input array\n if tracker.has_key?(x) # use the value to keep track of how often each thing shows up\n #increment the value up by 1\n tracker[x] += 1\n puts \"#{x} is incrementing\"\n else\n #add it\n tracker[x] = 1\n puts \"#{x} is being set\"\n end \n # -check the most frequent value \n \n puts \"tracker hash is like this: #{tracker}\"\n \n end \n puts \"array.each part done\"\n \n final_values = tracker.values\n highest = 0\n final_values.each do |x|\n if x > highest\n highest = x\n end \n \n end\n puts \"highest is #{highest}\"\n \n \n # find all the highest values and put em in an array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n \n end\n return output\nend", "title": "" }, { "docid": "d0e40c0600e6953d90755d7fa7a6a9f5", "score": "0.76212525", "text": "def find_most_frequent_integer(arr)\n count_hash = arr.each_with_object (Hash.new(0)) { |element, counts| counts[element] += 1 }\n count_hash.each { |key, value| return key if value == count_hash.values.max }\nend", "title": "" }, { "docid": "739cf66c3ea6c269832ab400abaca31d", "score": "0.75524485", "text": "def find_most_frequent_integer(arr)\n collect = Hash.new 0\n \n arr.each do |int|\n collect[int] += 1\n end\n \n if collect.select {|k,v| v == collect.values.max}.count > 1\n nil\n else\n collect.key(collect.values.max)\n end\nend", "title": "" }, { "docid": "746dbc84922d0d657d837e90573dc085", "score": "0.7514413", "text": "def mode(arr)\n\th = {}\n\tarr.each do |x| \n\t\th [x] = arr.count(x)\n\tend\n\tarr = h.values.sort\n highest_count = arr.last\n h.select {|k,v| v == highest_count}.keys\nend", "title": "" }, { "docid": "d83a2b8a77a19c7742d3493aa6726376", "score": "0.75000226", "text": "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n\n# adds each key (item) with the max value to the output array\n output = []\n tracker.each do |key, value|\n if value == tracker.values.max\n output << key\n end\n end\n\n return output\nend", "title": "" }, { "docid": "78036e12a907d76b7e7c72de0bb94b7f", "score": "0.74984944", "text": "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n# finds the highest value (frequency)\n final_values = tracker.values\n highest = 0 \n final_values.each do |x|\n if x > highest\n highest = x\n end \n end\n# adds each key (item) with the highest value to the output array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n end\n return output\nend", "title": "" }, { "docid": "679014b2ad83a0282477b77f68819f1c", "score": "0.74865216", "text": "def mode(array)\n instance = Hash.new(0)\n array.each do |item|\n instance[item] += 1\n end\n most_frequent = instance.values.max\n p instance.collect { |k, v| k if v == most_frequent }.compact\nend", "title": "" }, { "docid": "7744ee4941d57c31466abc7786ca464d", "score": "0.74851894", "text": "def most_frequent(nums)\n hash = {}\n max_occurence = 0\n\n nums.each do |num|\n if !hash.has_key?(num.to_s)\n hash[num.to_s] = 1\n else\n hash[num.to_s] += 1\n if max_occurence < hash[num.to_s] \n max_occurence = hash[num.to_s]\n end\n end\n end\n\n hash.select { |key, value| value == max_occurence }\n .map { |key, value| key.to_i} \nend", "title": "" }, { "docid": "19086904b3988953f557f87a54fc3c6d", "score": "0.7462243", "text": "def find_most_frequent_integer(arr)\n counts = Hash.new(0)\n\n arr.each do |int|\n counts[int] += 1\n end\n\n freq = counts.values\n # returns array of frequencies [2,1]\n\n if freq.uniq! == false && freq.uniq.length > 1\n freq.max\n counts.key(freq.max)\n else\n nil\n end\n\n \nend", "title": "" }, { "docid": "fd5bf1972813977563348cba8a6b500e", "score": "0.746068", "text": "def highestfrequency\r\n #@counts.group_by { |x| x }.map { |element, matches| [ element, matches ] }.to_h\r\n #@counts.each_with_object({}) { |item, memo| memo[item] ||= 0; memo[item] += 1 }\r\n ##@counts.uniq.map { |x| [x, @counts.count(x)] }.to_h\r\n #freq = @counts.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\r\n @counts.max_by { |k,v| v }\r\n end", "title": "" }, { "docid": "2541dc7e7b91c00feb2019694e15b58e", "score": "0.7454032", "text": "def mode(array)\n container = []\n final = []\n h = Hash.new(0)\n array.each {|object| h[object] += 1}\n h.each do |key, value|\n container << value\n end \n highest = container.max\n h.each do |key, value| \n if value == highest\n final << key\n end\n end\n final\nend", "title": "" }, { "docid": "22b1eafacb4de7e980a5d635317ceb37", "score": "0.74509585", "text": "def find_most_frequent_integer(arr)\n most = []\n freq = Hash.new(0)\n arr.each do |i|\n freq[i] += 1\n end\n freq.each do |k,v|\n if v == freq.values.max\n most.push(k)\n end\n end\n if most.count > 1\n nil\n else return most[0]\n end\nend", "title": "" }, { "docid": "f1cd39124db010234c302da5347279c7", "score": "0.7426969", "text": "def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend", "title": "" }, { "docid": "0fd3518a2e8805bced28ad78abc9b062", "score": "0.7350484", "text": "def mode(array)\n freq_hash = Hash.new(0)\n #hash_array = Hash[array.map{|x| [x,0]}]\n array.each do |arg|\n freq_hash[arg] += 1\n end\n freq_hash\n new_array = Array.new\n\n freq_hash.each do |key,value|\n if value == freq_hash.values.max\n new_array.push(key)\n end\n end\n new_array\nend", "title": "" }, { "docid": "df59cd2966f2b56bd33cd2256b0e932a", "score": "0.733441", "text": "def mode(array)\n freq = Hash.new(0)\n\n array.each do |i|\n freq[i] += 1\n end\n\n temp = Array.new\n largest = 0\n\n freq.each do |k, v|\n if(v > largest)\n temp.clear\n temp.push(k)\n largest = v\n elsif(v == largest)\n temp.push(k)\n end\n end\n\n return temp\nend", "title": "" }, { "docid": "46fd36d624821ef528d1ab69eebd07e6", "score": "0.7324112", "text": "def mode(array)\n h = Hash.new\n num = 0\n largest = 0\n while num < array.length\n h[array[num]] = array.count(array[num])\n num = num + 1\n end\n max_quantity = h.values.max\n max_h = h.select { |k, v| v == max_quantity }.keys\n p max_h\nend", "title": "" }, { "docid": "5e692edbed249737e4500f0a3938ede2", "score": "0.7314759", "text": "def mode(array)\n frequency = {}\n array.each do |item|\n if frequency.has_key?(item)\n frequency[item] = frequency[item] + 1\n else\n frequency[item] = 1\n end\n end\n\nmax_value = 0\nfrequency.each_value do |value|\n if value > max_value\n max_value = value\n end\nend\nmax = []\nmax_key = \"\"\nmax_freqency = []\nfrequency.each do |key, value|\n if value >= max_value\n max_value = value\n max_key = key\n max_freqency << max_key\n end\nend\nmax_freqency\nend", "title": "" }, { "docid": "2d60ac7ab35cb899a32fc0fd4781186c", "score": "0.7311013", "text": "def mode(input_array)\n counts = Hash.new\n input_array.each do |element|\n if counts.has_key?(element)\n counts[element] += 1\n else\n counts[element] = 1\n end\n end\n\n max = 0\n counts.each do |key, value|\n if value > max\n max = value\n end\n end\n\n output_array = Array.new\n counts.each do |word, count|\n if count == max\n output_array.push(word)\n end\n end\n return output_array\nend", "title": "" }, { "docid": "d283b5fff1624def91db281b609844c8", "score": "0.7306759", "text": "def mode(array)\n hash = Hash.new {|hash,key| hash[key] =0}\n array.each do |item|\n hash[item] = array.count(item)\n end\n array2 = []\n hash.each do |k, v|\n if v == hash.values.max\n array2 << k\n end\n end\n array2\nend", "title": "" }, { "docid": "444202910d71ef299743a3845cd97c43", "score": "0.7297913", "text": "def mode(array)\n hash = Hash.new {|hash,key| hash[key] =0}\n array.each do |item| \n hash[item] = array.count(item)\n end\n array2 = []\n hash.each do |k, v| \n if v == hash.values.max\n array2 << k\n end\n end\n p array2\n end", "title": "" }, { "docid": "b5dc674f8f671d61893857274f8115ec", "score": "0.7263938", "text": "def mode(array)\n count = Hash.new 0\n array.each do |n|\n count[n] += 1\n end\n\n frequency = count.values.max\n \n x = []\n count.each do |k, v|\n if frequency == v \n x.push k\n end\n end\n x\nend", "title": "" }, { "docid": "69ee344c1d6d9385a3c44be6714c0566", "score": "0.7262171", "text": "def mode(array)\n\n data = Hash.new\n\n while array.length > 0\n frequency = array.count(array[0])\n\n data[array[0]] = frequency\n array.delete(array[0])\n end\n# p array\n data\n data.each do |k, v|\n array << k if v == data.values.max\n end\n p array\nend", "title": "" }, { "docid": "81052574edc06efd83f4e5aaebcf0c3d", "score": "0.72588694", "text": "def mode(input_array)\n\n counts = Hash.new(0)\n input_array.each do |element|\n counts[element] += 1\n end\n\n output_array = Array.new\n\n counts.each do |word, count|\n if count == counts.values.max\n output_array << word\n end\n end\n\n return output_array\n\nend", "title": "" }, { "docid": "68ce2a9c0de8b545001a9e4ee02a5f39", "score": "0.7241821", "text": "def mode (array)\n hash = Hash.new (0)\n array.each { |item|\n hash[item] += 1}\n hash\n\n frequency = hash.values.max\n new_array = []\n\n hash.each { |key, value|\n if frequency == value\n new_array.push(key)\n end}\n new_array\nend", "title": "" }, { "docid": "248fde5367146abaafc4e3c6e5e92b11", "score": "0.72338676", "text": "def mode(array)\n hash = {}\n\n for i in 0...array.length\n count = 0\n current_element = array[i]\n for i in 0...array.length\n if current_element == array[i]\n count += 1\n else\n end\n hash[current_element] = count\n end\n end\n max_array = []\n hash.each {|key, value| (max_array.push(key)) if value == hash.values.max }\n return max_array\n\nend", "title": "" }, { "docid": "903aa1b9017dad0833d117688b62a064", "score": "0.72302365", "text": "def mode(array)\n count = Hash.new(0) \n array.each do |x| count[x] += 1 end #counts number of occurences and stores in count hash\n \n if array == array.uniq # if array values occur equally, return array\n array\n else\n array.keep_if{\n \t|x| array.count(x) >= count.values.max #keep all values that occur same number of times as highest count{} frequency\n \t}.uniq!\n end\nend", "title": "" }, { "docid": "aad96a1b3359be213ffb6b1d1e5590be", "score": "0.72187334", "text": "def mode(array)\n freq = {}\n array.each do |item|\n if freq.include?(item)\n freq[item] += 1\n else\n freq[item] = 1\n end\n end\n \n return freq.select{|k,v| v==freq.values.max}.keys\nend", "title": "" }, { "docid": "36ee73d4699e532512030071ce8574ae", "score": "0.71908635", "text": "def mode(array)\n freq = Hash.new\n array.each do |x|\n if freq[x].nil?\n freq[x] = 1\n elsif freq[x] >= 1\n freq[x] += 1\n end\n end\n max = 0\n freq.each do |x, y|\n if y != nil && y >= max\n max = y\n end\n end\n most = freq.select {|x, y| y == max}\n most.keys\nend", "title": "" }, { "docid": "54b37ab75e31411b64315b28a01af50e", "score": "0.7185424", "text": "def mode(array)\n freq = Hash.new\n array.each do |x|\n if freq[x].nil?\n freq[x] = 1\n else freq[x] += 1\n end\n end\n max = 0\n freq.each do |x, y|\n if y >= max\n max = y\n end\n end\n most = freq.select {|x, y| y == max}\n most.keys\nend", "title": "" }, { "docid": "aabbeb2dabd70557bf923fdda40250d0", "score": "0.71638656", "text": "def mode(array)\n new_hash = Hash.new\n array.uniq.each {|x| new_hash[x] = 1}\n new_hash.each {|element, value| new_hash[element] = array.count(element)}\n max = 0\n new_hash.each {|key, value| max = value if value > max}\n new_hash.select! {|key, value| value == max}\n return new_hash.keys\nend", "title": "" }, { "docid": "b341a332002af2a28f070f216ae6742e", "score": "0.71529317", "text": "def most_common_number(array)\n #var\n numbers_and_count = Hash.new 0\n \n array.each do |num|\n \tnumbers_and_count[num] += 1\n end\n #var\n most = numbers_and_count.sort_by { |key, value| value }.reverse\n \n top = Hash[*most.first]\n top.select { |k,v| p k }\n\nend", "title": "" }, { "docid": "2357b8fe55476ed5d2a46747e39b3c85", "score": "0.7151848", "text": "def mode(array)\n frequencies = array.each_with_object(Hash.new(0)) { |word, count| count[word] += 1 }\n mode_array = frequencies.select { |frequent_words, frequent_counts| frequent_counts == frequencies.values.max }.keys\n return mode_array\nend", "title": "" }, { "docid": "6edc8b02a149af6b2ddec4f89f75b371", "score": "0.71383137", "text": "def mode(input_array)\n counts = Hash.new\n\n # i=0\n # while i < input_array.length\n # if counts.has_key?(input_array[i])\n # counts[input_array[i]]+=1\n # else\n # counts[input_array[i]]=1\n # end\n # i+=1\n # end\n\n input_array.each do |element|\n if counts.has_key?(element)\n counts[element]+=1\n else\n counts[element]=1\n end\n end\n\n # puts counts\n\n max=0\n\n counts.each do |word,count|\n if count > max\n max = count\n end\n end\n\n # puts max\n\n output_array = Array.new\n\n counts.each do |word,count|\n if count == max\n output_array.push(word)\n end\n end\n\n p output_array\n\nend", "title": "" }, { "docid": "18bec153e5138377239f4b15cdba83e8", "score": "0.7134869", "text": "def most_frequent_word(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase!}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\nmost_frequent_item = hash.max_by{ |i| hash.count( i ) }\nputs most_frequent_item\nend", "title": "" }, { "docid": "5e90b66e99edc499c303ad9eaed91ead", "score": "0.7112179", "text": "def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend", "title": "" }, { "docid": "31b07df5db4706ef133fc04576f5f40b", "score": "0.7105521", "text": "def mode(array)\n new = Hash.new()\n array.each do |item|\n if new.has_key?(item)\n new[item] +=1\n else\n new[item] = 1\n end\n end\n mode = []\n freq = new.values.max\n new.each do |key,value|\n if freq==value\n mode.push(key)\n end\n end\n return mode\nend", "title": "" }, { "docid": "71b07663475859a8ce93028b5fd535ec", "score": "0.70863533", "text": "def mode array\n greatestRepeats = 0\n frequent = []\n array.each do |current|\n totalCurrent = array.count current\n puts \"For \" + current.to_s + \" we have found: \" + totalCurrent.to_s + \" repeats\"\n if totalCurrent > greatestRepeats\n counter = 0\n while frequent.length > 0 #wipe frequent\n frequent.delete(counter)\n counter += 1\n end\n greatestRepeats = totalCurrent\n frequent.push current\n elsif totalCurrent == greatestRepeats && totalCurrent > 0 #add without wiping frequent\n frequent.push current\n end\n end\n\n frequent.uniq\nend", "title": "" }, { "docid": "cb4c0394e6a6eda8bfab5c87c8a13ab5", "score": "0.7075775", "text": "def mode(array)\n new_array = []\n words_freq = {}\n max = 0\n array.each do |i|\n if words_freq.include?(i)\n words_freq[i] += 1\n else\n words_freq[i] = 1\n end\n\n if max < words_freq[i]\n max = words_freq[i]\n end\n end\n\n words_freq.each do |key, value|\n new_array << key if value == max\n end\n return new_array\nend", "title": "" }, { "docid": "4744c082b25c59be9b15e351057e40a6", "score": "0.7075502", "text": "def mode(arr)\n counter = Hash.new(0)\n arr.each{|key| counter[key] += 1}\n solution = []\n counter.select {|key, value| solution << key if value == counter.values.max}\n p solution\nend", "title": "" }, { "docid": "92be58936ed17421b71306f4ae640bd7", "score": "0.7070159", "text": "def mode(array)\n mode_hash = Hash.new\n array.each {|x| mode_hash[x] = 0}\n mode_hash.each do |k,v| \n mode_hash[k] = array.count(k)\n end \n new_array = []\n mode_hash.each do |k, v|\n if v == mode_hash.values.max; new_array << k\n end\n end\n return new_array\nend", "title": "" }, { "docid": "59c637e63384c931fb906a17b1c888d0", "score": "0.7067364", "text": "def mode(array)\n count = Hash.new(0) \n array.each do |x| count[x] += 1 end\n max_val = count.values.max\n puts max_val\n if array == array.uniq\n return array\n else\n array1 = array.keep_if do |x| array.count(x) >= count.values.max end\n array1.uniq!\n end\n \nend", "title": "" }, { "docid": "38a7319da979b48c20daa74d80b2c896", "score": "0.70579976", "text": "def mode(array)\n\thash = Hash.new(0)\n \t\tarray.each do |i|\n \t\thash[i] += 1\n \tend\n\tfinal_array = []\n \tn = 0\n \tfrequent_value = hash.values[0]\n \twhile n < hash.length\n\t\tif frequent_value < hash.values[n]\n \t\tfrequent_value = hash.values[n]\n \tend\n \tn += 1\n \tend\n \thash.each do |key, val|\n \tif val == frequent_value\n \t\tfinal_array.push(key)\n \tend\n \tend\n \tp final_array\nend", "title": "" }, { "docid": "0509c19e5d70f2eca00dd7debc1dd171", "score": "0.7052237", "text": "def mode(array)\n hash = Hash.new {|hash,key| hash[key] = 0} #creates a default value of 0 for all hash values\n\n array.each {|num| #iterate through the array and count +1 for each value\n hash[num] += 1\n }\n\n\n\n values = [] # Declare array of all values\n hash.each do |key, value|\n values.push(value)\n end\n\n\nmax_value = values.max #find the key with the maximum value\nresult = [] # Declare array where we return result\n\nhash.each do |key, value|\n if value == max_value\n result.push(key)\n end\nend\n return result\nend", "title": "" }, { "docid": "681a349d877e6f55c4904ae85196e321", "score": "0.7050049", "text": "def mode(ary)\n mode_count = ary.inject({}){|x, y| x[y] = ary.count(y); x }\n mode_count.select {|x,y| y == mode_count.values.max }.keys\nend", "title": "" }, { "docid": "4dabd6905b3423c9a7e4dc8d561c7167", "score": "0.70429444", "text": "def mode array\n freq = Hash.new(0)\n array.each do |num|\n freq.store(num, freq[num]+1)\n end\n target = []\n freq.each do |k,v|\n if v == freq.values.max\n target << k\n end\n end\n target\n \nend", "title": "" }, { "docid": "c33fa88a6c4d7dadbae77618d038ea4d", "score": "0.7034807", "text": "def top_k_frequent_elements(list, k)\n result = []\n\n hash = Hash.new\n \n list.each do |letter|\n if hash[letter]\n hash[letter] += 1\n else \n hash[letter] = 1\n end \n end \n\n k.times do \n max = nil\n hash.each do |num, value|\n\n if value && (max.nil? || value > max)\n max = num \n end \n end \n\n if max \n hash[max] = nil \n result << max \n end \n end \n return result end", "title": "" }, { "docid": "3a38deed1414e01122a0b83409398ea0", "score": "0.7033959", "text": "def array_mode(array)\n new_array = Array.new\n freq = Hash.new\n max_count = 1\n\n array.each do |i|\n if freq.include? (i)\n freq[i] += 1\n if freq[i] > max_count\n max_count = freq[i]\n end\n else\n freq[i] = 1\n end\n end\n freq.each {|k,v| new_array.push(k) if v == max_count}\n new_array\nend", "title": "" }, { "docid": "ac380264148354a32859efa3b330e2b4", "score": "0.703235", "text": "def most_used_letter\n s1 = @text.gsub(/[^a-z]/, '')\n arr= s1.split('')\n arr1 = arr.uniq #rids chars array of duplicates\n arr2 = {}\n\n #makes an object with a count of all unique characters\n arr1.map do |c|\n arr2[c] = arr.count(c) #count searches an array and returns the number of occurrances of the specified element\n end\n\n #to start the following loop with the first key/value pair of arr2\n biggest = { arr2.keys.first => arr2.values.first }\n arr2.each do |key, value|\n if value > biggest.values.first\n biggest = {}\n biggest[key] = value\n end\n end\n\n biggest\nend", "title": "" }, { "docid": "80a17a9f9fee497ea5bae36abce33573", "score": "0.7019372", "text": "def mode(arr)\n count = Hash.new(0)\n arr.each { |value| count[value] += 1 }\n count = count.sort_by { |key, value| value }\n count.reverse!\n high = count[0][1]\n count.select! { |key, value| value == high } \n result = count.collect(&:first)\n result.sort!\nend", "title": "" }, { "docid": "ed152f6d09bfbc6855faf2a36ff9e63d", "score": "0.701751", "text": "def mode(array)\n frequency = Hash.new(0)\n array.each do |x|\n frequency[x] += 1\n end\n mode_array = []\n frequency.each do |y, z|\n if z == frequency.values.max\n mode_array << y\n end\n end\n mode_array.sort\nend", "title": "" }, { "docid": "f9d6e70b72bc08d6fa3de69a2077250b", "score": "0.7010478", "text": "def mode(array)\n count = Hash.new(0)\n array.each {|element| count[element] += 1}\n max = count.values.max\n count.keep_if {|key,value| value == max}\n count.keys\nend", "title": "" }, { "docid": "9fe27bf5b323ef78511c4dda6e1737cd", "score": "0.7010095", "text": "def mode(array)\nfinal_array = []\nmax_count = []\narray.map do |r| \n max_count << array.count(r)\n end\n max_num = max_count.max\narray.map do |m|\n if array.count(m) == max_num\n final_array << m\n end\n end\n final_array.uniq\n\nend", "title": "" }, { "docid": "f28ab3d8a233156343e9905362ec0f31", "score": "0.7004347", "text": "def mode(array)\n counter = array.inject(Hash.new(0)) {|hash, key| hash[key] += 1; hash }\n new_array = []\n counter.each do |k, v|\n if v == counter.values.max\n new_array << k\n end\n end\n return new_array\nend", "title": "" }, { "docid": "e57fc2923337603c720f0c614fdbd251", "score": "0.6987647", "text": "def word_with_most_repeats(sentence)\n words = sentence.split\n\n hash = {}\n\n words.each do |word|\n hash[word] = count_repeats(word)\n end\n\n max = hash.values.max\n\n ties = hash.select {|k, v| v == max }.first.first\n\n\n\n\nend", "title": "" }, { "docid": "b089e3171452e5eb4fd1586d50a7797c", "score": "0.6982957", "text": "def mode(array)\n\tfrequency = Hash.new\n\n\tfor i in array\n\t\tfrequency[i] = array.count(i)\n\tend\n\n\tmost_frequent_key = frequency.values.max\n\tmode_list = []\n\n\tfor key, value in frequency\n\t\tif value == most_frequent_key\n\t\t\tmode_list << key\n\t\tend\n\tend\n\treturn mode_list\nend", "title": "" }, { "docid": "7a29f32d929afad5fe8c684585105af8", "score": "0.6960453", "text": "def mode(array)\n hash = Hash.new(0)\n array.each { |key| hash[key] += 1}\n max_value = hash.values.max\n output_array = hash.select { |key, value| value == max_value }.keys\n output_array\nend", "title": "" }, { "docid": "240ed5e94b146fd049417343b6859dea", "score": "0.69529855", "text": "def solution(a)\n # write your code in Ruby\n grouped_array = a.group_by(&:itself).values\n grouped_array.max_by(&:length).count\nend", "title": "" }, { "docid": "055db43bbfa2067152e486f84fba3e50", "score": "0.6947304", "text": "def mode(array)\n h = array.each_with_object(Hash.new(0)) do |item, list|\n list[item] += 1\n end\n a = []\n h.each {|k, v| a.push(k) if v == h.values.max}\n a\nend", "title": "" }, { "docid": "14bc8cae18f5603788983ce932ed09fc", "score": "0.6880242", "text": "def mode(array)\n hash = {}\n array.each do |x| \n if !hash.has_key?(x)\n \thash[x] = 1\n else\n hash[x] += 1\n end \n end\n array_new = []\n max_value = hash.values.max\n hash.each do |key, value|\n if value == max_value\n array_new.push(key)\n end \n end\n return array_new\nend", "title": "" }, { "docid": "dbb710a31b273e7dcce7d085181c2c2f", "score": "0.6877849", "text": "def mode(list)\n my_hash = {}\n list.each do |item| \n if my_hash[item]\n my_hash[item] += 1\n else\n my_hash[item] = 1\n end\n end\n max_count = my_hash.values.max\n my_hash.select { |key, value| value == max_count }.keys\nend", "title": "" }, { "docid": "79dd512e9042347173428af799df1e08", "score": "0.68743014", "text": "def mode(array)\n hash = Hash.new(0)\n array.each do |x|\n if hash.has_key?(x) == true\n hash[x] += 1\n else\n hash[x] = 1\n end\n end\n hash.select{|k,v| v == hash.values.max}.keys\nend", "title": "" }, { "docid": "50a0731ddcf3ed4dde89effa38486e30", "score": "0.68717784", "text": "def mode(arr)\n hash = arr.inject(Hash.new(0)) {|h, v| h[v] += 1; h}\n output = []\n hash.each {|k, v| output << k if v == hash.values.max}\n return output\nend", "title": "" }, { "docid": "50a0731ddcf3ed4dde89effa38486e30", "score": "0.68717784", "text": "def mode(arr)\n hash = arr.inject(Hash.new(0)) {|h, v| h[v] += 1; h}\n output = []\n hash.each {|k, v| output << k if v == hash.values.max}\n return output\nend", "title": "" }, { "docid": "4cc8085b83729e5acae244c79c10182a", "score": "0.6871649", "text": "def mode(array)\r\n new_hash = Hash.new(0)\r\n output = []\r\n \r\n array.each do |i|\r\n new_hash[i] += 1\r\n end\r\n \r\n new_hash.each do |i, j| \r\n if new_hash.values.max == j\r\n output << i\r\n end\r\n end\r\n output\r\nend", "title": "" }, { "docid": "b198e97bc045c27f62ed6dfc57fd8356", "score": "0.68704706", "text": "def mode(array)\n hash = {}\n \tarray.each do |item|\n \t\tif hash[item]\n \t\thash[item] = hash[item] + 1\n \t\telse\n \t\thash[item] = 1\n \t\tend\n \tend\n \tmax_value = hash.values.max\n\thash.select {|k, v| k if (v == max_value)}.keys\n\nend", "title": "" }, { "docid": "f91b18096e25053263c95cc3487c9a83", "score": "0.68485147", "text": "def mode(arr)\n hash = Hash[arr.map {|x| [x, 0]}]\n arr.each do |item|\n if hash.has_key?(item)\n hash[item] += 1\n end\n end\n max = hash.values.max\n new_hash = Hash[hash.select { |k, v| v == max}]\n return new_hash.keys\nend", "title": "" }, { "docid": "5ac41bc3ad41dad43febbe9d6c2cf37f", "score": "0.6841117", "text": "def mode(array)\n hash = Hash.new(0)\n array.each {|item| hash[item] += 1}\n answer = hash.max_by {|key, value| value}\n p answer\nend", "title": "" }, { "docid": "c30197b39957d83356d9495d8f04f3b5", "score": "0.68370974", "text": "def most_frequent_occurrence(str)\n lower_str = str.downcase\n letters = {}\n most_frequent = []\n\n for i in 0..lower_str.length - 1\n if letters[lower_str[i]]\n letters[lower_str[i]] += 1\n else\n letters[lower_str[i]] = 1\n end\n end\n\n letters.each do |key, value|\n if most_frequent.length == 0 || letters[key] > most_frequent[1]\n most_frequent = [key, value]\n end\n end\n\n return most_frequent[0]\nend", "title": "" }, { "docid": "1809a211301934adb77049557ab69deb", "score": "0.6825475", "text": "def find_most_popular(array)\n url_hash = {}\n \n array.each do |url|\n if url_hash[url]\n url_hash[url] += 1\n else\n url_hash[url] = 1\n end\n end\n \n max_url = url_hash.max_by(1) do |url, count|\n count\n end\n \n return max_url[0][0]\nend", "title": "" }, { "docid": "7d32c5ed926ac9ae4fdc6b0a078f2272", "score": "0.68252474", "text": "def mode(array)\n hash = Hash.new\n array.each do |x|\n quantity = array.count(x)\n hash[x] = quantity\n end\n mode_value = hash.values.max\n new_array= []\n hash.select do |key, value|\n if value == mode_value\n new_array.push(key)\n end\n end\n return new_array\nend", "title": "" }, { "docid": "a8c01cf598320001ee7b39862b409d7e", "score": "0.6811791", "text": "def most_frequent_bigram(str)\n new_array =[]\n new_arr = []\n hash = {}\n hash = Hash.new {|k, v| hash[k] = 0}\n new_str = str.split(\"\")\n (0...new_str.length).each do |i0|\n (i0...new_str.length).each do |iz|\n pair = new_str[i0..iz]\n new_array << pair\n end\n end\n\n new_array.each do |combined|\n if combined.length == 2\n new_arr << combined \n end\n end\n \n new_arr.each do |pairs| \n hash[pairs] += 1\n end\n \n hash.each {|k, v| return k.join(\"\") if v == hash.values.max}\n\n \nend", "title": "" }, { "docid": "cdc3bee7d32e0ab25c901a39036f5733", "score": "0.6788761", "text": "def top_k_frequent_elements(list, k)\n\n return [] if list.empty?\n \n # create a hash that has each element as key and number of occurrences as value: [1, 1, 1, 2, 2, 3] => {1=>3, 2=>2, 3=>1}\n hash = {}\n list.each do |element|\n if hash[element].nil?\n hash[element] = 1\n else \n hash[element] += 1\n end\n end\n \n # get the keys associated with k max values. There is almost certainly a better way to do this \n max_arrays = hash.max_by(k) {|key, value| value} # this returns k hash pairs as arrays: {1=>3, 2=>2, 3=>1}, k = 2 => [[1, 3], [2, 2]]\n\n # return the first element from each array\n max_keys = []\n max_arrays.each do |array|\n if k == 1\n # \"will work for an array when k is 1 and several elements appear 1 time\" situation: return the first key with value of 1 in the element counts hash\n max_keys << hash.min[0]\n else\n max_keys << array[0]\n end\n end\n\n return max_keys\n\nend", "title": "" }, { "docid": "63ef7916d230a3522518d2621f23e1c4", "score": "0.67882174", "text": "def mode(array) \n hash = Hash.new(0) \n array.each do |x| \n hash[x] += 1\n end\n mode_array = []\n hash.each do |k,v|\n if v == hash.values.max\n mode_array << k\n end\n end\n mode_array\nend", "title": "" }, { "docid": "2727b3d648c1626a73cba6368ea6d814", "score": "0.6787237", "text": "def most_common_value(a)\n a.group_by do |e|\n e\n end.values.max_by(&:size).first\nend", "title": "" }, { "docid": "5e8011fc04e26ad4defb68c5537665aa", "score": "0.67860556", "text": "def highest_rank(arr)\n #make a unique array so that I am not checking the same number multiple times\n unique = arr.uniq\n res = []\n #check count the instances of each number in the original array and\n #create a hash with the count of instances, and the number.\n unique.each do |n|\n res.push({arr.count(n)=>n})\n end\n # sort by the count and value, and grab the last result as it will be the highest count\n res.sort_by!(&:first)\nreturn res[-1].first[1]\nend", "title": "" }, { "docid": "fc3e60daec6ec34ae88684a5348faea0", "score": "0.67772484", "text": "def mode array\n hash = Hash.new(0)\n array.each do |x|\n hash[x] += 1\n end\n new_array=Array.new\n hash.each do |key, value|\n if value == hash.values.max\n new_array << key\n end\n end\n return new_array\nend", "title": "" }, { "docid": "112dcf600dd4549ae532cac51e8f3e14", "score": "0.67533475", "text": "def mode(array)\n mode_array = []\n counter = Hash.new(0)\n array.each do |x|\n counter[x] += 1 \n end\n counter.each do |k, v|\n if v == counter.values.max\n mode_array.push(k)\n end\n end\n return mode_array\nend", "title": "" }, { "docid": "ef03a75b371e7c3490fa87ee569d55a1", "score": "0.6751695", "text": "def repeats(sentence)\n\n words = sentence.split\n hash = {}\n\n words.each do |word|\n hash[word] = count(word)\n end\n\n greatest_value = hash.sort_by{|k, v| v}.last.last\n\n hash.select{|k,v|v=greatest_value}.first.first\n\nend", "title": "" }, { "docid": "6557068cf6dbb1739f0290a4b0d97a22", "score": "0.6736146", "text": "def mode(array)\n results = {}\n array.each do |e|\n if results.has_key?(e)\n results[e] += 1\n else\n results[e] = 1\n end\n end\n max = results.max_by{|k,v| v}\n results.select!{|k,v| v == max[1]}\n results.keys\nend", "title": "" }, { "docid": "a7516de437bf5fd0f23ce2c4d40d3c0f", "score": "0.67311466", "text": "def mode(array)\n hash = Hash.new(0)\n num_a = []\n final_a = Array.new\n\n array.each do |value|\n hash[value] += 1\n end\n\n num_a = hash.values.sort\n\n hash.each do |k,v|\n if v == num_a[-1]\n final_a << k\n end\n end\n\n return final_a\nend", "title": "" }, { "docid": "4a0fe0785ea7894b54fa9a4b320e475f", "score": "0.672453", "text": "def mode(array)\n y = Hash.new(0)\n array.each do |x|\n y[x] += 1\n end\n\n new_array = y.select{|a, b| b == y.values.max}.keys\nend", "title": "" }, { "docid": "067bff1f7607ca9e03ca930bd183130f", "score": "0.6699484", "text": "def mode(array) \n\th = Hash.new(0)\n\tarray.each do |x| \n\t\th[x] = h[x] + 1 \n\tend\n\th.select { |k,v| v == h.values.max }.keys\nend", "title": "" }, { "docid": "a0af6e1206b811251f37c9aad3854b23", "score": "0.6695577", "text": "def mode (array)\n\tcounter = Hash.new(0)\n\tarray.each do |element| \n\t\tcounter[element] += 1\n\tend\n\n\tcounter.keep_if do |element,count| \n\t\tcount == counter.values.max \n\tend\n\n\treturn counter.keys\nend", "title": "" }, { "docid": "689854a49d6420e8105dcf2ce6cbf88c", "score": "0.6684159", "text": "def mode(array)\n\tfrequencies = Hash.new(0)\n\tarray.each { |array_object| frequencies[array_object]+=1 }\n\tfrequencies = frequencies.select { |key,value| value>= frequencies.values.max }\n\tmode_array = []\n\tfrequencies.each_key {|key| mode_array << key}\n\treturn mode_array\nend", "title": "" }, { "docid": "c5a8f2cbe931f72f24ec25dc2f0839ea", "score": "0.66817635", "text": "def solution(a)\n return 0 if a.empty?\n sorted_hash = a.sort.group_by { |x| x }\n sorted_hash.values.last.count\nend", "title": "" }, { "docid": "e41fa0a9d2b680424ef2b9d45fee7a90", "score": "0.6675239", "text": "def mode(array)\n\n mode_hash = Hash.new\n for x in 0..(array.length - 1)\n if mode_hash.has_key?(array[x]) == true\n mode_hash[array[x]] = mode_hash[array[x]] + 1\n else\n mode_hash[array[x]] = 1\n end\n puts mode_hash\n end\n\n max_val = 0\n output_array =[]\n\n mode_hash.each do |key, value|\n\n if value > max_val\n output_array = []\n output_array[0] = key\n max_val = value\n\n elsif value == max_val\n\n output_array[output_array.length] = key\n max_val = value\n end\n end\n return output_array\nend", "title": "" }, { "docid": "2d2d57ceaa60dbd2832d024cb41ed191", "score": "0.6662173", "text": "def mode(array)\n mode_machine = Hash.new(0)\n array.each do |element|\n mode_machine[element] += 1\n end\n highest_count = 0\n mode_container = []\n mode_machine.each do |element, count|\n mode_container << element if count == highest_count\n if count > highest_count\n mode_container = []\n mode_container << element\n highest_count = count\n end\n end\n mode_container\nend", "title": "" }, { "docid": "6f5dac4c0a699cfb507e5c912cae9820", "score": "0.6653067", "text": "def mode(array)\n hash = Hash.new(0)\n array.each do |x|\n hash[x] += 1\n end\n result = []\n hash.each { |x,y|\n if y == hash.values.max\n result.push(x)\n end\n }\n return result\nend", "title": "" }, { "docid": "7ce6ffd68dd8b7bccd9f2a56307f0bd8", "score": "0.66494304", "text": "def mode(array)\n\thash = Hash.new{|key, value| key[value] = 0}\n\thash[1]\n\tarray.each do |number|\n\t\thash[number] += 1\n\t\tend\n\t\tarray = []\n\thash.each do |key, value| \n\t\tif value == hash.values.max\n\t\tarray.push(key)\n\tend\n\tend\n\tp array\nend", "title": "" }, { "docid": "fe00e606562bc34240510e172beec712", "score": "0.66471356", "text": "def most_common(string)\n # binding.pry\n arr = string.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\" \")\n arr = arr.map { |x| x.downcase }\n words_hash = arr.group_by { |x| x }\n final_arr = []\n words_hash.each do |k,v|\n #binding.pry\n if v.length > 1\n final_arr << k\n end\n end\n p final_arr\nend", "title": "" }, { "docid": "f9c2068c8a77a4c051599fef87e037be", "score": "0.6644959", "text": "def mode(array)\n table = Hash.new(0)\n for a in array\n table[a] = table[a] + 1\n end\n highest_freq = 0\n table.each do |k, v|\n if v > highest_freq\n highest_freq = v\n end\n end\n modes_hash = table.select{|k, v| highest_freq == v}\n modes = modes_hash.keys\nend", "title": "" }, { "docid": "5199ad7978eaeb3adccc9dff3e8c78b1", "score": "0.6644795", "text": "def top_k_frequent_elements(list, k)\n return [] if list == []\n hash = Hash.new(0)\n counter = 0;\n list.each do |value|\n hash[value] = [] if hash[value].nil?\n hash[value]+=1\n end\n \n if k > hash.size()\n raise ArgumentError, \"Not Enough Values to Display\"\n end\n \n solution = hash.max(k){ |a, b| b<=>a} \n p solution\n numbers = []\n solution.each do |array|\n numbers << array[0]\n end\n return numbers\nend", "title": "" }, { "docid": "1137d9b491bf8c2e86cdcf6163f7307b", "score": "0.6626166", "text": "def mode(numbers)\n counts = {}\n numbers.each do |num|\n if counts.has_key?(num)\n counts[num] = counts[num] + 1\n else\n counts[num] = 1\n end\n end\n\n num_list = counts.values\n highest_count = num_list.max\n\n modes = []\n counts.each do |key, count|\n if count == highest_count\n modes.push(key)\n end\n end\n return modes\nend", "title": "" }, { "docid": "db3a35a6b521a1f2c3ccccb6eb7b37f2", "score": "0.6599383", "text": "def most_frequent_bigram(str)\n\n new_hash = Hash.new(0)\n str.each_char.with_index do |ele, i|\n if i < (str.length - 1)\n new_hash[ele + str[i +1]] += 1\n end\n end\n # p new_hash.values.max\n new_hash.each do |k, v|\n if new_hash.values.max == v\n return k\n end\n end\n\nend", "title": "" }, { "docid": "86a013087fe33135eed664acf6625ca6", "score": "0.6596547", "text": "def majority_element(nums)\n counter_hash = Hash.new(0)\n\n nums.each do |num|\n counter_hash[num] += 1\n end\n\n counter_hash.find { |k,v| v == counter_hash.values.max }.first\nend", "title": "" }, { "docid": "dae7732b8fe1e506b0d2988b422625ce", "score": "0.65920573", "text": "def mode(array)\n\n mode_hash = {}\n mode_array = []\n max = 0\n\n array.each do |element|\n\n if mode_hash.has_key?(element)\n mode_hash[element] += 1\n else\n mode_hash.store(element, 1)\n end\n end\n\n mode_hash.each do |key,value|\n if value > max\n max = value\n mode_array.clear\n mode_array.push(key)\n elsif value == max\n mode_array.push(key)\n else\n end\n end\n return mode_array\n end", "title": "" } ]
b3e115a2664444fdce37b2a4f05119a5
TODO: must have a post_id before_filter
[ { "docid": "7bc21db0c1fab63da45fc0dfd1f2749b", "score": "0.0", "text": "def index\n redirect_to :new\n end", "title": "" } ]
[ { "docid": "1bed21388a7f4927aef81178201d2789", "score": "0.6640942", "text": "def before_request\n @post = Post.find(params[:post])\n end", "title": "" }, { "docid": "76134e8d7480c4a81bcc75eb0a367c9f", "score": "0.659046", "text": "def process_post(post)\n # No-op.\n end", "title": "" }, { "docid": "d901d4803a56ea40c4fce33c366b95fa", "score": "0.65421844", "text": "def create\n if params[:post][:repost_id]\n #Adding if clicking repost, deleting if unclicking repost\n repost_id = (params[:post][:repost_id]).to_i\n repost_exist = current_user.posts.all.select do |post|\n if post.repost_id == repost_id\n post\n end\n end\n if repost_exist.length > 0\n Post.destroy(repost_exist.first.id)\n else\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n @post.save\n end\n else\n @post = Post.new(params[:post])\n sentiment_data_json = Sentimentalizer.analyze(params[:post][:content])\n sentiment_data = JSON.parse(sentiment_data_json)\n sentiment_smiley = sentiment_data[\"sentiment\"]\n if sentiment_smiley == \":)\"\n @post.sentiment = true\n else\n @post.sentiment = false\n end\n @post.sentiment_prob = sentiment_data[\"probability\"]*100\n @post.user_id = current_user.id\n @post.save\n end\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully created.' }\n format.json { render json: @posts, status: :created, location: @post }\n end\n end", "title": "" }, { "docid": "5caf6ca47905bf18f1bbb5a15fca4db2", "score": "0.64940006", "text": "def posts\n Post.filter(:tag_id => self.tag_id)\n end", "title": "" }, { "docid": "ceb629dde24379cff199925d444ae027", "score": "0.64387256", "text": "def set_post\n # @post = @posts.detect{|post| post[\"id\"]==params[:id]}\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "87173165c1150c80ea3b8658f81bacd3", "score": "0.64303994", "text": "def set_post\n # just to hide ID's\n # and use uuid\n # for testing on heroku to avoid mass creation\n @post = Post.where(id: params[:id]).first || Post.where(uuid: params[:id]).first\n end", "title": "" }, { "docid": "887f8acc536c0f282821ced936114e12", "score": "0.6391617", "text": "def sanitize_post(post, context = 'display')\n if !post.kind_of?(Hash) # obj??\n # Check if post already filtered for this context.\n return post if post.filter == context\n post.id = 0 if post.id.blank?\n post.attributes.each do |field|\n post.write_attribute(field, sanitize_post_field(field, post.read_attribute(field), post.id, context))\n end\n post.filter = context\n elsif post.kind_of?(Hash)\n # Check if post already filtered for this context.\n return post if post.filter == context\n post['id'] = 0 if post.id.blank?\n post.each {|field, value| post[field] = sanitize_post_field(field, value, post['id'], context)}\n post.filter = context\n end\n return post\n end", "title": "" }, { "docid": "076ac687b686ee8bc040b3379d538d89", "score": "0.6341615", "text": "def posts; end", "title": "" }, { "docid": "1bf0b6280bae5325afd8f61e2d7b4585", "score": "0.6259254", "text": "def set_post\n @post = current_unit.posts.find(params[:post_id])\n end", "title": "" }, { "docid": "14fba87fb96f358a7918c0851e95e206", "score": "0.62525105", "text": "def set_post\n # @post = Post.find(params[:id])\n # want to scope posts to user. \n @post = current_user.posts.find(params[:id])\n end", "title": "" }, { "docid": "1ddaf9e59ab829c8a9d6371f9ae87888", "score": "0.62302065", "text": "def post\n @post ||= Post[post_id]\n end", "title": "" }, { "docid": "5899da2284b27f41c4c5cc41328d8b19", "score": "0.621961", "text": "def set_post\n @post = FlaggedPost.find(params[:id])\n end", "title": "" }, { "docid": "0ff534779eb3e55db1e9840689e5c36e", "score": "0.6216095", "text": "def post(postid)\n request(:id => postid).posts.first\n end", "title": "" }, { "docid": "a89fcc49ecd5326cc9b03dbf84479b16", "score": "0.6215516", "text": "def all_post\n end", "title": "" }, { "docid": "01dd7fc82770304e5df851f6348fef9a", "score": "0.6210602", "text": "def set_post\n @post = Post.with_deleted.find(params[:id])\n end", "title": "" }, { "docid": "249eac5b217e34946fe55a4a5d978fd8", "score": "0.62025577", "text": "def set_post\n @post = Post\n .includes(:postable)\n .find(params[:id].to_i)\n end", "title": "" }, { "docid": "883640f2d9804d909888be2ba9555c2a", "score": "0.61505306", "text": "def reblog\n @post = Post.find_by(id: params[:id])\n end", "title": "" }, { "docid": "7ad97c957ea80bef085dd6e362496b83", "score": "0.61482537", "text": "def find_own_post\n\t\t@post = current_user.posts.find(params[:id])\n\tend", "title": "" }, { "docid": "1870f4a23f30978368897817df315a45", "score": "0.6118312", "text": "def set_post_id\n @post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "962f06d8a99797c6ca57bfc1d40acaf5", "score": "0.6109384", "text": "def list_post\n \t@post = Post.find(params[:id])\n end", "title": "" }, { "docid": "73d7c60d274cda522ba3e7e36fd322de", "score": "0.6103112", "text": "def set_post\n @post = Post.find(params[:id])\n #@event = Event.find(params[:event_id])#\n end", "title": "" }, { "docid": "852e3778de83aec034f1963b27fe1ac5", "score": "0.6101459", "text": "def set_post\n post = Post.find_by(id: params[:id])\n end", "title": "" }, { "docid": "2da40a40f5365f8d11d8fbc996dd5df2", "score": "0.6093317", "text": "def set_post\n @post = Post.unscoped.find(params[:id])\n end", "title": "" }, { "docid": "0326739f9f8b77b3f2c6c3e8f7f4e044", "score": "0.6089925", "text": "def find_post\n @post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "7bdb06bf2bdcd6f3ec5b4ae457314657", "score": "0.6070735", "text": "def filter_posts_by_ids(post_ids)\n @posts = super(post_ids)\n if SiteSetting.private_replies_enabled && @topic.custom_fields.keys.include?('private_replies') && @topic.custom_fields['private_replies']\n if !@user\n @posts = @posts.where('posts.post_number = 1')\n end\n if @topic.user.id != @user.id && !@user.admin? # Topic starter and admin can see it all\n replied_users = Post.where('topic_id = ? AND deleted_at IS NULL' ,@topic.id).pluck(:user_id)\n if not (replied_users.include?(@user.id))\n @posts = @posts.where('posts.post_number = 1')\n end\n end\n end\n @posts\n end", "title": "" }, { "docid": "2647469b29b9cc1a60868e6ce65c0bda", "score": "0.6069481", "text": "def set_post\n @post = Post.includes(:user).find(params[:id])\n end", "title": "" }, { "docid": "95958a88f9d1de8ccc7c47e8e3d4a4db", "score": "0.6038581", "text": "def find_post\n @post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "2b0667b960948f2c84696347d8d27c5b", "score": "0.603615", "text": "def find_post\n # @post is an instance variable (not local variable) which is available in 'views'\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "4548ded691d883c3dd582c842c938c7b", "score": "0.603298", "text": "def is_a_post?\n self.object_type == :post\n end", "title": "" }, { "docid": "a49ae4a59a5dd2be762dd3bafb94e912", "score": "0.6029328", "text": "def set_post\n @posts = Post.find(params[:id])\n end", "title": "" }, { "docid": "0126d0d8d82e64ef45cd1d567af992ef", "score": "0.60290396", "text": "def set_post \n \t@post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "bc1f690b55775eb58eb786ccbe6d75cb", "score": "0.6015159", "text": "def set_post\n \t\t@post = Post.find(params[:id])\n \tend", "title": "" }, { "docid": "bc1f690b55775eb58eb786ccbe6d75cb", "score": "0.6015159", "text": "def set_post\n \t\t@post = Post.find(params[:id])\n \tend", "title": "" }, { "docid": "a9659e091b5b662ae559645debd0ac84", "score": "0.6002471", "text": "def set_post\n @post = Post.find_by(id: params[:id])\n end", "title": "" }, { "docid": "dc73d85dad912068ba5357ea2cc21ec8", "score": "0.59891725", "text": "def set_post\n @post = Post.cleaner.find(params[:id])\n end", "title": "" }, { "docid": "efc8ec2a160d0432a4b10509910a055f", "score": "0.5986278", "text": "def set_post\n @post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "efc8ec2a160d0432a4b10509910a055f", "score": "0.5986278", "text": "def set_post\n @post = Post.find(params[:post_id])\n end", "title": "" }, { "docid": "21c99cfb2f121f6c132c601cbd63563f", "score": "0.59730935", "text": "def find_post\n @post = Post.find params[:id]\n end", "title": "" }, { "docid": "4ae72ee35113f35c5ea1cc91eb889900", "score": "0.5972922", "text": "def set_post\n @post = Post.joins(:post_detail).select('posts.*, post_details.*').where(id: params[:post_id])\n end", "title": "" }, { "docid": "09053b3c340cbbd3b8b25778c75fbbdf", "score": "0.5970683", "text": "def set_post\n @post = Post.includes(:comments,:likes).find(params[:id])\n end", "title": "" }, { "docid": "6c10ef11c4bdd913757079d4c2ccaab9", "score": "0.59667456", "text": "def post\n @logged_in = is_logged_in\n @post = nil\n @previous = nil\n @next = nil\n begin\n @post = Post.find(params[:post_id].to_i)\n @previous = Tag.where(:name => \"home\").first.posts.where(\"sort_id < ? AND is_public = ?\", @post.sort_id, true).order(\"sort_id DESC\").first\n @next = Tag.where(:name => \"home\").first.posts.where(\"sort_id > ? AND is_public = ?\", @post.sort_id, true).order(\"sort_id ASC\").first\n rescue\n end\n return render_404 if !@post || (!@post.is_public && !@logged_in) || (@post.tags.size == 1 && @post.tags.first.name == \"sidebar\" && !@logged_in)\n if request.fullpath != @post.canonical_uri\n return redirect_to @post.canonical_uri, :status => 301\n end\n end", "title": "" }, { "docid": "04298f4fbcc800807137e110cbb64ac7", "score": "0.595212", "text": "def edit\n # find_post method gets called here\n end", "title": "" }, { "docid": "74e5275f64a2c4846f80c56d22060df3", "score": "0.59491926", "text": "def export_post(post) end", "title": "" }, { "docid": "5dd0a20b714c2b435c16a6b9633db170", "score": "0.59396315", "text": "def set_post\n id = params[:id].blank? ? params[:post_id] : params[:id]\n @post = Post.find(id)\n end", "title": "" }, { "docid": "0c863348efc3bddf5825d429c5099527", "score": "0.5938048", "text": "def set_post\r\n @post = Post.find(params[:post_id])\r\n end", "title": "" }, { "docid": "f470780a764bba3732995a4530dc2a8c", "score": "0.5931151", "text": "def post_read\n \n mark = ViewCountPost.new\n mark.post_id = params[:id]\n mark.ip_adress = request.remote_ip\n mark.save\n \n @post = Post.find(params[:id])\n @intab = Intab.where(:id => @post.intab_id).take\n @tab = Tab.where(:id => @intab.tab_id).take\n \n posts_same_intab = @intab.posts.all\n @pg = posts_same_intab.count/15\n \n @ppp = []\n posts_same_intab.each do |x|\n @ppp << x.id\n end\n \n end", "title": "" }, { "docid": "d87cdff96cf54de26a704270ab6839f8", "score": "0.5918401", "text": "def post(id:)\n Post.find(id)\n end", "title": "" }, { "docid": "d87cdff96cf54de26a704270ab6839f8", "score": "0.5918401", "text": "def post(id:)\n Post.find(id)\n end", "title": "" }, { "docid": "615a02afdde1f54d930d7032832d98b9", "score": "0.59149146", "text": "def set_post\n @post = Post.from_param(params[:post_id]) if params[:post_id].present?\n end", "title": "" }, { "docid": "a0b526a4867d02baba89618c5ae3fffa", "score": "0.59097445", "text": "def after_update(post)\n\n if post.changes.has_key?('hits')\n expire_action :controller => 'posts', :action => 'show',:id => post\n controller.params[:page] ?\n expire_action(:controller => 'posts', :action => 'index', :page => params[:page]): expire_action(:controller => 'posts', :action => 'index')\n elsif post.changes.has_key?('status')\n expire_action :controller => 'posts', :action => 'rss'\n #adding/deleting a new post needs to refresh the whole paginate. RoR action cache sucks!\n total_page = (Float(Post.published.count)/Post.per_page).ceil\n p = 1\n begin\n p != 1 ?\n expire_action(:controller => 'posts', :action => 'index', :page => p): expire_action(:controller => 'posts', :action => 'index')\n p += 1\n end while p <= total_page\n end\n\n \n \n \n\n end", "title": "" }, { "docid": "134bb58574f5678044a5f08be1382eaf", "score": "0.5902449", "text": "def get_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "98c26997dc583023a539745b2f4c62d6", "score": "0.5880741", "text": "def show\n @post = Post.friendly.find(params[:id])\n @taggedWith = ActsAsTaggableOn::Tagging.includes(:tag).where(context: 'tags').uniq\n @page_title = @post.title\n @sidebar_posts = Post.where.not(id: @post.id).order(\"Random()\").limit(4)\n end", "title": "" }, { "docid": "f424a278ea9738117dbe69a37c03face", "score": "0.58778155", "text": "def set_post\n @post = Post.find(params[:id])\nend", "title": "" }, { "docid": "59e746b38f5d9023ccdbf0c59164b653", "score": "0.5865531", "text": "def index \n if not current_user.nil? and current_user != :false\n \n # wenn ich von post_in_feed komme das remind_me neu setzen das ist die\n # erinnerung nach ablauf der 7 tages frist\n unless params[:user].nil?\n unless params[:user][:remind_me].nil?\n current_user.remind_me = params[:user][:remind_me]\n current_user.reminded = false\n current_user.save\n end\n\n end\n \n # wenn ich von edit_tag oder aehnlichem komme und abgebrochen wurde\n if params[:delete_file] == \"true\"\n current_user.delete_unposted_file\n end\n\n @posts = Post.find(:all,:order => \"created_at DESC\")\n \n @posts.reject! do |p|\n current_user.has_rated_for(p.id)\n end\n params[:id] = current_user.id\n end\n \n end", "title": "" }, { "docid": "08e0e0cb597f985b52e43d68d96b3233", "score": "0.5864019", "text": "def set_post_thread\n @post_thread = PostThread.viewable(current_account).find(params[:id])\n end", "title": "" }, { "docid": "26bda4915157b98ca4e676dad6a12625", "score": "0.58556867", "text": "def set_post\n #debugger\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "fda5d77b5f60f5199efc004cb2b08190", "score": "0.5844799", "text": "def find_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "19e071e7b7c22234d826373b7d457a11", "score": "0.5842375", "text": "def is_post?\n is_entry? && params[:_entry_type_] == 'post'\n end", "title": "" }, { "docid": "15b7c45680dd22b1b2ff910067e39995", "score": "0.5842266", "text": "def set_current_post_for_show(post)\n\n end", "title": "" }, { "docid": "54511f985a6e161c3a54b8cf0e22510e", "score": "0.58397925", "text": "def set_post\n @post = Post.friendly.find(params[:id])\n impressionist(@post)\n end", "title": "" }, { "docid": "d274f7692ee5e7145b5645b8ae1f86a0", "score": "0.5838776", "text": "def create\n params[:post][:published_at] = \"#{params[:published_date]} #{params[:date][:hour]}:#{params[:date][:minute]}:00\"\n\n if params[:post_id]\n Post.find(params[:post_id]).update_attributes(params[:post])\n this_post_id = params[:post_id]\n else\n this_post = Post.create(params[:post])\n this_post_id = this_post.id\n end\n\n redirect_to blog_path(this_post_id)\n end", "title": "" }, { "docid": "8aa7bb1e0b486f459aa4fb57cebdaad0", "score": "0.58370525", "text": "def related_posts; end", "title": "" }, { "docid": "7df205753cdf130bb6459a434fbb49f8", "score": "0.58365077", "text": "def private_filter\n post = Post.find(params[:id])\n if post.nil?\n flash[:error] = \"Post not found\"\n redirect_to home_url\n end\n\n if !post.has_access(current_user)\n flash[:error] = \"Post is private\"\n redirect_to home_url\n end\n end", "title": "" }, { "docid": "5e7c1d611be2a1e75ee3f07348cb25bd", "score": "0.58344495", "text": "def set_post\n @posts = Post.find(params[:id])\n end", "title": "" }, { "docid": "5c67f6e8342130918f5fc7f7a0b01b19", "score": "0.5833325", "text": "def create_post_action\n post = Post.create(:title => \"Untitled Post\", :title_html => \"\", :content => \"\", :content_html => \"\", :javascript => \"\", :css => \"\", :is_public => false, :sort_id => 1)\n post.tags = [Tag.get_tag_by_name(\"home\")]\n post.sort_id = post.id\n post.markdown!\n post.save!\n flash[:notice] = \"New post created.\"\n return redirect_to \"/edit_post/\" + post.id.to_s\n end", "title": "" }, { "docid": "ec5db9d752d05b1fb1d397374b7c7014", "score": "0.58213305", "text": "def index\n @posts = Post.where('status != ?', 'hidden')\n @posts = @posts.order(\"created_at DESC\")\n # @posts = @posts.where('created_at > ?', 20.hours.ago)\n @shared_post = Post.first\n if params['category']\n @posts = @posts.where(category: params['category'])\n end\n if params['contains']\n @posts = @posts.to_a.select {|post| post.includes_filter(params['contains'])}\n end\n # @posts.sort {|a,b| (a.created_at <=> b.created_at)}.reverse!\n # @posts.sort {|a,b| a.helping_users.count <=> b.helping_users.count}\n @posts = @posts.paginate(:page => (params[:page] || 1), :per_page =>3)\n end", "title": "" }, { "docid": "e733f66f43a8ce0391760a9842bb3208", "score": "0.5817412", "text": "def set_post\n #@post = Post.find(params[:id])\n @post = Post.find_by_slug(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" }, { "docid": "10a46d81ec62e9c97572fe10be5a6233", "score": "0.5817135", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" } ]
b4371c79c0c9fd6297cc73ad5931e561
Public: Define the queues worked by members of the worker pool.
[ { "docid": "41d20b20f4d3bde4b7dbcc8ed47a06c0", "score": "0.69341445", "text": "def queue(*queues)\n end", "title": "" } ]
[ { "docid": "66353c0338841801f1ca5258b5d511f3", "score": "0.7727562", "text": "def queues\n\t\t\t@queues ||= {}\n\t\tend", "title": "" }, { "docid": "0f8ccb9453fed2b07aea7fb4966cfc68", "score": "0.73576736", "text": "def queues\n register_classes\n register_bus\n sorted_queues\n end", "title": "" }, { "docid": "43f0883c9a441468388e2b70b907bcc4", "score": "0.73256624", "text": "def create_queues\n queue\n exchange\n end", "title": "" }, { "docid": "f5cc71258ad48ee16161383f1e2fb6b7", "score": "0.71335196", "text": "def workers\n @queues.keys\n end", "title": "" }, { "docid": "384c126104143f65523ae38d5dfccd79", "score": "0.7124086", "text": "def worker(*queues)\n end", "title": "" }, { "docid": "93b2abfe8ed6115b6266c77021d8c3f7", "score": "0.7057488", "text": "def queues\n world_config.queues\n end", "title": "" }, { "docid": "e99711620ad18fd3284e6ad4df9718f5", "score": "0.7011966", "text": "def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end", "title": "" }, { "docid": "84ee1c50dd5da394db5398eaeb3e1ba6", "score": "0.6996147", "text": "def queues\n subject.queues\n end", "title": "" }, { "docid": "d74ca5a041e8e7012a0c303630194585", "score": "0.69295377", "text": "def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end", "title": "" }, { "docid": "d74ca5a041e8e7012a0c303630194585", "score": "0.69295377", "text": "def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end", "title": "" }, { "docid": "6ecbe27ab55cfc60024172435e0958da", "score": "0.6810763", "text": "def queues\n @cache\n end", "title": "" }, { "docid": "d94fbbb17a6293d48685f1d2587d4c3e", "score": "0.6719138", "text": "def get_queues\n @gem_name_queue = get_queue 'gem_name'\n @gem_queue = get_queue 'gem'\n end", "title": "" }, { "docid": "62318c34fb9be63e72b067beaa884b0b", "score": "0.67110234", "text": "def workers\r\n @workers ||= []\r\n end", "title": "" }, { "docid": "0206daa01b773647f4d49c4b36b6ff0c", "score": "0.6689523", "text": "def setup_queues\n logger.info 'setting up queues'\n vetted = @consumers.reject { |c| group_configured? && group_restricted?(c) }\n vetted.each do |c|\n setup_queue(c)\n end\n end", "title": "" }, { "docid": "11c488e2a6ae890259f22843c8f07ca0", "score": "0.66771156", "text": "def running_workers\n pool_manager.workers.fetch(queues, {})\n end", "title": "" }, { "docid": "bada324f986966a8c261eca84bdc8a40", "score": "0.6669791", "text": "def queues\n @channel.queues\n end", "title": "" }, { "docid": "45527134c4d5e5e40c768e1db2623619", "score": "0.66215986", "text": "def queues\n @queues[0] == \"*\" ? RockQueue.queues : @queues\n end", "title": "" }, { "docid": "8056fbe7da94ac949184eb74c989eedd", "score": "0.66206926", "text": "def setup_queues\n setup_identity_queue\n setup_shared_queue if @shared_queue\n true\n end", "title": "" }, { "docid": "31c411125421e4394ae638d6931d69a9", "score": "0.6572787", "text": "def initialize(*)\n super\n @queues = Hash.new{|h,k| h[k] = Array.new } # autovivifying\n end", "title": "" }, { "docid": "b95e7d2cd46faeeb431c27c19ccbce5b", "score": "0.6548976", "text": "def worker_pool(count, *queues_and_options)\n end", "title": "" }, { "docid": "0592d9e0e63fc6d221b221aeac0225b7", "score": "0.6486367", "text": "def workers\n @@workers ||= []\n end", "title": "" }, { "docid": "ce3562b5b7607f9d491050d7a1cd9168", "score": "0.6481409", "text": "def enable_queues(jndi_names = {})\n configuration.enabled_queues = jndi_names\n end", "title": "" }, { "docid": "9dfe137db89b153b2f7af492325ea306", "score": "0.64263606", "text": "def autogenerated_queues\n @options['queues'] || []\n end", "title": "" }, { "docid": "dd8af005eecc29b2cbf60a14983c0e4c", "score": "0.6420167", "text": "def backlog\n @queues.map{|k,v| [k,v.size]} \n end", "title": "" }, { "docid": "076273d60d494f550d8aecf7feca3849", "score": "0.6383033", "text": "def queue\n @queue ||= []\n end", "title": "" }, { "docid": "4f014cc0a471344cd5602a941e561122", "score": "0.63820606", "text": "def master_queue; @master_queue ||= []; end", "title": "" }, { "docid": "e4aaa2c301ce059861f8c635634eba20", "score": "0.6372691", "text": "def queues(reload = false)\n if reload or @queues.nil?\n @queues = list_queues\n else\n @queues\n end\n end", "title": "" }, { "docid": "c4206ba33e30436e395dde4250becb09", "score": "0.63485724", "text": "def run\n done = []\n\n queues.each_with_object([]) {|(fqdn, queue), workers|\n @thread_limit.times.map.with_index {|i|\n workers << Thread.start {\n Thread.current[:id] = i+1\n done.push *worker_class(fqdn).new(fqdn, queue(fqdn), cache(fqdn), &@block).run(@thread_limit)\n }\n }\n }.each {|t| t.join }\n\n done\n end", "title": "" }, { "docid": "19f9767b1f5bb1e0b8a3532e55878305", "score": "0.63115346", "text": "def initialize\n @queue = Queue.new\n @workers = []\n @workers_count = 5\n end", "title": "" }, { "docid": "66720279c5f1dc2d2f7fd878af0b737b", "score": "0.62943554", "text": "def entry_queues\n qs = Bluth.priority.collect { |qname| self.send qname }\n if defined?(Bluth::TimingBelt)\n notch_queues = Bluth::TimingBelt.priority.collect { |notch| notch.queue }\n qs.insert 1, *notch_queues\n end\n qs\n end", "title": "" }, { "docid": "e135cd265b11b6d621a401020ab6409a", "score": "0.62866324", "text": "def worker_pool; end", "title": "" }, { "docid": "e135cd265b11b6d621a401020ab6409a", "score": "0.62866324", "text": "def worker_pool; end", "title": "" }, { "docid": "f205b9219742584ab1808a06f17a1afb", "score": "0.62823755", "text": "def reset workers\n workers.each{|worker| @queues[worker].clear if @queues[worker]}\n end", "title": "" }, { "docid": "bfca21bdbd2586034b4b932dcbd0b153", "score": "0.62449205", "text": "def schedules\n workers.map(&:schedule)\n end", "title": "" }, { "docid": "fc305d8906203603ef8596de5de608f5", "score": "0.62343943", "text": "def fill_queues \n while @thread_queues.any?(&:empty?) && (@running || !@output_queue.empty?)\n el = @output_queue.shift \n @thread_queues[el[:thread]] << el if el\n end\n end", "title": "" }, { "docid": "8d24e86da7ed974a87d3db3b88b91b9e", "score": "0.6233642", "text": "def queues_cmd\n return @unique_queues.dup << TIMEOUT if @strictly_ordered_queues\n queues = @queues.sample(@unique_queues.size).uniq\n queues.concat(@unique_queues - queues)\n queues << TIMEOUT\n end", "title": "" }, { "docid": "a815cf7c5f1eac6e052d234c8435399c", "score": "0.6210672", "text": "def setup(*)\n super\n @queue = Array.new\n end", "title": "" }, { "docid": "3238d9f1c7e47b51b785a9cbdfcd792b", "score": "0.6204694", "text": "def initialize\n @queue = []\n end", "title": "" }, { "docid": "119b65c9a953855453534c596a81c9f0", "score": "0.616948", "text": "def initialize\n @queue_options = {}\n @queue_configs = []\n end", "title": "" }, { "docid": "8e41a63387e8c3abf21998e226703f63", "score": "0.6167216", "text": "def initialize\n @@instances << self\n @queue = []\n @jobs = []\n end", "title": "" }, { "docid": "d2e6b45e3538ebbc8d2fb57d86bf963c", "score": "0.61538595", "text": "def setup\n setup_requeue_queue\n consume_requeue\n setup_retry_queues\n end", "title": "" }, { "docid": "bf045966c7b0dfe2f1e2860a6090c23d", "score": "0.614255", "text": "def build_queue\n raise AlreadyInQueue unless machine_deployments.empty?\n ordered = project.assignments.sort_by(&:role_id)\n ordered.chunk(&:machine_id).each do |machine_id, assignments|\n machine_deployments.create(machine_id: machine_id, roles: assignments.map(&:role).map(&:chef))\n end\n end", "title": "" }, { "docid": "f1dd49cd74b43b6bb8f418c72344f852", "score": "0.61332846", "text": "def queue(*queues)\n queues = queues.flatten.map(&:to_s)\n queues = ::Sidekiq::Stats.new.queues.map { |name, _| name.to_s } if queues.empty?\n list = queue_list\n queues.inject(0) do |memo, name|\n memo += (list[name.to_s] || 0)\n memo\n end\n end", "title": "" }, { "docid": "13f95b923b25e159240e0e65e4fd0a95", "score": "0.61278653", "text": "def register_all(queue)\n SideJob.redis.multi do |multi|\n multi.del \"workers:#{queue}\"\n multi.hmset \"workers:#{queue}\", @registry.map {|key, val| [key, val.to_json]}.flatten(1) if @registry.size > 0\n end\n SideJob::Port.group(log: false) do\n SideJob.publish \"/sidejob/workers/#{queue}\", @registry\n end\n end", "title": "" }, { "docid": "4ed048f12665b0abafc5c9102fdaf166", "score": "0.6121955", "text": "def pending_queues\n resp = get '/queues'\n\n Array.new.tap do |pending_queues|\n resp.parsed_response.css('queue').each do |queue_xml|\n queue = Elibri::ApiClient::ApiAdapters::V1::Queue.build_from_xml(self, queue_xml)\n pending_queues << queue if queue.products_count.nonzero?\n end \n end\n end", "title": "" }, { "docid": "1de05a2a35ca933fcb53a8bf01b7de3c", "score": "0.60838044", "text": "def configure worker,worker_config\n if worker_config[\"maximum_size\"]>0\n @queues[worker]=SizedQueue.new(worker_config[\"maximum_size\"])\n else\n @queues[worker]=Queue.new\n end\n configuration(worker)\n end", "title": "" }, { "docid": "50531306270ac780a9d66e01b8bbb9b9", "score": "0.6072261", "text": "def _q\n @queue||=[]\n end", "title": "" }, { "docid": "8f3115becf6c018e9c087e76a980de6d", "score": "0.6063784", "text": "def pools\n @pools ||= {}\n end", "title": "" }, { "docid": "8f3115becf6c018e9c087e76a980de6d", "score": "0.6063784", "text": "def pools\n @pools ||= {}\n end", "title": "" }, { "docid": "124e003700302d3d51d8f62efdb46308", "score": "0.6022647", "text": "def names_list\n backend.queue_names\n end", "title": "" }, { "docid": "7be1bcc3d4a866b02b202ad7bc5cba17", "score": "0.60203797", "text": "def workers\n ::Resque.info[:workers].to_i\n end", "title": "" }, { "docid": "0c8259a2bb89d7d4e5c1099fb2cb91bf", "score": "0.6020267", "text": "def paused_queues\n Sidekiq.redis { |conn| conn.smembers(PAUSED_QUEUES).to_a }\n end", "title": "" }, { "docid": "a3dd025ee64c41b7c034a76cedc950f3", "score": "0.6008563", "text": "def queue_count\n @queues.length\n end", "title": "" }, { "docid": "df4045739d8e947f8e562eda20416fb9", "score": "0.59963584", "text": "def put_queued_units\n queue = TactBattleManager.unit_queue\n queue.each do |args| \n opts = {:x => args[2], :y => args[3], :wait => args[4][:wait]}\n TactBattleManager.new_unit_h(args[0],args[1],opts)\n end\n TactBattleManager.empty_unit_queue\n end", "title": "" }, { "docid": "dabdff58090fe7ebb0bb38cc5ade37a0", "score": "0.5983957", "text": "def workers(count); end", "title": "" }, { "docid": "d53fb34dba76dd9c2b54f829ec76e60d", "score": "0.5937887", "text": "def queue_assignments\n puts \"queueing assignment\"\n Resque.enqueue_at(self.question.schedule , SchedulerJob , {:assignment_id => self.id})\n end", "title": "" }, { "docid": "7501d27101ff5ec7f766a75210a81a33", "score": "0.5936719", "text": "def queue\n @queue ||= produce_queue\n end", "title": "" }, { "docid": "c436e639374c9f5132f28b2fe4662195", "score": "0.5921857", "text": "def initialize\n @queue_for_storage = []\n @queue_for_removal = []\n @stored = []\n @removed = []\n end", "title": "" }, { "docid": "182ad836e5b3af55b49e6cc85e029066", "score": "0.59178305", "text": "def work_jobs(queue = :job)\n Resque::Worker.new(queue).work(0)\n end", "title": "" }, { "docid": "7d92e20382912aacb7609f0c075791a2", "score": "0.59169304", "text": "def create_work_queue\n queue = Queue.new\n\n @edges.size.times do |index|\n queue << index\n end\n\n queue\n end", "title": "" }, { "docid": "207ee4b82944568f03bf420b897c93d4", "score": "0.59129506", "text": "def autogenerated_queues\n @log.info(\"Autogenerating queues\")\n [\n \"#{@queue_prefix}#{@model}\",\n \"#{@queue_prefix}#{@brand}\",\n \"#{@queue_prefix}android\",\n \"#{@queue_prefix}android-#{@os_version}\",\n \"#{@queue_prefix}android-#{@os_version}-#{@model}\"\n ]\n end", "title": "" }, { "docid": "9eb169063d02aa905778d2121778844b", "score": "0.5912109", "text": "def initialize(*queues)\n queues = [:default] if queues.size == 0\n @queues = queues\n RockQueue.logger.info \"=> Initializing...\"\n end", "title": "" }, { "docid": "a96208978732c09e51b674b4acd88af1", "score": "0.5911652", "text": "def queue_stats\n broker_stats[\"queues\"]\n end", "title": "" }, { "docid": "59e14612bf2fc300310e7e077d4f7c22", "score": "0.5908808", "text": "def configuration worker\n if @queues[worker] \n @queues[worker].respond_to?(:max) ? max_size=@queues[worker].max : max_size=0\n {'worker'=>worker,'maximum_size'=>max_size}\n else\n raise InvalidData,\"non existent queue\"\n end\n end", "title": "" }, { "docid": "4929c5dfe13fed16e6389b983a3c782f", "score": "0.590739", "text": "def work_pool; end", "title": "" }, { "docid": "26a03199bbd134b3c1d7176eed83182e", "score": "0.5898999", "text": "def queue(*queues)\n queues.flatten!\n\n if defined?(Mongoid)\n c = ::Delayed::Job\n c = c.where(:failed_at => nil)\n c = c.where(:run_at.lte => Time.now.utc)\n c = c.where(:queue.in => queues) unless queues.empty?\n c.count\n elsif defined?(ActiveRecord)\n c = ::Delayed::Job\n c = c.where(:failed_at => nil)\n c = c.where(\"run_at <= ?\", Time.now.utc)\n c = c.where(:queue => queues) unless queues.empty?\n c.count\n else\n raise \"HireFire could not detect ActiveRecord or Mongoid for HireFire::Macro::Delayed::Job.\"\n end\n end", "title": "" }, { "docid": "39ab617538e8e63a9001fa9413dfceaa", "score": "0.58876795", "text": "def default_queue=(queue)\n @queues[nil] = queue\n end", "title": "" }, { "docid": "21b7a188393f39d0ebe468b95138d439", "score": "0.5887173", "text": "def setup_queues_and_policies\n publisher.setup_queues_and_policies\n end", "title": "" }, { "docid": "34cb4b8dc5f57c01259cef1d7637e966", "score": "0.5862803", "text": "def setup_retry_queues\n retry_delay_times.each_with_index.map do |delay, index|\n setup_retry_queue(delay, index)\n end\n end", "title": "" }, { "docid": "ff3421194aab3fb5ffad258888fca5b1", "score": "0.586222", "text": "def queue(process, units)\n waiting_list.push([process, units])\n end", "title": "" }, { "docid": "8e652140af6ef3f690b8503dbba361b1", "score": "0.5855853", "text": "def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end", "title": "" }, { "docid": "90597058fa01d4c6f419409261fa8ea0", "score": "0.5855738", "text": "def initialize\n @waiting_list = [\"Emma Woodhouse\", \"Emma Bovary\", \"Katniss Everdeen\", \"Lady Macbeth\", \"Anna Karenina\", \"Scout Finch\", \"Hester Prynne\", \"Luna Lovegood\", \"Liz Bennett\", \"Anne Elliot\", \"Hermione Granger\", \"Jane Eyre\", \"Arya Stark\", \"Jo March\"] # queue\n @people_currently_working = [] # stack\n initial_hiring\n end", "title": "" }, { "docid": "cee9d5e27d323e4c7b7c3c7e93f54de9", "score": "0.58467275", "text": "def available_queues(statistics = nil)\n raise MemCacheError, \"No active servers\" unless active?\n\n @servers.first = server\n sock = server.socket\n raise MemCacheError, \"No connection to server\" if sock.nil?\n \n @available_queues = []\n \n value = nil\n begin\n sock.write \"stats queue\\r\\n\"\n stats = {}\n while line = sock.gets do\n break if line == \"END\\r\\n\"\n if line =~ /STAT [\\w]+ ([\\w\\.\\:]+)/ then\n @available_queues << $1\n end\n end\n rescue SocketError, SystemCallError, IOError => err\n server.close\n raise MemCacheError, err.message\n end\n\n @available_queues\n end", "title": "" }, { "docid": "acdc9c676ea52138d86716076dc18d66", "score": "0.58408505", "text": "def personal_queue\n unless (local_queues = self.queues).empty?\n local_queues[0]\n end\n end", "title": "" }, { "docid": "a70ffe351391b28eaa8605f829777ee1", "score": "0.58390766", "text": "def init_workers(servers)\n @w = []\n servers.each{|s|\n @w << Worker.new(s)\n }\n end", "title": "" }, { "docid": "297660be774ade2b85af2f5827d7240c", "score": "0.5822482", "text": "def queue; end", "title": "" }, { "docid": "297660be774ade2b85af2f5827d7240c", "score": "0.5822482", "text": "def queue; end", "title": "" }, { "docid": "3a0eb999a73920d54e2e002095449ac9", "score": "0.5816951", "text": "def message_queue\n @message_queue ||= Hash.new do |hash, key|\n hash[key] = []\n end\n end", "title": "" }, { "docid": "0ee132b0a544935041503e30050b8519", "score": "0.581383", "text": "def initialize(max_concurrency)\n @max_concurrency = max_concurrency\n @host_queues = {}\n end", "title": "" }, { "docid": "95c42d2b309bab1762a6fc1c67802ab2", "score": "0.5808937", "text": "def schedule_process_connections\n ProcessQueue.create(:type => \"apply_primary_tags\",\n :priority => 1,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_inner_connections\",\n :priority => 2,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_outer_connections\",\n :priority => 5,\n :params => [self.id])\n end", "title": "" }, { "docid": "e7d7ec38e3278bb0a721927d8c36d368", "score": "0.579449", "text": "def _process_queue\n [@queue.length, @max_minifiers - @working_minifiers.length].min.times {\n _spawn_minifier\n }\n end", "title": "" }, { "docid": "48b84fa98c8e7aa8c241cc1d1851eb61", "score": "0.57877845", "text": "def queue_count()\n @work_queue.size + super()\n end", "title": "" }, { "docid": "02260ba1b9fb45f9aace1bb1f2c02035", "score": "0.5781218", "text": "def index\n @wait_queues = wait_queues\n end", "title": "" }, { "docid": "2205eed888aec25a660d5100421da73d", "score": "0.5778611", "text": "def initialize(redis, queues = [], options = {})\n options[:poll_interval] ||= 0.2\n @interval = Float(options[:poll_interval])\n\n @options = options\n @options[:redis] = redis\n @shutdown = false\n @mutex = {}\n @dequeue_count = 0\n\n queues = [ queues ] unless queues.is_a? Array\n @queues = queues.map do |klass_or_queue_name|\n if klass_or_queue_name.is_a? String\n queue_name = Boot::RedisHelper_.redis_key_by_tag(\"#{PREFIX}#{klass_or_queue_name}\")\n process_queue_name = \"#{queue_name}_process\"\n elsif klass_or_queue_name.is_a? Class\n queue_name = RedisMessageQueue::Queue.queue_from_class(klass_or_queue_name)\n process_queue_name = \"#{queue_name}_process\"\n else\n raise NoQueueError.new(\"Cannot infer queue name from arguments\")\n end\n\n unless queue_name and queue_name.length > PREFIX.length\n raise NoQueueError.new(\"Invalid queue name: #{queue_name}\")\n end\n\n @mutex[queue_name] = Mutex.new\n RedisQueue.new(queue_name, process_queue_name, @options)\n end\n\n if @queues.empty?\n raise NoQueueError.new(\"Please give each worker at least one queue.\")\n end\n end", "title": "" }, { "docid": "7914a79d1ed47f81c3be17f956fa8c81", "score": "0.57643354", "text": "def work_queue_size()\n @work_queue.size\n end", "title": "" }, { "docid": "5875d49f616ba6e297a703f54a2e3446", "score": "0.5754609", "text": "def list_workers\n Shuttle::Redis.smembers worker_set_key\n end", "title": "" }, { "docid": "2f46b4dfa765f57bcc45b929a23e3c78", "score": "0.57534266", "text": "def [](worker)\n @queues[worker]||=Queue.new\n @queues[worker].pop(true) rescue nil\n end", "title": "" }, { "docid": "c7e9383917680c8a52caded6ae0ca2e1", "score": "0.57432127", "text": "def setup_queue\n Thread.current[:carrot] = Carrot.new(:host=>'mediashelf1.dtic.dk')\n @q = Carrot.queue(@queue_name)\n end", "title": "" }, { "docid": "58b4510f02209d7d5a68f192fd9288c1", "score": "0.57423574", "text": "def max_queue_threads\n 1\n end", "title": "" }, { "docid": "3b890b261016209affa84c9fa07ba80f", "score": "0.57305765", "text": "def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end", "title": "" }, { "docid": "7cc5516395cef80dbdcb0afbb57f829c", "score": "0.5728667", "text": "def flush_redis_queues (array_of_connection_pools)\n\t#array_of_connection_pools.each { |redis| \n # Sidekiq.redis = redis\n #Sidekiq.redis {|c| c.flushdb rescue nil}\n #}\nend", "title": "" }, { "docid": "edf0e0c03efdc5e3bc128d0e1ddf30e1", "score": "0.5728579", "text": "def setup_queue\n queue = Queue.find self.queue_name\n unless queue\n queue = Queue.create _id: self.queue_name\n end\n end", "title": "" }, { "docid": "6e53ff85bb1739f58fc5358010cf01c4", "score": "0.5713052", "text": "def default_queue\n @queues[nil]\n end", "title": "" }, { "docid": "d6630007a7a47ce432cc2ad7e81999fc", "score": "0.5707846", "text": "def queue() = @queue ||= CommandQueue.new", "title": "" }, { "docid": "a45c01598b887b8dd678ade4b351a55c", "score": "0.5697777", "text": "def queues\n balaner_reset_usage_after_interval\n super.sort_by { |q| [balancer_usage[q], -balancer_weights[q]] }\n end", "title": "" }, { "docid": "ec0360f41faac490cdf7045be8f169f4", "score": "0.5694636", "text": "def delayed_queue_schedule_size\n redis.zcard(:delayed_queue)\n end", "title": "" }, { "docid": "327e70434115a69608250d9bee2e4c51", "score": "0.5692021", "text": "def set_initial_workers(strategy = nil, &system_factory)\n strategy ||= BinaryScalingStrategy.new\n system_factory ||= lambda {|queue| SpecifiedQueueSystem.new([queue])} \n @scalers.each do |queue, scaler|\n scaler.workers = strategy.call(system_factory.call(queue), 0)\n end\n end", "title": "" }, { "docid": "08defbea69afe9e4ee2b2bc7ff09f947", "score": "0.56896335", "text": "def job_groups()\n @job_queues.keys.dup\n end", "title": "" }, { "docid": "a66a292ac3782d355336855f64249f0d", "score": "0.5689108", "text": "def reserve\n queues.each do |queue|\n log_with_severity :debug, \"Checking #{queue}\"\n if job = Resque.reserve(queue)\n log_with_severity :debug, \"Found job on #{queue}\"\n\n if job.payload['enqueue_ts']\n delay_ts = Time.now.to_i - job.payload['enqueue_ts'].to_i\n max_delay = Resque.redis.get(\"fifo-stats-max-delay\") || 0\n Resque.redis.incrby(\"fifo-stats-accumulated-delay\", delay_ts)\n Resque.redis.incr(\"fifo-stats-accumulated-count\")\n if (delay_ts > max_delay.to_i)\n Resque.redis.set(\"fifo-stats-max-delay\", max_delay)\n end\n end\n return job\n end\n end\n\n nil\n rescue Exception => e\n log_with_severity :error, \"Error reserving job: #{e.inspect}\"\n log_with_severity :error, e.backtrace.join(\"\\n\")\n raise e\n end", "title": "" }, { "docid": "c245cefd6282b643e72f5c8cef5c98cd", "score": "0.5686334", "text": "def add_job job_data,workers=[]\n queued_in=0\n workers=@queues.keys if workers.empty?\n if valid?(job_data)\n @queues.each do |w,q|\n if workers.include?(w)\n #this handles a SizedQueue without blocking\n if q.respond_to?(:max) && q.size == q.max\n q.pop\n end\n q.push(job_data)\n queued_in+=1 \n end\n end\n else\n raise InvalidData\n end\n return queued_in\n end", "title": "" } ]
39039a45c2ee48c502a31f90c1bd8522
Encrypts files with the supplied password or master key. The original file is not modified; a new encrypted file is created. The password is not required if a master key has been set (either with `random_key_gen` or with `set_master_key`). If a password is supplied it will be used to create a key with PBKDF2.
[ { "docid": "3a2599c8c65b7f32e03e796a25aa6bab", "score": "0.71699035", "text": "def encrypt_file(path, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n cipher = cipher(aes_key, iv)\n hmac = OpenSSL::HMAC.new(mac_key, OpenSSL::Digest::SHA256.new)\n new_path = path + '.enc'\n\n File.open(new_path, 'wb') do |out_file|\n out_file.syswrite salt\n out_file.syswrite iv\n hmac.update iv\n\n file_chunks(path).each do |chunk|\n encrypted = cipher.update(chunk)\n hmac.update encrypted\n out_file.syswrite encrypted\n end\n encrypted = cipher.final\n\n hmac.update encrypted\n out_file.syswrite encrypted\n out_file.syswrite hmac.digest\n end\n new_path\n rescue TypeError, ArgumentError, SystemCallError, IOError => e\n error_handler e\n end", "title": "" } ]
[ { "docid": "f037ae44a04a4d9b80a6da1f7ceeab96", "score": "0.6263909", "text": "def _encrypt\n cryptor_files(@encrypting)\n end", "title": "" }, { "docid": "fc11d0cbe4082ca2b6e0663300b29fbc", "score": "0.6044591", "text": "def encrypt_file(filename, key)\n File.open(filename) do |file|\n data = file.read\n encrypted64 = hex_to_base64(repeat_key_xor(data, key))\n\n File.open(\"encrypted64_\" + filename, \"w\") do |out_file|\n out_file.write(encrypted64)\n end\n end\nend", "title": "" }, { "docid": "c7c3ed73055a1a871c4895f476c1057d", "score": "0.5831682", "text": "def encryptFile(fileIn,conf)\n\nsalt_len = 8\nbuf=''\npassword = conf[:passphrase]\ncipher = 'aes-128-cbc'\nputs aktTime()+' encrypting archive...'\nSTDOUT.flush #write out immediately\nsalt= OpenSSL::Random::pseudo_bytes(salt_len)\n\nc = OpenSSL::Cipher::Cipher.new(cipher)\nc.encrypt\n#generate key + IV from given password\nc.pkcs5_keyivgen(password, salt, 1)\nFile.open(CRYPT_TMP,'wb') do |fo|\n \n fo.write(MAGIC) #write magic string \n fo.write(salt) #write 8 bytes random salt\n File.open(fileIn,'rb') do |fi|\n while fi.read(4096,buf) \n fo.write c.update(buf)\n end\n fo.write( c.final)\n end\nend\n\n#overwrite archive with crypted archive\nputs aktTime()+' archive encrypted '\nFile.rename(CRYPT_TMP,fileIn)\nend", "title": "" }, { "docid": "4926e9979488632419b7c69f902264d5", "score": "0.57531166", "text": "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "title": "" }, { "docid": "a122e80215dbc8fcc4fad8aef9dcde4d", "score": "0.5630059", "text": "def encrypt_to(filename)\n self.opts.merge!({output: filename})\n encrypt\n end", "title": "" }, { "docid": "ac66c4c3ae0fccf4e8a13609bff0af01", "score": "0.54970974", "text": "def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "88b6a157e84317b9000e453bb6c9ebe4", "score": "0.54923254", "text": "def encrypt_password!\n if( !password.blank? )\n self['encrypted_password_store'] = BCrypt::Password.create( password, :cost => 11 )\n password, password_confirmation = nil, nil\n end\n end", "title": "" }, { "docid": "314dc60927203e5c649b0159c44679b1", "score": "0.5477111", "text": "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "f54825daaa54435141b4d6559a961ca7", "score": "0.54668176", "text": "def master_password=(master_password)\n @master_password = master_password\n @private_key = OpenSSL::PKey::RSA.new(File.read(\"#@config_dir/#{PRIVATE_KEY}\"), master_password)\n @public_key = OpenSSL::PKey::RSA.new(File.read(\"#@config_dir/#{PUBLIC_KEY}\"))\n @unlocked = true\n end", "title": "" }, { "docid": "ed6ea3e5801dcbd8e8cdcd65c9fc63e4", "score": "0.5439154", "text": "def encrypt(filename, key)\r\n\t\r\n\t_original = File.open(filename, \"r\")\r\n\t_encrypted = File.open(\"encrypted.txt\", \"w+\")\r\n\t\r\n\t# initialize the keyword as an encryption key\r\n\t_key = EncryptionKey.new(key)\r\n\t\r\n\tlinecount = 1\r\n\t\r\n\t# loop through each line, and then each character, modifying it by the current key value\r\n\t# then write the modified character to the output file\r\n\t_original.each do |line|\r\n\t\tcharcount = 1\r\n\t\tline.split(\"\").each do |originalChar|\r\n\t\t\t\r\n\t\t\ttemp = originalChar.ord\r\n\t\t\ttemp = (temp + _key.nextModVal()) % 256\t\t\t\r\n\t\t\tencryptedChar = temp.chr\r\n\t\t\t_encrypted << encryptedChar\r\n\t\t\tcharcount += 1\r\n\t\tend\r\n\t\tlinecount += 1\r\n\tend\r\n\t\r\nend", "title": "" }, { "docid": "b856264139c8f4c873177471558f08fe", "score": "0.542574", "text": "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "ccbbfed5689eff7d084ebc37c5d05bba", "score": "0.5418219", "text": "def encrypt_key(passwd, _options = {})\n passwd = passwd.to_s\n raise 'Missing encryption password!' if passwd.empty?\n Digest::SHA256.digest(passwd)\n end", "title": "" }, { "docid": "3b0e1b22a91d029493c4e58934822048", "score": "0.5406215", "text": "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "cdb373fbd441d06e204bc1a935e0c917", "score": "0.5390147", "text": "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(self.password)\n end", "title": "" }, { "docid": "fe71f581caeac31b43d0f25504095ed4", "score": "0.53851193", "text": "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", "title": "" }, { "docid": "b6623f167201aa9ded4d72c7dc3f3f5b", "score": "0.5382449", "text": "def encrypt(data, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n aes = cipher(aes_key, iv, true)\n ciphertext = aes.update(data) + aes.final\n mac = sign(iv + ciphertext, mac_key)\n\n encrypted = salt + iv + ciphertext + mac\n encrypted = Base64.strict_encode64(encrypted) if @base64\n encrypted\n rescue TypeError, ArgumentError => e\n error_handler e\n end", "title": "" }, { "docid": "ca036eafc3bff7d30ae2b34fd1108c21", "score": "0.53748393", "text": "def encrypt_password\n if(password.blank?)\n return\n else\n self.salt = make_salt(password) unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end\n end", "title": "" }, { "docid": "289f34a7ca5b2a62d9415a1229c5d2a9", "score": "0.53543425", "text": "def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end", "title": "" }, { "docid": "15f27b09b4e153378b8b5dc2a5c5489d", "score": "0.5345251", "text": "def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end", "title": "" }, { "docid": "e5ff96dd65786b242e6209ded1f4cd25", "score": "0.5344336", "text": "def master_password=(master_pwd)\n @master_password = master_pwd\n @private_key = OpenSSL::PKey::RSA.new(File.read(\"#@config_dir/#{PRIVATE_KEY}\"), master_pwd)\n @public_key = OpenSSL::PKey::RSA.new(File.read(\"#@config_dir/#{PUBLIC_KEY}\"))\n @unlocked = true\n end", "title": "" }, { "docid": "3742394802c55258d04d0ba56b7f629c", "score": "0.5340737", "text": "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "c1efb7f07ce57bc1923406a40264a0fb", "score": "0.5332018", "text": "def encrypt_password\n return if password.blank?\n self.salt = User.make_token if new_record?\n self.crypted_password = encrypt(password)\n end", "title": "" }, { "docid": "f3f2f6bcb10a0b7bf3af83206ca6235f", "score": "0.52583855", "text": "def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = encrypt(password)\n end", "title": "" }, { "docid": "e5cbcd30ddf3b5226536efcf0cef7ad4", "score": "0.525488", "text": "def encrypt_password\n if new_record?\n self.salt = make_salt\n self.password_digest = encrypt(password_digest)\n end\n end", "title": "" }, { "docid": "7b40ad73a8add1d54d009c90ea86a6f4", "score": "0.52348304", "text": "def encrypt_password\n\t\t\tif new_record?\n\t\t\t\tself.salt = make_salt\n\t\t\tend\n\t\t\tself.encrypted_password = encrypt(password)\n\t\tend", "title": "" }, { "docid": "61086d8768da76786e11a9516e9da2c3", "score": "0.5210746", "text": "def encrypt(plain_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n cipher = new_cipher(:encrypt, password, salt)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plain_text)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_ciphertext(iv, ciphertext))\n end", "title": "" }, { "docid": "1cc48ee9571fad8e22cd8b2e525e6e17", "score": "0.52096677", "text": "def encrypt_password\n\t\treturn if password.blank?\n\t\tif new_record?\n\t\t\tself.salt = Digest::SHA1.hexdigest(\"--#{Time.now}--#{name}--\")\n\t\tend\n\t\tself.encrypted_password = User.encrypt(password, salt)\n\tend", "title": "" }, { "docid": "9dbca2994019d355543b8d44e39573e3", "score": "0.5207904", "text": "def encrypt_password\n unless self.password.nil?\n self.salt = make_salt\n self.encrypted_password = encrypt(password)\n end\n end", "title": "" }, { "docid": "b1a329845d9e32c331c771c76fcc9f25", "score": "0.5200241", "text": "def encrypt_move(directory, key)\n\tfile_names = get_files\n\t#puts 'FILE NAMES ' + file_names.to_s\n\t\n\tenc_names = encrypt_files(file_names, key)\n\t#puts 'ENC NAMES ' + enc_names.to_s\n\t\n\tmove_files(enc_names, directory)\n\tremove_files(enc_names, directory)\nend", "title": "" }, { "docid": "e9f4aa7e3967d1e5aa1b1b29e7b2a3a1", "score": "0.5175861", "text": "def encrypt_new_password\n return if password.blank?\n self.hashed_password = encrypt(password)\n end", "title": "" }, { "docid": "3b05d299eb2787d50ee24fa96a05ed04", "score": "0.5169741", "text": "def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end", "title": "" }, { "docid": "0224d2b9247ec8e08d983bf2c44ff1d3", "score": "0.5169031", "text": "def encrypt_password\n\t unless @password.blank?\n self.password_salt = salt\n self.encrypted_password = encrypt(@password, salt)\n\t end\n\tend", "title": "" }, { "docid": "7304942223b38b2e18bcc91902542e18", "score": "0.5140056", "text": "def update (data)\n cipher = new_encryption_cipher\n encrypted_file_content = cipher.update(data.to_yaml) + cipher.final\n\n File.open(vault_path, 'wb') { |f| f.write(encrypted_file_content) }\n FileUtils.chmod(0600, vault_path)\n end", "title": "" }, { "docid": "10dafb6dc97681695c88344c7774221c", "score": "0.5129457", "text": "def encrypt_password(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_password = \n AES_ENCRYPT(#{quote_value(self.decrypted_password)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end", "title": "" }, { "docid": "1ec03a5484d0625750a0ca919fd66d65", "score": "0.5129132", "text": "def encrypt_new_password\n return if password.blank?\n self.hashed_password = encrypt(password)\n end", "title": "" }, { "docid": "0b5c86684dcfede2b63d2b3323ce41cc", "score": "0.5111479", "text": "def zip_archive_zip_create_encrypted(password, input_file1, opts = {})\n data, _status_code, _headers = zip_archive_zip_create_encrypted_with_http_info(password, input_file1, opts)\n data\n end", "title": "" }, { "docid": "241ccb545f4be8eec2515d810d54dacb", "score": "0.5108725", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "a7a134769b8ece4c85e3fe71a4d3775d", "score": "0.51000947", "text": "def encrypt_password\n unless password.empty?\n self.password_hash = Digest::SHA1.hexdigest(password)\n end\n end", "title": "" }, { "docid": "f712f6f95935682fab00b5e78abcb461", "score": "0.5094369", "text": "def encrypt_password\n if self.new_record? || !self.password.blank?\n self.encrypted_password = Digest::SHA256.hexdigest(\"#{self.encryption_salt}::#{@password}\")\n end\n end", "title": "" }, { "docid": "5c00c2ac470c01045f1d7fb2f827868d", "score": "0.508324", "text": "def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end", "title": "" }, { "docid": "320baae3ff918cda40a8107e587a532c", "score": "0.5066993", "text": "def encrypt_password\n # the argument on the right hand side is implicitly self.password\n self.encrypted_password = encrypt( password )\n end", "title": "" }, { "docid": "ccb10409d096d40ef3ec1b315a395221", "score": "0.50598913", "text": "def encrypt(password)\n self.class.encrypt(password) #, salt)\n end", "title": "" }, { "docid": "cf4d4fef8b5047b876ea3d6fb8821872", "score": "0.50488406", "text": "def access_safe(password = nil)\n if !File.file? @pw_file\n pa %[No password safe detected, creating one at #@pw_file], :blue, :bold\n @pw_hash = Encryptor.hash password || ask_for_password(%[please enter a new master password], :yellow, :bold)\n write_safe\n else\n print %[Access password safe at #@pw_file | ]\n @pw_hash = Encryptor.hash password || ask_for_password(%[master password])\n end\n end", "title": "" }, { "docid": "756e09af755e48e555af64ab6f35be17", "score": "0.50458676", "text": "def encrypt_password\n return if self.password.blank?\n \n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.username}--\") if self.new_record?\n self.crypted_password = self.encrypt(self.password)\n end", "title": "" }, { "docid": "46cd3ad6695de8fc5bbe0ff92e086d71", "score": "0.5036354", "text": "def write_safe\n @pwdata.gsub!(/\\n+/, \"\\n\") # try to remove any \"empty entries\"\n Encryptor.iv = create_random_IV\n pwdata_encrypted = Encryptor.encrypt(@pwdata, @pwhash)\n\n # add the initialization-vector to the start of the string to be \n # base64 translated and saved to file\n pwdata_encrypted = Encryptor.iv + pwdata_encrypted\n\n # use pack with 'm*' to translate the encrypted bytes into base64\n # for better / easier to read storage on file\n pwdata_enc_base64 = [pwdata_encrypted].pack('m*')\n File.open( @pwfile, 'w' ){ |f| f.write pwdata_enc_base64 }\n\n # read_safe is here to check that the file just written is openable\n # with the password the user typed in (not corrupted)\n # if it's not corrupted, then make a backup copy of it\n read_safe\n FileUtils.copy( @pwfile, \"#@pwfile.bak\" )\n end", "title": "" }, { "docid": "e9884357347d8e0b1bb2db489d5594b0", "score": "0.50096303", "text": "def encryptor(io, password, &b)\n Encrypt.open(io, password, mtime, &b)\n end", "title": "" }, { "docid": "4590e86ff0570b683519c3231e45311c", "score": "0.5009627", "text": "def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = User.encrypt(password,self.salt)\n end", "title": "" }, { "docid": "66209b2149e75c119f53e1a7112b0050", "score": "0.50011057", "text": "def encrypt_file(filename, rotation)\n \t# 1. Create the file handle to the input file\n \t\tinput = File.open(filename, \"r\")\n \t# 2. Read the text of the input file\n \t\tinput_string = input.read\n \t# 3. Encrypt the text\n \t\tencrypted_string = encrypt(input_string, rotation)\n \t# 4. Create a name for the output file\n \t\toutput_file = filename + \".encrypted\"\n \t# 5. Create an output file handle\n \t\tout = File.open(output_file, \"w\")\n \t# 6. Write out the text\n \t\tout.write(encrypted_string)\n \t# 7. Close the file\n \t\tout.close\n \tend", "title": "" }, { "docid": "ba7cfe738094ebcb4b9143558373e7f9", "score": "0.49755603", "text": "def encrypt_password\n \t\tunless password.blank?\n \t\t# Encrypt password using BCrypt\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.encrypted_password = BCrypt::Engine.hash_secret(password, salt)\n \tend\n end", "title": "" }, { "docid": "08e551079c331958b5fb515064454ec6", "score": "0.49739236", "text": "def encrypt_password\n unless password.blank?\n self.salt = BCrypt::Engine.generate_salt\n self.fish = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end", "title": "" }, { "docid": "7b983600f1ee844b86c120ec4ca434a4", "score": "0.49732846", "text": "def encrypt_password\n if password.present?\n #create salt password\n self.salt_password = BCrypt::Engine.generate_salt\n #create hash password\n self.password = BCrypt::Engine.hash_secret(password,salt_password)\n end\n end", "title": "" }, { "docid": "55db1f9f47740323e364baa3856bb211", "score": "0.49714354", "text": "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n #the encrpyted_password attribute of the current user is the encryption of the password virtual attribute?\n self.encrypted_password = encrypt(password)\n end", "title": "" }, { "docid": "a434e6f604c2c2b91f6d3f0ac613adfc", "score": "0.4971352", "text": "def encrypt_password\n config = sorcery_config\n send(:\"#{config.salt_attribute_name}=\", new_salt = TemporaryToken.generate_random_token) unless config.salt_attribute_name.nil?\n send(:\"#{config.crypted_password_attribute_name}=\", self.class.encrypt(send(config.password_attribute_name), new_salt))\n end", "title": "" }, { "docid": "94cbeb09418905cac753c5066f0c6d5f", "score": "0.49698606", "text": "def encrypt(password)\n self.class.encrypt(password, self.salt)\n end", "title": "" }, { "docid": "2eb5bfcd820711208f05c10781395cb8", "score": "0.4959919", "text": "def password_encrypt\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "0d5713b2f242d71d49d6aa5dfbdd0623", "score": "0.4959008", "text": "def encrypt_password()\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end", "title": "" }, { "docid": "c1bcce2964d8caf9a196d2d753725746", "score": "0.49357966", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "fbea829c6f50420278aff69bbd76cbd6", "score": "0.49278083", "text": "def encrypt(*attributes) \n \tinclude ActiveCrypto::Encrypted\n \tbefore_save :encrypt_attributes\n \tafter_save :decrypt_attributes\n options=attributes.last.is_a?(Hash) ? attributes.pop : {}\n keyholder\n if options and options[:key]\n \t\t\t\tmodule_eval <<-\"end;\"\t\t\t\t \n \t\t\t\t\tdef session_key\n \t\t\t\t\t\t(send :#{options[:key]} ).send :session_key\n \t\t\t\t\tend\t \n \t\t\t\t\t@@external_key=true\n \t\t\t\tend;\n end\n\n base64_encode = (options and options[:base64])\n module_eval <<-\"end;\"\n def self.ezcrypto_base64?\n #{base64_encode.to_s}\n end\n end;\n \n self.encrypted_attributes=attributes\n end", "title": "" }, { "docid": "14ab1b98251d6b6066afa14a7ca42b25", "score": "0.492533", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "14ab1b98251d6b6066afa14a7ca42b25", "score": "0.492533", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "14ab1b98251d6b6066afa14a7ca42b25", "score": "0.492533", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "14ab1b98251d6b6066afa14a7ca42b25", "score": "0.492533", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "14ab1b98251d6b6066afa14a7ca42b25", "score": "0.492533", "text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "title": "" }, { "docid": "b839f52f2e754ffce7ab54a087d9f20c", "score": "0.49250373", "text": "def encrypt_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password= BCrypt::Engine.hash_secret(password, salt)\n end\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" }, { "docid": "62cabf2c46327f229a946974aa0e6124", "score": "0.49231288", "text": "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "title": "" } ]
f76a257e3d2622de8f11f25c1dc674e7
Opcode 8 is equals: if the first parameter is equal to the second parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.
[ { "docid": "ae8c06cbc56569c0149b62fd00448797", "score": "0.7127667", "text": "def op_equals(instruction)\n\t\tptr = instruction.ptr\n\t\tpos_v1, pos_v2, pos_v3 = ram[ptr + 1, 3]\n\t\tv1 = instruction.p1 == 0 ? ram[pos_v1] : pos_v1\n\t\tv2 = instruction.p2 == 0 ? ram[pos_v2] : pos_v2\n\t\tvalue = v1 == v2 ? 1 : 0\n\t\tram[pos_v3] = value\n\tend", "title": "" } ]
[ { "docid": "2dd1ad62dac8591d821f30ad47f372aa", "score": "0.6616957", "text": "def opcode_8(prog, pc, params)\n prog[prog[pc + 3]] = if value(prog, pc + 1, params[-1]) == value(prog, pc + 2, params[-2])\n 1\n else\n 0\n end\n\n [prog, pc + 4]\n end", "title": "" }, { "docid": "2dd1ad62dac8591d821f30ad47f372aa", "score": "0.6616957", "text": "def opcode_8(prog, pc, params)\n prog[prog[pc + 3]] = if value(prog, pc + 1, params[-1]) == value(prog, pc + 2, params[-2])\n 1\n else\n 0\n end\n\n [prog, pc + 4]\n end", "title": "" }, { "docid": "2dd1ad62dac8591d821f30ad47f372aa", "score": "0.6616957", "text": "def opcode_8(prog, pc, params)\n prog[prog[pc + 3]] = if value(prog, pc + 1, params[-1]) == value(prog, pc + 2, params[-2])\n 1\n else\n 0\n end\n\n [prog, pc + 4]\n end", "title": "" }, { "docid": "dca84746e0330e72c9f401be2d8f3e54", "score": "0.65892375", "text": "def do_8\n self.log \"do_8: @input[#{@input[@cur_pos+1]}] == @input[#{@input[@cur_pos+2]}]\"\n input1, input2 = determine_inputs\n\n if input1 == input2\n @input[@input[@cur_pos+3]] = 1\n else\n @input[@input[@cur_pos+3]] = 0\n end\n end", "title": "" }, { "docid": "88e00a1a8ca8c8ebd3da52afab68da27", "score": "0.6322757", "text": "def eqri(a, b, c)\n @registers[c] = @registers[a] == b ? 1 : 0\n end", "title": "" }, { "docid": "39c73af02809021c6c059e53466ac1a7", "score": "0.6305723", "text": "def equal\n\t\t\tif @value == @interpreter.memory.get(@interpreter.memory_position) \n\t\t\t\t@value = 1\n\t\t\telse\n\t\t\t\t@value = 0\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "afd6fc0564ac0f4a70624fec51ac0c2b", "score": "0.62967074", "text": "def match(a,b)\n a == b ? 0 : 1\nend", "title": "" }, { "docid": "f4f4c96e11934569aa9e71c1c25bbfd0", "score": "0.6289892", "text": "def eq(arg)\n binary_operation(arg, 0){|t1, t2| t1.eq t2}\n end", "title": "" }, { "docid": "9ff8b67eccc4e6d88c4ddb090eb814a5", "score": "0.62891626", "text": "def opcode_8(prog, pc, params)\n prog[addr(prog, pc, params, 3)] = if value(prog, pc, params, 1) ==\n value(prog, pc, params, 2)\n 1\n else\n 0\n end\n\n [prog, pc + 4]\n end", "title": "" }, { "docid": "10636a5e2bdb103af5a5cf7b61452750", "score": "0.6254325", "text": "def equals(intcode:, modes:, arguments:)\n term1 = modes[0] == 1 ? arguments[0] : intcode[arguments[0]]\n term2 = modes[1] == 1 ? arguments[1] : intcode[arguments[1]]\n result_address = arguments[2]\n\n intcode[result_address] = term1 == term2 ? 1 : 0\nend", "title": "" }, { "docid": "c10fd34a988cc4f7afc240af54afa7be", "score": "0.6248632", "text": "def eqir(a, b, c)\n @registers[c] = a == @registers[b] ? 1 : 0\n end", "title": "" }, { "docid": "2d467552c886063420ddbd6d4b1784f3", "score": "0.6166451", "text": "def ===(p0) end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.607005", "text": "def ==(p0) end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.607005", "text": "def ==(p0) end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.607005", "text": "def ==(p0) end", "title": "" }, { "docid": "d20050ec793890d62582e4e9364c2087", "score": "0.5939215", "text": "def single_eq(other); end", "title": "" }, { "docid": "400a3f40883bed86d263bedeec71b9b7", "score": "0.59303933", "text": "def eqrr(a, b, c)\n @registers[c] = @registers[a] == @registers[b] ? 1 : 0\n end", "title": "" }, { "docid": "e74ba5de99f37152be97683a1500c511", "score": "0.59196097", "text": "def equals!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n type = EQUALS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 154:10: '='\n match( 0x3d )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n end", "title": "" }, { "docid": "ed33b68f2608f6da187d44a7563cd719", "score": "0.5918269", "text": "def equal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 104 )\n\n\n\n type = EQUAL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 264:9: '='\n match( 0x3d )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 104 )\n\n\n end", "title": "" }, { "docid": "8eff0e5ea31a33d3ff09eb30661fd02f", "score": "0.5917798", "text": "def equal(a,b)\n a == b\nend", "title": "" }, { "docid": "da87fdbda83ed0c47a6fa198a977fa19", "score": "0.59150666", "text": "def oA\n binary_operator \"===\"\n end", "title": "" }, { "docid": "21e5462629fa9fff0c2f209c66a79e4b", "score": "0.5910706", "text": "def ===(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "21e5462629fa9fff0c2f209c66a79e4b", "score": "0.5910706", "text": "def ===(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "9588cf336158ba0294d43102c12af2f6", "score": "0.58647317", "text": "def executeEquals(opCode, opParams)\n\n\t\tvalue1 = opParams[:value1];\n\t\tvalue2 = opParams[:value2];\n\t\tdst = opParams[:addrs3];\n\n\t\tresult = (value1 == value2) ? 1 : 0;\n\t\ttraceOp(opCode, opParams, \"(#{value1} == #{value2}) -> #{result}, storeMem(#{dst}, #{result})\");\n\n\t\tstoreMem(dst, result);\n\n\tend", "title": "" }, { "docid": "9588cf336158ba0294d43102c12af2f6", "score": "0.58647317", "text": "def executeEquals(opCode, opParams)\n\n\t\tvalue1 = opParams[:value1];\n\t\tvalue2 = opParams[:value2];\n\t\tdst = opParams[:addrs3];\n\n\t\tresult = (value1 == value2) ? 1 : 0;\n\t\ttraceOp(opCode, opParams, \"(#{value1} == #{value2}) -> #{result}, storeMem(#{dst}, #{result})\");\n\n\t\tstoreMem(dst, result);\n\n\tend", "title": "" }, { "docid": "9588cf336158ba0294d43102c12af2f6", "score": "0.58647317", "text": "def executeEquals(opCode, opParams)\n\n\t\tvalue1 = opParams[:value1];\n\t\tvalue2 = opParams[:value2];\n\t\tdst = opParams[:addrs3];\n\n\t\tresult = (value1 == value2) ? 1 : 0;\n\t\ttraceOp(opCode, opParams, \"(#{value1} == #{value2}) -> #{result}, storeMem(#{dst}, #{result})\");\n\n\t\tstoreMem(dst, result);\n\n\tend", "title": "" }, { "docid": "9588cf336158ba0294d43102c12af2f6", "score": "0.58647317", "text": "def executeEquals(opCode, opParams)\n\n\t\tvalue1 = opParams[:value1];\n\t\tvalue2 = opParams[:value2];\n\t\tdst = opParams[:addrs3];\n\n\t\tresult = (value1 == value2) ? 1 : 0;\n\t\ttraceOp(opCode, opParams, \"(#{value1} == #{value2}) -> #{result}, storeMem(#{dst}, #{result})\");\n\n\t\tstoreMem(dst, result);\n\n\tend", "title": "" }, { "docid": "9588cf336158ba0294d43102c12af2f6", "score": "0.58647317", "text": "def executeEquals(opCode, opParams)\n\n\t\tvalue1 = opParams[:value1];\n\t\tvalue2 = opParams[:value2];\n\t\tdst = opParams[:addrs3];\n\n\t\tresult = (value1 == value2) ? 1 : 0;\n\t\ttraceOp(opCode, opParams, \"(#{value1} == #{value2}) -> #{result}, storeMem(#{dst}, #{result})\");\n\n\t\tstoreMem(dst, result);\n\n\tend", "title": "" }, { "docid": "18274dbd44c693edb22e8750dfe64893", "score": "0.58215755", "text": "def ==(arg0)\n end", "title": "" }, { "docid": "18274dbd44c693edb22e8750dfe64893", "score": "0.58215755", "text": "def ==(arg0)\n end", "title": "" }, { "docid": "18274dbd44c693edb22e8750dfe64893", "score": "0.58215755", "text": "def ==(arg0)\n end", "title": "" }, { "docid": "80741f8f9d3d2e0d3d3c41441902a830", "score": "0.5817806", "text": "def equal?(*args)\n args.each { |i|\n self == i ? (return true) : next\n }\n return false\n end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.58153236", "text": "def ==(*) end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.58153236", "text": "def ==(*) end", "title": "" }, { "docid": "b2f023a778d66ef20e972a6826bd52e2", "score": "0.57962584", "text": "def equal_op\nn=(1..50)\nn1 = n === 5\nreturn n1\nend", "title": "" }, { "docid": "0adf8e1421f7b72ae129ed1c4c83040a", "score": "0.57876146", "text": "def eql?(p0) end", "title": "" }, { "docid": "0adf8e1421f7b72ae129ed1c4c83040a", "score": "0.57876146", "text": "def eql?(p0) end", "title": "" }, { "docid": "6234427fa619f6b287a696208ae8a36a", "score": "0.57851464", "text": "def ==(vector2)\n end", "title": "" }, { "docid": "91381948a6d8075b35f41d6a6ca0bdcf", "score": "0.5771939", "text": "def equal_found\n @keyval_stack[-1] = 1\n end", "title": "" }, { "docid": "804cd97c32454a4c0010e500b61a68a8", "score": "0.57440937", "text": "def ===(arg0)\n end", "title": "" }, { "docid": "0ae2dd159f348616e406b97e1b737f66", "score": "0.57195413", "text": "def o8\n binary_operator \"&\"\n end", "title": "" }, { "docid": "baecd4d00557592c568fb70d07278bc5", "score": "0.5699712", "text": "def eq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n\n type = EQ\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 84:5: '=='\n match( \"==\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end", "title": "" }, { "docid": "f38c7a6457eba376c3ba32a10b6edf24", "score": "0.5697447", "text": "def same (a, b)\n a == b\nend", "title": "" }, { "docid": "97fb68122451cdb3f67e31de4ba9d6d3", "score": "0.5692079", "text": "def equal\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=M\")\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=D-M\")\n append(\"M=0\") # set to not equal by default: `false`, i.e., 0000000000000000\n append(\"@#{line_count + 7}\")\n append(\"D;JNE\") # ...\n append(\"@0\")\n append(\"D=A-1\")\n append(\"@SP\")\n append(\"A=M\")\n append(\"M=D\")\n increment_stack_pointer \n end", "title": "" }, { "docid": "97fb68122451cdb3f67e31de4ba9d6d3", "score": "0.5692079", "text": "def equal\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=M\")\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=D-M\")\n append(\"M=0\") # set to not equal by default: `false`, i.e., 0000000000000000\n append(\"@#{line_count + 7}\")\n append(\"D;JNE\") # ...\n append(\"@0\")\n append(\"D=A-1\")\n append(\"@SP\")\n append(\"A=M\")\n append(\"M=D\")\n increment_stack_pointer \n end", "title": "" }, { "docid": "e36de80030a7c6a2061aaf1fdfec6cf2", "score": "0.56863207", "text": "def eq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n\n type = EQ\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 56:5: '=='\n match( \"==\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n\n end", "title": "" }, { "docid": "fc057c3d51441fe32725aabad4169b8c", "score": "0.56573045", "text": "def skip_triple_equal_on=(_arg0); end", "title": "" }, { "docid": "a4ff5c40cda0b5cb5c3a61c6575addfa", "score": "0.5620743", "text": "def ==; end", "title": "" }, { "docid": "dee9fa279c1787073e0e54357b4fccc8", "score": "0.5584314", "text": "def eql?(arg0)\n end", "title": "" }, { "docid": "dee9fa279c1787073e0e54357b4fccc8", "score": "0.5584314", "text": "def eql?(arg0)\n end", "title": "" }, { "docid": "dee9fa279c1787073e0e54357b4fccc8", "score": "0.5584314", "text": "def eql?(arg0)\n end", "title": "" }, { "docid": "dee9fa279c1787073e0e54357b4fccc8", "score": "0.5584314", "text": "def eql?(arg0)\n end", "title": "" }, { "docid": "dee9fa279c1787073e0e54357b4fccc8", "score": "0.5584314", "text": "def eql?(arg0)\n end", "title": "" }, { "docid": "5b305f111bd96cec635ec2d8854e8961", "score": "0.5577449", "text": "def eqshifts\n return [0, 1, 2]\nend", "title": "" }, { "docid": "e94f19371793882852107f5908a57612", "score": "0.5577448", "text": "def eq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 56 )\n\n type = EQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 435:6: '=='\n match( \"==\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 56 )\n\n end", "title": "" }, { "docid": "4230b760d721a30059c57162d55d9ab3", "score": "0.55587155", "text": "def ===(o); eq(o); end", "title": "" }, { "docid": "38891cf3843fc020c12e55909fb7f6a1", "score": "0.5541413", "text": "def match(x, y)\n x.eql?(y) ? 0 : 1\n end", "title": "" }, { "docid": "74e68ecdcf02c548112b8263d39a99c6", "score": "0.5541249", "text": "def equal_to(*args, &block); end", "title": "" }, { "docid": "ba5f54bad8e5e3df450c2af330a675b8", "score": "0.55316794", "text": "def equals(value); end", "title": "" }, { "docid": "4cf30716a31c8d35ccfeaad23c76ffee", "score": "0.5521162", "text": "def ==(v); equal?(v); end", "title": "" }, { "docid": "cb37fc7b2af5c2207047c2292d4ec20b", "score": "0.5513509", "text": "def equal\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=M\")\n decrement_stack_pointer\n append(\"A=M\")\n append(\"D=D-M\")\n append(\"M=0\") # set to not equal by default: `false`, i.e., 0000000000000000\n append(\"@#{@line_count + 7}\")\n append(\"D;JNE\") # ...\n append(\"@0\")\n append(\"D=A-1\")\n append(\"@SP\")\n append(\"A=M\")\n append(\"M=D\")\n increment_stack_pointer\n end", "title": "" }, { "docid": "374aa642a576ae66b2a41505d11b8d36", "score": "0.5511436", "text": "def test_eq_2_ints_are_same\n assert interpret('eq?(1,1)')\n end", "title": "" }, { "docid": "2abfdedc4f8fd44c43c2672ad87c4f94", "score": "0.550807", "text": "def t__81!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 59)\n\n type = T__81\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 65:9: '=='\n match(\"==\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 59)\n\n end", "title": "" }, { "docid": "4b1488bda8eb47c6c00a7825e9a5c6de", "score": "0.55059385", "text": "def ==(toi); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.54878527", "text": "def ==(r); end", "title": "" }, { "docid": "1619898975ca087c34f2126864e11672", "score": "0.5462287", "text": "def equal_to_four x\n if x == 4\n puts \"yup\"\n else\n puts \"nope\"\n end\nend", "title": "" }, { "docid": "cceacf25fbd7fd0e474fd44d29e7d4c4", "score": "0.54587597", "text": "def equality\n expr = comparison\n\n while match(:BANG_EQUAL, :EQUAL_EQUAL)\n operator = previous\n right = comparison\n expr = Expression::Binary.new(expr, operator, right)\n end\n\n expr\n end", "title": "" }, { "docid": "8654ba85b01e0ae4a21664581ca6d4d1", "score": "0.5448945", "text": "def magic3(a)\n a[0]+a[4]+a[8]==S && a[2]+a[4]+a[6]==S &&\n a[0]+a[1]+a[2]==S && a[3]+a[4]+a[5]==S && a[6]+a[7]+a[8]==S &&\n a[0]+a[3]+a[6]==S && a[1]+a[4]+a[7]==S && a[2]+a[5]+a[8]==S\nend", "title": "" }, { "docid": "22e51317a2cb2a86428dc356a38e8073", "score": "0.54466444", "text": "def ===(x)\n return @fields[0] == x || @fields[3] == x\n end", "title": "" }, { "docid": "ef93adf70eb8440298a47df62f311017", "score": "0.5415202", "text": "def equals(modes:, arguments:)\n term1 = read(address: arguments[0], mode: modes[0])\n term2 = read(address: arguments[1], mode: modes[1])\n result_address = write(address: arguments[2], mode: modes[2])\n\n @memory[result_address] = term1 == term2 ? 1 : 0\n @pointer += 4\n end", "title": "" }, { "docid": "ef93adf70eb8440298a47df62f311017", "score": "0.5415202", "text": "def equals(modes:, arguments:)\n term1 = read(address: arguments[0], mode: modes[0])\n term2 = read(address: arguments[1], mode: modes[1])\n result_address = write(address: arguments[2], mode: modes[2])\n\n @memory[result_address] = term1 == term2 ? 1 : 0\n @pointer += 4\n end", "title": "" }, { "docid": "ef93adf70eb8440298a47df62f311017", "score": "0.5415202", "text": "def equals(modes:, arguments:)\n term1 = read(address: arguments[0], mode: modes[0])\n term2 = read(address: arguments[1], mode: modes[1])\n result_address = write(address: arguments[2], mode: modes[2])\n\n @memory[result_address] = term1 == term2 ? 1 : 0\n @pointer += 4\n end", "title": "" }, { "docid": "e9d3245a90e5bbb5a921e7411b05cf24", "score": "0.5388961", "text": "def ==(tti); end", "title": "" }, { "docid": "7c74e03c038269493b380d96a1cc3689", "score": "0.5387576", "text": "def compare_token(first, second)\n return false if first.blank? || second.blank? || first.bytesize != second.bytesize\n\n l = first.unpack \"C#{first.bytesize}\"\n res = 0\n second.each_byte { |byte| res |= byte ^ l.shift }\n res.zero?\n end", "title": "" }, { "docid": "d03978a2ec30971200f3b18c004c7168", "score": "0.5376093", "text": "def is_eq x\n (self.compare_with x) == 0\n end", "title": "" }, { "docid": "c774efd670b38ec6641cc4722827eabd", "score": "0.5361974", "text": "def reacts?(a, b)\n (a.ord - b.ord).abs == 32 # ?a.ord - ?A.ord == 32\nend", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.53604954", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.53604954", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.53604954", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.53604954", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.53604954", "text": "def ==\n end", "title": "" }, { "docid": "67fa051df42efb41378bc3e632dab5e5", "score": "0.53548443", "text": "def dos_equals(other)\r\n to_i/2 == other.to_i/2\r\n end", "title": "" }, { "docid": "0944c18e585ea087d356d029881f0614", "score": "0.5346189", "text": "def ===(other)\n end", "title": "" }, { "docid": "742948d59d307b6b20b82b2ee7078152", "score": "0.53435594", "text": "def ===(value); end", "title": "" }, { "docid": "2a4fb6a63d10a27a29d04db525f514ab", "score": "0.5340824", "text": "def BEQ addr, op\n branch(op) if status.zero?\n end", "title": "" }, { "docid": "34b5e9a9694350ee2a7ac52f906ff2c6", "score": "0.53381914", "text": "def identical_to(value) self.equal? value end", "title": "" }, { "docid": "6f67156f3f6c2bc1439936e2e9183f0a", "score": "0.53275913", "text": "def ct_equal(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C*\")\n r = 0\n i = -1\n\n b.each_byte { |v| r |= v ^ l[i += 1] }\n r.zero?\n end", "title": "" }, { "docid": "6f67156f3f6c2bc1439936e2e9183f0a", "score": "0.53275913", "text": "def ct_equal(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C*\")\n r = 0\n i = -1\n\n b.each_byte { |v| r |= v ^ l[i += 1] }\n r.zero?\n end", "title": "" }, { "docid": "d6d75bccbc298a2472db82dc8e6073a4", "score": "0.53246087", "text": "def ==(other); self.x == other.x and self.y == other.y; end", "title": "" }, { "docid": "d0cb25032fd2a603beeab329038b96e9", "score": "0.5321679", "text": "def checkEqir(before, after, instruction)\n\ta = instruction[1] #val\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn (after[c] == 1 && a == before[b]) || (after[c] == 0 && a != before[b])\nend", "title": "" }, { "docid": "fce1f1837d6f84175365b746daa5b54f", "score": "0.53168964", "text": "def ==(point2)\n end", "title": "" }, { "docid": "aacbcf465e2cf752cc0fc193d63575fe", "score": "0.53148746", "text": "def set?(pos)\n (rawbyte(pos / 8) & (1 << (pos % 8))).positive?\n end", "title": "" }, { "docid": "80f49316a0ac806408985748e1841a8c", "score": "0.5314326", "text": "def ==(rhs)\n\t\t@ea == rhs[0].address\n\tend", "title": "" } ]
32d98a3addb15761039864beb63caa8b
Set the ini data for the key +key+
[ { "docid": "69f6c7178bac01e9c4e883d34116cf51", "score": "0.6610282", "text": "def []=(key, value)\n raise TypeError, \"String expected\" unless key.is_a? String\n raise TypeError, \"String or Hash expected\" unless value.is_a? String or value.is_a? Hash\n \n @inihash[key] = value\n end", "title": "" } ]
[ { "docid": "68d5877b0569acf7ad54d910b87a203f", "score": "0.7259275", "text": "def _set_setting(key_name, value)\n ini = Rex::Parser::Ini.new(@config_file)\n ini.add_group(@group_name) if ini[@group_name].nil?\n ini[@group_name][key_name] = value\n ini.to_file(@config_file)\n end", "title": "" }, { "docid": "b16d3366e4f8698e88be6d911227e7e5", "score": "0.7074194", "text": "def set_value key, value\n begin\n p = @ini[@section_name]\n @dict_stack.map { |d| p = (p[d]||={}) }\n p[key] = value\n rescue NoMethodError\n raise ConfigParseError, \"sectionless parameter declaration encountered at line #{@line_number}\"\n end\n end", "title": "" }, { "docid": "ee3d68979205c916fcfe009b113fb4fa", "score": "0.6947707", "text": "def set_request_data(key, value)\n Bugsnag.configuration.set_request_data(key, value)\n end", "title": "" }, { "docid": "58e514837b0f0b80f3016074e6b9ecbb", "score": "0.67605484", "text": "def set(key)\n SETTINGS[key] = true\n end", "title": "" }, { "docid": "d37dec5acd048ec192092127a9cb46b9", "score": "0.67449474", "text": "def set_key(*args)\n\t\t\t\t@infos.set_key(*args)\n\t\t\tend", "title": "" }, { "docid": "980d9a50c489282276870725b1d181e8", "score": "0.6703099", "text": "def set key, value\n @settings[key] = value\n end", "title": "" }, { "docid": "980d9a50c489282276870725b1d181e8", "score": "0.6703099", "text": "def set key, value\n @settings[key] = value\n end", "title": "" }, { "docid": "980d9a50c489282276870725b1d181e8", "score": "0.6703099", "text": "def set key, value\n @settings[key] = value\n end", "title": "" }, { "docid": "1020820b3d04ee752ed414ac753cf257", "score": "0.6696218", "text": "def set(key, data)\n storage.set(\"#{@prefix}:#{key}\", data)\n end", "title": "" }, { "docid": "5e576bf77d6bb7b3987a9432000bbe2e", "score": "0.6654119", "text": "def []=(key, value)\n #raise TypeError, \"String expected\" unless key.is_a? String\n key = key.to_str\n \n #raise TypeError, \"String or Hash expected\" unless value.is_a? String or value.is_a? Hash\n value = value.to_str unless Hash === value\n\n @inihash[key] = value\n end", "title": "" }, { "docid": "2b9578e9258876f83a309e19bdfa8d39", "score": "0.66394645", "text": "def []= key, value\n @data[key] = value\n save_configuration\n value\n end", "title": "" }, { "docid": "9b9bddb15039dc12563816c2b75005ab", "score": "0.65868247", "text": "def set_data(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "93f878bbf5cc76e7cf651fac8f2c5439", "score": "0.6535266", "text": "def set(key, value)\n data = YAML::parse(File.read(@name)).transform\n data[key] = value\n write(data)\n end", "title": "" }, { "docid": "f2dc3671bc939fd80a34a07ded8f54c6", "score": "0.65263504", "text": "def set_request_data(key, value); end", "title": "" }, { "docid": "a04a329b4e9b1ffe1953ca40de00abca", "score": "0.6488828", "text": "def set!(key, data)\n if alias_key = @alias[key]\n set! alias_key, data\n else\n @internal[key] = data\n end\n end", "title": "" }, { "docid": "79ca154fe10870733363623df36fa218", "score": "0.64512956", "text": "def set_key_config!( key )\n raise MissingConfigOptionError.new(\"No config entry found for key [#{key}]\") unless yaml_data && yaml_data[key].is_a?(Hash)\n @key_config = OpenStruct.new( yaml_config[key] ) # Argument HAS to be a hash\n end", "title": "" }, { "docid": "0a5d0a07be52bd841d03b727455a7a70", "score": "0.6391715", "text": "def update_config(key, new_value)\n if @data.key? key.to_sym\n @data[key.to_sym] = new_value\n else\n raise \"Could not find key '#{key}' to update in RunnerConfig.\"\n end\n end", "title": "" }, { "docid": "0a5d0a07be52bd841d03b727455a7a70", "score": "0.6391715", "text": "def update_config(key, new_value)\n if @data.key? key.to_sym\n @data[key.to_sym] = new_value\n else\n raise \"Could not find key '#{key}' to update in RunnerConfig.\"\n end\n end", "title": "" }, { "docid": "321e48726ff8d5849af2b63d2c270b26", "score": "0.6384682", "text": "def set(key, value)\n subkeys = key.split('.').reverse\n return false if subkeys.length == 0\n hash = {subkeys.shift.to_s => value}\n subkeys.each{|v|\n hash = {v.to_s => hash}\n }\n @config = @config.deep_merge(hash)\n return true\n end", "title": "" }, { "docid": "6f6fb6f2d0489b1bd21450c2cd515f15", "score": "0.63674754", "text": "def []=(key, value)\n validate_key! key\n\n @settings[key] = value\n end", "title": "" }, { "docid": "313066d3e13a9aa9b37c5a5416d871de", "score": "0.63583016", "text": "def set key, value\n # capture new value in instance\n send(\"#{key}=\", value)\n attributes.merge!(key => value)\n # and store it\n File.write UserConfig.config_path, YAML.dump(attributes)\n end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "d49a7256948ce963ae8fb80c71a6966e", "score": "0.63373137", "text": "def set(key, value); end", "title": "" }, { "docid": "c9e015a8ebaa371bdbb089ac4a1bc413", "score": "0.6318539", "text": "def set(key, value)\n ary = key.split('.')\n qualifier = ary[0..-2]\n name = ary.last\n\n _data = @data\n qualifier.each do |path|\n _data = _data[path]\n end\n _data[name] = value\n\n @dirty = true\n end", "title": "" }, { "docid": "72b39332b015ef4f47cbba820abe2133", "score": "0.63105696", "text": "def set(key, value)\n @data[key.to_s] = value\n self\n end", "title": "" }, { "docid": "40f89e0a0cbbd16647c6465d9ea49de2", "score": "0.63091445", "text": "def []= key, value\n @settings[key] = value\n end", "title": "" }, { "docid": "fd69f4d75d6e94af3cbefddfbc073aed", "score": "0.6298971", "text": "def set_request_data(key, value)\n self.request_data[key] = value\n end", "title": "" }, { "docid": "736bd6c6e7da756eb2241ab36b25c928", "score": "0.629507", "text": "def set(key, value)\n case key\n when \"id\" then @id = value\n when \"event\" then @event = value\n when \"data\" then append_data(value)\n end\n end", "title": "" }, { "docid": "67da943f33f34f511f65ec77c917952a", "score": "0.62892234", "text": "def set(key, value, **options); end", "title": "" }, { "docid": "12fed78890ff9e1e28c3583be2063350", "score": "0.6288681", "text": "def set(key, value)\n subkeys = key.split('.').reverse\n return false if subkeys.length == 0\n hash = {subkeys.shift.to_s => value}\n subkeys.each{|v|\n hash = {v.to_s => hash}\n }\n @config = @config.recursive_merge(hash)\n return true\n end", "title": "" }, { "docid": "1031a7e41016457d905cd6665dd5b117", "score": "0.6281906", "text": "def set(key, value)\n settings[key] = value\n end", "title": "" }, { "docid": "acadca89140f6dc6b2b6f30a12b1bf71", "score": "0.62798625", "text": "def set!(key, value)\n set(key, value)\n save_file\n end", "title": "" }, { "docid": "7254e60493bbf2150f79e668ead2a6a8", "score": "0.6276338", "text": "def set(key, value)\n @config[key.to_sym] = value\n end", "title": "" }, { "docid": "5bee3e283d6a213fda47a23626004e09", "score": "0.625566", "text": "def set(key, data)\n `#{store}.setItem(#{key},#{data.to_json})`\n end", "title": "" }, { "docid": "b1054e4c7f2edfbd59b9e05cc37d82be", "score": "0.6235643", "text": "def set_opt(key, value)\n @opts ||= {} # store non-data information\n @opts[key] = value\n end", "title": "" }, { "docid": "ca17d4527d86c3519c406fd750b321fd", "score": "0.6230128", "text": "def set_data(key, value)\n unless defined?(`#@native.$data`)\n `#@native.$data = {}`\n end\n `#@native.$data[key] = value`\n end", "title": "" }, { "docid": "ae469605dcae858453fca49443084cb8", "score": "0.6226757", "text": "def save_setting(key_name, value)\n ini = Rex::Parser::Ini.new(self.config_file)\n ini.add_group(self.group_name) if ini[self.group_name].nil?\n ini[self.group_name][key_name] = value\n ini.to_file(self.config_file)\n end", "title": "" }, { "docid": "c7dbfb67050ea0b4c7691c5db5b996b1", "score": "0.6204947", "text": "def set(data, keypath, value, preserve = false)\n set_keys(data, Bindl::Keypath.parse(keypath), value, preserve)\n end", "title": "" }, { "docid": "76188d78a3a1a9a8e2a48411b4ecc96c", "score": "0.62037385", "text": "def []=(key, value)\n config[key] = value\n end", "title": "" }, { "docid": "42e3ea1a1d4bc59490084fc458f76a39", "score": "0.61887646", "text": "def set(key,value)\n data[key.to_s] = value\n save\n value\n end", "title": "" }, { "docid": "19de66f079ffa1738630a2afa3946b0d", "score": "0.61770016", "text": "def set(key, value)\n opt_key = key.to_sym\n if !@opts.include?(opt_key)\n raise IndexError, \"Unknown option: #{key.to_s}\"\n end\n @opts[opt_key] = value\n end", "title": "" }, { "docid": "ff2bdad8fb6bd1baecd6f8e5efddba6a", "score": "0.6174577", "text": "def setnx(key, value); end", "title": "" }, { "docid": "ff2bdad8fb6bd1baecd6f8e5efddba6a", "score": "0.6174577", "text": "def setnx(key, value); end", "title": "" }, { "docid": "465b7374b5263346599cc9cdc0097ced", "score": "0.6173598", "text": "def set_metadata(key, value)\n if metainfo.is_a?(Hash)\n metainfo[key.to_s] = value\n else\n self.metainfo = {key.to_s => value}\n end\n end", "title": "" }, { "docid": "f8f95df5c1a4e8817ba8102643abbbf4", "score": "0.6161731", "text": "def []= key, value\n @config[key] = value\n end", "title": "" }, { "docid": "014f7099211644062a5b1b77e71281c7", "score": "0.6159959", "text": "def set!(key, value)\n @data[key.to_sym] = value\n end", "title": "" }, { "docid": "ae908674cbbda0eb224f6fbda1577c30", "score": "0.61581343", "text": "def []=(key, value)\n (@configuration ||= setup)[key] = value\n end", "title": "" }, { "docid": "9e4e1e205374b400c76a371fef56eb2d", "score": "0.61513865", "text": "def dmpSetDatafile(k,datafilename)\n @datafile[k] = datafilename ;\n end", "title": "" }, { "docid": "576510e4cea305d7785f4ae181898075", "score": "0.61479855", "text": "def []= key, value\n\t\t\twrite unless File.exist? PATH\n\t\t\tdata = YAML.load_file PATH\n\t\t\tconfigs = defaults.merge(data)\n\t\t\tconfigs[key] = value\n\t\t\tFile.open(PATH, 'w') do |fh|\n\t\t\t\tfh.puts(configs.to_yaml)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9d7defb0c9613d982de16e2b08a04027", "score": "0.6146178", "text": "def []=(key, value)\n @config[key] = value\n # automatically save to file if this has been requested.\n save unless @options[:autosave] == false\n end", "title": "" }, { "docid": "6ec1146963bb751e4e9d2f6bda759992", "score": "0.6132342", "text": "def []=(key, value)\n @settings[key] = value\n end", "title": "" }, { "docid": "c853a62d4de98719b4cae2b17555eb73", "score": "0.6130581", "text": "def []=(key, value)\r\r\n @data[key] = value\r\r\n end", "title": "" }, { "docid": "c853a62d4de98719b4cae2b17555eb73", "score": "0.6130581", "text": "def []=(key, value)\r\r\n @data[key] = value\r\r\n end", "title": "" }, { "docid": "08be68fc470172c355c9f24b3ffcbe3b", "score": "0.61182916", "text": "def []=(key, file)\n file = File.open(file.to_s) unless file.respond_to? :read\n path = @path.join key\n FileUtils.mkpath path.dirname\n File.open(path, 'wb') {|f| f << file.read}\n self[key]\n end", "title": "" }, { "docid": "ff852904f0c2b31a86116b9d3629dfa2", "score": "0.611565", "text": "def set(key, val)\n\n #::Chef::Log.info(\"#{key} = #{val}\")\n if val.is_a?(String)\n if val != \"on\" && val != \"off\"\n if !val.match(/^-?\\d+/)\n val = \"'#{val.gsub(/^'|'$/, \"\")}'\"\n end\n end\n\n elsif val.is_a?(TrueClass)\n #::Chef::Log.info(\"#{key} is true\")\n val = \"on\"\n\n elsif val.is_a?(FalseClass)\n #::Chef::Log.info(\"#{key} is false\")\n val = \"off\"\n\n else\n if !val.is_a?(Integer) && !val.is_a?(Float)\n raise ::Errno::ENOENT.new(\"Unsupported config type at key #{key}\")\n end\n end\n\n conf_line = \"#{key} = #{val}\"\n if @conf_lookup.has_key?(key)\n cb = @conf_lookup[key]\n if !cb[1].empty?\n conf_line += \" ##{cb[1]}\"\n end\n @conf_lines[cb[0]] = conf_line\n\n else\n @conf_lines << conf_line\n @conf_lookup[key] = [@conf_lines.length, \"\"]\n\n end\n\n end", "title": "" }, { "docid": "d04338d62f17471eb952d5d71b5bcac5", "score": "0.6111005", "text": "def set key, value\n run_method(:set, key, value)\n end", "title": "" }, { "docid": "1ac4523a5e41da891d1e697251e02966", "score": "0.6102956", "text": "def set(key, value)\n f = File.open(get_path(key), 'w')\n Marshal.dump(value, f)\n f.close\n end", "title": "" }, { "docid": "08c4172bfb07b1b8eaa99faa7f674946", "score": "0.6102339", "text": "def setting(key)\n @config[key]\n end", "title": "" }, { "docid": "08c4172bfb07b1b8eaa99faa7f674946", "score": "0.6102339", "text": "def setting(key)\n @config[key]\n end", "title": "" }, { "docid": "bb45c44ca0566671cdbacf1f3db0e561", "score": "0.60984284", "text": "def set(key, value)\n f = File.open(get_path(key), \"w\")\n Marshal.dump(value, f)\n f.close\n end", "title": "" }, { "docid": "3a2cff107970fd6f613263f5731d2808", "score": "0.6090132", "text": "def set_config(key, value)\n request({req: 'setconfig', key: key, value: value})\n end", "title": "" }, { "docid": "33109604887f9fd9404da3f49df06767", "score": "0.60827965", "text": "def set(key, value, params = {})\n settings_write(key, params).set(key, value)\n save\n end", "title": "" }, { "docid": "abea52ea32cd8a0552cf05afb3a343e9", "score": "0.60810745", "text": "def []=(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "015758618e9b5b2daf98438564900258", "score": "0.60755694", "text": "def set(cmd)\n arr = cmd.split\n if arr.size != 3\n puts \"Wrong number of arguments\"\n return\n end\n cmd, key, value = arr\n SysConfig.store_config(key, value)\n end", "title": "" }, { "docid": "5919a960495bbe0fe93b7721f9934485", "score": "0.60751987", "text": "def []= key, value\n\t\t\tfileval = YAML.load_file PATH\n\t\t\tconfigs = defaults.merge(fileval)\n\t\t\tconfigs[key] = value\n\t\t\tFile.open(PATH, 'w') do |fh|\n\t\t\t\tfh.puts(configs.to_yaml)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "a1d6e15936ea476909445931c0607c2e", "score": "0.6073463", "text": "def method_missing(key, *args)\n text = key.to_s\n\n if text[-1,1] == \"=\"\n self[text.chop.to_sym] = args[0]\n else\n raise \"undefined attachment configuration option: #{key}\" unless self.has_key?(key)\n self[key]\n end\n end", "title": "" }, { "docid": "7a9f7ec185ce218a42ed0925cdd20b52", "score": "0.6070213", "text": "def []=(key, value)\r\n @data[key] = value\r\n end", "title": "" }, { "docid": "7a9f7ec185ce218a42ed0925cdd20b52", "score": "0.6070213", "text": "def []=(key, value)\r\n @data[key] = value\r\n end", "title": "" }, { "docid": "6d1c77f2fbda01ec447b143e90fbc4a0", "score": "0.60662496", "text": "def hmset(key, *attrs); end", "title": "" }, { "docid": "6d1c77f2fbda01ec447b143e90fbc4a0", "score": "0.60662496", "text": "def hmset(key, *attrs); end", "title": "" }, { "docid": "241cf32eb5a7193d5d49028a844333a1", "score": "0.60558677", "text": "def []=(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "241cf32eb5a7193d5d49028a844333a1", "score": "0.60558677", "text": "def []=(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "241cf32eb5a7193d5d49028a844333a1", "score": "0.60558677", "text": "def []=(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "2e415ef28674a785344016489e64a18a", "score": "0.6052973", "text": "def [] key\n\t\t\twrite unless File.exist? PATH\n\t\t\tdata = YAML.load_file PATH\n\t\t\tdefaults.merge(data)[key]\n\t\tend", "title": "" }, { "docid": "d5dc9509871470ef48bdcb6612da92fa", "score": "0.6046812", "text": "def []=(key,val)\n @configuration[key] = val\n end", "title": "" }, { "docid": "d5dc9509871470ef48bdcb6612da92fa", "score": "0.6046812", "text": "def []=(key,val)\n @configuration[key] = val\n end", "title": "" }, { "docid": "c43b5042c8c82e9abdc6919e8a33ec76", "score": "0.6046552", "text": "def []=(key, value)\n @metadata[key] = value\n end", "title": "" }, { "docid": "da993a32c445994ee1375cef6bd74180", "score": "0.6043091", "text": "def set(key, value)\n settings[key.to_sym] = value\n end", "title": "" }, { "docid": "da993a32c445994ee1375cef6bd74180", "score": "0.6043091", "text": "def set(key, value)\n settings[key.to_sym] = value\n end", "title": "" }, { "docid": "4669d7abdc94a4ed2eda569e880c826c", "score": "0.6041656", "text": "def _set(kv)\n case kv.first.to_sym\n when :name\n @name = kv.last\n when :value\n @value = kv.last\n when :path\n @path = kv.last\n when :domain\n @domain = kv.last\n when :expires\n @expires = Time.parse(kv.last.gsub('GMT', 'UTC'))\n when :httponly\n @httponly = true\n when :secure\n @secure = true\n end\n end", "title": "" }, { "docid": "9c22bbec522fa002e3f683d91f9529ad", "score": "0.60400015", "text": "def set(key, value)\n @connection.set key.to_s, value\n end", "title": "" }, { "docid": "651466324b92dac949eb9e71d49f4f9c", "score": "0.60395604", "text": "def configure(key,val)\n\t\t\t@configuration[key] = val\n\t\tend", "title": "" }, { "docid": "09d83317174103aca30d28340dd4ee4a", "score": "0.6033546", "text": "def setKey(key)\r\n\t\t\t\t\t@key = key\r\n\t\t\t\tend", "title": "" }, { "docid": "100351ae833d978b7424efd26bc2a107", "score": "0.60256493", "text": "def []=(key, value)\n # Let's play nice with strings and non-strings\n string_key = key.to_s\n settings = get_settings\n editor = settings.edit\n json = serialize(string_key,value)\n editor.putString(string_key, json.toString)\n editor.commit\n end", "title": "" }, { "docid": "44425bfb0a00f726a06b85df7fb2d887", "score": "0.6019834", "text": "def []=(key, value)\n @data[key] = value\n end", "title": "" }, { "docid": "f462a358e467b10d3064d53c1c16978f", "score": "0.60147554", "text": "def set(key,val)\n @content[key] = val\n end", "title": "" }, { "docid": "bc720934566431bbeb814476a9c8814c", "score": "0.60044175", "text": "def update_config(key, value)\n @config[key] = value\n end", "title": "" }, { "docid": "bc720934566431bbeb814476a9c8814c", "score": "0.60044175", "text": "def update_config(key, value)\n @config[key] = value\n end", "title": "" }, { "docid": "bf2ac17064320fe509bab4abb7ecfd79", "score": "0.60016507", "text": "def []=(key, value)\n @data[key.to_s] = value\n end", "title": "" }, { "docid": "4de1ed35ea1471a73bfe9df8c56a51e6", "score": "0.60008675", "text": "def set_attributes_from_key!(key)\n attributes_from_basename(key.to_s).each do |attribute, value|\n public_send(:\"#{ attribute }=\", value)\n end\n end", "title": "" }, { "docid": "7a14c8cf74218fd844c83509bcb3b8f2", "score": "0.60000664", "text": "def []= key, value\n config[key.to_sym] = value\n end", "title": "" }, { "docid": "7fa0e286898b06ac6dd4cc8882276816", "score": "0.59988976", "text": "def []=(key, value)\n data[key.to_s] = value\n end", "title": "" }, { "docid": "f7a50e789e314620f106b24850b303b9", "score": "0.5993671", "text": "def set(key, value)\n\t\t\t\t\tpath = \"#{@base_path}/#{key}\"\n\t\t\t\t\tstring = Marshal.dump value\n\t\t\t\t\n\t\t\t\t\tzk.set path, string\n\t\t\t\trescue ZK::Exceptions::NoNode\n\t\t\t\t\tzk.create path, string\n\t\t\t\tend", "title": "" } ]
30b6f6e5b06a13cc74d24918d721be34
es el equivalente a un metodo de clase: def self.publicados Article.where(state: "published") end Custom setter
[ { "docid": "bc298d4c2735bc0e8bcc23c92ee40127", "score": "0.0", "text": "def categories=(value)\n\t\t@categories = value\n\tend", "title": "" } ]
[ { "docid": "e4682ed7ef72785ec3e98ab2796e428b", "score": "0.66863024", "text": "def set_published_state; end", "title": "" }, { "docid": "6fafa79daff4a9b45389dda7a177bc7a", "score": "0.65139997", "text": "def set_publicacao\n @publicacao = Publicacao.find(params[:id])\n end", "title": "" }, { "docid": "742f5e5b3d9b3ce1a22ccdfa2d75c139", "score": "0.6433429", "text": "def set_publicacion\n @publicacion = Publicacion.find(params[:id])\n end", "title": "" }, { "docid": "742f5e5b3d9b3ce1a22ccdfa2d75c139", "score": "0.6433429", "text": "def set_publicacion\n @publicacion = Publicacion.find(params[:id])\n end", "title": "" }, { "docid": "742f5e5b3d9b3ce1a22ccdfa2d75c139", "score": "0.6433429", "text": "def set_publicacion\n @publicacion = Publicacion.find(params[:id])\n end", "title": "" }, { "docid": "742f5e5b3d9b3ce1a22ccdfa2d75c139", "score": "0.6433429", "text": "def set_publicacion\n @publicacion = Publicacion.find(params[:id])\n end", "title": "" }, { "docid": "bc1826142b76673b60f0c495dc7274b1", "score": "0.64256334", "text": "def set_publicacion\n @publicacion = Publicacion.find_by_id(params[:id])\n end", "title": "" }, { "docid": "11c9d11ed94ad0c5e6de35a8eb27af33", "score": "0.63554496", "text": "def set_public\n Public.all\n @public = Corporation.find(params[:id])\n end", "title": "" }, { "docid": "a7cc9ced9c0208c6da0544997f0c8e17", "score": "0.61762154", "text": "def articles_published\n @articles_published\n end", "title": "" }, { "docid": "9b25f9a90b70937c7a25bbb8e1ad1e47", "score": "0.61547726", "text": "def set_publicidad\n @publicidad = Publicidad.find(params[:id])\n end", "title": "" }, { "docid": "9b25f9a90b70937c7a25bbb8e1ad1e47", "score": "0.61547726", "text": "def set_publicidad\n @publicidad = Publicidad.find(params[:id])\n end", "title": "" }, { "docid": "f1f1ad51d24ec5c7c9884eb776e2b8a2", "score": "0.60845685", "text": "def is_public?\n return true if self.statut == \"public\"\n end", "title": "" }, { "docid": "c832e20126dde87d2339b37f6df56d9e", "score": "0.60483617", "text": "def set_publicacion\n @publicacion = Publicacion.friendly.find(params[:id])\n end", "title": "" }, { "docid": "241de861517aa149ee7e715a69e336ad", "score": "0.60356563", "text": "def set_pagos_publicidad\n @pagos_publicidad = PagosPublicidad.find(params[:id])\n end", "title": "" }, { "docid": "e1f3c3a53354af9333de2ab104d103f9", "score": "0.6034148", "text": "def publish!\n self.update_attribute(:published, true)\n end", "title": "" }, { "docid": "876f9f521687d6e4834972817d4e02d5", "score": "0.6020109", "text": "def publish\n self.published = true\n end", "title": "" }, { "docid": "1fd3dc32c4cde285fb990e9235646ff4", "score": "0.5978593", "text": "def set_publico\n @publico = Publico.find(params[:id])\n end", "title": "" }, { "docid": "862e59f7d5a1cbb104ee801a3949cd6b", "score": "0.5912893", "text": "def set_publicacion_esperada\n @publicacion_esperada = PublicacionEsperada.find(params[:id])\n end", "title": "" }, { "docid": "63f05e7160cf709c020d0c47096c0933", "score": "0.58795464", "text": "def publish!\n @new = true if self.private?\n self.status = statuses.public\n self.save!\n end", "title": "" }, { "docid": "64dc611755c8adf6ae2f0dc9b7b0d982", "score": "0.5873382", "text": "def is_public=( f )\n self.update_item_flag = ( is_public != f )\n write_attribute( :is_public, f ) if self.update_item_flag\n end", "title": "" }, { "docid": "999cfbe51278dc6e8622ee4f7a857c74", "score": "0.58055717", "text": "def published!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "f9154d4c6c74abdef3ae5b02dfeafd50", "score": "0.5795492", "text": "def published\n @pages = Page.published\n respond_with(@pages)\n end", "title": "" }, { "docid": "f5bf04d828b948e8c6b2876f171c4f92", "score": "0.5793608", "text": "def index\t#hace referencia al archivo index.html.erb en vista, articles. dada que esta es la accion que nos traera la lista de todos los articulos, se programara todo en la accion index\n\t#este seria como un SELECT * FROM articles en sql articles.all\n\t@articles = Article.paginate(page: params[:page],per_page:5).publicados.ultimos#metodo para paginar, y podemos colocarle nuestra relacion de busqueda scope\n\t#@articles = Article.publicados.ultimos #.published es una particularidad de la gema aasm y se cambio por publicados.ultimos que es un llamado del scope para realizar un orden o busquedas \n\t#@articles = Article.where(state: \"published\") #busqueda con condicion\n\t#@articles = Article.all #dado que en article.rb solo porque esta heredando de ActiveRecord::Base ya tiene los metodos con los que se accedera a la base de datos \t\n\tend", "title": "" }, { "docid": "02bc99a28537e632eda22c882ac6c681", "score": "0.5779624", "text": "def show\n @coleccion = {}\n @coleccion['publicaciones'] = @objeto.publicaciones.page(params[:page]) #.where(estado: @estado)\n end", "title": "" }, { "docid": "02bc99a28537e632eda22c882ac6c681", "score": "0.5779624", "text": "def show\n @coleccion = {}\n @coleccion['publicaciones'] = @objeto.publicaciones.page(params[:page]) #.where(estado: @estado)\n end", "title": "" }, { "docid": "88465b43d16e444a594e149c2528820e", "score": "0.5777338", "text": "def set_pedido_publico\n @pedido_publico = PedidoPublico.find(params[:id])\n end", "title": "" }, { "docid": "2015baddbac07e7c3e81fb50226ffd34", "score": "0.57408774", "text": "def published() @feed.read_attribute(:published); end", "title": "" }, { "docid": "00358a2a90bdece5bcbb5dc7288ea534", "score": "0.5716338", "text": "def publish!\n self.published = true\n save\n end", "title": "" }, { "docid": "97644044e7c574c3f15088601a13ac06", "score": "0.57", "text": "def set_publicaciones_planeadas_avance\n @publicaciones_planeadas_avance = PublicacionesPlaneadasAvance.find(params[:id])\n end", "title": "" }, { "docid": "7a3ee4e49984c05ccf4686fd7922b0b4", "score": "0.5696967", "text": "def index\n get_by_published_status(true)\n end", "title": "" }, { "docid": "0b7920dd455cb074753b5db5d3bbba86", "score": "0.5683264", "text": "def index\n\t @articles = Article.paginate(page: params[:page],per_page:5).publicados.ultimos\n\tend", "title": "" }, { "docid": "48c88e8baf7042581d4e969fbf31c194", "score": "0.56696767", "text": "def published?\n self.published\n end", "title": "" }, { "docid": "9d9eef7f0329153811eed95f4c908e33", "score": "0.5648315", "text": "def published=(new_published)\n @published = new_published\n end", "title": "" }, { "docid": "8c45f017a82192cc574c89d2a8c87245", "score": "0.56338924", "text": "def toggle_status\n self.published = !published\n self.save\n end", "title": "" }, { "docid": "95b74ccc3fcf401b277d361c5ff4fccb", "score": "0.5615629", "text": "def make_public\n update_attribute( :is_public, true )\n end", "title": "" }, { "docid": "d3cb4a8202e1e74371e1a8d12861ee31", "score": "0.559565", "text": "def index\n @publicaciones = publicaciones_scope.all\n end", "title": "" }, { "docid": "434b53384cff2ae133a490c90adf8b00", "score": "0.55656666", "text": "def set_published_at\n self.published_at ||= Time.now if status_id == STATUSES.index('published')\n end", "title": "" }, { "docid": "b37acd33929a26c01e269c89c2e1e035", "score": "0.5550961", "text": "def publico\n puts \"e aqui el metodo publico\"\n end", "title": "" }, { "docid": "48ceb76dad1cb7d75db893815ca62fef", "score": "0.55455196", "text": "def published?; end", "title": "" }, { "docid": "48ceb76dad1cb7d75db893815ca62fef", "score": "0.55455196", "text": "def published?; end", "title": "" }, { "docid": "feb425954c3c3b4595a3726c5a7d2b63", "score": "0.5541454", "text": "def index\n @publicaciones = Publicacion.all\n end", "title": "" }, { "docid": "9e5c04854d911343422b5bed7b38d28e", "score": "0.5523373", "text": "def is_published(*args)\n # set default args if none passed in\n args = [:live, :draft, :hidden] if args.blank?\n args = args.first if args.first.is_a?(Array)\n \n # the various publish states accepted.\n @publish_states = args.collect{ |state| state.to_s.downcase.to_sym }\n @publish_states_for_validation = args.collect{ |state| state.to_s.downcase }\n \n extend DataMapper::Is::Published::ClassMethods\n include DataMapper::Is::Published::InstanceMethods\n \n # do we have a :publish_status declared\n if properties.any?{ |p| p.name == :publish_status }\n \n # set default value to first value in declaration or the given value\n d = properties[:publish_status].default.blank? ? @publish_states.first.to_s : properties[:publish_status].default\n \n # set the length to 10 if missing or if shorter than 5, otherwise use the given value\n l = 5 if properties[:publish_status].length.blank?\n l = (properties[:publish_status].length <= 10 ? 10 : properties[:publish_status].length)\n \n property :publish_status, String, :length => l, :default => d.to_s\n else\n # no such property, so adding it with default values\n property :publish_status, String, :length => 10, :default => @publish_states.first.to_s \n end\n \n # create the state specific instance methods\n self.publish_states.each do |state|\n define_method(\"is_#{state}?\") do \n self.publish_status == state.to_s\n end\n define_method(\"save_as_#{state}\") do \n self.publish_status = state.to_s\n save\n end\n end\n \n # ensure we are always saving publish_status values as strings\n before :valid? do\n self.publish_status = self.publish_status.to_s if self.respond_to?(:publish_status)\n end\n \n validates_within :publish_status, \n :set => @publish_states_for_validation,\n :message => \"The publish_status value can only be one of these values: [ #{@publish_states_for_validation.join(', ')} ]\"\n \n end", "title": "" }, { "docid": "6ac03c95a17b775a9004b7acecee89b7", "score": "0.5518943", "text": "def index\n @publicacions = Publicacion.all\n end", "title": "" }, { "docid": "0e29c5867a0ef8240d8430090af20587", "score": "0.55166864", "text": "def published\n respond_with published_query(true)\n end", "title": "" }, { "docid": "9042c8e3677f8afc894bd44260fde8c5", "score": "0.55166376", "text": "def published?\n [:public, :private].include?(self.status)\n end", "title": "" }, { "docid": "53977c3be51abf45d433369ab2fd7b12", "score": "0.5511944", "text": "def index\n\t\t# Devuelve los articulos publicados\n\t\t@articles = Article.paginate(page: params[:page],per_page:9).publicados.ultimos\n\tend", "title": "" }, { "docid": "57b281edd86cc56d76d7faae0a40e23f", "score": "0.5506716", "text": "def articles=(value)\n @articles = value\n end", "title": "" }, { "docid": "49ab0722a0933ef902a8eac5128070d5", "score": "0.54904026", "text": "def published\n if self.delivery_options.publishable.present?\n meth = \"published_by_#{self.delivery_options.publishable.to_s}\"\n return self.send(meth.to_sym)\n end\n where(:published => true)\n end", "title": "" }, { "docid": "21a88f9208fdb7ca856236b44d45d744", "score": "0.5486129", "text": "def set_public_repository\n @public_repository = PublicRepository.find(params[:id])\n end", "title": "" }, { "docid": "b39195345e464d3acd5981cf97d03e35", "score": "0.5462388", "text": "def publish\n status_id = STATUSES.index('published')\n set_published_at\n end", "title": "" }, { "docid": "3bee108263e0ae5f0accee59e0ad832e", "score": "0.54616094", "text": "def unpublished; end", "title": "" }, { "docid": "ea01424216638da57a97b3f9b47ada1e", "score": "0.5457521", "text": "def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end", "title": "" }, { "docid": "656baae292ad6b5a050a3d2e119bee07", "score": "0.5453751", "text": "def public!\n self.status = Status::PUBLIC\n end", "title": "" }, { "docid": "9674bc9955274aaadcd482fd8f8fb35a", "score": "0.5453028", "text": "def set_apuntes\n\t\t\t@entry = Entry.find(params[:id])\n\t\t\t@publicacion = Publicacion.find(@entry.publicacion_id)\n\t\tend", "title": "" }, { "docid": "8e632f77b85366313839bc6786b7f227", "score": "0.54515225", "text": "def manage\n @huatis = Huati.order(\"id desc\").page(params[:page] || 1).per(100)\n if params[:published].present?\n @huatis = @huatis.where(:published=>nil)\n end\n end", "title": "" }, { "docid": "7273e1169e7e2efdfbcf6eae6a221963", "score": "0.5446922", "text": "def show\n @coleccion = {}\n @coleccion['publicaciones'] = @objeto.publicaciones.page(params[:page])\n end", "title": "" }, { "docid": "3e0bd1df5584b6ef9baa0a1360031950", "score": "0.5444979", "text": "def publish\n @page = params[:page]\n public = params[:public]\n @story = Story.find(params[:id])\n \n respond_to do |format|\n if @story.update_attribute(:public, public)\n format.html { redirect_to(\"/admin/stories?filter=\" + @story.story_set_id.to_s + \"&page=\" + @page.to_s) }\n format.xml { head :ok }\n format.json { render json: @story, status: :updated}\n format.js\n else \n format.json{ render :json=> {:success => \"false\"} }\n format.js\n end\n end\n end", "title": "" }, { "docid": "2722b1d2d8eed871d47a980b3c732214", "score": "0.54285973", "text": "def enable_for_public\n # TODO Create and write all the checks necessary for the listing to become active and public\n self.update_attribute(:active, true)\n end", "title": "" }, { "docid": "a9154e984bc4a80fe5cc2b07894d096a", "score": "0.54142505", "text": "def published_or_not\n self.published = (self.published_at <= Time.now and self.unpublished_at >= Time.now) ? 1 : 0\n end", "title": "" }, { "docid": "5aedf66595fb264109fc3814efdc5427", "score": "0.5413371", "text": "def publish\n\t\tchanged = !published?\n\t\tself.status = 'published'\n\t\tchanged\n\tend", "title": "" }, { "docid": "d2728ba7b2af71c45335c47a267827e7", "score": "0.540889", "text": "def index\n @publicacaos = Publicacao.all\n end", "title": "" }, { "docid": "d3ab11d8f8ab2a15a3b8cbde2cb51f5e", "score": "0.53742874", "text": "def publicado\n\t\t\t# Usado para mostrar el capitulo 14 - Following\n\t\t\t# Ejecuta una consulta SQL con id escapado\n\t\t#Microentrada.where(\"usuario_id = ?\", id) \n\t\t\t# siguiendo_ids = usuario.siguiendo.map(&:id)\n\t\t#Microentrada.where(\"usuario_id IN (?) OR usuario_id = ?\", siguiendo_ids, id) \n\t\t\t# Mediante el sub-select, la operacion se mantiene en la BD\n\t\tsiguiendo_ids = \"SELECT seguido_id FROM relaciones WHERE seguidor_id = :usuario_id\"\n\t\tMicroentrada.where(\"usuario_id IN (#{siguiendo_ids}) OR usuario_id = :usuario_id\", usuario_id: id)\n\t\t\t# equivalente a: \n\t\t#microentradas\n\tend", "title": "" }, { "docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed", "score": "0.5353201", "text": "def public; end", "title": "" }, { "docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed", "score": "0.5353201", "text": "def public; end", "title": "" }, { "docid": "d907acd463f2c1182e7c32a060207f06", "score": "0.53502965", "text": "def update\n #@article = current_user.articles.find(params[:id])\n authorize! :article_set_published, Article if params[:article][:published]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ae2bfd54cbb6cacae03f59212d11da7", "score": "0.534202", "text": "def published?\n self.product.try(:published?)\n end", "title": "" }, { "docid": "fa7db75f90ad64e78c58e1a8ec85606a", "score": "0.5341682", "text": "def index\n @pagos_publicidads = PagosPublicidad.all\n end", "title": "" }, { "docid": "b3856fd683f97c30d57d34ded48df055", "score": "0.5330491", "text": "def with_published(obj)\n yield if obj.published?\n end", "title": "" }, { "docid": "d4178539aec72a512877634bfdda9f3e", "score": "0.5317996", "text": "def published\n @pages = Page.published\n\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end", "title": "" }, { "docid": "b050e914ba1fe6b7534882e17bde34b4", "score": "0.531507", "text": "def publicize\n begin\n study = Study.find(params[:study_id])\n \n if study.user_id == session[:user_id] && study.active\n study.public = true\n study.save\n end\n rescue\n \n ensure\n redirect_to(manage_study_path)\n end\n end", "title": "" }, { "docid": "32eaf139727788479549b8e89fc057a2", "score": "0.5315014", "text": "def set_publish\n @publish = Publish.find(params[:id])\n end", "title": "" }, { "docid": "32eaf139727788479549b8e89fc057a2", "score": "0.5315014", "text": "def set_publish\n @publish = Publish.find(params[:id])\n end", "title": "" }, { "docid": "139259356275c9d13f118a06dbf0287f", "score": "0.5314456", "text": "def to_none\n self.public = true\n end", "title": "" }, { "docid": "7df5802b8340a2654b63006a859fbef0", "score": "0.53128153", "text": "def index\n @publicos = Publico.all\n end", "title": "" }, { "docid": "782234f2002de7d63364b031b04c871a", "score": "0.5309709", "text": "def published=(val)\n parsed = parse_datetime(val)\n @published = parsed if parsed && (!@published || parsed < @published)\n end", "title": "" }, { "docid": "b8d8a409ca8120989882bb0355ef3303", "score": "0.5298618", "text": "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n self.public_at = nil\n end\n end", "title": "" }, { "docid": "b8d8a409ca8120989882bb0355ef3303", "score": "0.5298618", "text": "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n self.public_at = nil\n end\n end", "title": "" }, { "docid": "1a12f06053b2f122562a2c35232cf5d9", "score": "0.5295658", "text": "def published?\n self.published_at.present?\n end", "title": "" }, { "docid": "2982bcb7ffa0778d7080d4fdc536af71", "score": "0.52913785", "text": "def published=(val)\n parsed = parse_datetime(val)\n @published = parsed if !@published || parsed < @published\n end", "title": "" }, { "docid": "2982bcb7ffa0778d7080d4fdc536af71", "score": "0.52913785", "text": "def published=(val)\n parsed = parse_datetime(val)\n @published = parsed if !@published || parsed < @published\n end", "title": "" }, { "docid": "9feac69fb5f213aa592ebfd547c1d033", "score": "0.5284966", "text": "def public?\n @public\n end", "title": "" }, { "docid": "a570cda195f0d82516d9ea1f87c21155", "score": "0.5284762", "text": "def is_published=(value)\n published_date = nil\n # check if value is parsable date\n begin\n published_date = Time.parse(value.to_s)\n rescue\n # otherwise evaluate value, true or false\n published_date = Time.now.beginning_of_day if value\n end\n\n self.published_on = published_date\n end", "title": "" }, { "docid": "b9109c42b1c894b21db9cb8182e24ff0", "score": "0.5272401", "text": "def articles\n @articles\n end", "title": "" }, { "docid": "e83e770c0e8f0693612e478a9fdce20d", "score": "0.5269192", "text": "def publicize\n @post = Post.find_by_slug!(params[:id])\n @post.public = true\n\n respond_to do |format|\n if @post.save\n format.js\n else\n format.js { render 'error' }\n end\n end\n end", "title": "" }, { "docid": "4631dd5540285b1db2b5d6bb374557b9", "score": "0.5268425", "text": "def publish\n self.update_attributes(status: STATUS_PUBLISHED)\n end", "title": "" }, { "docid": "c8885608a544104d3233b040e4cc7b4c", "score": "0.5265461", "text": "def private_to_public\n current_user.wikis.each do |wiki|\n wiki.update_attributes(:private => false)\n end\n end", "title": "" }, { "docid": "f093ec62f1f936aee3a5f997aea7b7dd", "score": "0.5265145", "text": "def is_public?\n self.is_public\n end", "title": "" }, { "docid": "56c6b6aa141056d4bde0fa5c00abd18d", "score": "0.5260453", "text": "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end", "title": "" }, { "docid": "56c6b6aa141056d4bde0fa5c00abd18d", "score": "0.5260453", "text": "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end", "title": "" }, { "docid": "8faf14c83ae1c9c2858d1d29c158f1f2", "score": "0.52516085", "text": "def toggle_publish\n @course.published = !@course.published\n @course.save\n end", "title": "" }, { "docid": "f7b61cd35f27354750bf534a2c6b6817", "score": "0.5250182", "text": "def become_public\n page.touch(:published_at)\n activate!\n end", "title": "" }, { "docid": "4ef98869105f4101ed02a027030a64c6", "score": "0.52384967", "text": "def set_unpublished_obituary\n @unpublished_obituary = UnpublishedObituary.find(params[:id])\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.52315027", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.52315027", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.52315027", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "fc1fdfbadea2f06b770761d203ea8ba5", "score": "0.52315027", "text": "def publish!\n self.update_attribute(:status, PUBLISHED)\n end", "title": "" }, { "docid": "db8da6685192f978b633cb3b054b613b", "score": "0.5231359", "text": "def index\n @presentations = Presentation.all.where(:publish => true)\n end", "title": "" }, { "docid": "75c6f97731702399a46b40ddc05904b3", "score": "0.52293193", "text": "def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end", "title": "" }, { "docid": "fdd5d1f0337573fe5c4dc72df53c08ad", "score": "0.5223103", "text": "def fecha_publicacion\n run_at = self.publication_date\n end", "title": "" }, { "docid": "e08c53cb5d12cbd174b03b34226e5347", "score": "0.52227753", "text": "def make_public\n self.private = false\n save\n self.collaborators.clear # remove collaborators when user is downgraded, and wiki is made public\n end", "title": "" }, { "docid": "dac7478b463d338ae38bad27d2e0e0f0", "score": "0.5222738", "text": "def updated() read_attribute_w_fallbacks( :updated, :published ); end", "title": "" } ]
2c1dc6488a6765c110307eaec6fbdc49
Reads the entries from the URL in the Import Creates a new Importer object for each entry and calls perform on it
[ { "docid": "3ac6515f33136a315e78fb98f2250826", "score": "0.6730337", "text": "def perform\n start_time = Time.now\n LOG.info \"JOB #{self.to_s}: Performing on #{@reader.to_s}\"\n import_entries\n LOG.info \"Finished importing in #{(Time.now - start_time).duration}.\"\n end", "title": "" } ]
[ { "docid": "604d811619e8044b4332d7ca05fa46ac", "score": "0.6542798", "text": "def sequential_import\n each_object_to_import do |object|\n repr = representation_class.from_api_response(object)\n\n importer_class.new(repr, project, client).execute\n end\n end", "title": "" }, { "docid": "abab906dc601678591c61ed981b59a4d", "score": "0.6456575", "text": "def import!\n download! && extract! && insert!\n ensure\n cleanup if @cleanup\n end", "title": "" }, { "docid": "4c339d75bdd67382352182d08dab7205", "score": "0.6201674", "text": "def import\n fetch\n convert\n load\n end", "title": "" }, { "docid": "e5a1ed365c55d5914dd3115b9e92c514", "score": "0.6104854", "text": "def import_work_representations\n\n # json file list\n work_representations_url = \"http://telephoneassets.satellitecollective.org/\"\n\n @data_report = \"<h2>Starting work representations import</h2>\";\n\n @data_report << \"<h3>Opening work representations URL: #{work_representations_url}</h3>\";\n work_representations_json = open(work_representations_url).read\n work_representations = JSON.parse(work_representations_json) \n \n worksList = Work.all\n worksList.each do |localWork|\n \n # Work representations\n work_representations_for_this_work = 0 \n work_representations.each do |filename| \n\n if filename.start_with?(localWork.full_orig_id)\n \n tmp_fileext = filename.split(\".\").pop.downcase.chomp\n tmp_url = work_representations_url + URI::encode(filename.chomp)\n # If the file is a markdown file, store the actual text contents instead of a URL to the work\n if tmp_fileext == \"md\"\n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: tmp_url,\n fileext: tmp_fileext,\n text_body_markdown: open(tmp_url).read\n )\n # If the file is a text file with just a URL in it, store the contents in URL\n elsif tmp_fileext == \"url\" \n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: open(tmp_url).read,\n fileext: tmp_fileext\n ) \n # Otherwise just import a URL to the work representation\n else\n localRep = WorkRepresentation.create(\n work_id: localWork.id,\n url: tmp_url,\n fileext: tmp_fileext,\n )\n end\n work_representations_for_this_work += 1\n end\n \n end # work_representations each \n\n @data_report << \"<div>Work representations added: #{work_representations_for_this_work.to_s}</div>\"\n \n end # works end \n \n end", "title": "" }, { "docid": "108bde5326568396eb0266acde145039", "score": "0.6071939", "text": "def run\n super\n\n _log_good \"Downloading latest file\"\n z = download_and_store \"http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip\"\n\n domains = []\n # unzip\n _log_good \"Extracting into memory\"\n Zip::File.open(z) do |zip_file|\n # Handle entries one by one\n zip_file.each do |entry|\n ### Do the thing\n _log_good \"Parsing out domains\"\n entry.get_input_stream.read.split(\"\\n\").map do |l|\n # Drop them into an array\n domains << l.split(\",\").last.chomp\n end\n end\n end\n\n project = @entity.project\n entity_ids = []\n\n # Create the entities\n domains.each do |domain|\n entity_ids << Intrigue::EntityManager.create_bulk_entity(project.id,\n \"Intrigue::Entity::Uri\", \"http://#{domain}\", {\"name\" => \"http://#{domain}\"}).id\n end\n\n # Now schedule enrichemnt\n entity_ids.each do |eid|\n e = Intrigue::Entity::Uri.first :id => eid\n start_task(\"task_enrichment\", project,nil, \"enrich/uri\", e, 1, [{\"name\" => \"correlate_endpoints\", \"value\" => false}]) if e\n end\n\n end", "title": "" }, { "docid": "abaddcb2f4025b9db4f43c13766bcf54", "score": "0.6069477", "text": "def import_all!\n # The recipe:\n # download the root url and search for a matching strategy\n # root_page = HTTParty.get(url)\n end", "title": "" }, { "docid": "3356b58b8e60f8d89e06368073407b32", "score": "0.6014806", "text": "def scrape\n # Set our start and end date\n start_date = ::Date.today - 7\n end_date = ::Date.today\n\n articles = []\n IMPORTERS.each do |importer_klass|\n importer = importer_klass.new(start_date, end_date)\n importer.scrape\n articles += importer.articles\n end\n articles\n end", "title": "" }, { "docid": "89e9e70b2722859d8a376b56e0ef2531", "score": "0.5976479", "text": "def member_imports\n imports = params[:imports].nil? ? [] : params[:imports]\n head :ok, format: :json if imports.empty?\n begin\n imports.each do |import|\n doc = Document.new file: Base64.decode64(import[:file])\n doc.save_or_get\n type = import[:type]&.downcase&.to_sym\n\n if type == :dv\n import = Import.create(document_id: doc.id, import_type: 'ImportJob::DV', dataset_id: params[:id], state: :pending)\n ImportJob::DV.perform_async(doc.id, {object: params[:id], import_id: import.id})\n elsif type == :topicv\n import = Import.create(document_id: doc.id, import_type: 'ImportJob::TopicV', dataset_id: params[:id], state: :pending)\n ImportJob::TopicV.perform_async(doc.id, {object: params[:id], import_id: import.id})\n end\n end\n head :ok, format: :json\n rescue => e\n render json: {message: e}, status: :bad_request\n end\n end", "title": "" }, { "docid": "6c7659e637fb0c02e5fc4d9d1bd0ca9a", "score": "0.59694016", "text": "def import_data\n data_files.each do |data_file|\n \"Freebase::Importer::#{@type.camelize}\".classify\n .constantize\n .perform_async(data_file)\n end\n end", "title": "" }, { "docid": "97998f4c7cb03ebc79dc6ddbf879614a", "score": "0.5951134", "text": "def refresh\n all_importers = Allimporters.new\n all_importer_arr = all_importers.importers\n all_importer_arr.each do |importer_klass|\n importer_klass.scrape\n end\n redirect_to '/articles'\n end", "title": "" }, { "docid": "fead6eae9a5913f7eeb3e0cd6b49bf08", "score": "0.59418607", "text": "def run(args)\n url = args[:url]\n\n if url\n import_school_file(url)\n else\n Dir.entries(Import_Dir).each do |entry|\n if File.extname(entry) == \".yml\"\n puts \"importing #{entry}...\"\n import_school_file Import_Dir + entry\n end\n end\n end\nend", "title": "" }, { "docid": "19db1fb85ab130eee9d4d5498dd16219", "score": "0.59154814", "text": "def index\n @import_results_from_urls = ImportResultsFromUrl.all\n end", "title": "" }, { "docid": "c05da6297fead48f8e50d8d9e7ebc03f", "score": "0.588122", "text": "def import\n\t\t\t\tkeywords = %w(kind:favorite src:youtube).map do |keyword|\n\t\t\t\t\tKeyword.find_or_create_by_name keyword\n\t\t\t\tend\n\n\t\t\t\tlast_updated = @@utilities.last_updated({ :service_name => \"YouTube\" })\n\n\t\t\t\tentries = []\n\t\t\t\tcurrent_offset = 0\n\t\t\t\tget_next_page = true\n\t\t\t\tper_page = 50\n\t\t\t\timport_error = false\n\n\t\t\t\tputs \" * getting favorites\"\n\t\t\t\t# xxx need to handle error situations -- HTTP errors, empty responses,\n\t\t\t\t# authentication failure, etc.\n\t\t\t\tuntil !get_next_page\n\t\t\t\t\tparams = { \"max-results\" => per_page }\n\t\t\t\t\tif current_offset > 0\n\t\t\t\t\t\tparams.merge!({ \"start-index\" => current_offset })\n\t\t\t\t\tend\n\t\t\t\t\tfavorites = api_call({ :method => \"favorites\", :params => params })\n\n\t\t\t\t\tif favorites && favorites[\"feed\"] && favorites[\"feed\"][\"entry\"] && !favorites[\"feed\"][\"entry\"].empty?\n\t\t\t\t\t\tfavorites[\"feed\"][\"entry\"].each do |item|\n\t\t\t\t\t\t\tbookmark_url = item[\"link\"].first[\"href\"].sub(\"&feature=youtube_gdata\", \"\")\n\n\t\t\t\t\t\t\tentry = Entry.where(:bookmark_url => bookmark_url).first\n\n\t\t\t\t\t\t\t# Only process/log previously-unseen items\n\t\t\t\t\t\t\tunless entry\n\t\t\t\t\t\t\t\tprint \".\"\n\t\t\t\t\t\t\t\tentry = generate_entry item\n\t\t\t\t\t\t\t\tentry.keywords = keywords\n\t\t\t\t\t\t\t\tentries << entry\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Stop pulling items when we hit an entry that's before our\n\t\t\t\t\t\t\t# most recent import.\n\t\t\t\t\t\t\t#\n\t\t\t\t\t\t\t# xxx possible problem if there's a item while the import is\n\t\t\t\t\t\t\t# running (/jordan)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tcurrent_offset += per_page\n\n\t\t\t\t\t\tsleep 1\n\t\t\t\t\telse\n\t\t\t\t\t\timport_error = true\n\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs\n\n\t\t\t\tputs \" * found #{entries.length} new items\"\n\t\t\t\t# Insert oldest-to-newest.\n\t\t\t\tentries.reverse_each { |entry| entry.save }\n\n\t\t\t\tunless import_error\n\t\t\t\t\tif last_import\n\t\t\t\t\t\tlast_import.update_attributes :timestamp => Time.now\n\t\t\t\t\telse\n\t\t\t\t\t\tLastImport.create({ :service_name => \"YouTube\",\n\t\t\t\t\t\t\t\t:timestamp => Time.now })\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "8c54962eab07a86edd0bd0878d2a4ee3", "score": "0.5878443", "text": "def fetch\n import_counter\n end", "title": "" }, { "docid": "e66abaab9cd87684eedb988309f5282d", "score": "0.58587927", "text": "def fetch_entries\n @log.info \"[#{@name}] fetching entries for\"\n DirList.new(open(@url)).entries.each do |entry|\n @entries[Gem::Version.new(parse_entry(entry))] = entry\n end\n @log.info \"[#{@name}] got #{@entries.length} entries\"\n end", "title": "" }, { "docid": "70aa6142d786cffaf2e42387e5d63d9e", "score": "0.5844289", "text": "def fetch\n urls\n .map do |url|\n parse_feed(Feedjira::Feed.fetch_and_parse(url))\n end\n .inject :+\n end", "title": "" }, { "docid": "cef41123e59768c18f8c02886c47928a", "score": "0.5832868", "text": "def import\n\n # TODO\n # Ask by which category to import (ingredient / difficulty)\n\n # category =\n\n # if category == \"1\"\n # url = \"http://www.letscookfrench.com/recipes/find-recipe.aspx?s=#{keyword}\"\n # elsif category == \"2\"\n # url = \"http://www.letscookfrench.com/recipes/find-recipe.aspx?dif=#{keyword}\"\n # else\n # puts \"Please press 1 or 2\"\n # end\n\n # Ask the user the ingredient that he/she wants\n ingredient = @view.ask_user_for_ingredient\n\n\n message = \"'#{ingredient}' recipes\"\n @view.show_scraping_message(\"Looking for\", message)\n\n # Scraping the data\n scraper = ScrapeLetsCookFrenchService.new\n data_recipes = scraper.call(ingredient)\n\n @view.show_recipes_found(data_recipes)\n\n # Ask the user the recipe to import\n index_recipe = @view.ask_user_for_index(\"import\")\n\n # TODO\n # Let the user import multiple recipes in one time\n\n # creating the recipe and adding it to the database\n recipe = data_recipes[index_recipe]\n\n message = \"'#{recipe.name}'\"\n\n @view.show_scraping_message(\"Importing\", message)\n\n # recipe = Recipe.new(attributes)\n @cookbook.add_recipe(recipe)\n end", "title": "" }, { "docid": "ce50d61da6b12e0e6f69e5a9238b9cc8", "score": "0.58034104", "text": "def import\n\t\t\t\t@client = oauth_client\n\n\t\t\t\tpost_keywords = [\"kind:status\", \"src:twitter\"].map do |keyword|\n\t\t\t\t\tKeyword.find_or_create_by_name(keyword)\n\t\t\t\tend\n\n\t\t\t\tlast_import = LastImport.first({\n\t\t\t\t\t\t:conditions => { :service_name => \"Twitter\" }})\n\t\t\t\tlast_updated = last_import ? last_import.timestamp : nil\n\n\t\t\t\t# posts\n\n\t\t\t\tentries = []\n\t\t\t\tcurrent_page = 1\n\t\t\t\tget_next_page = true\n\t\t\t\tper_page = 200\n\n\t\t\t\tputs \" * getting statuses\"\n\t\t\t\t# xxx need to handle error situations -- HTTP errors, empty responses,\n\t\t\t\t# authentication failure, etc.\n\t\t\t\tuntil !get_next_page\n\t\t\t\t\titems = api_call(:user_timeline, { :count => per_page,\n\t\t\t\t\t\t\t:page => current_page })\n\t\t\t\t\t# stop looking if the API doesn't like us\n\t\t\t\t\tif items.is_a?(Array)\n\t\t\t\t\t\tunless items.empty?\n\t\t\t\t\t\t\titems.each do |item|\n\t\t\t\t\t\t\t\tentry = Entry.first({ :conditions => {\n\t\t\t\t\t\t\t\t\t\t:bookmark_url => \"https://twitter.com/#{item[\"user\"][\"screen_name\"]}/status/#{item[\"id\"]}\" }})\n\n\t\t\t\t\t\t\t\t# Only process/log previously-unseen statuses\n\t\t\t\t\t\t\t\tunless entry\n\t\t\t\t\t\t\t\t\tprint \".\"\n\t\t\t\t\t\t\t\t\tentry = generate_entry(item)\n\t\t\t\t\t\t\t\t\tentry.keywords = post_keywords\n\t\t\t\t\t\t\t\t\tentries << entry\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t# Stop pulling items when we hit an entry that's before our\n\t\t\t\t\t\t\t\t# most recent import.\n\t\t\t\t\t\t\t\t#\n\t\t\t\t\t\t\t\t# xxx possible problem if there's a status update while the\n\t\t\t\t\t\t\t\t# import is running (/jordan)\n\t\t\t\t\t\t\t\tif last_updated && entry.created_at < last_updated\n\t\t\t\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tcurrent_page += 1\n\n\t\t\t\t\t\t\tsleep 3\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs\n\n\t\t\t\t# favorites\n\n\t\t\t\tfavorite_keywords = [\"kind:favorite\", \"src:twitter\"].map do |keyword|\n\t\t\t\t\tKeyword.find_or_create_by_name(keyword)\n\t\t\t\tend\n\n\t\t\t\tcurrent_page = 1\n\t\t\t\tget_next_page = true\n\n\t\t\t\tputs \" * getting favorites\"\n\t\t\t\t# xxx need to handle error situations -- HTTP errors, empty responses,\n\t\t\t\t# authentication failure, etc.\n\t\t\t\tuntil current_page == 4\n\t\t\t\t\titems = api_call(:favorites, { :page => current_page })\n\n\t\t\t\t\t# stop looking if the API doesn't like us\n\t\t\t\t\tif items.is_a?(Array)\n\t\t\t\t\t\tunless items.empty?\n\t\t\t\t\t\t\titems.each do |item|\n\t\t\t\t\t\t\t\tentry = Entry.first({ :conditions => {\n\t\t\t\t\t\t\t\t\t\t:bookmark_url => \"https://twitter.com/#{item[\"user\"][\"screen_name\"]}/status/#{item[\"id\"]}\" }})\n\n\t\t\t\t\t\t\t\t# Only process/log previously-unseen statuses\n\t\t\t\t\t\t\t\tunless entry\n\t\t\t\t\t\t\t\t\tprint \".\"\n\t\t\t\t\t\t\t\t\tentry = generate_entry(item)\n\t\t\t\t\t\t\t\t\tentry.keywords = favorite_keywords\n\t\t\t\t\t\t\t\t\tentries << entry\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tcurrent_page += 1\n\n\t\t\t\t\t\t\tsleep 3\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tget_next_page = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs\n\n\t\t\t\tputs \" * found #{entries.length} new items\"\n\t\t\t\t# We call the API newest-to-oldest, but it makes more sense for us to\n\t\t\t\t# write to the database oldest-to-newest.\n\t\t\t\tentries.reverse_each { |entry| entry.save }\n\n\t\t\t\tunless entries.empty?\n\t\t\t\t\tif last_import\n\t\t\t\t\t\tlast_import.update_attributes({ :timestamp => Time.now })\n\t\t\t\t\telse\n\t\t\t\t\t\tLastImport.create({ :service_name => \"Twitter\",\n\t\t\t\t\t\t\t\t:timestamp => Time.now })\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "e9b1137194e9e15bda4f68cdd97cb4d5", "score": "0.5791111", "text": "def perform\n urls = Feed.find_for_fetch(:forums) | Feed.find_for_fetch(:letter_items)\n urls.each { |url| FetchFeedJob.perform_later(url) }\n end", "title": "" }, { "docid": "d4a9e758533cc2564a1028930fc34850", "score": "0.5782272", "text": "def process_url(import_url, import_host)\n # TODO - use import_host.stale_age_duration or query_param to decide if to refresh\n listing = PropertyWebScraper::Listing.where(import_url: import_url).first_or_create\n expiry_duration = 24.seconds\n # expiry_duration = 1.minute\n # For datetime, yesterday is < today\n recent = (DateTime.now.utc - expiry_duration)\n\n listing_retrieved_recently = listing.last_retrieved_at.present? && (listing.last_retrieved_at > recent)\n\n # TODO - add specs for stale_age calculation\n if listing.last_retrieved_at.blank? || !listing_retrieved_recently\n # if listing has not been retrieved within time defined by stale age\n # retrieve from source rather than db\n retrieve_and_save listing, import_host.slug\n import_host.last_retrieval_at = DateTime.now\n import_host.save!\n end\n listing\n end", "title": "" }, { "docid": "c5d3d02e6525c6c3643724e38f301dbc", "score": "0.5776614", "text": "def import\n puts \"Fetching files from remote buckets and local directories\"\n files_to_load = FileFetcher.new(@load_config).fetch\n db_options = get_db_options(@load_config)\n FileLoader.new(db_options, files_to_load)\n Redis.new(db_options.to_h).call(\"save\")\n end", "title": "" }, { "docid": "422e03eab69cea2c3d2aceab3cfbdbc7", "score": "0.57658345", "text": "def member_imports\n imports = params[:imports].nil? ? [] : params[:imports]\n head :ok, format: :json if imports.empty?\n #\n # binding.pry\n # 1\n begin\n imports.each do |import|\n doc = Document.new(file: Base64.decode64(import[:file]), item: @object)\n doc.save_or_get\n\n type = import[:type]&.downcase&.to_sym\n import = Import.create(document_id: doc.id, import_type: @@map[type], instrument_id: params[:id], state: :pending)\n @@map[type].perform_async(doc.id, {object: params[:id], import_id: import.id})\n end\n head :ok, format: :json\n rescue => e\n render json: {message: e}, status: :bad_request\n end\n end", "title": "" }, { "docid": "8ec510c7c4f9f0931e122ccff13d575d", "score": "0.5742886", "text": "def import (feed)\n feeders.each do |records|\n report = records.import(feed)\n puts report if report && env == :development\n end\n end", "title": "" }, { "docid": "3af0930b0a31ce51f8f178fd83dabc42", "score": "0.5706206", "text": "def import\n data.each do |entry|\n # begin\n next if Book.where(title: entry['title']).where.not(domain: 'yakaboo.ua').first\n author = [book_author(entry['author'])]\n\n tags = []\n tags_arr = entry['tags']\n if tags_arr.present?\n tags_arr.each do |tag|\n tags << book_tag(tag.mb_chars.downcase.to_s)\n end\n end\n\n create_book(entry, author, tags)\n # rescue\n # end\n end\n\n true\n end", "title": "" }, { "docid": "1a3c09a558a1669badf92e5fb824c6ed", "score": "0.5675575", "text": "def fetch_entries_via(url = nil)\n fetch_page url if url\n rows = @page.body_str.split(\"\\n\").map do |line|\n process_row(line, @config.fetch('column', 0))\n end.compact\n\n rows.shift if @config.fetch('header', false)\n rows.reject(&:empty?)\n end", "title": "" }, { "docid": "e49e645af192e9f006e52a8ac98f2140", "score": "0.5660897", "text": "def import_all_the_data\n log('Starting #import_all_the_data...')\n file_import_classes = FileImporterOptions.new.prioritized_file_importer_classes(@importer_keys)\n log(\"file_import_classes = [\\n #{file_import_classes.join(\"\\n \")}\\n]\")\n timing_log = []\n\n file_import_classes.each do |file_import_class|\n file_importer = file_import_class.new(options: options_for_file_importers)\n\n timing_data = { importer: file_importer.class.name, start_time: Time.current }\n\n begin\n log(\"Starting file_importer#import for #{file_importer.class}...\")\n file_importer.import\n log(\"Done file_importer#import for #{file_importer.class}.\")\n rescue => error\n log(\"Error! #{error}\")\n log(error.backtrace)\n\n message = \"ImportTask#import_all_the_data caught an error from #{file_import_class.name} and aborted that import task, but is continuing the job...\"\n log(message)\n Rollbar.error(message, error)\n end\n\n timing_data[:end_time] = Time.current\n timing_log << timing_data\n\n @record.update(\n importer_timing_json: timing_log.to_json,\n time_ended: DateTime.current,\n )\n\n @record.save!\n end\n log('Done #import_all_the_data...')\n end", "title": "" }, { "docid": "be62341891af25bfbc983d6dbc4e87c8", "score": "0.56506884", "text": "def import\n @imports.each do |item|\n source = @sources[item['source']] || {}\n source_dir = source['path']\n source_files = item['files'] || []\n target = @targets[item['target']] || {}\n table_name = target['table']\n \n file_list = build_file_list(source_dir, source_files)\n transform = @transforms[item['transform']] || {}\n \n file_list.each do |file_name|\n columns = parse_file(file_name, source_dir, transform)\n \n create_table(target, columns)\n \n data_file_name = File.basename(file_name, '.*') + '.dat'\n data_file_path = File.full_path(@working_dir, data_file_name)\n error_file_name = File.basename(file_name, '.*') + '.err'\n error_file_path = File.full_path(@error_dir, error_file_name)\n \n bcp_file(table_name, data_file_path, error_file_path, target)\n end\n end\n end", "title": "" }, { "docid": "e09ab64f2d19f896252796818fa51dc2", "score": "0.56320304", "text": "def import_entries request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_import_entries_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "7259c90d31dc44daa435ef7dcfb90ca9", "score": "0.56299156", "text": "def import_images\n settings = self.class.import_image_from_url_settings\n if settings.any?\n for field in settings.keys\n leaf = settings[field]\n field_import_url = \"#{field}_import_url\"\n\n if self.send(field_import_url).present?\n # Normalize\n url = self.send(field_import_url)\n url = \"http://#{url}\" unless url.include?(\"http\")\n\n # Validate URL\n begin\n uri = URI.parse(url)\n rescue URI::InvalidURIError\n self.errors.add(field_import_url, \"was invalid\")\n return false\n end\n\n # Download\n io = nil\n begin\n Timeout::timeout(leaf[:timeout_seconds]) do\n io = uri.open\n end\n rescue SocketError => e\n self.errors.add(field_import_url, \"could not be retrieved: #{e}\")\n return false\n rescue OpenURI::HTTPError => e\n self.errors.add(field_import_url, \"could not be retrieved: #{e}\")\n return false\n rescue Timeout::Error => e\n self.errors.add(field_import_url, \"could not be retrieved because it timed-out after #{leaf[:timeout_seconds]} seconds\")\n return false\n end\n\n # Validate status\n unless io.status.first.to_i == 200\n self.errors.add(field_import_url, \"could not be retrieved because of HTTP error: #{io.status.first} -- #{io.status.last}\")\n return false\n end\n\n # Validate size\n if io.size == 0\n self.errors.add(field_import_url, \"could not be imported, file size is 0 bytes\")\n return false\n elsif io.size > leaf[:maximum_size]\n self.errors.add(field_import_url, \"could not be imported, size must be smaller than #{leaf[:maximum_size]} bytes, but was #{io.size} bytes\")\n return false\n end\n\n # Provide a way to get the filename from the 'open-uri' result\n def io.original_filename\n base_uri.path.split('/').last\n end\n\n # Assert thumbnail creation\n begin\n self.send(\"#{field}=\", io)\n rescue Exception => e\n self.errors.add(field_import_url, \"could not be imported, file doesn't seem to be an image -- thumbnail generation failed with: #{e}\")\n return false\n end\n end\n end\n end\n\n return true\n end", "title": "" }, { "docid": "ed28b04aee61e888b018a67082834001", "score": "0.56292355", "text": "def import_urls(filename, groupname)\n name = 'NAME'\n url = 'URL'\n group= 'GROUP'\n begin\n #puts \"filename: \" + filename\n file = RubyXL::Parser.parse('./import/' + groupname + '/' + filename + '.xlsx')\n table_site = file[0].get_table([group, name, url])\n table = table_site[:table][0..table_site[:table].size-2]\n groupname_file = table[0][group]\n #puts \"group file: \" + groupname_file\n table = table.sort_by { |element| element[name] }\n site_base = Site.where('name = ?', filename).first\n\n group_base = Group.where(name: groupname_file).first\n items_array = group_base.items.order('name')\n items_array.each do |item_base|\n #puts '----------------------'\n #puts item_base.name\n flag = false\n table.each do |hash|\n str = hash[name].gsub('Е', 'E').gsub('Н', 'H').gsub('О', 'O').gsub('Р', 'P').gsub('А', 'A').gsub('В', 'B').gsub('С', 'C').gsub('М', 'M').gsub('Т', 'T').gsub('К', 'K').gsub('Х', 'X').gsub(' ', ' ')\n if !str.nil? && str.include?(item_base.name) && !flag\n if (item_base.urls & site_base.urls).empty?\n url_base = Url.new\n url_base.url = hash[url]\n url_base.price = 0\n url_base.item = item_base\n url_base.site = site_base\n #puts url_base.site.name\n #puts url_base.url\n url_base.save ############### сохранение в базу\n else\n url_base = Url.where(item: item_base, site: site_base).first\n url_base.url = hash[url]\n url_base.price = 0\n #puts \"change:\"\n #puts url_base.url\n url_base.save ############### сохранение в базу\n end\n flag = true\n end\n end\n end\n rescue => e\n puts 'error import file: ' + filename + '|' + table.to_s\n puts e.inspect\n end\nend", "title": "" }, { "docid": "c824a06c171ec54b8501f6431f448708", "score": "0.56272835", "text": "def fetch\n AspawayImporter.fetch(@initial_path)\n end", "title": "" }, { "docid": "1f7b0a500f776471cf4e5e64eb6dde0e", "score": "0.56269807", "text": "def parse\n hydra = Typhoeus::Hydra.new(max_concurrency: 1)\n sitemap_urls = []\n @urls.each do |url|\n uri = URI(url)\n if uri.scheme && uri.scheme.start_with?(\"http\")\n request = Typhoeus::Request.new(url, followlocation: true)\n request.on_complete do |response|\n sitemap_urls.concat(on_complete(response))\n end\n hydra.queue(request)\n else\n if File.exist?(url)\n sitemap_urls.concat(extract_urls(File.read(url)))\n end\n end\n end\n loop do\n hydra.run\n break if hydra.queued_requests.empty?\n end\n sitemap_urls\n end", "title": "" }, { "docid": "a6f50f730c385bcffc564ad37e8e090f", "score": "0.5626075", "text": "def import\n #1.Ask the user for keyword\n ingredient = @view.ask_input(\"ingredient\")\n #call the service\n #2. open url\n #3. parse html\n #4.For the first five results\n #5. Create a recipe and store it in a results array\n scrape = ScrapeallrecipesService.new(ingredient)\n imported_recipes = scrape.call\n\n #6. display the results\n @view.display(imported_recipes)\n #7. ask the user which recipe to import\n selected_recipe = imported_recipes[@view.get_index]\n #8. add it to the cookbook\n @cookbook.add(selected_recipe)\n #9. display it\n list\n end", "title": "" }, { "docid": "309ce73903254ff52bf69b55c736e3b6", "score": "0.56149054", "text": "def zipreader(url)\n CSV.new(open(url), {:col_sep => \"\\t\"}).each do |row|\n l = Location.new({:country => row[ZIP_COUNTRY],\n :zip => row[ZIP_POSTAL],\n :location_name => row[ZIP_LOCATION_NAME]\n })\n l.save if Location.where('zip = ?',l.zip) == []\n end\n return \"Load attempted\"\n end", "title": "" }, { "docid": "f566dbb391493948f21844c70fa0cf1f", "score": "0.55957174", "text": "def import_all_perform(import_client)\n springboard_resources = import_client.get.body.results\n import_springboard_resources(springboard_resources)\n true\n rescue StandardError => error\n log(error, data: { msg: 'Import Last Day Error' })\n end", "title": "" }, { "docid": "17807ba35df0ffe80d985768138f04b0", "score": "0.5594686", "text": "def import_all_the_data\n log('Starting #import_all_the_data...')\n file_import_classes = UnwrapFileImporterOptions.new(@source).sort_file_import_classes\n log(\"file_import_classes = [\\n #{file_import_classes.join(\"\\n \")}\\n]\")\n timing_log = []\n\n file_import_classes.each do |file_import_class|\n file_importer = file_import_class.new(options: options_for_file_importers)\n\n timing_data = { importer: file_importer.class.name, start_time: Time.current }\n\n begin\n log(\"Starting file_importer#import for #{file_importer.class}...\")\n file_importer.import\n log(\"Done file_importer#import for #{file_importer.class}.\")\n rescue => error\n log(\"Error! #{error}\")\n log(error.backtrace)\n\n message = \"ImportTask#import_all_the_data caught an error from #{file_import_class.name} and aborted that import task, but is continuing the job...\"\n log(message)\n extra_info = { \"importer\" => file_importer.class.name }\n Rollbar.error(message, error, extra_info)\n end\n\n timing_data[:end_time] = Time.current\n timing_log << timing_data\n\n @record.update(\n importer_timing_json: timing_log.to_json,\n time_ended: DateTime.current,\n )\n\n @record.save!\n end\n log('Done #import_all_the_data...')\n end", "title": "" }, { "docid": "b734e71f70f4954e1aeb34ec25bc3af4", "score": "0.5591891", "text": "def urls\n reader_klass = FORMAT_READERS.fetch(file_format) do\n raise(ArgumentError, \"unknown format #{file_format}\")\n end\n reader_klass.new(content)\n end", "title": "" }, { "docid": "ea6b363cd6b8a6f2a6ce5e778b0a9d8d", "score": "0.55870336", "text": "def extract\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.pathname} from S3 to #{local_file}\"\n File.open(local_file, 'wb') { |file| entry.raw.get(response_target: file) }\n local_file\n end\n end", "title": "" }, { "docid": "814ae7a1f060e1c3cbf2c1fd0b61e35b", "score": "0.5582797", "text": "def run\n Importer.new(options).import\n end", "title": "" }, { "docid": "b9da5de9a16921f8f99ea55adfa9914d", "score": "0.5567325", "text": "def process_list(url)\n\n begin\n html = open(url)\n rescue Exception => ex\n #TODO make true rescue\n Log4r::Logger['main'].error \"Could not open #{url}: #{ex.message}\"\n return\n end\n \n Log4r::Logger['main'].info \"Crawl #{url}\"\n \n doc = Nokogiri::HTML(html.read)\n \n batch = GirlFriday::Batch.new(nil, :size => ARTICLE_WORKERS) do |link|\n process_article(link)\n end\n \n if @config['archive-links']['type'] == 'CSS'\n article_links = doc.css(@config['archive-links']['path'])\n elsif @config['archive-links']['type'] == 'XPath'\n article_links = doc.xpath(@config['archive-links']['path'])\n end\n\n if article_links == nil\n return \n end\n\n # get page content from each article link\n article_links.each do|l|\n batch << l\n end\n batch.results\n end", "title": "" }, { "docid": "ccaebb414d50ed50b94dfc0f654fb5b2", "score": "0.5562919", "text": "def perform(*args)\n begin\n logger.info \"Importing from the CSV\"\n `bundle exec rake parse`\n rescue\n logger.fatal \"Something is wrong with the hyper drive\"\n ensure\n # \n end\n end", "title": "" }, { "docid": "a170fe2ebd0607457aa524a72f6c35f3", "score": "0.5560708", "text": "def load_data_from(rows, sheet_definition)\n entries = []\n running_total = 0\n process_csv_row = ProcessCsvRow.new(sheet_definition)\n\n rows.data.each do |row|\n entry = SubmissionEntry.new(\n submission_file: @submission_file,\n submission: submission,\n entry_type: rows.type,\n source: {\n row: Integer(row['line_number']) + 1,\n sheet: rows.sheet_name\n },\n data: process_csv_row.process(row)\n )\n\n next if entry.data.values.map { |v| v.to_s.strip }.all?(&:blank?) # Skip empty rows\n\n entry.customer_urn = entry.data.dig(sheet_definition.export_mappings['CustomerURN'])\n entry.customer_urn = nil unless @urns.key?(entry.customer_urn)\n\n entry.total_value = entry.data.dig(sheet_definition.total_value_field)\n\n entry.validate_against!(sheet_definition)\n\n running_total += entry.total_value || 0\n entries << entry\n end\n\n if @persist\n SubmissionEntry.transaction do\n SubmissionEntry.import(entries, batch_size: 500, validate: false)\n yield running_total if block_given?\n end\n else\n File.open(\"/tmp/ingest_#{@submission_file.id}_#{rows.type}.yml\", 'w') do |f|\n f.write entries.to_yaml\n end\n end\n end", "title": "" }, { "docid": "e085fb4946926243057ff251b0dee7fc", "score": "0.55535305", "text": "def import *args, &block\n import_options = args.extract_options!\n batch_size = import_options.delete(:batch_size) || BATCH_SIZE\n\n objects = args.empty? && @target.respond_to?(import_all_method) ?\n @target.send(import_all_method) : args.flatten.compact\n\n import_objects(objects, batch_size, &block)\n end", "title": "" }, { "docid": "1f6a54dfe8be2a7dc6d81a3d4c07d13c", "score": "0.554962", "text": "def run_this_import\n return unless import_log.blank?\n\n # -- preparations\n result = {\n 'User' => user && user.name,\n 'Date' => (source_timestamp or '').to_s,\n 'Project' => sample.project.name,\n 'Sample' => \"#{sample.external_id} (#{sample.name})\",\n 'Nodes' => [],\n 'Status' => 'UNSUPPORTED'\n }\n nodes_created = 0\n predecessors = {}\n predecessors.default = []\n @name2node = {}\n @name2node.default = []\n\n # -- create new nodes\n content.each do |entry|\n log = handle_node(entry)\n result[\"Nodes\"] << log\n if log[\"IsMain\"] and log[\"Status\"] == \"Success\"\n result[\"MainNodeID\"] = log[\"Id\"]\n result[\"MainNodeExternalID\"] = log[\"ExternalID\"]\n end\n predecessors[log[\"Id\"]] += entry[\"predecessors\"]\n nodes_created += 1 if log[\"Created\"]\n end\n\n # -- create database links between the nodes in this import\n link_log = link_predecessors(predecessors)\n \n # -- compose a log for this import\n status = result[\"Nodes\"].map { |x| x[\"Status\"] }\n result[\"Status\"] = status.include?(\"Failure\") ? \"Mixed\" : \"Success\"\n result[\"Messages\"] =\n [\"Created #{pluralize nodes_created, \"data node\"}.\"] + (link_log || [])\n\n # -- set the log attribute\n self.import_log = result\n\n # -- force save to create external id on sample if missing\n self.sample.save!\n\n rescue Exception => ex\n result ||= {}\n result[\"Status\"] = 'Error'\n result[\"Messages\"] = [ex.to_s] + ex.backtrace[0,50]\n self.import_log = result\n end", "title": "" }, { "docid": "27a068d00423eb639ccafc9aa8de338a", "score": "0.5541003", "text": "def import\n\tend", "title": "" }, { "docid": "6a6af4abcca50a4f145a007c5c662e39", "score": "0.55394524", "text": "def load_entries\n @lines = IO.readlines(@filename)\n @lines.each_with_index do |line,idx|\n if entry_klass.is_entry?(line) then\n entry = entry_klass.from_line(line)\n v = { 'entry' => entry, 'line_index' => idx }\n @entries[entry.key] = v\n end\n end\n nil\n end", "title": "" }, { "docid": "764750373b1dcd3c2459150dfdcf3671", "score": "0.5533362", "text": "def import\n search_word = @view.ask_for_import\n recipes = @scraper.get_recipes(search_word)\n chosen_one = @view.pick_import(recipes)\n difficulty = @view.ask_for_difficulty\n recipe = Recipe.new(chosen_one[:title], chosen_one[:description], chosen_one[:time], difficulty)\n @cookbook.add_recipe(recipe)\n end", "title": "" }, { "docid": "c13bd4d8a02ffc8c7e3ac5e1d4f98f8e", "score": "0.5530352", "text": "def import\n\n end", "title": "" }, { "docid": "4caf1356fbf0f070585bd8f108f2d5cb", "score": "0.5519599", "text": "def fetch\n hydra = Typhoeus::Hydra.hydra\n\n share_data = sources.reduce({}) do |results, source|\n # initialize the source\n instance = source.new(url)\n # get a request\n instance.request.tap do |request|\n\n # set the oncomplete handler\n request.on_complete { |response|\n\n # parse response and add to results\n results[instance.name.downcase] = instance.parse_response(response)\n }\n\n # queue request\n hydra.queue(request)\n end\n\n results\n end\n\n hydra.run\n\n # FIXME: this code doesn't communicate resulting format well\n share_data.with_indifferent_access\n end", "title": "" }, { "docid": "b6e5ee3f5f75a4cb5d6664696f2214b2", "score": "0.5503154", "text": "def import_data\n pending_import = Import.find_by_status(Import::STATUS[:pending])\n return if pending_import.blank?\n\n Thread.new{ \n directory_name = pending_import.directory_name\n locations_in_csv = read_metadata_csv(directory_name)\n read_other_csvs(directory_name)\n import_data\n } \n end", "title": "" }, { "docid": "5e8fc5624d7ebfc88e9a06e035288952", "score": "0.5494128", "text": "def fetch\n begin\n if skipped.present? && skipped == true\n log \"#{name} is skipped\"\n return\n end\n\n timestamp = Time.now\n log \"Fetching catalogs from #{self.name} at #{timestamp.to_s}\"\n\n #loop through each entry_url\n self.entries.each do |entry_url|\n try do\n process_main_catalog(entry_url)\n end\n end\n\n log \"We have got #{@@product_count} Products in #{name}!\"\n\n log \"Finished at at #{Time.now.to_s}, duration #{(Time.now - timestamp)} seconds\"\n rescue\n log \"Something goes wrong with this website!\"\n return\n end\n\n end", "title": "" }, { "docid": "98aacb14b1ac36a4306e6371e053676e", "score": "0.548439", "text": "def create_import url\n post_request \"imports\", {url: url}\n end", "title": "" }, { "docid": "a6fe52974611222565d7f4db773defc8", "score": "0.5471273", "text": "def scrape_url_list(url_list)\r\n\t\turl_list.each do |url|\r\n\t\t\tbegin\r\n\t\t\tname = url.text().to_s.tap{|s| s.slice!(\"https://twitter.com/\")}\r\n\t\t\tscraper = TwitterScraper.new(url)\r\n\t\t\r\n\t\t\ttwitter_item = scraper.scrape_and_parse\r\n\r\n\t\t\t#the design of subverting the twitter scraper does not make sense\r\n\t\t\t\r\n\t\t\ttwitter_item.parse #make sure all mandatory fields are evaluated first\r\n\t\t\t#twitter_item.fetch_tweets\r\n\t\t\t@run_file_name = \"dataNow\"\r\n\t\t\ttwitter_item.write_to_file(name+\".xml\",@run_file_name)\r\n\t\t\t#get here = sucess\r\n\t\t\tsleep(20)\r\n\t\t\t\r\n\t\t\trescue Exception => e\r\n\t\t\t\t#log the exception\r\n\t\t\t\tputs e\r\n\t\t\tend\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "046b47f1c8349ee82cb41a8c6c604c1d", "score": "0.546871", "text": "def import\n files.each{|f| Song.new_by_filename(f)} #this will send files to the song class\n end", "title": "" }, { "docid": "6337b53dcc33ff8a9d37760c9ecb631a", "score": "0.5462657", "text": "def process_import\n JSON.parse(import_params.dig(:json)).each do |record|\n record = record.with_indifferent_access\n\n begin\n blueprint = process_blueprint(record)\n rescue ActiveRecord::RecordInvalid => invalid\n flash[:error] = \"#{record[:name]}: #{invalid.message}. #{t('admin.import_blueprint_invalid')}\"\n\n return render :import\n end\n\n process_field_blueprints(blueprint, record)\n end\n\n redirect_to admin_content_page_blueprints_path, flash: { success: t(\"admin.import_ok\", log: @log.join(\", \")) }\n end", "title": "" }, { "docid": "5e7e4b927e22ffd8ad27966851f650cf", "score": "0.54607075", "text": "def fetch_entries\n entries = []\n doc = Hpricot.XML(open(self.google_reader_feed_url))\n (doc/'entry').each do |item|\n entries << parse_entry(item)\n end\n entries.reject { |e| e.nil? }\n rescue Timeout::Error => tme\n logger.warn \"#{SERVICE_NAME}: Error fetching posts (timeout error): #{tme}\"\n []\n rescue => e\n logger.warn \"#{SERVICE_NAME}: Error fetching posts: #{e}\"\n []\n end", "title": "" }, { "docid": "873d91859cc7c978d309a65229d574a1", "score": "0.545775", "text": "def import(raw_s)\n\n s, _ = RXFReader.read(raw_s)\n\n s.strip.lines.each do |raw_url|\n\n url = raw_url.chomp\n puts 'url : ' + url.inspect if @debug\n r = @dx.find_by_url url.chomp\n\n if r then\n puts 'exists' if @debug\n else\n puts 'new URL found' if @debug\n @dx.create url: url\n end\n\n end\n\n save()\n end", "title": "" }, { "docid": "f87b9702c6cff1c064115e7d35618357", "score": "0.544962", "text": "def import_all\n @service.each do |e|\n Earthquake.where(source: e[:source], eqid: e[:eqid]).first_or_initialize.tap do |earthquake|\n break unless earthquake.new_record? || earthquake.version < e[:version]\n earthquake.update_attributes!(e)\n end\n report_progress\n end\n end", "title": "" }, { "docid": "8da3c4aee7747aee18b0380638e0dced", "score": "0.54378295", "text": "def importer; end", "title": "" }, { "docid": "0bfc1d5327f3b4955e666c0ae513a46c", "score": "0.54310316", "text": "def import\n end", "title": "" }, { "docid": "0bfc1d5327f3b4955e666c0ae513a46c", "score": "0.54310316", "text": "def import\n end", "title": "" }, { "docid": "0bfc1d5327f3b4955e666c0ae513a46c", "score": "0.54310316", "text": "def import\n end", "title": "" }, { "docid": "0bfc1d5327f3b4955e666c0ae513a46c", "score": "0.54310316", "text": "def import\n end", "title": "" }, { "docid": "7f1607bb52894a5372009db1f06de247", "score": "0.5426035", "text": "def perform_import!\n parse_file\n save_purchases\n end", "title": "" }, { "docid": "0b272b5aea265e9ad5cb9ec2e2ecf9fe", "score": "0.5421964", "text": "def import\n @@all.each do |file|\n new_song = Song.new_by_filename(file)\n new_song.artist.add_song(new_song)\n end\n @@all\n end", "title": "" }, { "docid": "e54fec95f63b850ba0be3a123fede12b", "score": "0.5411689", "text": "def import!\n begin\n fs = File.size(@path)\n if fs.to_i == 0\n @data_import.set_error_code(1005)\n @data_import.log_error(\"File contains no information, check it locally\" )\n raise \"File contains no information, check it locally\"\n elsif @remaining_quota < (0.3*fs)\n disk_quota_overspend = (File.size(@path) - @remaining_quota).to_int\n @data_import.set_error_code(8001)\n @data_import.log_error(\"#{disk_quota_overspend / 1024}KB more space is required\" )\n raise CartoDB::QuotaExceeded, \"#{disk_quota_overspend / 1024}KB more space is required\"\n end\n\n errors = Array.new\n suggested = @suggested_name.nil? ? get_valid_name(File.basename(@original_name,@ext).tr('.','_').downcase.sanitize) : @suggested_name\n\n\n # All imports start with only one file, so 'import_data' is an array of\n # on length = 1\n import_data = [{\n :ext => @ext,\n :path => @path,\n :suggested_name => suggested\n }]\n\n # A record of all file paths for cleanup\n @entries << @path\n\n # TODO: A Zip -> KMZ/Zip will fail because it wont know \n # how to go back and do the Decompressor stage again\n decompressor = decompressor_for(@ext)\n import_data = decompressor.process! if decompressor\n\n @data_import.log_update('file unzipped') if import_data\n @data_import.reload\n\n # Preprocess data and update self with results\n # preprocessors are expected to return a hash datastructure\n\n processed_imports = Array.new\n import_data.each do |data|\n @entries << data[:path]\n @working_data = data\n @working_data[:suggested_name] = get_valid_name(@working_data[:suggested_name])\n preprocessor = preprocessor_for(data.fetch(:ext))\n @data_import.refresh\n\n if preprocessor\n begin\n out = preprocessor.process!\n\n # Return raw data if preprocessor returns false\n # For example: we don't want to run JSON preprocessor\n # on GEOJSON files\n if out == false\n processed_imports << data\n else\n out.each { |d| processed_imports << d }\n @data_import.log_update('file preprocessed')\n end\n rescue\n @data_import.reload\n errors << OpenStruct.new(\n description: @data_import.get_error_text[:title],\n stack: @data_import.get_error_text[:what_about],\n code: @data_import.error_code\n )\n end\n else\n processed_imports << data\n end\n end\n\n # Load data in\n payloads = Array.new\n processed_imports.each do |data|\n @entries << data[:path]\n @working_data = data\n # re-check suggested_name in the case that it has been taken by another in this import\n @working_data[:suggested_name] = @suggested_name.nil? ? get_valid_name(@working_data[:suggested_name]) : get_valid_name(@suggested_name)\n @data_path = data[:path]\n\n loader = loader_for(data.fetch(:ext))\n\n if !loader\n puts '=============== Setting 1002 error code'\n puts data.fetch(:ext)\n @data_import.log_update(\"no importer for this type of data, #{@ext}\")\n @data_import.set_error_code(1002)\n else\n begin\n\n out = loader.process!\n\n out.each { |d| payloads << d }\n @data_import.log_update(\"#{data[:ext]} successfully loaded\")\n rescue => e\n @data_import.reload\n errors << OpenStruct.new(\n description: @data_import.get_error_text[:title],\n stack: @data_import.log_json,\n code: @data_import.error_code\n )\n end\n end\n end\n\n # Check if user is over table quota, raise the appropiate error\n @data_import.raise_error_if_over_quota payloads.length\n\n @data_import.refresh\n\n # Flag the data import as failed when no files were imported,\n # save imported table names otherwise\n if payloads.length > 0\n @data_import.tables_created_count = payloads.size\n @data_import.table_names = payloads.map(&:name).join(',')\n @data_import.log_update(\"#{payloads.size} tables imported\")\n else\n @data_import.failed\n end\n\n @data_import.save\n return [payloads, errors]\n rescue => e\n puts e\n @data_import.refresh\n drop_created_tables payloads.map(&:name)\n raise e\n ensure\n @db_connection.disconnect\n cleanup_disk\n if @import_from_file.is_a?(File) && File.file?(@import_from_file.path)\n File.unlink(@import_from_file)\n elsif @import_from_file.is_a? Tempfile\n @import_from_file.unlink\n end\n @data_import.save if @data_import\n end\n end", "title": "" }, { "docid": "fc708a97cd7c50ad800a6225afaa4e38", "score": "0.5408175", "text": "def import(filename)\n tree = JSON.load @storage.show(filename)\n\n tree.each do |key,value|\n clazz = key.constantize\n\n value.each do |itm|\n item_params = {}\n itm.each do |itm_key,itm_value|\n\n next if itm_value.nil?\n\n # handle inheritance\n if (itm_key.to_s == \"clazz\")\n clazz = itm_value.constantize\n next\n end\n\n # handle url paths separatley\n if itm_key.to_s.end_with?(\"_url\")\n if File.exist?(itm_value)\n orig_key = itm_key.to_s[0..-5].to_sym\n item_params[orig_key] = File.open(itm_value)\n else # remote\n item_params[\"remote_#{itm_key}\"] = itm_value\n end\n else\n item_params[itm_key] = itm_value\n end\n end\n clazz.new(item_params).save(validate: false)\n end\n end\n end", "title": "" }, { "docid": "8b20adb5e9879c75eb84063bf01870a8", "score": "0.53951716", "text": "def import_single(urls, options)\n # try the import\n storyparser = StoryParser.new\n begin\n if urls.size == 1\n @work = storyparser.download_and_parse_story(urls.first, options)\n else\n @work = storyparser.download_and_parse_chapters_into_story(urls, options)\n end\n rescue Timeout::Error\n setflash; flash.now[:error] = ts(\"Import has timed out. This may be due to connectivity problems with the source site. Please try again in a few minutes, or check Known Issues to see if there are import problems with this site.\")\n render :new_import and return\n rescue StoryParser::Error => exception\n setflash; flash.now[:error] = ts(\"We couldn't successfully import that work, sorry: %{message}\", :message => exception.message)\n render :new_import and return\n end\n\n unless @work && @work.save\n setflash; flash[:error] = ts(\"We were only partially able to import this work and couldn't save it. Please review below!\")\n @chapter = @work.chapters.first\n load_pseuds\n @series = current_user.series.uniq\n render :new and return\n end\n\n # Otherwise, we have a saved work, go us\n send_external_invites([@work])\n @chapter = @work.first_chapter if @work\n if @work.posted\n redirect_to work_path(@work) and return\n else\n redirect_to preview_work_path(@work) and return\n end\n end", "title": "" }, { "docid": "baab3ecfd0f67e041442c0e45179109e", "score": "0.5385217", "text": "def import\n files.each do |file|\n Song.new_by_filename(file)\nend\n\nend", "title": "" }, { "docid": "7e2138ac5320dc1a2a0677203a8e2055", "score": "0.5384426", "text": "def results\n if !@results\n # Fetch files + data\n @results = DayOne::entries.each_with_object({}){ |file, hash| hash[file] = File.read(file, external_encoding: \"UTF-8\") }\n\n search_engines = self.active_search_engines\n @results = @results.select{ |k,v| search_engines.all?{ |se| se.matches?(v) }}\n @results = @results.map{ |file,data| DayOne::EntryImporter.new(data,file).to_entry }\n end\n @results\n end", "title": "" }, { "docid": "622dfb835e024399ed1fd5df2e52a40d", "score": "0.5382985", "text": "def import\n\nend", "title": "" }, { "docid": "15827439ecfc801ba81e6dc403e02a47", "score": "0.53768224", "text": "def import\n @import\n end", "title": "" }, { "docid": "162d97b4426f672ea25c7f4450bfabcc", "score": "0.5374166", "text": "def import_from_url_with_http_info(import_from_url_input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.import_from_url ...'\n end\n # verify the required parameter 'import_from_url_input' is set\n if @api_client.config.client_side_validation && import_from_url_input.nil?\n fail ArgumentError, \"Missing the required parameter 'import_from_url_input' when calling FilesApi.import_from_url\"\n end\n # resource path\n local_var_path = '/files/v3/files/import-from-url/async'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(import_from_url_input)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ImportFromUrlTaskLocator'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"FilesApi.import_from_url\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#import_from_url\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "70da20e904f6da52f5c508d661265231", "score": "0.5370018", "text": "def call(import)\n raise 'No import model given' if import.blank?\n raise \"File #{import.filepath} does not exist\" unless File.exist?(import.filepath)\n raise \"File #{import.filepath} is not a csv file\" if import.filepath !~ /\\.csv$/\n\n CSV.foreach(import.filepath, headers: true) do |row|\n row = trim_data(row)\n\n next if row['Originating Account Number'].blank?\n\n date = row['Posting Date'].split('/')\n year = date.pop\n date = ([year] + date).flatten.join('-')\n\n if Transaction.where(\"reference = ? and date(posted_at) = ?\", row['Reference Number'], date).blank?\n Transaction.create! data(row, import)\n end\n end\n end", "title": "" }, { "docid": "8a6c3b04b45ffcc98cd723179c9d21b6", "score": "0.53695744", "text": "def scrape_all\n # define an overall article array\n @articles = []\n @importers ||= all_importers\n @importers.each do |importer|\n # pass all articles in an array and flatten them\n (@articles << importer.scrape).flatten!\n end\n # DEBUGGING\n puts \"Total articles number: #{@articles.count}\"\n @articles\n end", "title": "" }, { "docid": "4527e5c6ead3f316408a3b2e8d2f6388", "score": "0.5369064", "text": "def import_from(file)\n raise 'File not found' unless File.exist?(file)\n input = File.read(file).split(/\\n\\n/)\n input.each_with_index do |collection, index|\n extract_from(index, collection)\n end\n\n [@habits, @entries]\n end", "title": "" }, { "docid": "8e5041dcec5f54e6768037d7f2694653", "score": "0.53681546", "text": "def import_links(importer)\n importer.links.each do |link|\n website.add_link(link)\n end\n end", "title": "" }, { "docid": "75a8b7b362fb4c52a4717352edbdb498", "score": "0.5367218", "text": "def run\n super\n\n if @entity.kind_of? Entities::ParsableText\n text = @entity.text\n else #ParsableFile\n text = open(@entity.uri).read\n end\n\n # \n # This task allows you to import a file with the following format: \n #\n # { \"type\" : \"Entities::EmailAddress\", \"name\" : \"test@test.com\" }\n #\n # The format is a JSON hash of fields, with a specified type. One \n # entity / line\n #\n \n # For each line in the file, create an entity\n text.each_line do |json|\n begin\n fields = JSON.load(json)\n\n # Check to make sure a type was specified\n next unless fields['type']\n\n # Let's sanity check the type first. \n next unless Entities::Base.descendants.map{|x| x.to_s}.include?(fields['type'])\n\n # Okay, we know its a valid type, so go ahead and eval it. \n type = eval(fields['type'])\n\n # Create the entity\n create_entity type, fields\n\n rescue Exception => e\n @task_logger.error \"Encountered exception #{e}\"\n @task_logger.error \"Unable to create entity: #{type}, #{fields}\"\n \n end\n\n end\n\nend", "title": "" }, { "docid": "4a58619ffdfac00347da82dd672e4153", "score": "0.5365708", "text": "def each_object_to_import\n repo = project.import_source\n\n # We inject the page number here to make sure that all importers always\n # start where they left off. Simply starting over wouldn't work for\n # repositories with a lot of data (e.g. tens of thousands of comments).\n options = collection_options.merge(page: page_counter.current)\n\n client.each_page(collection_method, repo, options) do |page|\n # Technically it's possible that the same work is performed multiple\n # times, as Sidekiq doesn't guarantee there will ever only be one\n # instance of a job. In such a scenario it's possible for one job to\n # have a lower page number (e.g. 5) compared to another (e.g. 10). In\n # this case we skip over all the objects until we have caught up,\n # reducing the number of duplicate jobs scheduled by the provided\n # block.\n next unless page_counter.set(page.number)\n\n page.objects.each do |object|\n next if already_imported?(object)\n\n yield object\n\n # We mark the object as imported immediately so we don't end up\n # scheduling it multiple times.\n mark_as_imported(object)\n end\n end\n end", "title": "" }, { "docid": "1297f64854f27de5bc4254f074fd5a5a", "score": "0.5358944", "text": "def run\r\n if @job[:url]\r\n url = @job[:url]\r\n log \"Opening #{url} as a data page\"\r\n\r\n #get page according to URL what was setup in ats.rb\r\n @page = @agent.get(url)\r\n\r\n #parse method should be override in subclasses\r\n @data = parse(@page)\r\n else\r\n #some jobs do not have \"datapage\" URL\r\n #for example after login you're already on your very own datapage\r\n #this is to be addressed in 'parse' method of subclass\r\n @data = parse(nil)\r\n end\r\n\r\n# @configuration = Configuration.find(@job[:id])\r\n# @configuration.last_run = Date.today\r\n# @configuration.no_of_times_run = @configuration.no_of_times_ru.to_i + 1\r\n# @configuration.time_of_last_run = Time.now\r\n# @configuration.save\r\n\r\n #saves @data to where @job[:save_path] points\r\n #@data should be already a CSV string\r\n #only has meaning for CSV worker(s)\r\n #save_data if @job[:save_path]\r\n\r\n rescue Exception=>e\r\n puts \" Failed to parse URL '#{url}', exception=>\"+e.message\r\n end", "title": "" }, { "docid": "fabf5109af2bdbcce9e7fa317cc182da", "score": "0.53581095", "text": "def call(options = {})\n set_options(options)\n\n # Create import path if it doesn't exist\n FileUtils.mkdir_p(IMPORT_PATH)\n\n if @skip_download\n @file = DataImporter::File.open(ZIP_FILE_PATH)\n else\n log \"Downloading #{REMOTE_ZIP_PATH}...\"\n @file = DataImporter::File.download(REMOTE_ZIP_PATH, ZIP_FILE_PATH)\n end\n\n log \"Importing file #{ZIP_FILE_PATH}\"\n if @skip_download || file_changed?\n unless @skip_extract\n log \"Extracting files...\"\n DataImporter::File.extract(ZIP_FILE_PATH, IMPORT_PATH,\n [PEOPLE_FILE_NAME, ADDRESSES_FILE_NAME])\n end\n\n counter = 0\n log \"Loading addresses...\"\n addresses = Hash.new\n CSV.foreach(ADDRESSES_FILE_PATH, encoding: CSV_ENCODING) do |line|\n state = normalize_value(line[1])\n city = normalize_value(line[2])\n district = normalize_value(line[3])\n addresses[line[0]] = { state: state, city: city, district: district }\n end\n log \"#{addresses.size} addresses loaded into memory\"\n debug \"Addresses:\\n#{addresses.inspect}\"\n\n record_count = 0\n bulk_size = 1000\n\n if ::File.exist?(OLD_ZIP_PATH)\n new_version = Hash.new\n CSV.foreach(PEOPLE_FILE_PATH, encoding: CSV_ENCODING) do |line|\n address = addresses[line[1]]\n id = normalize_value(line[0])\n gender = normalize_value(line[2])\n name = normalize_value(line[5])\n last_name_1 = normalize_value(line[6])\n last_name_2 = normalize_value(line[7])\n new_version[id] = { id: id, address: address, gender: gender, name: name, last_name_1: last_name_1, last_name_2: last_name_2 }\n end\n\n old_version = Hash.new\n\n log \"Extracting old files\"\n FileUtils.mkdir_p(IMPORT_PATH2)\n Zip::File.open(OLD_ZIP_PATH) do |file|\n file.each do |entry|\n if entry.name == \"PADRON_COMPLETO.txt\"\n entry.extract(\"#{IMPORT_PATH2}/PADRON_COMPLETO.txt\")\n end\n end\n end\n\n ::File.rename(\"#{IMPORT_PATH2}/PADRON_COMPLETO.txt\", \"#{IMPORT_PATH2}/PADRON_COMPLETO2.txt\")\n\n log \"Comparing new data with old data and saving the differences\"\n CSV.foreach(OLD_FILE_NAME, encoding: CSV_ENCODING) do |line|\n address = addresses[line[1]]\n id = normalize_value(line[0])\n gender = normalize_value(line[2])\n name = normalize_value(line[5])\n last_name_1 = normalize_value(line[6])\n last_name_2 = normalize_value(line[7])\n old_version[id] = { id: id, address: address, gender: gender, name: name, last_name_1: last_name_1, last_name_2: last_name_2 }\n\n compare_and_update(old_version, new_version)\n\n record_count += 1\n # Print a progress report every 1000 records\n log \"#{record_count} records imported\" if (record_count % bulk_size) == 0\n end\n\n ::File.delete(OLD_FILE_NAME)\n\n else\n log \"Saving all data without comparing (there is not a .last zip file)\"\n\n threads = []\n CSV.foreach(PEOPLE_FILE_PATH, encoding: CSV_ENCODING) do |line|\n address = addresses[line[1]]\n id = normalize_value(line[0])\n gender = normalize_value(line[2])\n name = normalize_value(line[5])\n last_name_1 = normalize_value(line[6])\n last_name_2 = normalize_value(line[7])\n\n person_info = {\n id: id,\n name: name,\n last_name_1: last_name_1,\n last_name_2: last_name_2,\n gender: gender,\n state: address[:state],\n city: address[:city],\n district: address[:district]\n }\n person = Person.new(person_info)\n #debug \"Adding/updating person: #{person_info.inspect}\"\n unless @dry_run\n threads << Thread.new do\n # Force a record overwrite if it exists\n person.save(force: true)\n end\n end\n record_count += 1\n if (record_count % bulk_size) == 0\n threads.each(&:join)\n # Print a progress report every 1000 records\n log \"#{record_count} records imported\"\n threads.clear\n end\n end\n\n end\n\n log \"Updating digest file and final cleanup...\"\n update_digest_file\n cleanup_import_files\n\n log \"Import complete!\"\n else\n log \"Import file hasn't changed, nothing to do.\"\n end\n end", "title": "" }, { "docid": "84dd5a16328d05d510ce65a95013eb51", "score": "0.5348002", "text": "def main\n log_file=File.open(\"foodwine.log\", \"a+\")\n urls = File.open(\"urls\",\"r\")\n while test_url = urls.gets\n parse(test_url, log_file)\n end\n end", "title": "" }, { "docid": "c6f3df37380be693d78a6b739c8d783c", "score": "0.5345878", "text": "def import\n\n attributes_array = self.class.file_to_hashes(@import.file)\n attributes_array.each do |attributes|\n\n object = find_or_initialize_object(attributes)\n\n if object.persisted?\n attribs = self.class.prepare_nested_attributes(object, attributes)\n object.update_attributes(attribs) ? @updated_count += 1 : build_discard(object)\n else\n set_missing_attributes(object)\n object.save ? @created_count += 1 : build_discard(object)\n end\n\n after_import(object)\n\n end\n\n end", "title": "" }, { "docid": "c2741e525749101bd3dbb8110b287f36", "score": "0.53455585", "text": "def fetch!(&block)\n @results = []\n link = @url\n\n until link.nil?\n document = retrieve(link)\n results = parse(document)\n link = results[:nextpage]\n entries = results[:entries]\n\n yield entries if block_given?\n end\n @results\n end", "title": "" }, { "docid": "a0df2889e86404fc5ad2cc514d3fa474", "score": "0.53446954", "text": "def import\n self.files.collect do |file_name|\n Song.new_by_filename(file_name)\n end\n #Artist.all\n end", "title": "" }, { "docid": "3a8e0c6621649fb80e20561d1350d5fc", "score": "0.53426653", "text": "def process_filename(request)\n require 'spreadsheet'\n # pass an IO object to Spreadsheet.open\n # this works 100% of the time\n # spreadsheet = Spreadsheet.open \"#{Rails.root}/public/EJStoreLocator1updated.xls\"\n\n open \"#{Dragonfly[:refinery_resources].remote_url_for(self.attached_file.file_uid)}\" do |f|\n spreadsheet = Spreadsheet.open f\n end\n\n first_worksheet = spreadsheet.worksheet 0\n first_worksheet.each(5) do |row|\n next if row.compact.reject(&:blank?).empty? || row[0] == 'ECOMMERCE'\n location = Location.new do |l|\n l.name = row[0]\n l.address = row[1]\n l.city = row[2]\n l.state_or_province = row[3]\n l.zip = row[4]\n l.country = row[5]\n l.phone = row[6]\n l.website = row[7]\n l.online = !has_an_address(row)\n l.women = (row[8] ? true : false)\n l.handbags = (row[9] ? true : false)\n l.shoes = (row[10] ? true : false)\n l.eyewear = (row[11] ? true : false)\n l.jewelry = (row[12] ? true : false)\n l.textile = (row[13] ? true : false) \n end\n # location.save!\n end\n rescue Exception => e \n Rails.logger.error(\"Error processing import #{self.id}: #{e.message}\")\n Rails.logger.error(\"Inspected Error: #{e.inspect}\")\n end", "title": "" }, { "docid": "e6be455297702b90da0a85397d3b1008", "score": "0.53421855", "text": "def parse_import_files\n \n self.import_files = {}\n \n File.directory? @import_dir and Dir.foreach(@import_dir) do |file|\n next if (file !~ /.+\\.format$/) #skip if anything other than a format file\n \n csv_file = file.sub('.format', '.csv')\n self.import_files[csv_file] = {}\n file =~ /([^\\.]+)/ # Get filename ahead of extension\n self.import_files[csv_file][:id] = $1\n \n # Read/store format of file, which should be first 2 lines of .format file\n # variables\n # \n file_info = `head -n 2 #{@import_dir}/#{file}`\n file_info =~ /(.+)\\n(.+)/\n format = $1\n self.import_files[csv_file][:order] = $2.gsub(' ','')\n self.import_files[csv_file][:vars] = format.gsub(' ','').split(',')\n \n \n end\n \n self.import_files\n \n end", "title": "" }, { "docid": "6f39eb9c487d5c8d8cf1558f9755c66d", "score": "0.5340033", "text": "def import(client, project)\n waiters = importers(project).each_with_object({}) do |klass, hash|\n info(project.id, message: \"starting importer\", importer: klass.name)\n waiter = klass.new(project, client).execute\n hash[waiter.key] = waiter.jobs_remaining\n end\n\n AdvanceStageWorker.perform_async(\n project.id,\n waiters,\n :lfs_objects\n )\n end", "title": "" }, { "docid": "bc7fcddd3f5fdf6b7acdbb51d846a842", "score": "0.5339776", "text": "def import_places\n create_place_importer if place_importer.nil?\n\n place_importer.run\n end", "title": "" }, { "docid": "fdf22752f8b2badbe20c1ea9426e53e3", "score": "0.5338537", "text": "def batch_import\n with_error_handling do\n path = '/tmp/lark_import.csv'\n copy_csv_file(path, request)\n CSV.foreach(path, headers: true, encoding: 'ISO-8859-1') do |row|\n create_record(row.to_hash.to_json)\n end\n File.delete(path) if File.exist?(path)\n [201, response_headers, []]\n end\n end", "title": "" }, { "docid": "f6e84c749d0d95cd47110e9f75b5432d", "score": "0.533513", "text": "def load_temperatures(url, name)\n @name = name\n @url = url\n # download\n download_and_parse_json\n # basic parse into hash/arrays\n get_all_data_by_day\n # process into standard form\n standardize\n end", "title": "" }, { "docid": "22c3a9f6c92dfa6c12cdbcabac5f06e4", "score": "0.5334644", "text": "def each\r\n @input.rewind\r\n \r\n referrers = @input.read.slice(REGEXP_PAGEREFS_EXTRACT, 1).strip\r\n \r\n referrers.each_line do |line|\r\n if line =~ REGEXP_URL\r\n yield $1\r\n end\r\n end\r\n end", "title": "" }, { "docid": "91428d1a2be6a56287693b1cddc64f73", "score": "0.5332283", "text": "def import!(force_import_sections=false)\n raise Article::LastImportNotFinished if !!last_import_requested_at && loading?\n update_import_requested_at!\n full_reset_ready! # reset ready immediately without waiting for the ArticleImporter job to be processed\n import_batch.jobs { ArticleImporter.perform_once(id, force_import_sections) }\n end", "title": "" }, { "docid": "352d636531d0c7a4155ec44ab268dfdd", "score": "0.533033", "text": "def import_cities_from_file\n cities = JSON.parse File.read(\"#{PATH}/db/cities_pop.json\")\n cities.each do |city|\n import city\n end\nend", "title": "" }, { "docid": "4163766a5e5608566cf327ee857c0ed4", "score": "0.5325704", "text": "def import\n files.each do |file|\n save_remote_file_locally(file)\n begin\n convert_to_redis_commands(file) if class_exists?(file.to_class_name.to_sym)\n rescue NameError\n add_errors(\"#{file.name} is not matched by a class #{file.to_class_name} in the system.\")\n add_errors($!)\n end\n end\n\n pipeline\n end", "title": "" }, { "docid": "f5f5c51b38b1dda43462765afb36a40b", "score": "0.5321616", "text": "def load_entries\n entries.load_target unless entries.loaded?\n end", "title": "" }, { "docid": "010ba53411c428df4240c05198f7ff3b", "score": "0.5316717", "text": "def on_file_set_url_imported(event)\n Hyrax::ImportUrlFailureService.new(event[:file_set], event[:user]).call if\n event[:result] == :failure\n end", "title": "" }, { "docid": "60d7da33c35407446b448e733d074a73", "score": "0.5315522", "text": "def import(client, project)\n IMPORTERS.each do |klass|\n klass.new(project, client).execute\n end\n\n project.import_state.refresh_jid_expiration\n\n ImportPullRequestsWorker.perform_async(project.id)\n end", "title": "" }, { "docid": "34b2f06c17c43cda342749d406776d8b", "score": "0.53136224", "text": "def mandate_import_entries\n @mandate_import_entries ||= Services::MandateImportEntriesService.new(@api_service)\n end", "title": "" }, { "docid": "dde7e12335e2f8b9909854cab3cf7847", "score": "0.53109765", "text": "def import! *args\n errors = nil\n subscriber = ActiveSupport::Notifications.subscribe('import_objects.chewy') do |*args|\n errors = args.last[:errors]\n end\n import *args\n ActiveSupport::Notifications.unsubscribe(subscriber)\n raise Chewy::FailedImport.new(self, errors) if errors.present?\n true\n end", "title": "" } ]
bb3411015b81cfdbe5cd3e7a76d2c5e5
Write a method select_odds(numbers) that takes in an array of numbers and returns a new array containing the odd numbers of the original array. My solution 1) What data type I want to return ? input : nums in array output(returned vablue) : nums in array need a storage(=a new variable) to store a new output/retured value : yes iteration need? : yes Process 0 : return / a new variable Process 1 : iteration start / finish / i += 1 Process 2 : set a range while line positive <= num divided Process 3 : conditionals/methods << My solution
[ { "docid": "960e278e9c5b9d64b79a83af2b80c070", "score": "0.798954", "text": "def select_odds(numbers)\n new_arr = []\n\n i = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n new_arr << numbers[i]\n else \n end\n\n i += 1\n end\n\n return new_arr\n \nend", "title": "" } ]
[ { "docid": "d5b03e7bb68a7e9236130d61bb9bf757", "score": "0.79271936", "text": "def select_odds(numbers)\n \n i = 0\n \n new_array = []\n \n while i < numbers.length\n \n if numbers[i] % 2 != 0\n \n \tnew_array << numbers[i]\n end\n \n i += 1\n end\n return new_array\n\nend", "title": "" }, { "docid": "a26c49206d7feb252f6837d97a119e12", "score": "0.78687304", "text": "def select_odds(numbers)\n index = 0 \n \n odds = [] \n \n while index < numbers.length \n if numbers[index] % 2 != 0\n odds << numbers[index]\n end \n \n index += 1 \n end \n \n return odds \n \nend", "title": "" }, { "docid": "d7161d368b6b8070295789c92536baac", "score": "0.77876014", "text": "def select_odds(numbers)\n\tarry = []\n \ti = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n arry << numbers[i]\n end\n i += 1\n end\n return arry\nend", "title": "" }, { "docid": "dcd45f613bf826d5cc2fb82e584420c2", "score": "0.7762246", "text": "def select_odds(numbers)\n i = 0\n newArr = []\n while i < numbers.length\n if numbers[i] % 2 != 0\n newArr << numbers[i]\n end\n i += 1\n end\n return newArr\n end", "title": "" }, { "docid": "25bd65b975acafd5f6469ff2d91b26b1", "score": "0.77528304", "text": "def select_odds(numbers)\n odd_numbers = []\n \n i = 0\n while i < numbers.length\n if numbers [i] % 2 == 1\n odd_numbers << numbers [i]\n end\n \n i += 1\n end\n \n return odd_numbers\nend", "title": "" }, { "docid": "9db789f4a958b0821a82b8c4e04dd9b7", "score": "0.7658174", "text": "def select_odds(numbers)\n\tnums = []\n \n\ti = 0\n\twhile i < numbers.length\n\t\tif numbers[i] % 2 == 1\n\t\t\tnums << numbers[i]\n\t\tend\n\t\ti += 1\n end\n \n\treturn nums\nend", "title": "" }, { "docid": "c717aae39b55ad83ab236476f968fe0d", "score": "0.7650967", "text": "def select_odds(nums)\n odds = []\n\n i = 0\n while i < nums.length\n if nums[i] % 2 == 1\n odds << nums[i]\n end\n i += 1\n end\n return odds\nend", "title": "" }, { "docid": "540350e613dd757b837b0b678dcf3c30", "score": "0.76401216", "text": "def select_odds(numbers)\n odds = []\n\n i = 0\n\n while i < numbers.length\n if numbers[i] % 2 == 1\n odds << numbers[i]\n end\n i += 1\n end\n\n return odds\nend", "title": "" }, { "docid": "e7842a2b941b57a698172253127fde17", "score": "0.76313704", "text": "def select_odds(numbers)\n array = []\n i = 0\n while i < numbers.length\n \n if numbers[i] % 2 == 1\n array << numbers[i]\n end\n i += 1\n end\n return array\n end", "title": "" }, { "docid": "3e4163807e4bd1f70e16824935f55ed0", "score": "0.7596809", "text": "def select_odds(numbers)\n odds = []\n \n i = 0\n while i < numbers.length\n num = numbers[i]\n if num % 2 == 1\n odds << num\n end\n \n i += 1\n end\n \n return odds\n end", "title": "" }, { "docid": "2a2b00f0987b6ec8149651fb885781ec", "score": "0.75916266", "text": "def select_odds(numbers)\n\todds = []\n \tfor i in 0..numbers.length-1\n number = numbers[i]\n if number % 2 == 1\n odds << number\n end\n end\n return odds\nend", "title": "" }, { "docid": "55f20f3fcdd4735738527dd271d6e0e4", "score": "0.73209786", "text": "def odd_numbers(array)\n end", "title": "" }, { "docid": "4f748db49274f85abb81459309c0bb8e", "score": "0.73200077", "text": "def even_numbers(num_array)\n\n\tnum_array.select! do |num|\n\t\tnum % 2 == 0\n\tend\n\n\tnum_array\n\nend", "title": "" }, { "docid": "80b2f510d7be9ba66360c0a8ef882199", "score": "0.7312283", "text": "def odd_index_nums(array)\n array.select do |num|\n current_index = array.index(num)\n \n if current_index % 2 == 1\n num\n end\n end\nend", "title": "" }, { "docid": "cfc01e6b96c877d9892140b6e98a4697", "score": "0.7094361", "text": "def odd_integers(array)\nend", "title": "" }, { "docid": "0cc9d9bb5608ad378c2744d125c7f255", "score": "0.7033177", "text": "def select_arr(arr)\n # select and return all odd numbers from the Array variable `arr`\n arr.select(&:odd?)\nend", "title": "" }, { "docid": "7d70e4aeccacb0dc04deaa87d0031375", "score": "0.6988446", "text": "def even_num_array(numbers)\n puts \"The original array is #{numbers}\"\n\tnumbers = numbers.select {|n| n.even? } \n\tputs \"The modified array is #{numbers}\"\nend", "title": "" }, { "docid": "3b4edd7b0a99b858309815673080e3bd", "score": "0.6960139", "text": "def oddities(array)\nselected_index = []\nindex = 0\n\n\tloop do \n\tcurrent_array = array[index]\n\t\tif index.even?\n\t\t\tselected_index << current_array\n\t\tend\n\tindex += 1\n\tbreak if index == array.size\n\tend\nselected_index\n\nend", "title": "" }, { "docid": "49bf70d8ff1a1c43a6bc0c59fe4962dd", "score": "0.6957594", "text": "def no_odds( values )\n # Return only non-odd values\n @num = []\n values.each do |item|\n @num << item if item % 2 == 0\n end\n @num\nend", "title": "" }, { "docid": "7c939e2a0b030997944f18766d72caf3", "score": "0.69387007", "text": "def select_evens(array)\n output_array = []\n\n array.each do |number|\n if number % 2 == 0\n output_array << number\n end\n end\n\n return output_array\nend", "title": "" }, { "docid": "7c36e75c98af8b1d31ae79da5ab0e479", "score": "0.6928794", "text": "def separate_arr_into_even_and_odd_num(arr)\n arr.select { |e| e.even? || e == odd }\nend", "title": "" }, { "docid": "80cd0b6089f987f16e5046942aea328e", "score": "0.6917685", "text": "def double_odd_numbers(numbers)\n doubled_numbers = []\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n current_number *= 2 if current_number.odd?\n doubled_numbers << current_number\n \n\n counter += 1\n end\n\n doubled_numbers\nend", "title": "" }, { "docid": "6d81dc66784992b4a5c1e33b950a168c", "score": "0.68659246", "text": "def select_arr(arr)\n # select and return all odd numbers from the Array variable `arr`\n arr.select {|a| a % 2 != 0}\nend", "title": "" }, { "docid": "e789766b78b47950919889704ff854af", "score": "0.6853906", "text": "def all_the_odds_each\n numbers = [1,2,3,4,5]\n odds = [] #code-smell: when you look at this... you know there's a better way of doing it...\n\n numbers.each do |number| #each will always return everything in the array\n if number.odd? \n odds << number \n end\n end\n odds\nend", "title": "" }, { "docid": "3add79ca0370b6e72440d5750b7b9de4", "score": "0.68410015", "text": "def even_numbers(num_array)\n\tnum_array.select! { |num| num.even? }\nend", "title": "" }, { "docid": "bf1b1d36531444d96d20993095cc15bd", "score": "0.68378806", "text": "def evens_and_odds(arr)\r\n arr.partition{ |num| num.odd?}\r\nend", "title": "" }, { "docid": "3bd89dadae913423a67d6697d11c56b2", "score": "0.68341535", "text": "def separate_array_into_even_and_odd_numbers(array)\n even_numbers = array.select {|number|number.even?} \n odd_numbers = array.select {|number|number.odd?} \n [even_numbers, odd_numbers]\nend", "title": "" }, { "docid": "c7e90264fd355f72c72d7548bf466bf1", "score": "0.6818452", "text": "def remove_odd array\n no_odds_array = []\n array.each do |number|\n if number % 2 == 0\n no_odds_array.push(number)\n end\n end\n no_odds_array\nend", "title": "" }, { "docid": "68193ce0488dd867e762d5b72a47fbb7", "score": "0.6814258", "text": "def even_numbers(array)\n array.select{ |num| num.even? }\n\n # TODO: Return the even numbers from a list of integers.\n # You should use Enumerable#select\nend", "title": "" }, { "docid": "b6d75e86cc82b2d1c70036f8e896bf8a", "score": "0.6808819", "text": "def double_odd_numbers(numbers)\r\n doubled_numbers = []\r\n counter = 0\r\n\r\n loop do\r\n break if counter == numbers.size\r\n\r\n current_number = numbers[counter]\r\n current_number *= 2 if counter.odd?\r\n doubled_numbers << current_number\r\n\r\n counter += 1\r\n end\r\n\r\n doubled_numbers\r\nend", "title": "" }, { "docid": "b93ba2d89e69bc46d7b548270f4d220a", "score": "0.6802689", "text": "def another_example_of_even_odd(array)\n arr_evens = []\n arr_odds = []\n\n array.each { |num| num.even? ? arr_evens << num : arr_odds << num }\n p arr_evens \n p arr_odds\nend", "title": "" }, { "docid": "e108ac0950f6329de824052bc377b5e7", "score": "0.67860657", "text": "def double_odd_index(numbers)\n doubled_numbers = []\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n current_number *= 2 if counter.odd?\n doubled_numbers << current_number\n \n counter += 1\n end\n\n doubled_numbers\n\nend", "title": "" }, { "docid": "d2e78652b2c2b73c0cd97c9275f2de15", "score": "0.6785965", "text": "def oddities(int_array)\n index = 0\n odds = []\n\n while index < int_array.size\n odds.push(int_array[index])\n index += 2\n end\n odds\nend", "title": "" }, { "docid": "f631c7946352c385df48108a8c2af326", "score": "0.67769825", "text": "def oddities(arr)\r\n arr2 = arr.select do |x|\r\n arr.index(x).even?\r\n end\r\n arr2\r\nend", "title": "" }, { "docid": "7b9c2f703e4ebd697861ce7a73d71f2f", "score": "0.6772479", "text": "def square_only_odds(numbers)\n odd_array = numbers.select do |x|\n (x % 2) != 0\n end\n\n odd_array.map do |i|\n i = i**2\n end\n\nend", "title": "" }, { "docid": "7137242ac36909b0992bcc769855ffa2", "score": "0.6772114", "text": "def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend", "title": "" }, { "docid": "a2b61e4e489ff6c66ff43f68f819f3f0", "score": "0.67648137", "text": "def evil_even_numbers(array_of_numbers)\n result = []\n for number in array_of_numbers\n result.push(number) if(number % 2 == 0)\n end\n \n return result \nend", "title": "" }, { "docid": "7e84ac939ef35e5476a5e1089795d36d", "score": "0.67619354", "text": "def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend", "title": "" }, { "docid": "022806a8bbeee1052e9cbe8954d33d90", "score": "0.67504376", "text": "def separate_array_into_even_and_odd_numbers(array)\n\ta = [1, 2, 3, 4, 5, 6, 7]\n\teven = a.select { | n | n.even? }\n\todd = a.select { | n | n.odd? }\n\tn = Array.new << even << odd\nend", "title": "" }, { "docid": "f517de79d8230ec72819b39f84b24352", "score": "0.674775", "text": "def oddities(array)\n\n result = [] # empty array to push each item in the array to.\n index = 0 # creates a counter called index\n\n while index < array.size\n result << array[index] # array index is the number in the array.\n index += 2 # += 2 iterates over and returns even items.\n end\n result # again with loops put the result outside of the loop.\nend", "title": "" }, { "docid": "e2cd14f01145394f9b15aceb9cd6669d", "score": "0.6742362", "text": "def select_arr(arr)\n # select and return all odd numbers from the Array variable `arr`\n arr.select { |x| x%2!=0 }\n end", "title": "" }, { "docid": "055d95f16fa4c4c48ce31588b4e6ba80", "score": "0.6717448", "text": "def odd_numb array\n new_arr= array.select! do |value|\n value.class == Integer\n end\n new_arr.select { |value| value % 2 != 0 }.sort\nend", "title": "" }, { "docid": "b18635ef1aa4cbe84a4b59588929f68f", "score": "0.6712005", "text": "def odd_array(numbers)\n odd_value = []\n \n numbers.each_with_index do |value, idx|\n odd_value << value if idx.even?\n end\n odd_value\nend", "title": "" }, { "docid": "ad42613febc6b2f9fc5516b758e31f84", "score": "0.6711434", "text": "def separate_array_into_even_and_odd_numbers(array)\n array.partition {|x| x.even?}\nend", "title": "" }, { "docid": "5f4504228f576e417e7e55748a933ed3", "score": "0.67055064", "text": "def oddities(array)\n new_array = []\n array.each_with_index { |num, idx| new_array << num if idx.even? }\n new_array\nend", "title": "" }, { "docid": "f5da4e0ba069d70d6c70046def030066", "score": "0.6702915", "text": "def odd_range(min, max) # Define method with 2 params\n \n i = min # since we are being to ask to start with first param we set i to start at min; the first param\n new_array = [] # Create an empty array to shovel values into\n \n while i <= max # Sets condition\n \n if i % 2 != 0 # If statement that uses an expression to determine if number is NOT an even number, odd numbers will always equal 1, but you can also put not equal to 0. Logical expression\n new_array << i # Shovel not even number value screened by above condition into array\n end # End of if loop\n \n i += 1 # Increments each iteration by one\n end # End of method\n return new_array # Returns array values after end of method\n\nend", "title": "" }, { "docid": "f32e16d0e6d5492d8377756899a3bdec", "score": "0.6696258", "text": "def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend", "title": "" }, { "docid": "c372298491def44ce2e602d678990090", "score": "0.6694033", "text": "def odd_indexed_integers(array)\n\nend", "title": "" }, { "docid": "48bacd064dc2a4b659eebed68fee3a9f", "score": "0.66896766", "text": "def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend", "title": "" }, { "docid": "450dd89d25be0de180982fc1f14ab715", "score": "0.6676792", "text": "def oddities_1(array)\n array.select { |element| array.index(element) % 2 == 0 }\nend", "title": "" }, { "docid": "87997193523ea0bfaebde60a87e59f43", "score": "0.6665512", "text": "def get_even_numbers_from_array(numbers)\n even_numbers = []\n\n for number in numbers\n\n if number.even? == true\n even_numbers << number\n end\n \n end\n\n return even_numbers\nend", "title": "" }, { "docid": "9f863cef175da4e7c0e6c8e96a62b550", "score": "0.66597486", "text": "def double_odd_indices(numbers)\n counter = 0\n doubled_numbers = []\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n\n current_number *= 2 if counter.odd?\n doubled_numbers << current_number\n\n counter += 1\n end\n\n doubled_numbers\nend", "title": "" }, { "docid": "fa3b38feb30e278e86a994a43c91a682", "score": "0.66538066", "text": "def select_method(array)\r\n\r\n array.select{|number| number.odd?}\r\n\r\nend", "title": "" }, { "docid": "03fefb4d82fe88fc01dc02424a127440", "score": "0.6628105", "text": "def oddities(array)\n ret_array = []\n array.each_with_index do |value, index|\n if index.even?\n ret_array << value\n end\n end\n ret_array\nend", "title": "" }, { "docid": "eaf57154890dfd824feff908dd46bbb9", "score": "0.66275877", "text": "def oddities(arr)\n index = 0\n arr.select do |e|\n index += 1\n index.odd?\n end\nend", "title": "" }, { "docid": "cb0a8fc7c7d850bb0b530300bec09162", "score": "0.66232204", "text": "def oddities(array)\n return_array =[]\n array.each_with_index do |element, index|\n return_array << element if index.even?\n end\n return_array\nend", "title": "" }, { "docid": "694d7e015d75b2b7ac7dbbe58bfe206a", "score": "0.66196454", "text": "def oddities(array)\n odd_values = []\n index = 0\n \n while index < array.size\n odd_values << array[index]\n index += 2\n end\n odd_values\nend", "title": "" }, { "docid": "11112d5d149dab163f7bfa6ceef363b4", "score": "0.66133577", "text": "def oddNums array\n # Go through the array and select only the integers\n numArray = array.select { |value| value.is_a?(Integer) }\n # Go through the array of integers and select the ones that are odd\n oddNumArray = numArray.select { |value| value.odd? }\n # Sort the array of odd numbers in place using the bang operator\n oddNumArray.sort!\n # Implicity return the array of odd numbers, sorted from least to greatest\nend", "title": "" }, { "docid": "724fe4e6298d0bd7a614be3b2be88d92", "score": "0.6612063", "text": "def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend", "title": "" }, { "docid": "0c021347fe9dc924d907f57b16f9f1cb", "score": "0.66090256", "text": "def oddities(array)\nresult = []\narray.each_with_index do |value, idx|\n result << value if (idx + 1).odd?\nend\nresult\nend", "title": "" }, { "docid": "01ea520a18c740842ec2ee7b0b7d4fe8", "score": "0.65863335", "text": "def oddities2(arr)\n index = 0\n result = []\n loop do\n break if index >= arr.size\n result << arr[index]\n index += 2\n end\n result\nend", "title": "" }, { "docid": "9309afa8fb1a46f399b3dfd93f22dd11", "score": "0.6582803", "text": "def oddities(arr)\n # Same problem here. arr.index returns the index of the first element with that value. Do not use!\n arr.select.with_index do |elem, index|\n index % 2 == 0\n end\nend", "title": "" }, { "docid": "04079e3cf178dcef2e817ac569c21a58", "score": "0.65806603", "text": "def oddies(numerals, odd = true)\n odd ? numerals.select { |item| numerals.index(item).even? } : arr.select { |item| numerals.index(item).odd? } \nend", "title": "" }, { "docid": "5f405159be31e3f7a3501153d158c130", "score": "0.65805364", "text": "def oddities(array)\n new_array = []\n\n index = 0\n while index < array.size\n new_array << array[index] if index.even?\n index += 1\n end\n new_array\nend", "title": "" }, { "docid": "67432af046b29fe4656bd38285b8e2e4", "score": "0.6561835", "text": "def oddities(input_array)\n input_array.select.each_with_index { |_, i| i.even? } # => [2, 4, 6], [\"abc\"], [123], []\nend", "title": "" }, { "docid": "82fd8a9679a26b06067aeefbd7c6c78d", "score": "0.6553651", "text": "def no_odds( values )\n evenOnly = []\n values.each do |i|\n if i%2 == 0\n evenOnly.push(i)\n end\n end\n return evenOnly\nend", "title": "" }, { "docid": "5e24ac4002132d2c3a8180cff72746ad", "score": "0.65460885", "text": "def oddities(init_array)\n odd_bods = []\n init_array.each_with_index do |element, index|\n odd_bods << element if index.odd?\n end\n odd_bods\nend", "title": "" }, { "docid": "d1f44b9c2903aa754f6b3f8ccd8416bc", "score": "0.6544229", "text": "def even_numbers_less_than num\n array_for_even_numbers = []\n for i in 0...num\n if i % 2 == 0\n array_for_even_numbers.push(i)\n end\n end\n return array_for_even_numbers\n\nend", "title": "" }, { "docid": "b908a5c229497cc2c54251d114844b9c", "score": "0.6539047", "text": "def odd_only arr\n arr.select{|value| value % 2 != 0}\nend", "title": "" }, { "docid": "46fcc726c58b879f813de63a390513f3", "score": "0.6535129", "text": "def select_every_even array\n\n array.map!.with_index do |n, i, x| \n\n if i.even?\n puts 'i was even'\n puts x\n puts i\n puts n \n elsif i.odd?\n puts 'i was odd'\n puts x\n puts i\n puts array.slice!(i)\n end \n end\n end", "title": "" }, { "docid": "e9f3367e428d4d6181b4f4494cff63a9", "score": "0.65342027", "text": "def oddities(array)\n result = []\n index = 0\n\n while index < array.size\n result << array[index]\n index += 2\n end\n\n result\nend", "title": "" }, { "docid": "436283458640cf001b2aa2a096a1e98a", "score": "0.6531311", "text": "def oddities(arr)\n\tarr.select.with_index { |num, index| num if index.even? }\nend", "title": "" }, { "docid": "a2ed7605b9b32f053fa00423dfb04bfa", "score": "0.652765", "text": "def no_odds(arr)\n\teven_arr = []\n\tarr.each { |x| even_arr << x if x.even?}\n\treturn even_arr\nend", "title": "" }, { "docid": "adbe3a79bdb9efffb75d439ac2937ae3", "score": "0.65250343", "text": "def odd_nums_ascending (array)\n #map through array\n #create new array to hold numbers\n num_array = array.select do | num |\n num.class == Integer\n #chaining on select to see if number is odd\n end.select do | num |\n num.odd?\n #sort by ascending\n end.sort\n #return array\n num_array\nend", "title": "" }, { "docid": "144b19623e89e7f2a0a28d81a0ed2c0e", "score": "0.65250117", "text": "def return_odd(input)\n input.select do |i|\n i.odd?\n end\nend", "title": "" }, { "docid": "1546280efa166de44e15924bd4c8d46b", "score": "0.6522447", "text": "def oddities(array)\n array.select.with_index { |e, i| (i + 1).odd? }\nend", "title": "" }, { "docid": "616ea14b4dc42a763bddee524536068f", "score": "0.6519322", "text": "def oddities(array)\n new_array = []\n i = 0\n while i < array.size\n new_array << array[i]\n i += 2\n end\n new_array\nend", "title": "" }, { "docid": "c7d861cc76c8fefba44ef8f77369a5b3", "score": "0.6515322", "text": "def oddball(arr)\r\n # your code goes here\r\n evens = []\r\n odds = []\r\n\r\n arr.each do |int|\r\n\r\n if int % 2 == 0\r\n evens << int\r\n else\r\n odds << int\r\n end\r\n\r\n end\r\n if evens.length == 1\r\n return evens[0]\r\n else\r\n return odds[0]\r\n end\r\n\r\nend", "title": "" }, { "docid": "f6b94afdb5641a6ec33acb7fc2c4d5cf", "score": "0.6515244", "text": "def oddities(ary)\n new_array = []\n counter = 0\n loop do\n break if counter == ary.size\n new_array << ary[counter] if counter.even?\n counter += 1\n end\n new_array\nend", "title": "" }, { "docid": "390f6f885caf2a9e68a97d35216fe841", "score": "0.65102607", "text": "def oddities(array)\n odd_array = []\n array.each_with_index do |e, idx|\n odd_array << e if idx.even?\n end\n odd_array\nend", "title": "" }, { "docid": "cf0062a9a07849f756c542299409fef7", "score": "0.6510058", "text": "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "title": "" }, { "docid": "cf0062a9a07849f756c542299409fef7", "score": "0.65086246", "text": "def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend", "title": "" }, { "docid": "771e70a5ff4bce4e76254f861019f98a", "score": "0.65042436", "text": "def select_even_numbers(array)\n array.select{|x| x % 2 == 0}\nend", "title": "" }, { "docid": "d5a20df794eee7e45056f4a1c4746eb3", "score": "0.6503447", "text": "def odds_only array\n array.select do |value|\n value.odd?\n end\nend", "title": "" }, { "docid": "e784f08bba580a43dbe6e4b7854eade2", "score": "0.64965266", "text": "def oddities(array)\n array.select { |a| puts a if a % 2 == 0 }\nend", "title": "" }, { "docid": "dbe280675454d38177e7cb0d88f67291", "score": "0.6495566", "text": "def separate_arr_into_even_and_odd_num(arr)\n odd_array = []\n even_array = []\n odd_index = 0\n even_index = 0\n arr.each do |number|\n if number % 2 == 0\n even_array.insert(odd_index, number)\n even_index += 1\n else\n odd_array.insert(odd_index, number)\n odd_index += 1\n end\n end\n\n # remove nils\n index = 0\n for num in even_array\n if num == nil\n even_array.delete(num)\n end\n\n index += 1\n end\n\n return [even_array, odd_array]\nend", "title": "" }, { "docid": "a378806b1f9931e1ced629b496929fc4", "score": "0.64932424", "text": "def even_index_nums(array)\n counter = 0\n even_index_array = []\n \n loop do\n break if counter == array.length\n \n current_element = array[counter]\n \n if counter % 2 == 0\n even_index_array << current_element\n end\n \n counter += 1\n end \n even_index_array\nend", "title": "" }, { "docid": "3ddd5f8a81b0193aa0607c9e6d09d33c", "score": "0.6493223", "text": "def oddOrEven(arr)\n even = false\n evenCnt = 0\n for i in 0..2 do\n if arr[i] % 2 == 0 then\n evenCnt += 1\n end\n end\n\n if evenCnt > 1 then\n even = true\n for x in arr do\n if x % 2 != 0 then\n return x\n end\n end\n else\n for x in arr do\n if x % 2 == 0 then\n return x\n end\n end\n end\n\nend", "title": "" }, { "docid": "7286b7e198a8d864ce800bc702eebfe7", "score": "0.6490698", "text": "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "title": "" }, { "docid": "4bd20b8322ae45d031fe9bfb99dc6b65", "score": "0.64905936", "text": "def even_numbers_less_than num\n\t# array_of_nums = []\n\t# i = 0\n\t# while i < num\n\t# \tarray_of_nums.push(i)\n\t# \t# array_of_nums.delete_if &:odd?\n\t# \ti += 2\n\t# end\n\t# array_of_nums\n\t(0...num).select { |numbers| numbers.even? }\nend", "title": "" }, { "docid": "dd12df21309300a912731831538ada29", "score": "0.6489441", "text": "def odd_numbers(num1, num2)\n (num1..num2).select { |n| n.odd? }\nend", "title": "" }, { "docid": "91c79e4ea41e906ce90a4c371a75eea5", "score": "0.64739543", "text": "def separate_array_into_even_and_odd_numbers(array)\n #Find out if each element even or odd\n # if even, put into one array\n # if odd, put into other array\n # combine arrays\n even_array = Array.new\n odd_array = Array.new\n final_array = Array.new\n array.each{|number|\n if number.odd?\n odd_array << number\n else\n even_array << number\n end\n }\n final_array = [even_array,odd_array]\nend", "title": "" }, { "docid": "799b30ec35e40b1fb5d11c8219b87a61", "score": "0.6473107", "text": "def oddities(array)\n new_array = []\n array.each_with_index do |element, index|\n new_array.push(element) if (index + 1).odd?\n end\n new_array\nend", "title": "" }, { "docid": "e364e2159dcf3c2831a5f1ac2da18b9a", "score": "0.6469616", "text": "def select_every_odd arr\n ans = []\n arr.each_with_index do |item, i|\n if i%2 == 1 \n ans.push item\n end\n end\n ans\nend", "title": "" }, { "docid": "64b54c9a22d841396f1b52a579d1c8f4", "score": "0.6463055", "text": "def even_numbers_less_than num\n even_numbers_array = []\n i=0\nwhile i<num do\n even_numbers_array.push(i)\n i+=2\nend\n return even_numbers_array\nend", "title": "" }, { "docid": "51cdc08dbdf7d4ccbf70d9e7821232e2", "score": "0.64600897", "text": "def prints_evens_and_odds(array)\n odds = []\n evens = []\n array.each {|number| number.even? ? evens << number : odds << number }\n p evens\n p odds\nend", "title": "" }, { "docid": "833637598377324bac96000153259d42", "score": "0.6455049", "text": "def odd_index_nums(array)\n odd_index_array = []\n \n array.each_with_index do |element, index|\n if index.odd?\n odd_index_array << element\n end\n end\n odd_index_array\nend", "title": "" }, { "docid": "3e6e24d5b496540f89f012ddf1068d38", "score": "0.6447525", "text": "def odds_sorted array\n odd_nums = array.select do |value|\n value.is_a?(Integer) && value.odd?\n end\n odd_nums.sort\nend", "title": "" }, { "docid": "a0ac26c43c5f84c0a23803adbbdc656d", "score": "0.6444361", "text": "def my_select(collection)\n new_collection = [] #create new empty array\n i = 1 #counter variable i set to 1 (not 0, which is even)\n while i < collection.length #start while loop, execute code below as long as i is less than the length of the array\n (new_collection << i) if i.even? # each number gets appended to new_collection that is even\n i = i + 1 #increment value of i variable\n end #end do loop\n new_collection #return new_collection array\nend", "title": "" }, { "docid": "cfd83d764b5fc40d590659fa222b3f09", "score": "0.6443711", "text": "def double_odd_index_numbers(numbers)\n result = []\n numbers.each_with_index do |number,i|\n result << number*2 if i.odd?\n result << number if i.even?\n end\n result\nend", "title": "" } ]
e7885b01bb2e70cca398d7c2ec7abdf3
todo: rename this to 'submit_payment'
[ { "docid": "474bd26d33e7c3f114a7c201351f0755", "score": "0.0", "text": "def step2(params)\n transaction_uuid = params[:transaction_uuid]\n transaction = Transaction.by_uuid(transaction_uuid)\n transaction.perform_payment(params)\n transaction\n end", "title": "" } ]
[ { "docid": "a11a77faa5ecec563671688dede27eb3", "score": "0.74994594", "text": "def process_payment!\n @payment_type.pay\n end", "title": "" }, { "docid": "ffb1cf02d51b6aa5e3e683c6acb50cd4", "score": "0.7221705", "text": "def payment_instruction\n end", "title": "" }, { "docid": "c13b941788a5fce4c92b25e518e92687", "score": "0.71287364", "text": "def create_first_payment\n make_payment\n end", "title": "" }, { "docid": "ae143d8931b7af09f6a80fd3e3d4a3c9", "score": "0.69381934", "text": "def submit_payment val\n if val\n @invoice.transaction_id, @invoice.status = val, 'paid' \n @invoice.save!\n else\n false\n end\n end", "title": "" }, { "docid": "8f1a67f6c7311af7df4f2e7917746707", "score": "0.68129915", "text": "def pay(payment)\n retval\n end", "title": "" }, { "docid": "c4bc0de17c0b911f7f423cf098655397", "score": "0.67603225", "text": "def submit; end", "title": "" }, { "docid": "66e1677b986ce5673f76672db9c1955f", "score": "0.6678247", "text": "def submit\n end", "title": "" }, { "docid": "18d3e19cdb1211dae8876c4803fb4f2b", "score": "0.6618939", "text": "def submits; end", "title": "" }, { "docid": "adb02a6d82d6548411c76e2bda3316a1", "score": "0.6618532", "text": "def guard_process_payment_from_created; true; end", "title": "" }, { "docid": "adb02a6d82d6548411c76e2bda3316a1", "score": "0.6618532", "text": "def guard_process_payment_from_created; true; end", "title": "" }, { "docid": "7263bd3257236585e6788f7a8102d4ac", "score": "0.6612002", "text": "def subscription_payment\n\n\n @sub = Subscription.where(return_token: params[:id]).first\n\n @amount = 0\n if @sub.subscription_type = \"Standard\"\n @amount = 3\n end\n \n if @sub.subscription_type = \"Pro\"\n @amount = 5\n end\n\n if @sub.subscription_type = \"Enterprise\"\n @amount = 10\n end\n\n @sub.payment_status = \"Paid\"\n @sub.save\n\n @sub_payment = SubscriptionPayment.new\n @sub_payment.subscription_type = @sub.subscription_type\n @sub_payment.amount = @amount\n @sub_payment.date_from = @sub.date_from\n @sub_payment.date_to = @sub.date_to\n @sub_payment.payment_for = \"Subscription\"\n @sub_payment.subscription_id = @sub.id\n @sub_payment.payment_date = Date.today\n\n @sub_payment.save\n\n redirect_to :controller => 'backend', :action => 'dashboard'\n\n end", "title": "" }, { "docid": "b7671dd6c0d3ccef4e76da668fd6fc97", "score": "0.6583571", "text": "def before_submit_purchased!\n end", "title": "" }, { "docid": "8cf9675bd65e3a474c24304127b9f564", "score": "0.6558786", "text": "def payment_form \n unless params[:payment_method_token].blank?\n @payment_method = Samurai::PaymentMethod.find params[:payment_method_token]\n else\n @payment_method = Samurai::PaymentMethod.new :is_sensitive_data_valid => false\n end\n\n unless params[:reference_id].blank?\n @transaction = Samurai::Transaction.find params[:reference_id]\n end\n end", "title": "" }, { "docid": "0b50f24d0c0197ea16a84d5497baf84d", "score": "0.65529644", "text": "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", "title": "" }, { "docid": "aa42d7f0932b93d50bf771e9d8ee21a3", "score": "0.6538929", "text": "def process_payments!\n if group_buy\n process_payments_with(:authorize!)\n else\n process_payments_with(:purchase!)\n end\n end", "title": "" }, { "docid": "b007de217d26fa00ae4919c386521cda", "score": "0.6531507", "text": "def create\n #PaypalCallback object sends the raw post request to paypal and expects to get VERIFIED back\n response = PaypalCallback.new(params, request.raw_post, ENV[\"PAYPAL_POST_URL\"])\n\n #check that the payment says completed & paypal verifies post content\n if response.completed? && response.valid?\n @transaction = Transaction.find(params[:invoice]) #invoice is a pass through variable that gets embedded in the encrpyted paypal form and we get it back here\n Payment.create(:params => params.to_unsafe_h, :transaction_id => @transaction.id, :amount => params['payment_gross'], :confirmed => true)\n else\n #TODO maybe send out some type of alert to an admin\n end\n head :ok\n end", "title": "" }, { "docid": "a2f3a54266a5d80144379d149743f9ea", "score": "0.6525068", "text": "def submit_purchased!\n return false if was_submitted?\n\n wizard_steps[:checkout] = Time.zone.now\n submit!\n end", "title": "" }, { "docid": "36beb7b292801d54176fcf90e68cf854", "score": "0.652163", "text": "def submit!\n raise('already submitted') if was_submitted?\n raise('expected a purchased order') unless submit_order&.purchased?\n\n wizard_steps[:checkout] ||= Time.zone.now\n wizard_steps[:submitted] = Time.zone.now\n submitted!\n end", "title": "" }, { "docid": "9a8bdd82edacd606e43cbdfb277e7ba7", "score": "0.6510488", "text": "def submit!\n\tend", "title": "" }, { "docid": "e69802612029d95f0f4106e8be6fec21", "score": "0.6505812", "text": "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "title": "" }, { "docid": "b68f6284fa0a33d11c6cf276ce51e0cf", "score": "0.6489672", "text": "def post_processing\n if params['redirect_status'] == 'succeeded'\n flash[:success] =\n 'Payment submitted. Thank you! Please wait a moment and refresh to see your dues updated.'\n else\n flash[:error] =\n 'Payment could not be submitted. Please contact a director for further help.'\n end\n redirect_to(root_url)\n end", "title": "" }, { "docid": "21de9e10cf31fe8eb3e71a8ee75e85b8", "score": "0.6469489", "text": "def notify_payment\n begin\n user = User.find(params['referenceId'].split(\"-\").first)\n check_payment(\"POST\", user)\n render :text => \"Thank you!\"\n rescue Exception => ex\n logger.error \"params: #{params.inspect}\"\n logger.error \"a problem occured when processing a payment: #{ex.message} \\n #{ex.backtrace}\"\n render :text => \"A problem occured\"\n end\n end", "title": "" }, { "docid": "8e39f51b7626ee2c933a95a972386f25", "score": "0.64635825", "text": "def create\n plan = params[\"payment\"][\"plan\"]\n plan=\"premium_monthly\" if plan.empty?\n stripe_token = params[:payment][:stripe_customer_token]\n cardHolderName = params[\"cardHolderName\"]\n email = params[\"payment\"][\"email\"]\n flag = false\n\n if stripe_token\n begin\n @payment = current_user.payments.new(payment_params)\n customer = current_user.do_transaction(params[:payment_type], stripe_token, plan, cardHolderName, email)\n if customer\n @payment.stripe_customer_token = customer.id\n subcripted_detail = customer.subscriptions[\"data\"][0]\n flash[:notice] = 'Card charged successfully'\n else\n flag = true\n flash[:alert] = 'Some error happened while charging you, please double check your card details'\n end\n rescue Stripe::APIError => e\n flash[:alert] = e\n flag = true\n end\n else\n flag = true\n flash[:alert] = 'You did not submit the form correctly'\n end\n\n if flag\n render new_payment_path({plan: plan, error: e})\n end\n\n respond_to do |format|\n if @payment.save\n plan = Payment.plans[plan]\n current_user.update_attributes(subscription: plan, remaining_days: -1, stripe_customer_id: customer.id, is_paid_user: true)\n NotificationMailer.monthly_subscription_email(current_user, subcripted_detail).deliver_now\n format.html { redirect_to \"/users/edit\", notice: 'Payment made successfully.'}\n format.json { render json: @payment, status: :created, location: @payment }\n end\n end\n\n end", "title": "" }, { "docid": "0eaf2e0c2b9061594730f067ce859541", "score": "0.6444874", "text": "def payment\n @invoice = BitcoinInvoice.find_by_notification_key(params[:id])\n #if @invoice.status != BitcoinInvoice::NEW\n # redirect_to root_path, :alert => 'Cannot pay more than once!' and return\n #end\n end", "title": "" }, { "docid": "b1682e4e5c5fcccf6cce78637e6baee9", "score": "0.64356947", "text": "def create\n @payment = Payment.new(payment_params)\n @order = Order.find(params[:order_id])\n @payment.order_id = @order.id\n @payment.total = @order.total\n @payment.state = \"Completed\"\n @payment.token = \"tkn\" #ONLY DURING TESTS\n @payment.payment_method_id = params[:payment][:payment_method_id]\n @order.state = \"Completed\"\n @order.save\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: \"Payment was successfully created.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8269b5957a9e41b8d56950f9e1b7e34f", "score": "0.6433001", "text": "def make_payment\n payment_id = params[:payment_id]\n user_id = params[:user_id]\n offer_id = params[:offer_id]\n response = Subscription.make_payment(payment_id, user_id, offer_id)\n render json: response\n end", "title": "" }, { "docid": "9fd8ec7fd7ed166507d59c1da41f7d3c", "score": "0.64179015", "text": "def alipay_checkout_payment\n payment_method = PaymentMethod.find(params[:payment_method_id])\n #Rails.logger.debug \"@payment_method=#{@payment_method.inspect}\" \n Rails.logger.debug \"[DEBUG] alipay_full_service_url:\"+aplipay_full_service_url(@order, payment_method)\n # notice that load_order would call before_payment, if 'http==put' and 'order.state == payment', the payments will be deleted. \n # so we have to create payment again\n @order.payments.create(:amount => @order.total, :payment_method_id => payment_method.id)\n @order.payments.first.started_processing!\n\n #redirect_to_alipay_gateway(:subject => \"donatecn\", :body => \"donatecn\", :amount => @donate.amount, :out_trade_no => \"123\", :notify_url => pay_fu.alipay_transactions_notify_url)\n end", "title": "" }, { "docid": "1aae00d502a8559378d8022ecb72f978", "score": "0.6391939", "text": "def create\n @profile = current_user.profile\n @payment = Payment.new(payment_params)\n @payment.profile = current_user.profile\n if @payment.save\n uri = URI('http://acm.ut.ac.ir/epayment/payments')\n parameters = {\n 'merchant' => \"4452A141\",\n 'amount' => @payment.amount,\n 'redirect' => \"http://acm.ut.ac.ir/events/payments/approve\"}\n response = transact(uri, parameters)\n puts response.body\n @payment.response = response.body\n parsed_response = JSON.parse(response.body)\n if parsed_response[\"status\"] != 1\n redirect_to payments_path, notice: \"در ارتباط با بانک خطایی رخ داده‌است.\"\n return\n end\n @payment.reference_key = parsed_response[\"reference\"]\n if @payment.save\n redirect_to parsed_response[\"bank\"]\n return\n else\n render :new\n end\n else\n render :new\n end\n\n end", "title": "" }, { "docid": "46f503bec1b99ada9d1b389f46184709", "score": "0.6385015", "text": "def pay_callback\n\t \torder = params[:order]\n\t \tif (order.present? and order[:status] != \"expired\")\n\t \t\tpayment = Payment.new({\n \t\t\t\tdocument_id: order[:custom],\n\t \t\t\tsigner_id: current_user.id,\n\t \t\t\tpayment_amount: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_btc: order[:total_btc][:cents],\n\t \t\t\tbitcoin_total_native: order[:total_native][:cents],\n\t \t\t\tbitcoin_total_payout: order[:total_payout][:cents],\n\t \t\t\tbitcoin_transaction_id: order[:transaction][:id],\n\t \t\t\tbitcoint_receive_address: order[:receive_address],\n\t \t\t\tbitcoin_order_id: order[:id],\n\t \t\t\tbitcoin_status_order: order[:status]\n\t \t\t})\n\t \t\tpayment.save\n\t \tend\t\n\t \trender :text => \"OK\"\n\t end", "title": "" }, { "docid": "aa03950f78113673284d0e09b194d625", "score": "0.6381516", "text": "def contact_us_to_complete_payment\n # Horrible hack: when the user triggers a £40 edit charge, chooses a payment\n # method but then navigates backward, we get into a state where we can no\n # longer compare the \"old\" and \"new\" carrier types (because we no longer\n # know what the \"old\" type was as its now been overwritten in Mongo). This\n # means the new charge determination will output no charge, potentially\n # making the change of carrier type free.\n setup_registration('payment', true)\n render_not_found and return unless @registration\n end", "title": "" }, { "docid": "2bf67c0f221974a4cb65c4d4062e00b3", "score": "0.63640606", "text": "def click_submit\n end", "title": "" }, { "docid": "c17f870e27a4024c2ed442c7b176d050", "score": "0.6358417", "text": "def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85862b63998e7f49ecb6db5f4df9b17f", "score": "0.63458663", "text": "def process_with_payu\n process_purchase\n end", "title": "" }, { "docid": "c3a9c9e81873c34396f9ff1f41cc90a0", "score": "0.6341591", "text": "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n # @transaction = AuthorizeNet::AIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], :gateway=>:sandbox)\n # credit_card = AuthorizeNet::CreditCard.new('4111111111111111', '1120')\n # @response = @transaction.purchase('10.00', credit_card)\n\n # if @response.success?\n # puts \"Successfully made a purchase (authorization code: #{response.authorization_code})\"\n # else\n # raise \"Failed to make purchase.\"\n # end\n end", "title": "" }, { "docid": "4d0df949af7ab7df25d739b8eac5cae9", "score": "0.63093925", "text": "def create\n @payment = Payment.new(params.require(:payment).permit(:amount, :comment, :contract_id, :customer_id,\n :date_time, :finance_agreement_id, :invoice_id,\n :merchant_services_status, :payment_method_id, :status))\n ok = validatePayment?(@payment)\n\n respond_to do |format|\n if ok and @payment.save\n format.html { redirect_to payments_url,\n notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created,\n location: @payment }\n else\n prepFormVariables(@payment)\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, \n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f2edd890c32b7ae342317ba37ca244bc", "score": "0.62990427", "text": "def pay\n unless self.payment_id\n payment = create_payment\n self.payment_id = payment.id\n self.status = 'paid'\n self.pay_date = Time.now\n self.save\n add_to_balance\n end\n end", "title": "" }, { "docid": "6dcdff2de9aa207796fb9a4857f343ff", "score": "0.6289627", "text": "def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end", "title": "" }, { "docid": "5b37835eaf12687181ce3ef6ee9767cf", "score": "0.6271314", "text": "def process_payment\n @order.update_with_totals(order_params)\n processor = new_processor(@order, params[:stripeToken])\n checkout_response = checkout(processor).pay!\n \n if checkout_response[:status] == \"succeeded\"\n successful_order\n elsif checkout_response[:status] == \"pending_confirmation\" \n @order.pending_confirmation!\n redirect_to checkout_response[:second_step_url]\n else\n failed_order\n end\n end", "title": "" }, { "docid": "4b90b623fc89b513940902944f1bcf14", "score": "0.6260282", "text": "def process_payment \n if params != nil \n @order =Checkout.new( \n :name => params[:name],\n :pay_method => params[:pay_method] ,\n :total_price => params[:total_price].to_i)\n end \n\n if not params[:pay_err]\n render :layout => \"paygate\" \n else\n # @err = params[:pay_err].force_encoding('utf-8')\n @error_code = params[:replycode] \n flash[:error] = @error_code\n redirect_to pay_url\n end \n end", "title": "" }, { "docid": "800771ab20612e2a9b038f53350f057a", "score": "0.62599677", "text": "def create\n @payment = @user.payments.build(payment_params)\n if @payment.save\n redirect_to user_payment_url(@user, @payment)\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "08007208941c98bfc90d1445e2c846d1", "score": "0.62520164", "text": "def new\n payment_type = nil \n if params.has_key? :payment_type\n payment_type = params[:payment_type]\n else\n payment_type = 'sign_up'\n end\n @payment = Payment.new\n\n respond_to do |format|\n format.html {\n case payment_type\n when 'sign_up'\n # really want to go to a form, that submits here, i save that info, populate the send\n # thing and send it off to payp.\n render(:action => 'sign_up.rhtml') && return \n when 'trip'\n render(:action => 'trip_sign_up.rhtml') && return \n else\n end\n }\n format.xml { render :xml => @payment }\n end\n end", "title": "" }, { "docid": "62e76f536c1af2a69d7b4cf229bd6634", "score": "0.6244731", "text": "def payment\n {\n :credit_card => credit_card\n }\n end", "title": "" }, { "docid": "c04fb6230e70e775e0a3ddd2c15d07f3", "score": "0.6229219", "text": "def make method\n if params.include?(:user)\n @payment_type_id = params[:user][:payment_type_id].to_i\n @form_url = @user.subscribed_to < Time.zone.now ? make_payment_path(I18n.locale) : make_authorization_path(I18n.locale)\n @method = @user.subscribed_to ? 'sale' : 'authorization'\n case @payment_type_id\n when 1\n self.paypal method\n when 2..3\n self.card method\n else\n redirect_to request.referer, alert: t(:bad_payment, :scope => 'payments.errors') and return\n end\n else\n redirect_to request.referer, alert: t(:no_payment, :scope => 'payments.errors')\n end\n end", "title": "" }, { "docid": "2c53beab7d5b5bc891034abd87c86962", "score": "0.62285286", "text": "def payment\n # FIXME: please constantize the step numbers!\n @step = 5\n session[:step] = 5 if (session[:step].nil? || session[:step] < 5)\n @tipsters = Tipster.where(id: tipster_ids_in_cart)\n unless current_subscriber.subscription.present?\n @subscription = current_subscriber.build_subscription(plan_id: session[:plan_id])\n else\n @subscription = current_subscriber.subscription\n end\n @subscription.tipsters = @tipsters unless current_subscriber.already_has_subscription?\n @subscription.plan = selected_plan\n @subscription.using_coupon = true if using_coupon?\n @subscription.active = false\n @subscription.save\n @subscription.set_primary(tipster_ids_in_cart.first.to_i)\n\n if request.post?\n if params[:is_one_shoot] == \"true\"\n @subscription.update_attributes(is_one_shoot: true)\n elsif params[:is_one_shoot] == \"false\"\n @subscription.update_attributes(is_one_shoot: false)\n end\n if params[:method] == Payment::BY_PAYPAL\n ret = @subscription.generate_paykey\n if ret[:success]\n paykey = ret[:paykey]\n @paypal = {\n amount: \"%05.2f\" % @subscription.calculator_price,\n currency: \"EUR\",\n item_number: current_subscriber.id,\n paykey: paykey,\n item_name: \"TIPSTER HERO SUBSCRIPTION\"\n }\n respond_to do |format|\n format.js { render 'paypalinit.js.haml' }\n end\n else\n logger = Logger.new('log/payment_error.log')\n logger.info(\"CREATE PAYKEY FAILER\")\n logger.info(ret[:message])\n render js: 'window.location = '/''\n end\n else\n puts \"FRENCH BANK HERE\"\n end\n end\n\n end", "title": "" }, { "docid": "afc48923c2ad5186caeb4e30e0a2785c", "score": "0.62250096", "text": "def save_with_payment\n # if valid (ruby)\n if valid?\n # create a variable that stores all of the values from the form as well as a new stripe_card_token that will be returned from stripe\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n # set a variable that is equal to the id attribute of the customer object that was created above\n # save all of this to the User database\n # needed to run a migration to add AddStripeCustomerTokenToUsers column to User database\n self.stripe_customer_token = customer.id # User.stripe_customer_token = ....\n save!\n end\n end", "title": "" }, { "docid": "acbdd2b5f512a0038d99cbcf48932036", "score": "0.6216635", "text": "def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if ((can_access_invoice payment_params, @payment) && @payment.save)\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'Congratulations! Your payment was successfully processed.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'We were unable to process your payment. Please try again.' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "579de7d86c1c0166f7b9c3f2735751de", "score": "0.62166023", "text": "def valitation\n # Create a payment and send ID\n end", "title": "" }, { "docid": "9a0abc48b0c2891479339a95cf1d1e8e", "score": "0.62120366", "text": "def save_with_payment\n if valid? # We did added some validation to make sure user filled in properly ::contact.rb\n # After Stripe get this info, Stripe will do the charging, this method comes from Stripe gem\n # Stripe will return an id after charging\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token) # Stripe had upgrade their API from card: -> source:\n # Set a property to the user after received the id Stripe returned(stripe will return customer hash)\n # 'self' means the target of this function, in this case is User, and we set a new atribute stripe_customer_token to User. \n self.stripe_customer_token = customer.id # Setting stripe_customer_token to Stripe::customer.id \n save!\n end\n \n end", "title": "" }, { "docid": "6a698ee500510aa344ab2496eb17c9f1", "score": "0.62071836", "text": "def path\n \"payment/process\"\n end", "title": "" }, { "docid": "dec8f192db1ee5cc1cca00f2e843df81", "score": "0.62063754", "text": "def make_preapproved_payments(preapproval_key)\n api.execute :Pay, payment_options(preapproval_key)\nend", "title": "" }, { "docid": "8d356a25267c17e1f5a5db061ed5d1fe", "score": "0.6204458", "text": "def create_payment\n payment = ShopPayment.new({\n :order => @order,\n :gateway => gateway_name,\n :amount => @order.price,\n :card_type => card_type,\n :card_number=> card_number_secure\n })\n \n @order.update_attribute(:status, 'paid')\n \n @result[:payment] = payment.save\n end", "title": "" }, { "docid": "5b15cb3851ceafad73deaf69d8161c9d", "score": "0.6187521", "text": "def payment_made\n invoice = Invoice.find(params[:id])\n invoice.payment_received = true\n invoice.save!\n redirect_to root_path \n end", "title": "" }, { "docid": "8c0006cac1a42d2d08420eb50eda2f34", "score": "0.61586666", "text": "def post_payment(order_details, merchant_id, amount, locale='en')\r\n dispatch('6',order_details, merchant_id, amount, locale) \r\n @message = get_payment_client_error('PaymentClient.Error') unless @no_error\r\n end", "title": "" }, { "docid": "8a77e0c1b298c52f2f6e52dc1688795f", "score": "0.6147235", "text": "def payment_params\n params[:payment]\n end", "title": "" }, { "docid": "b9445539e7b6615e5b0ce4e9ee81fd8d", "score": "0.6145798", "text": "def create\n @payment = Payment.new(payment_params)\n if @payment.save\n redirect_to payments_path, notice: \"Successfully created payment.\"\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "9aceb2d07b30bdf60e477ed61ec2347d", "score": "0.61402136", "text": "def paid\r\n #if @notification.acknowledge # check if it’s genuine Robokassa request\r\n #@user.approve! # project-specific code\r\n render :text => @notification.success_response\r\n @payment.approve!\r\n #else\r\n #head :bad_request\r\n #end\r\n end", "title": "" }, { "docid": "35f1d329a2911a0e8238514dc61007ed", "score": "0.6128083", "text": "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n CrmMailer.thank_for_payment(@payment)\n\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n @members = Member.all\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dce232d326b679ab9594e72684d73ab0", "score": "0.611859", "text": "def creator_payment\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n redirect_to button_user_path(@user)\n end\n @nav = \"signup\"\n end", "title": "" }, { "docid": "8b7515bd18ddd08678c6900820ce57e4", "score": "0.6106377", "text": "def void\n @order.void_payment\n render 'status'\n end", "title": "" }, { "docid": "48d4cb1396568df837518916f9e295d2", "score": "0.6099405", "text": "def payment_params\n params.require(:payment).permit(:webtransaction, :amount, :subscription_id, :type_id, :user_id)\n end", "title": "" }, { "docid": "cd39820032d7cb2cf9f5e9a7ef89a016", "score": "0.6098937", "text": "def submit_details(details)\n response = adyen_client.checkout.payments_api.payments_details(details)\n puts response.to_json\n response\n end", "title": "" }, { "docid": "59a8d9703e4cffbee01d1b2fe77f7460", "score": "0.609498", "text": "def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n login_and_email\n render :action => :thanks\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end", "title": "" }, { "docid": "df954ab8d0d74203a7d7e5dfb5524659", "score": "0.60920864", "text": "def checkout\n \n # there must be a payment\n @payment = session[:payment]\n if !@payment || !@payment.amount\n @message = \"Sorry an internal error has occured\"\n render :action => 'error'\n return\n end\n\n # the donation can change based on parameters supplied\n if @payment.amount < 1\n # collect both possible donations\n donation = params[:donation]\n donation2 = params[:donation2]\n donation2 = donation if donation2\n donation = donation2.to_i\n @payment.update_attributes( :amount => donation )\n end\n if @payment.amount < 1\n @message = \" bad donation amount entered. Please hit back and try again\"\n render :action => 'error'\n return\n end\n\n # capture the company match if there is one\n matching_company = params[:matching_company]\n if matching_company\n @payment.update_attributes( :matching_company => matching_company)\n end\n\n # try get a party if there is one passed - this overrides anything from before.\n @party = nil\n @party = User.find(params[:party].to_i) if params[:party]\n @partyid = 0\n @partyid = @party.id if @party\n @payment.update_attributes( :owner_id => @partyid ) if @partyid > 0\n \n #if @payment.owner_id == 0\n # @message = \"Sorry no person to donate to found\"\n # render :action => 'error'\n # return\n #end\n\n # move payment along to the next stage\n @payment.update_attributes( :description=> Payment::CHECKOUT , :amount => donation )\n\n @notify_url = url_for(\n :controller=>\"payment\",\n :action => 'payment_received',\n :id => @payment.id,\n :only_path => false\n )\n\n @return_url = url_for(\n :controller=>\"payment\",\n :action => 'confirm_standard',\n :only_path => false\n )\n\n @paypal_business_email = SETTINGS[:paypal_business_email]\n @business_key = PAYPAL_MYPRIVKEY\n @business_cert = PAYPAL_MYPUBCERT\n @business_certid = SETTINGS[:paypal_cert]\n @action_url = \"http://www.paypal.com/cgi-bin/webscr\"\n Paypal::Notification.ipn_url = @action_url\n Paypal::Notification.paypal_cert = PAYPAL_CERT\n\n end", "title": "" }, { "docid": "643e0dfa8f1f72ab71b6af92e0fcd125", "score": "0.6087231", "text": "def create\n\n payment = PagSeguro::Payment.new(notification_url: 'https://safe-dusk-38202.herokuapp.com/notification', payment_method: 'creditCard', reference: '1')\n\n\n ## Adicionando endereço do comprador\n address = PagSeguro::Address.new(postal_code: params[:zipcode], street: params[:street], number: params[:number], complement: '', district: params[:district], city: params[:city], state: params[:state])\n \n shipping = PagSeguro::Shipping.new\n shipping.address = address\n payment.shipping = shipping\n \n\n items = [PagSeguro::Item.new(id: @product.id, description: @product.description, amount: @product.price, quantity: 1)]\n payment.items = items\n\n # Criando uma referencia para a nossa ORDER\n \n payment.reference = @reference\n\n\n phone = PagSeguro::Phone.new(params[:phone_code], params[:phone_number])\n document = PagSeguro::Document.new(params[:cpf])\n sender = PagSeguro::Sender.new(email: params[:email], name: params[:name], hash_id: params[:sender_hash] )\n sender.phone = phone\n sender.document = document\n payment.sender = sender\n\n # payment.credit_card_token = params[:card_token]\n credit_card = PagSeguro::CreditCard.new(params[:card_token])\n credit_card.holder = PagSeguro::Holder.new(params[:card_name], params[:birthday].to_datetime())\n document = PagSeguro::Document.new(params[:cpf])\n credit_card.holder.document = document\n phone = PagSeguro::Phone.new(params[:phone_code], params[:phone_number])\n credit_card.holder.phone = phone\n \n credit_card.billing_address = address\n\n payment.credit_card = credit_card\n\n\n credit_card.installment = PagSeguro::Installment.new(1, @product.price)\n\n # payment.create\n transaction = payment.transaction\n\n\n\n # Cria uma Order para registro das transações\n \n create_order\n \n \n \n\n if payment.errors.any?\n puts \"=> ERRORS\"\n puts payment.errors.join(\"\\n\")\n render plain: \"Erro No Pagamento #{payment.errors.join(\"\\n\")}\"\n else\n\n redirect_to order_index_path\n\n end\n\n end", "title": "" }, { "docid": "be6c106f13927382407a783084242a7f", "score": "0.6087019", "text": "def pay\n @bill = Bill.find_by(id: params[:bill_id].to_i, home_id: params[:home_id].to_i)\n @payment = Payment.new(description: @bill.name, amount: @bill.amount,\n recipient_paypal_email: @bill.user.paypal)\n @recipient = @payment.recipient_paypal_email\n @payment.sender_paypal_email = current_user.paypal\n @payment.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @amount = @payment.amount\n request = HTTParty.post(\"https://svcs.sandbox.paypal.com/AdaptivePayments/Pay\",\n headers: {\"X-PAYPAL-SECURITY-USERID\" => \"maria.cassino-facilitator_api1.gmail.com\",\n \"X-PAYPAL-SECURITY-PASSWORD\" => \"U9FL2MK962DKPXMR\",\n \"X-PAYPAL-SECURITY-SIGNATURE\" => \"AFcWxV21C7fd0v3bYYYRCpSSRl31A2tjSJXfuAz3het2TLAiz2uCt1eN\",\n \"X-PAYPAL-REQUEST-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-RESPONSE-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-APPLICATION-ID\" => \"APP-80W284485P519543T\"\n },\n body: {actionType: \"PAY\",\n currencyCode: \"USD\",\n receiverList: {\n receiver:[\n {amount: @amount,\n email: @recipient}\n ]\n },\n returnUrl: \"http://www.example.com/success.html\",\n cancelUrl: \"http://www.example.com/failure.html\",\n requestEnvelope:{\n errorLanguage: \"en_US\",\n detailLevel: \"ReturnAll\"\n }}.to_json\n )\n @payment.save\n @bill.paid_by = current_user.id\n @bill.paid = true\n @bill.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @bill.save\n render :payment\n end", "title": "" }, { "docid": "feb3f8bb7351c82296eced4fc43a2a84", "score": "0.6082346", "text": "def pay\n \n Notifyer.print( 'Shop::StripeTransfer#pay' , self ) if Rails.env.development?\n \n set_description\n self.process!\n \n begin\n Stripe::Transfer.create(\n amount: self.amount.round.to_i,\n destination: self.destination,\n source_transaction: self.source_transaction,\n currency: self.currency,\n description: self.description,\n metadata: {\n 'description' => self.description,\n 'order_item_id' => self.order_item_id\n },\n statement_descriptor: \"#{self.description} test 001\",\n application_fee: self.application_fee,\n #recipient: self.destination \n )\n self.finis!\n rescue Stripe::StripeError => e\n self.fail!\n self.update(stripe_errors: e.message)\n errored('Shop::StripeTransfer#pay', e )\n return false\n end\n true\n end", "title": "" }, { "docid": "c55a86c1a2ae9978d5373cb7b299638d", "score": "0.6081573", "text": "def create\n\t\t# @payment = Payment.new({\n\t\t# :intent => \"sale\",\n\t\t# :payer => {\n\t\t# :payment_method => \"credit_card\",\n\t\t# :funding_instruments => [{\n\t\t# :credit_card => {\n\t\t# \t:type => params[:payment][:card_type], #\"visa\",\n\t\t# :number => params[:payment][:card_number], #\"4242424242424242\",\n\t\t# :expire_month => params[:payment][\"card_expires_on(2i)\"], #\"1\",\n\t\t# :expire_year => params[:payment][\"card_expires_on(1i)\"], #\"2018\",\n\t\t# :cvv2 => params[:payment][:cvv2], #\"874\",\n\t\t# :first_name => params[:payment][:first_name], #\"Joe\",\n\t\t# :last_name => params[:payment][:last_name], #\"Shopper\",\n\t\t# :billing_address => {\n\t\t# :line1 => params[:payment][:address], #\"52 N Main ST\",\n\t\t# :city => params[:payment][:city], #\"Johnstown\",\n\t\t# :state => params[:payment][:state], #\"OH\",\n\t\t# :postal_code => params[:payment][:postal_code], #\"43210\",\n\t\t# :country_code => params[:payment][:country_code] #\"US\" \n\t\t# }}}]},\n\t\t# :transactions => [{\n\t\t# :amount => {\n\t\t# :total => \"10.00\",\n\t\t# :currency => \"USD\" },\n\t\t# :description => \"This is the payment transaction description.\" }]})\n\n\t\t# @payment.create\n\t\t# if @payment.id.nil?\n\t\t# \terror = @payment.error\n\t\t# \tredirect_to payment_index_url, :alert => error.name+\"\\n\"+error.details.to_s\n\t\t# else\n\t\t# \tparams[:payment][:transaction_id] = @payment.id\n\t\t# \tparams[:payment][:amount] = 10\n\t\t# \t@data = current_user.build_payment(payment_params)\n\t\t# \tif @data.save\n\t\t# \t\tredirect_to payment_index_url, :notice => \"Payment Done with payment id #{@payment.id}\"\n\t\t# \telse\n\t\t# \t\tredirect_to payment_index_url, :alert => \"Something went wrong.\"\n\t\t# \tend\n\t\t# end\n\tend", "title": "" }, { "docid": "5ce683679a91003b2e085cd672546f1e", "score": "0.6076735", "text": "def perform_test_payment\n subscription = user.subscriptions.not_paid.first\n SubscriptionManager.new(subscription: subscription).pay if subscription\n end", "title": "" }, { "docid": "c4ec7eb6df6d1234814e572dcca5ebc2", "score": "0.60742974", "text": "def confirm\n @model = User::BillingLog.find params[:id]\n @billable = @model.billable\n\n authorize @model\n\n if request.post?\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::BALANCE\n case @billable.class.name\n when 'Billing::Delocoin::Buy'\n run Billing::Delocoin::Buy::Operation::Finish, id: @billable.id do |result|\n roistat.push_async(:delocoin_buy_finish, cost: result['model'].cost)\n end\n\n return redirect_to status_my_billing_path(@model.billing_log.id)\n end\n end\n\n not_found\n end\n\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::YANDEX_KASSA\n @fields = Billing::YandexKassa::RequestFieldsService.new(@billable).perform\n\n render 'my/billing/confirm/yandex_kassa'\n when *Billing::PaymentTypeList::BALANCE\n render 'my/billing/confirm/balance'\n else\n not_found\n end\n end", "title": "" }, { "docid": "b96b7ca1bc03f3baca6eee40b590de4d", "score": "0.6061449", "text": "def pay_slip\n \n end", "title": "" }, { "docid": "ed7f78aa994514c2bc020c7728f5f37c", "score": "0.60580325", "text": "def create\n order = current_user.orders.find(params[:order_id])\n @payment = Payment.new\n @payment.price = order.price\n @payment.order_id = order.id\n @payment.variable_symbol = order.id.to_s + rand(1..100).to_s.rjust(3, '0')\n url = get_link_url\n @payment.save!\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to url }\n format.json { render :show, status: :created, location: url }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41e5e70c81b198481fe980749e4b7f6f", "score": "0.60550237", "text": "def pay\n @cash_out = CashOut.find(params[:id])\n\n @transaction = Transaction.new\n @transaction.user = @cash_out.user\n @transaction.transaction_type = 'payment'\n @transaction.amount = @cash_out.amount * -1\n @transaction.attachable = @cash_out\n @transaction.transaction_at = Time.now\n\n if @transaction.save\n @cash_out.status = 'paid'\n @cash_out.paid_at = @transaction.transaction_at\n @cash_out.save\n\n flash[:notice] = \"Se ha realizado el pago\"\n redirect_to [:admin, @cash_out]\n else\n flash[:error] = \"No se pudo realizar el pago\"\n redirect_to [:admin, @cash_out]\n end\n end", "title": "" }, { "docid": "649c0fc66fc948b8661d510bcd6f09e7", "score": "0.6053898", "text": "def payment_params\n params.require(:payment).permit(:amount, :refund_amount, :description, :method, :card_id, :scheduled_for)\n end", "title": "" }, { "docid": "1bb1d056c37eac4702aad78366d0381f", "score": "0.60538465", "text": "def make_payment\n if request.post?\n \n @product = Product.find_by_id(params[:id])\n\n\n @today = Time.now.in_time_zone(\"Eastern Time (US & Canada)\").to_datetime\n\n offer_token = (session[:_csrf_token] ||= SecureRandom.base64(32))\n ip = request.remote_ip\n @offer = @product.last_offer(ip,offer_token)\n unless @offer\n @offer = Offer.create(:product_id => @product.id,:price => @product.regular_price,:response => \"counter\", :token => offer_token, :ip => ip,:counter => 1)\n end\n \n if @offer.nil?\n redirect_to root_path\n return\n end\n session[@offer.id] = @offer.product.regular_price if session[@offer.id].nil?\n @month = Date.today.month\n @payment = Payment.find_or_initialize_by_offer_id(@offer.id) \n @payment.price = @offer.price\n @payment.save(:validates => false)\n redirect_to payments_path(@payment)\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "0aa0436fa5e20635b77eb10dcd1488f4", "score": "0.6045503", "text": "def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n @invoice.accept_cash_or_cheque_or_bank_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n if @order.instance_of? CompetitionsUser\n note = \"no notes created\"\n note = @order.competition.timing.note if @order.competition.timing\n start_date = @order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = @order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if invoice\n\n p \"fdfgffggfdgfgd\"\n\n \n p \"i got the invoice and creating pdf\"\n\n create_pdf(invoice.id,invoice.number,start_date,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,invoice.final_amount.to_i,0,false,end_date)\n end \n else\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n end\n elsif @order.instance_of? ExhibitionsUser\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n begin\n\n # email= UserMailer.create_send_invoice(invoice,@current_user)\n # UserMailer.deliver(email)\n\n p \"sending the emaillll\"\n email= UserMailer.create_send_invoice(invoice,@current_user)\n #UserMailer.deliver(email)\n\n rescue\n end\n session[:total_entry] = nil \n if @invoice.purchasable_type == \"Order\"\n session[:cart]=nil\n end\n end", "title": "" }, { "docid": "f744f842d8b342fe4142bcb607cd4c81", "score": "0.60450286", "text": "def payment_completed\n @payment = Payment.new(\n reservation_id: params[:reservation_id],\n state: params[:state],\n total: params[:total]\n )\n @payment.save!\n @reservation = Reservation.find(params[:reservation_id])\n @reservation.update!(paid: true)\n end", "title": "" }, { "docid": "dbddd3c8d26595fb218a79db292d0dc6", "score": "0.60403943", "text": "def send_payment_and_dispose!\n mturk_bonus_assignment(self.mturk_assignment_id, self.mturk_worker_id)\n mturk_approve_assignment(self.mturk_assignment_id)\n self.update_attributes(:paid_at => Time.now)\n dispose_hit_on_mturk(self.mturk_hit_id) #we can also delete it on mturk, tidy up\n end", "title": "" }, { "docid": "bf27d9bb77908152ccf130e7e964b410", "score": "0.6039787", "text": "def create\n\n campaign_id = params[:campaign_id]\n credit_card_id = params[:credit_card_id]\n amount = params[:amount]\n\n #testing\n campaign = Campaign.find_by_id(campaign_id)\n user_id = campaign.user_id\n wepay_payment_type = \"credit_card\"\n if(amount>1)\n if(campaign!=nil)\n #create the payment object\n payment = Payment.new({\n campaign_id: campaign_id,\n payer_id: user_id,\n wepay_payment_id: credit_card_id,\n wepay_payment_type: wepay_payment_type,\n amount: amount\n })\n if !payment.valid?\n render json: error(payment.errors.full_messages)\n end\n if payment.valid? && payment.create_checkout && payment.save\n campaign.update_amount_donated\n render json: {\"checkout_id\" => payment[\"wepay_checkout_id\"]}\n else\n render json: payment_invalid_error\n end\n end\n end\n end", "title": "" }, { "docid": "6c92d06f03723a32d55fa421209ee6b9", "score": "0.60384196", "text": "def test_success_cc_payment_page\r\n @u = users(:user_without_sps_gateway_settting)\r\n @user = watir_session.with(:user_without_sps_gateway_settting)\r\n @user.logs_in\r\n\r\n @invoice = invoices(:invoice_moneris_payment_cc)\r\n \r\n \r\n b = @user.b\r\n add_sps_cc_profile(:user_without_sps_gateway_settting)\r\n @url = send_invoice(@invoice.id, true, true, true)\r\n \r\n total = b.span(:id, \"invoice_total\").text\r\n assert_equal \"10.00 CAD\", total\r\n\r\n link = b.link(:text, \"Pay Invoice\")\r\n link.click\r\n b.wait\r\n \r\n b.button(:value, \"Pay Now\").click\r\n b.wait\r\n assert b.html.include?(\"12 errors\"), \"cannot find validation error message\"\r\n \r\n pay = Payment.find(:first, :conditions => {:pay_type => 'moneris' })\r\n assert_equal 'created', pay.status\r\n\r\n b.text_field(:id, 'card_number').value=('4242424242424242')\r\n b.text_field(:id, 'card_first_name').value=('Payer First')\r\n b.text_field(:id, 'card_last_name').value=('Payer Last')\r\n b.select_list(:id, 'card_year').option(:text, '2012').select\r\n b.text_field(:id, 'card_verification_value').value=('123')\r\n \r\n\r\n b.text_field(:id, 'billing_address_name').value=('Payer Name')\r\n b.text_field(:id, 'billing_address_address1').value=('Payer Address1')\r\n b.text_field(:id, 'billing_address_city').value=('Payer City')\r\n b.select_list(:id, 'billing_address_state').select('BC - British Columbia')\r\n b.text_field(:id, 'billing_address_zip').value=('12345')\r\n b.text_field(:id, 'billing_address_phone').value=('123-456-7890')\r\n b.text_field(:id, 'billing_address_email').value=('test@test.com')\r\n \r\n b.button(:value, \"Pay Now\").click\r\n b.wait\r\n assert b.html.include?(\"successfully recorded\")\r\n pay = Payment.find(:first, :conditions => {:pay_type => 'moneris' })\r\n assert_equal 'cleared', pay.status\r\n \r\n @user.goto(@url)\r\n b.wait\r\n sleep 3\r\n #verify pay invoice link does not exist\r\n assert !b.html.include?(\"Pay Invoice\") , \"Paid invoice link found for fully paid invoice.\"\r\n inv = Invoice.find(@invoice.id)\r\n assert_equal \"paid\", inv.status\r\n assert_equal 0.0, inv.owing_amount\r\n assert_equal inv.total_amount, inv.paid_amount\r\n \r\n \r\n @u = nil\r\n @user.teardown \r\n end", "title": "" }, { "docid": "6c3b0e8a25109dd39e2afddf2aee48ff", "score": "0.60376054", "text": "def pay_status_paypal\n\n end", "title": "" }, { "docid": "04d5c62ceba8fb43d729315d87f51280", "score": "0.60353875", "text": "def payment_params\n params.require(:payment).permit(:first_name, :last_name, :last4, :card_security_code, :credit_card_number, :expiration_month, :expiration_year, :amount, :amount, :success, :authorization_code, :user_id, :notify, :parking_id)\n end", "title": "" }, { "docid": "202b224ed240ff673668bfbb7fbbb0eb", "score": "0.6032372", "text": "def create\n @donation_form = DonationForm.new(donation_params)\n @product = Donation.find(donation_params[:donation_id])\n\n payment = PagSeguro::CreditCardTransactionRequest.new\n payment.notification_url = notifications_url\n # payment.notification_url = \"\"\n payment.payment_mode = \"default\"\n\n # Aqui vão os itens que serão cobrados na transação, caso você tenha multiplos itens\n # em um carrinho altere aqui para incluir sua lista de itens\n payment.items << {\n id: @product.id,\n description: @product.description,\n amount: @product.price,\n weight: 0\n }\n\n # Criando uma referencia para a nossa ORDER\n reference = \"REF_#{(0...8).map { (65 + rand(26)).chr }.join}_#{@product.id}\"\n payment.reference = reference\n payment.sender = {\n hash: donation_params[:sender_hash],\n name: donation_params[:name],\n email: donation_params[:email],\n cpf: donation_params[:cpf],\n document: { type: \"CPF\", value: donation_params[:cpf] },\n phone: {\n area_code: donation_params[:phone_code],\n number: donation_params[:phone_number]\n }\n }\n\n shipping_address = {\n type_name: ENV['DEV_SHIPPING_TYPE'],\n address: {\n street: ENV['DEV_SHIPPING_STREET'],\n number: ENV['DEV_SHIPPING_NUMBER'],\n complement: ENV['DEV_SHIPPING_COMPLEMENT'],\n city: ENV['DEV_SHIPPING_CITY'],\n state: ENV['DEV_SHIPPING_STATE'],\n district: ENV['DEV_SHIPPING_DISTRICT'],\n postal_code: ENV['DEV_SHIPPING_POSTAL_CODE']\n }\n }\n\n payment.shipping = shipping_address\n payment.billing_address = shipping_address[:address]\n\n payment.credit_card_token = donation_params[:card_token]\n payment.holder = {\n name: donation_params[:card_name],\n birth_date: donation_params[:birthday],\n document: {\n type: \"CPF\",\n value: donation_params[:cpf]\n },\n phone: {\n area_code: donation_params[:phone_code],\n number: donation_params[:phone_number]\n }\n }\n\n payment.installment = {\n value: donation_params[:card_installment_value],\n quantity: donation_params[:card_options].to_i\n }\n\n # payment.extra_params << { shippingAddressRequired: 'false' }\n\n puts \"=> REQUEST\"\n puts PagSeguro::TransactionRequest::RequestSerializer.new(payment).to_params\n puts\n\n payment.create\n\n # Cria uma Order para registro das transações\n if @donation_form.valid? && payment.errors.empty?\n Order.create(donation_id: @product.id, buyer_name: donation_params[:name], reference: reference, status: 'pending')\n\n redirect_to wedding_supports_path,\n flash: { notice: 'Obrigado. Sua doação foi realizada com sucesso!' }\n else\n @donation_form.payment_errors = payment.errors\n puts \"Payment Errors:\"\n puts payment.errors.join(\"\\n\")\n puts @donation_form.errors.messages\n @donation = @product\n @session_id = (PagSeguro::Session.create).id\n render :new and return\n end\n end", "title": "" }, { "docid": "9c84270ff9cb9ea76b4958d09a0abdac", "score": "0.6023666", "text": "def payment_params\n #params.require(:payment).permit(:amount, :profile_id, :reference_key, :status, :succeed_time)\n params.require(:payment).permit(:amount)\n end", "title": "" }, { "docid": "7514484a706beeb13e9af0f40a43f4db", "score": "0.6018281", "text": "def wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "9ec6d3fefbe5b3871c0c36b7d883ad3f", "score": "0.6013869", "text": "def submit\n click_button 'SEND'\n self\n end", "title": "" }, { "docid": "fb5f62ff49eff050dd0ffeeae9186da3", "score": "0.60077137", "text": "def confirm_course_payment\n\n\n tx_id = 123456789 # default tax_id we need to changes after latter\n @course = Course.find(params[:id])\n\n @price_detail = CoursePricing.find_by_course_id(@course.id)\n if @price_detail!=nil\n @price =@price_detail.price\n else\n @price=0.0\n end\n @discount=session[:coupon_price].to_f\n @subtotal=@price - @discount\n @tax = Course.tax_calculation(@course,@subtotal)\n @user = current_user\n if session[:payment_completed] ==nil\n if params[:coupon_code].present?\n @coupon = Coupon.find_coupon(params[:coupon_code], user_id = current_user.id, metadata=@course.id)\n Coupon.redeem(params[:coupon_code], @user.id, tx_id, @coupon.metadata)\n end\n\n enroll_student(@course, current_user)\n invoice = invoices_data(@course, params)\n invoice_generate_pdf(@course, params)\t\t\t\n session[:payment_completed]=true\n end\n end", "title": "" }, { "docid": "125ae00835ab76ab19d83d3040dba355", "score": "0.6007012", "text": "def insert_payment_method\n authorize current_employer\n @customer = Customer.new(customer_params)\n pay_service = Services::Pay.new(current_employer, nil, @customer.stripe_card_token)\n\n if pay_service.is_customer_saved?\n redirect_to employers_payment_methods_path,\n notice: 'You have successfully added your payment information!'\n else\n redirect_to employers_payment_verify_path, alert: \"There was an error processing your card. Contact support.\"\n end\n end", "title": "" }, { "docid": "435809c11e023e9c73e7f04baf98def7", "score": "0.60052085", "text": "def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: \"Le payment a bien été crée.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1b72fdd464cf6749ea8997181aa8c92", "score": "0.6004255", "text": "def submit\n respond_to do |format|\n if @order.submit\n session[:order_id] = nil\n format.html { redirect_to orders_path, notice: 'Замовлення відправлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bcc6c75ea802d420c3747d0b41db490", "score": "0.60011667", "text": "def create\n @payment = Payment.new(payment_params)\n @payment.order_id = params[:order_id]\n respond_to do |format|\n if @payment.save\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount, _links: { next: {profile: \"http://#{my_address}:3000/order\", href: \"http://#{my_address}:3000/orders/#{@payment.order_id}\", enctype: 'application/json'}}}\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: response_json, status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84eea55c9d0d03f3007106151c9fef1c", "score": "0.5998391", "text": "def alipay_handle_billing_integration \n payment_method = PaymentMethod.find(params[:payment_method_id])\n payment = @order.pending_payments.first\n #payment_method = @order.pending_payments.first.payment_method\n if payment.payment_method.kind_of?(BillingIntegration::Alipay)\n #pay\n redirect_to alipay_full_service_url(@order, payment_method)\n end\n end", "title": "" }, { "docid": "e163adc140fb4929725c0d2bf6195d62", "score": "0.59944", "text": "def payment_params\n params.require(:payment).permit(:amount, :receiver, :refunded, :completed, :user_id)\n end", "title": "" }, { "docid": "2eca25a0c1a8d2e7784f96df5f36c7e0", "score": "0.5994264", "text": "def create\n params[:payment][:amount].gsub!(/[$,]/, \"\")\n params[:payment][:amount] = (params[:payment][:amount].to_f * 100).to_i\n @payment = Payment.new(payment_params)\n\n if params[:booth_id]\n @payable = @booth = Booth.find(params[:booth_id])\n @payer = @booth.vendor\n else\n @payer = Vendor.find(params[:vendor_id])\n end\n\n @payment.payer = @payer\n @payment.payable = @payable\n\n if @payment.save\n if @payment.errors.empty?\n redirect_to(@payment.payable || @payment.payer, notice: \"Payment was successfully created.\")\n else\n redirect_to(@payment.payable || @payment.payer, alert: @payment.errors.full_messages.join(\".\\n\") + \".\")\n end\n else\n @editable = true\n render(:new)\n end\n end", "title": "" }, { "docid": "8e567b1fde157399bf0f1e9a4c4035e3", "score": "0.5994058", "text": "def create\n # You maybe want to log this notification\n notify = Paypal::Notification.new request.raw_post\n \n # Split the item_id\n account_id = notify.item_id\n \n @user = User.find account_id\n\n if notify.acknowledge\n # Make sure you received the expected payment!\n if notify.complete? and 9.99 == Decimal.new( params[:mc_gross] ) and notify.type == \"subscr_payment\"\n # All your bussiness logic goes here\n @user.premium = true\n @user.valid_till = Date.today + 1.month\n @user.save\n render :nothing => true\n end\n end\n end", "title": "" }, { "docid": "58fe582e4933ef0c5d12f1aa8cc8dfa0", "score": "0.599321", "text": "def save_with_payment\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token)\n self.stripe_customer_token = customer.id\n save!\n end\n end", "title": "" }, { "docid": "9b846734d5fd634aa75637a0e8e0b841", "score": "0.5990809", "text": "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n # check_entry = CheckEntry.find_by_check_code(@payment.payment_check_code)\n # @payment.update_attributes(:check_entry_id => check_entry.id) if check_entry\n\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n p @payment.errors.to_yaml\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0dd0a743fbf6da3945055ba0cfaf5a47", "score": "0.5987191", "text": "def payment_params\n params.require(:payment).permit(:legalname, :request)\n end", "title": "" }, { "docid": "ee7f055538ea33b05217d1a4a151e04e", "score": "0.59776795", "text": "def create\n authorize! :pay_with_sofort, @order\n @order.assign_attributes(confirmation_params)\n unless @order.valid?\n @order = @order.decorate\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/confirm'\n end\n # TODO: check if chosen paymentmethod is sofort. sofort payment must be available for this event\n transaction = ::Sofort::StartTransaction.new(@order)\n transaction.run do |sofort_checkout|\n return redirect_to sofort_checkout\n end\n # TODO: Handle case of Transaction not working\n # render 'something'\n end", "title": "" }, { "docid": "a6c78fd72ccc01b78a422113ec2f770f", "score": "0.59729785", "text": "def payment_new(payment, payable, company_phone)\n @payment = payment\n @payable = payable\n @company_phone = company_phone\n @company = Company.find_by!(\n id: company_phone[:company_id]\n )\n emails = company_phone.extensions.admin\n mail(\n to: emails.map(&:email),\n subject: '¡En GurúComm hemos recibido tu pago!'\n )\n end", "title": "" }, { "docid": "69a0c3c68ac78da6fcde3abb34f85813", "score": "0.59711766", "text": "def ouroboros_accept\n MorLog.my_debug('Ouroboros payment : accept', 1)\n @payment = Payment.find(:first, :conditions => \"id = #{params[:order_id].to_i}\")\n if @payment\n @user = @payment.user\n MorLog.my_debug(\"Ouroboros payment : user - #{@user.id}\", 1)\n @enabled = Confline.get_value(\"Ouroboros_Enabled\", @user.owner_id).to_i\n if @enabled.to_i == 1\n if @payment.pending_reason.to_s == 'Unnotified payment'\n key = Confline.get_value(\"Ouroboros_Secret_key\", @user.owner_id)\n @hash = Ouroboros::Hash.reply_hash(params, key)\n if @hash == params[:signature]\n if params[:amount].to_d == @payment.amount.to_d*100\n @currency = Confline.get_value('Ouroboros_Default_Currency', @user.owner_id)\n rate = count_exchange_rate(session[:default_currency], @payment.currency)\n @user.balance += @payment.gross.to_d / rate\n @user.save\n @payment.completed = 1\n @payment.transaction_id = params[:tid]\n @payment.shipped_at = Time.now\n @payment.payer_email = @user.email\n @payment.payment_hash = params[:signature]\n @payment.pending_reason = ''\n @payment.save\n MorLog.my_debug(\"Ouroboros payment : payment - #{@payment.id}\", 1) if @payment\n MorLog.my_debug(\"Ouroboros payment : amount - #{@payment.gross.to_d / rate}\", 1)\n @error = 0\n else\n @error = 5\n MorLog.my_debug('Ouroboros payment : Amount missmach')\n MorLog.my_debug(' SYSTEM :' + @payment.amount.to_s)\n MorLog.my_debug(' Ouroboros :' + (params[:amount].to_d/100).to_s)\n end\n else\n @error = 4\n MorLog.my_debug('Ouroboros payment : Hash missmach')\n MorLog.my_debug(' SYSTEM :' + @hash)\n MorLog.my_debug(' Ouroboros :' + params[:signature])\n end\n else\n @error = 3\n MorLog.my_debug('Ouroboros payment : Unnotified payment.')\n MorLog.my_debug(' SYSTEM : ' + @payment.pending_reason.to_s)\n MorLog.my_debug(' Ouroboros : Notified payment')\n end\n else\n @error = 2\n MorLog.my_debug('Ouroboros payment : Ouroboros disabled')\n MorLog.my_debug(' SYSTEM : '+ @enabled.to_s)\n end\n else\n @error = 1\n MorLog.my_debug('Ouroboros payment : Payment was not found')\n end\n end", "title": "" }, { "docid": "44d9d7647048508535f1c6e8ec041d8e", "score": "0.59691095", "text": "def payment\n if @amortization.present?\n @amortization.payment\n else\n nil\n end\n end", "title": "" } ]
97d456396ca453b07de87cb8c4f9ccad
Returns the data for this item that's defined in the item schema
[ { "docid": "dea3addc7c936eb50af95afb81d8a118", "score": "0.61330694", "text": "def schema_data; end", "title": "" } ]
[ { "docid": "b35015fc987157454e80d180ceaa3945", "score": "0.7864488", "text": "def schema_data\n inventory.item_schema.items[@defindex]\n end", "title": "" }, { "docid": "65e5fd551a6bca9c86376589a9214413", "score": "0.7393111", "text": "def item_data\n if @item_data.nil\n @item_data = JSON.parse(@configuration[:conn].get(@item_data_url).body)\n end\n \n @item_data\n end", "title": "" }, { "docid": "ee0987e2280229471bf8e02ed32d76e3", "score": "0.728855", "text": "def data_item\n @data_item||=AMEE::Data::Item.get(connection, data_item_path, get_options)\n end", "title": "" }, { "docid": "7e7431ffaf059b95b2359a3e9c36d4a3", "score": "0.7270125", "text": "def item_schema; end", "title": "" }, { "docid": "e9258665a8a2cd135b66d2a24fead566", "score": "0.6888918", "text": "def item\n case @kind\n when 1; $data_items[@data_id]\n when 2; $data_weapons[@data_id]\n when 3; $data_armors[@data_id]\n else; nil\n end\n end", "title": "" }, { "docid": "a34a24810fd84b941be808188c9245ef", "score": "0.67635596", "text": "def data(item)\n data = []\n column_names.each do |column|\n data << item.public_send(column)\n end\n data\n end", "title": "" }, { "docid": "f8227d59fb28839b995c728fcf4f6351", "score": "0.6751331", "text": "def item\n return unless data[\"Item\"]\n @item ||= DynamoDB.deserialize(data[\"Item\"])\n end", "title": "" }, { "docid": "1a079f69214a1b7bbb76efd78843b815", "score": "0.66828793", "text": "def get( name )\n item = get_item( name )\n item && item.is_a?( Item ) ? item.data : nil\n end", "title": "" }, { "docid": "a1c5eacebfc483e7cfff694fe3796e40", "score": "0.6658355", "text": "def item\n case @item_type\n when 1\n $data_items[@item_id]\n when 2\n $data_weapons[@item_id]\n when 3\n $data_armors[@item_id]\n when 4\n $data_fake_items[@item_id]\n else\n nil\n end\n end", "title": "" }, { "docid": "10d038d2cdbadd63980e11fdf6018319", "score": "0.6611305", "text": "def data\n fetch_data_by_key(:data)\n end", "title": "" }, { "docid": "86084340ce546cdd33ae4e114769c638", "score": "0.65793073", "text": "def raw\n @item\n end", "title": "" }, { "docid": "93a841ccd7d0f308fbde0a8667803f59", "score": "0.65739906", "text": "def item\n case item_type\n when 0\n return $data_items[item_id]\n when 1\n return $data_weapons[item_id]\n when 2\n return $data_armors[item_id]\n else\n return nil\n end\n end", "title": "" }, { "docid": "5f9d834feca8c3eda0b8596a9f8e3af5", "score": "0.65702146", "text": "def item\n case @item_type\n when nil, 0\n return nil\n when 1\n return $data_items[@item]\n when 2\n return $data_weapons[@item]\n when 3\n return $data_armors[@item]\n else\n return nil\n end\n end", "title": "" }, { "docid": "a4283ae6cd858872026a28daca190fa2", "score": "0.6524865", "text": "def get_data\n @data\n end", "title": "" }, { "docid": "de15c7e994f39d1dec93018d3cd9773f", "score": "0.6494858", "text": "def item\n case @kind\n when 1\n $data_items[data_id]\n when 2\n $data_weapons[data_id]\n when 3\n $data_armors[data_id]\n else\n nil\n end\n end", "title": "" }, { "docid": "91f9e2b9b207600ab48c6f604c9de0c2", "score": "0.64352757", "text": "def iteminfo\n @iteminfo ||= Dmm::Iteminfo.new(@attrs[:iteminfo])\n @iteminfo\n end", "title": "" }, { "docid": "13d5c4cff59e34d1033a0c82e36a68b0", "score": "0.6406833", "text": "def item\n Item.find(@item_id)\n end", "title": "" }, { "docid": "b735b21cbd2bc28756d820e215f7d43c", "score": "0.64034307", "text": "def data\n self[:data]\n end", "title": "" }, { "docid": "ef46d289dedeec4e37335e8ca1babd7e", "score": "0.63641393", "text": "def item\n @item\n end", "title": "" }, { "docid": "ef46d289dedeec4e37335e8ca1babd7e", "score": "0.63641393", "text": "def item\n @item\n end", "title": "" }, { "docid": "be5d25e203d70ca234fbbb3eb2842e5d", "score": "0.63609636", "text": "def get_data\n return @data\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "e876f625be56ba809c04981c50bcdd9a", "score": "0.63509774", "text": "def data\n attributes.fetch(:data)\n end", "title": "" }, { "docid": "13e3407a2baa513cbf6eaf80f253238f", "score": "0.63406944", "text": "def get_data\r\n @data\r\n end", "title": "" }, { "docid": "3ecdea44cc43dd3d3e5235b57b86e1e6", "score": "0.6340659", "text": "def values(item)\n item.attributes\n end", "title": "" }, { "docid": "9c5135dab8bd8a2124a23eea76b1fe16", "score": "0.6330384", "text": "def data\n @data\n end", "title": "" }, { "docid": "323e2973f9218cb63afc65d8f55d74d3", "score": "0.63288724", "text": "def data\n return @data\n end", "title": "" }, { "docid": "280869d3e90fb601d68a58d39e54451a", "score": "0.6305234", "text": "def item_schema\n @item_schema ||= GameItemSchema.new app_id, @@schema_language\n end", "title": "" }, { "docid": "913ba448e727aabe4257bcbd9e21f26f", "score": "0.62967837", "text": "def item_data(hsh)\n hsh[:attributes][:latest_data][:data][:attributes]\n end", "title": "" }, { "docid": "c3c122485b3feae75a22e8751e14fddc", "score": "0.62932897", "text": "def object\n return $data_skills[@item_id] if is_skill?\n return $data_items[@item_id] if is_item?\n return $data_weapons[@item_id] if is_weapon?\n return $data_armors[@item_id] if is_armor?\n return $data_titles[@item_id] if is_title?\n return $data_capacities[@item_id] if is_capacity?\n return $data_recipe[@item_id] if is_recipe?\n return nil\n end", "title": "" }, { "docid": "352a2e4a635153943cb6a038ba6d3aef", "score": "0.6289605", "text": "def data_attributes\n @data\n end", "title": "" }, { "docid": "74a6b102ffb81d615786904b05a76f38", "score": "0.62893134", "text": "def get_data\n @data\n end", "title": "" }, { "docid": "117b313936b8f499ff4bf489717f0d74", "score": "0.6284346", "text": "def item\n return @children['item'][:value]\n end", "title": "" }, { "docid": "41997e40d2a2bc19e48597caccb474fb", "score": "0.6283828", "text": "def items\n @item\n end", "title": "" }, { "docid": "fbee5e0532bba16b25f33c3d9d059668", "score": "0.6281709", "text": "def data\n document[:data]\n end", "title": "" }, { "docid": "48032ccef722f6a7ffced6f9cfea3d9a", "score": "0.62753224", "text": "def data\n self['data']\n end", "title": "" }, { "docid": "a7a3f7bcaa34b62f6f634587cf220140", "score": "0.6271364", "text": "def data\n @data\n end", "title": "" }, { "docid": "a7a3f7bcaa34b62f6f634587cf220140", "score": "0.6271364", "text": "def data\n @data\n end", "title": "" }, { "docid": "a7a3f7bcaa34b62f6f634587cf220140", "score": "0.6271364", "text": "def data\n @data\n end", "title": "" }, { "docid": "a7a3f7bcaa34b62f6f634587cf220140", "score": "0.6271364", "text": "def data\n @data\n end", "title": "" }, { "docid": "8c91bf91d660985a3a59d4f0f5ab7394", "score": "0.6268891", "text": "def item\n Item.find_by_id(@item_id)\n end", "title": "" }, { "docid": "c4d8d4238ad149b02e1ca298e48e65d0", "score": "0.6263861", "text": "def data\n check_type(DATA)\n return @data\n end", "title": "" }, { "docid": "d7c38b14af529fed54af8becd16e04db", "score": "0.62623775", "text": "def fields\n @data\n end", "title": "" }, { "docid": "2e4705d91fc576b1ef5904bcf0236bda", "score": "0.62520593", "text": "def data\n return @data\n end", "title": "" }, { "docid": "d44475c67853a65917f0c20ea807b473", "score": "0.623035", "text": "def item\n @data[@index]\n end", "title": "" }, { "docid": "2acb0924bcf6af7ba3eac5776ff57e89", "score": "0.62165046", "text": "def attributes\n data.attributes\n end", "title": "" }, { "docid": "dee8e66ef7dbbb47e183e8cab7a83f6e", "score": "0.62140214", "text": "def custom_data\n @custom_data\n end", "title": "" }, { "docid": "419ae20a58fb0c7930e841a3344ef602", "score": "0.61843586", "text": "def get_item(path)\n @db.object_data(path)\n end", "title": "" }, { "docid": "08a3e68233cff43cd335a220bb5a07a7", "score": "0.61840683", "text": "def get_data\n # Interface method\n end", "title": "" }, { "docid": "b5dbffdeb42837147fefcab60fc527f3", "score": "0.61765033", "text": "def data\n self\n end", "title": "" }, { "docid": "22335343bf09ef19239164f10b438708", "score": "0.61691517", "text": "def data\n get if !@data and exists?\n @data\n end", "title": "" }, { "docid": "fe2f1cb8b886d7c7298bf96dba65fd7d", "score": "0.6168185", "text": "def item_metadata\n @item = params[:item]\n @metadata = @item.head\n end", "title": "" }, { "docid": "0e1612b599ab3f373adf23ce32cdd10e", "score": "0.6164585", "text": "def items\n @item\n end", "title": "" }, { "docid": "f88750a7f2a92e121d1eb00c990b4b45", "score": "0.6159294", "text": "def item_data\n @item_data ||= begin\n values = []\n\n # Item data is on the 945 fields.\n marc_fields.each_with_index do |marc_field, index|\n next if marc_field.keys.first != \"945\"\n\n f_945 = marc_field[\"945\"]\n location_code = subfield_value(f_945, \"l\")\n barcode = subfield_value(f_945, \"i\")\n\n bookplate_code = subfield_value(f_945, \"f\")\n\n # bookplate URL and display text are on the next 996\n i = index + 1\n while i < marc_fields.count\n if marc_fields[i].keys.first == \"945\"\n # ran into a new 945, no bookplate info found.\n break\n end\n\n if marc_fields[i].keys.first == \"996\"\n f_996 = marc_fields[i][\"996\"]\n bookplate_url = subfield_value(f_996, \"u\")\n bookplate_display = subfield_value(f_996, \"z\")\n # parsed a 996, we should be done.\n break\n end\n i += 1\n end\n\n item = ItemData.new(barcode)\n item.location_code = location_code\n item.bookplate_code = bookplate_code\n item.bookplate_url = bookplate_url\n item.bookplate_display = bookplate_display\n values << item\n end\n values\n rescue StandardError => e\n Rails.logger.error \"Error parsing item_data for ID: #{self.fetch('id', nil)}, #{e.message}\"\n []\n end\n end", "title": "" }, { "docid": "6cd82ff635a9047b9b714ef79fe32022", "score": "0.61589795", "text": "def data\n @data || datastore['DATA']\n end", "title": "" }, { "docid": "b29987b765acb3fc51157443fbae77d9", "score": "0.6150407", "text": "def getData\n\t\t\treturn @data\n\t\tend", "title": "" }, { "docid": "206264857d9b690cad18a97d134e571f", "score": "0.61422646", "text": "def item\n end", "title": "" }, { "docid": "206264857d9b690cad18a97d134e571f", "score": "0.61422646", "text": "def item\n end", "title": "" }, { "docid": "206264857d9b690cad18a97d134e571f", "score": "0.61422646", "text": "def item\n end", "title": "" }, { "docid": "206264857d9b690cad18a97d134e571f", "score": "0.61422646", "text": "def item\n end", "title": "" }, { "docid": "1b4a24277754d1fb9bc3dacffa0b63f3", "score": "0.6139885", "text": "def getData()\n return @data\n end", "title": "" }, { "docid": "b2161a8fa1ebd8c6ad625fb4d3f41229", "score": "0.61306936", "text": "def data\n get if !@data and exists?\n @data\n end", "title": "" }, { "docid": "9b7bcd298d7a00bf238aa347dea92e0d", "score": "0.61301076", "text": "def data\n return {\n \"type\" => self.type,\n \"name\" => self.name,\n \"null\" => self.null?,\n \"maxlength\" => self.maxlength,\n \"default\" => self.default,\n \"primarykey\" => self.primarykey?,\n \"autoincr\" => self.autoincr?\n }\n end", "title": "" }, { "docid": "9b7bcd298d7a00bf238aa347dea92e0d", "score": "0.6129213", "text": "def data\n return {\n \"type\" => self.type,\n \"name\" => self.name,\n \"null\" => self.null?,\n \"maxlength\" => self.maxlength,\n \"default\" => self.default,\n \"primarykey\" => self.primarykey?,\n \"autoincr\" => self.autoincr?\n }\n end", "title": "" }, { "docid": "19ac0cedb2191a16c2e59b5e8d2e3d91", "score": "0.6129182", "text": "def item_info()\n db = connect_db()\n items = db.execute(\"SELECT * FROM items\")\n return items\n end", "title": "" }, { "docid": "35103e30ff46e3b2793d7e56e2598e94", "score": "0.61092293", "text": "def data\n @elements[:data]\n end", "title": "" }, { "docid": "36bdcbba5d7710b978b110d15d4e0688", "score": "0.6106788", "text": "def item\n Item.find(id)\n end", "title": "" }, { "docid": "00dff938ae8bde60ddde5b66c404952a", "score": "0.610177", "text": "def item\n @item ||= Item.new(full_response[\"Item\"])\n end", "title": "" }, { "docid": "1de2f126a32867b4d7c59be43839283e", "score": "0.6101761", "text": "def data\n @data ||= get\n end", "title": "" }, { "docid": "ac7bcf89cc930d35baed66a171f2b7c6", "score": "0.6078393", "text": "def metadata\n @data.fetch(\"metadata\")\n end", "title": "" }, { "docid": "1993ae9c0e77d1d245a6e7d357b40f38", "score": "0.6073526", "text": "def data\n @raw_data\n end", "title": "" }, { "docid": "abd1adef5dfd1af4a4fdc91034b80654", "score": "0.6062059", "text": "def data\n\t\treturn @data\n\tend", "title": "" }, { "docid": "c96ce8f506e69ceae756525492ce090a", "score": "0.6055542", "text": "def data\n\t\t\treturn elements[2]\n\t\tend", "title": "" }, { "docid": "9246715e000c28ac4ecb94e6eca1ac49", "score": "0.6035736", "text": "def data\n @data\n end", "title": "" }, { "docid": "d9f9a0cc55bd1ba7505ce25f110d8e76", "score": "0.6026799", "text": "def data\n @data\n end", "title": "" }, { "docid": "d9f9a0cc55bd1ba7505ce25f110d8e76", "score": "0.6026799", "text": "def data\n @data\n end", "title": "" }, { "docid": "d9f9a0cc55bd1ba7505ce25f110d8e76", "score": "0.6026799", "text": "def data\n @data\n end", "title": "" }, { "docid": "d9f9a0cc55bd1ba7505ce25f110d8e76", "score": "0.6026799", "text": "def data\n @data\n end", "title": "" }, { "docid": "d9f9a0cc55bd1ba7505ce25f110d8e76", "score": "0.6026799", "text": "def data\n @data\n end", "title": "" }, { "docid": "8247badef3c747e6549a2642f7bc9b8e", "score": "0.6026103", "text": "def value_for_item(it)\n it.data[uuid]\n end", "title": "" }, { "docid": "438951537f811c1f5484793e166fe080", "score": "0.6026033", "text": "def [](i)\n super :get_item_data, i\n end", "title": "" }, { "docid": "bc78405f7e3c374a696c36ef02afa166", "score": "0.6012269", "text": "def get_data\n\t\t@data\n\tend", "title": "" }, { "docid": "9cc3b98736cbceaf1d3b96b37c05e63a", "score": "0.6012256", "text": "def data\n raise NoMethodError, \"You have to implement private method 'data' with returns an array of fields.\"\n end", "title": "" }, { "docid": "ef9bb025b2532861610699fbe9cbb201", "score": "0.59943897", "text": "def data\n return @data\n end", "title": "" }, { "docid": "858279569cc9ddc18c40986b3f47b2b2", "score": "0.5984767", "text": "def item_data\n @idata ||= MultiJson.decode(params[:menu_items])\n end", "title": "" }, { "docid": "91ff7204b9b8f6e4166411b8ec6d517b", "score": "0.59793097", "text": "def metadata\n @data[1]\n end", "title": "" }, { "docid": "a1957028402871507a610bb35cc469d3", "score": "0.5977194", "text": "def product_meta_data\n end", "title": "" }, { "docid": "d49467414b2850506759c457e765b187", "score": "0.59681976", "text": "def getData\n\t\treturn @data\n\tend", "title": "" }, { "docid": "08a2d3bd66f0d29da307931ed7ba4e0c", "score": "0.5967936", "text": "def data\n @raw\n end", "title": "" }, { "docid": "38907ce71022f3a6b569e6ba22fc42ce", "score": "0.59651005", "text": "def data\n @raw\n end", "title": "" }, { "docid": "18ec11bcb5ba14ac615107edf696a7d4", "score": "0.5953868", "text": "def fetch_data(item)\n component = get_from_component\n release = get_from_release\n if release.key?(item)\n release[item]\n else\n component[item]\n end\n end", "title": "" }, { "docid": "87cbc0a8dd73bc6a844552f6b990a1d6", "score": "0.59529823", "text": "def attributes_for_new_item(data)\n {data: data}\n end", "title": "" } ]
ad138018ba8574cdfb139559c78ac560
This is how the array is split, if you can't tell by the regex: 0: user 1: ident 2: host 3: channel/user 4: message
[ { "docid": "a64fb3c361bdffb305446d834552a6c3", "score": "0.6463286", "text": "def grab_info(text)\n if text =~ /^\\:(.+)\\!\\~?(.+)\\@(.+) PRIVMSG \\#?(\\w+) \\:(.+)/\n return [$1, $2, $3, $4, $5]\n else\n return false\n end\n end", "title": "" } ]
[ { "docid": "d11abe985212a03caf71f3b0315494e6", "score": "0.6759121", "text": "def split_params(params)\n channels = params.select { |param| param.start_with?(\"#\") }.map { |param| param[1..] }\n users = params.select { |param| param.start_with?(\"@\") }.map { |param| param[1..] }\n \n return channels, users\n end", "title": "" }, { "docid": "3bd0b7f116e38db0e32847b8e3aa9a5a", "score": "0.6756705", "text": "def split_params(params)\n channels = params.select { |param| param.start_with?(\"#\") }.map { |param| param[1..-1] }\n users = params.select { |param| param.start_with?(\"@\") }.map { |param| param[1..-1] }\n return channels, users\n end", "title": "" }, { "docid": "226913d0777f4a7e29f1ee91f33f7b21", "score": "0.65036505", "text": "def split_msg(msg)\n sub_end = MAX_CHAR - 5\n # Goes back to start of word if matches inside a word. If it matches inside a coloured key go back to start of word before colour\n # Remove starting whitespace. Sometimes creates empty array indice so remove if length isn't long enough\n arr = msg.scan(/.{0,#{Regexp.escape(sub_end.to_s)}}[\\\\033\\[0-90-9m\\w\\\\e\\[0m\\ ]{0}(?:\\ |$)/mi).select { |s| s.length > 1 }.each { |n| n.slice!(0) if n[0] == \" \"}\n end", "title": "" }, { "docid": "bd1509b557861bcd95f1090309ca79ee", "score": "0.6188501", "text": "def splitter(data)\n data.split(%r{(?:@)[^\\s]+|(?:http)s?:\\/[^\\s]+|\\W}).reject(&:empty?)\n end", "title": "" }, { "docid": "0bef88fac84aa4a59d5acd868a0b9773", "score": "0.6160114", "text": "def domain_username_split(user)\n return user if(user.nil? || user.empty?)\n if !user[/\\//] # Only /, not \\!\n return [nil,user]\n else\n return user.split(\"/\",2)\n end\n end", "title": "" }, { "docid": "b779c7528aa85349a6f74e06dd98f6c2", "score": "0.6155799", "text": "def msgData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"who\" => arr[2], \"event\" => arr[3][1..-1], \"args\" => arr[4..-1].join(\" \")}\n end", "title": "" }, { "docid": "01460bb831687491d905e117745635b1", "score": "0.6069269", "text": "def parse_message message\n message.split(\"=>\").map { |i| i.strip }\n end", "title": "" }, { "docid": "d22223a632b60524f84e3a41af862133", "score": "0.6014351", "text": "def parse\n emails.split(/, | /).uniq\n end", "title": "" }, { "docid": "61bc549e0e47fac39e4ce79ab3f43aca", "score": "0.5977125", "text": "def split_login(str)\n login = []\n # search from the right so we don't pick out ampersands in a\n # password or username\n if i = str.rindex(?@)\n login << str[i+1..-1]\n if 0 < i\n str = str[0..i-1]\n i = str.index(?:)\n if 0 == i\n login << '' << str[i+1..-1]\n elsif i\n login << str[0..i-1] << str[i+1..-1]\n else\n login << str\n end\n else\n login << ''\n end\n else\n login << str\n end\n if login.first.sub!(/:(\\d+)$/,'')\n login << $1.to_i\n else\n login << nil\n end\nend", "title": "" }, { "docid": "76b45dff6aa513d20e81c456ddb3e2b1", "score": "0.5910064", "text": "def split\n [@protocol,\n @userinfo,\n @host,\n @port,\n @registry,\n @path,\n @opaque,\n @query,\n @fragment]\n end", "title": "" }, { "docid": "8f6ccbbf54c288392ecb8edeb53591b1", "score": "0.5901072", "text": "def split_email_at_reply(text)\n text.split(/(-----Original Message-----|Sent from my iPhone|Sent from my BlackBerry|On\\s.+?\\n?.+?wrote:|________________________________)/, 2)\n end", "title": "" }, { "docid": "f33e01a6ae1d80095d97fdd44b131946", "score": "0.5883681", "text": "def nickservData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"to\" => arr[2], \"usr\" => arr[3][1..-1], \"status\" => arr[5]}\n end", "title": "" }, { "docid": "3cf604855a487a45d75913983c65c26f", "score": "0.58729804", "text": "def parse_discord_user(msg)\n user = msg[NAME_PATTERN, 2].downcase\n raise OutteError.new \"You need to provide a user.\" if user.nil?\n\n parts = user.split('#')\n users = User.search(parts[0], !parts[1].nil? ? parts[1] : nil)\n case users.size\n when 0\n raise OutteError.new \"No user named #{user} found in the server.\"\n when 1\n return users.first\n else\n list = users.map{ |u| u.username + '#' + u.tag }.join(\"\\n\")\n raise OutteError.new \"Multiple users named #{parts[0]} found, please include the numerical tag as well:\\n#{format_block(list)}\"\n end\nend", "title": "" }, { "docid": "8dc555e36001628db9dfd7e13459d5de", "score": "0.5834833", "text": "def segments\n message.split(%r(\\n\\n(?=[<>])))\n end", "title": "" }, { "docid": "d1397d3141b517a4c295d8885ebe11dc", "score": "0.5810993", "text": "def content_from(mesg)\n mesg.slice(6..mesg.length).split(',')\nend", "title": "" }, { "docid": "75c4d2e563eeb9d6618856d7311f65de", "score": "0.58075863", "text": "def parse\n @emails.split(/[,\\s]+/).uniq\n end", "title": "" }, { "docid": "9b626acd55ac2907b12360cbe596aeef", "score": "0.5765842", "text": "def relayed_nick_parts\n @relayed_nick_parts ||= cinch_user.nick.split('/', 2)\n end", "title": "" }, { "docid": "040f50a837ad81d576512452a266f22e", "score": "0.57532936", "text": "def process_irc message\n res = message.scan(/\\00314\\[\\[\\00307(.*)\\00314\\]\\]\\0034\\s+(.*)\\00310\\s+\\00302.*(diff|oldid)=([0-9]+)&(oldid|rcid)=([0-9]+)\\s*\\003\\s*\\0035\\*\\003\\s*\\00303(.*)\\003\\s*\\0035\\*\\003\\s*\\((.*)\\)\\s*\\00310(.*)\\003/).first\n #get rid of the diff/oldid and oldid/rcid groups\n res.delete_at(4)\n res.delete_at(2)\n res\n end", "title": "" }, { "docid": "31f31b678ae6aa29f00905bc90cd64dc", "score": "0.57248366", "text": "def split(parts); end", "title": "" }, { "docid": "a65e168b9912899b6110bad439fd10da", "score": "0.57112575", "text": "def parse\n # emails = email_parser.scan(/\\w+@\\w+.\\w+/).uniq\n @emails.scan(/\\w+@\\w+.\\w+/).uniq\n end", "title": "" }, { "docid": "0a229b636d5c24cfc66de79e5b7ee2bb", "score": "0.5708741", "text": "def process_message(message)\n msg = message.to_s\n\n if msg =~ /[\\.\\?!;]/\n msg.split(/[\\.\\?!;]/)\n if msg.is_a? String\n process_sentence(msg)\n else\n msg.each do |m|\n process_sentence(m)\n end\n end\n else\n process_sentence(msg)\n end\n end", "title": "" }, { "docid": "986d25d8e3c36a42dfd5c8a7b5c4cd5a", "score": "0.56734955", "text": "def emails\n email.split(/[, ]/)\n end", "title": "" }, { "docid": "556bb57c1cb686d26403353f75a5fe15", "score": "0.56587905", "text": "def split; end", "title": "" }, { "docid": "663bad33086ccddd09bc16afdcb4e82e", "score": "0.560514", "text": "def categorize_sms_content(content)\n\n \tcontent = content.strip\n\n \tif (content.include? '#')\n \t\tif(content.include? ' ')\n \t\t\tupdated_content = content.split(/\\s*#\\s*/)\n \t\telse\n \t\t\tupdated_content = content.split('#')\n \t\tend\n \t\tif (updated_content.length == 1)\n \t\t\treturn updated_content[0].delete! ' #'\n \t\tend\n \t\treturn updated_content\n \telsif (content.include? ' ')\n \t\tsplit_content = content.split(/\\s* \\s*/)\n \t\tif (split_content.length < 3)\n \t\t\treturn split_content \n \t\telse\n \t\t\treturn [split_content[0], split_content[1]]\n \t\tend\n\tend\n\treturn content\n end", "title": "" }, { "docid": "81d1d0022e4d26955d3c44df95179fc0", "score": "0.55810064", "text": "def parse_incoming_message(message, user)\n winning_team_id, score = message.split(\",\")\n if !winning_team_id || !score\n send_message(\"Invalid format detected. Valid format: #{user_pick_format}.\" +\n \" Valid teams: #{valid_teams_pretty}\")\n return\n end\n\n if !Team.find(winning_team_id)\n send_message(\n \"Invalid Team ID for this pool. Valid teams: #{valid_teams_pretty}\",\n user,\n )\n return\n end\n\n home_team_score, away_team_score = score.split(\"-\").map(&:strip)\n if !home_team_score || !away_team_score\n send_message(\"Invalid Score Format detected. The score should have the winning\" +\n \" teams total first, and the losing teams second, separated by a dash.\")\n return\n end\n end", "title": "" }, { "docid": "203ab70aba2761f767f39764cc24e031", "score": "0.55766326", "text": "def extract_message(input)\n sender = nil\n content = nil\n is_action = false\n \n stripped = input.strip\n if stripped[0...1] == '*' # action\n is_action = true\n stripped = stripped[1..-1].split(' ')\n sender = stripped[0]\n content = stripped[1..-1].join(' ')\n else\n scanned = /<([^>]*)> (.*)/.match(stripped)\n sender = scanned[1].strip\n content = scanned[2]\n end\n \n [{:ident => sender, :name => sender, :host => nil}, content, is_action]\n end", "title": "" }, { "docid": "5f3a205924b5e49863232582356973e9", "score": "0.5566156", "text": "def email_parser(str) \n str.gsub(/, /,\" \").gsub(/,/,\" \").split.uniq\nend", "title": "" }, { "docid": "221994b536dc8e7b3d55375eb951af9b", "score": "0.5557803", "text": "def split_request_message(message)\n header_and_body = message.split(/\\n\\n/)\n if header_and_body[0]\n message_type = header_and_body[0].split(/\\n/)[0]\n header_element = header_to_hash(header_and_body[0])\n end\n return message_type, header_element, header_and_body[1]\n end", "title": "" }, { "docid": "7cb89ded07400e3abc16cd866034cebd", "score": "0.55404735", "text": "def parse \n #splits using regex\n #regex => comma space or space\n email_arr = @emails.split(/,\\s|\\s/)\n print email_arr\n #use set intersection with itself to remove dups\n (email_arr & email_arr)\n\n end", "title": "" }, { "docid": "812aaa6bff1e240f115df72ae9eb1385", "score": "0.55315226", "text": "def components(host_string)\n host_string = host_string.strip\n\n # IPv6\n if host_string.start_with?('[')\n end_idx = host_string.index(']')\n raise ::Aerospike::Exceptions::Parse, 'Invalid IPv6 host' if end_idx.nil?\n\n # Slice away brackets and what's inside them, then split on : and\n # replace first entry with string inside brackets\n host_string.slice(end_idx+1..-1).split(':').tap do |result|\n result[0] = host_string[1...end_idx]\n end\n else\n host_string.split(?:)\n end\n end", "title": "" }, { "docid": "5756d68c16eca8db460c8cda0714af47", "score": "0.5528272", "text": "def parse_args(str)\n return str.split(/\\s+:(.*)|\\s+/)\n end", "title": "" }, { "docid": "22887f7f9fa87c05d5990e1649b29a40", "score": "0.550582", "text": "def is_valid_email(str)\n parts = str.split(\"@\")\n print parts\n puts\n\nend", "title": "" }, { "docid": "2c085638bed5535819fbbc5861eace86", "score": "0.54888254", "text": "def parse_list(user, listfile)\n #match only first found line, there should be no duplicates; also, case insensitive SHOULD be ok.\n line=File.readlines(listfile).select { |line| line =~ /#{user}/i }[0]\n val=line.split(':')\n return val[6].strip, val[1], val[2].strip, home \nend", "title": "" }, { "docid": "05ae0e8be5187292b36e6e1f5a463cb2", "score": "0.54661816", "text": "def normalize_user_mentions(text)\n users = []\n\n text.gsub!(NORMALIZE_USER_REGEXP) do\n prefix = $1\n user = $2\n users.push(user)\n \"#{prefix}@user#{users.size}\"\n end\n\n users\n end", "title": "" }, { "docid": "e0d4ce79dbe8a1c6302ae6d90ce0e6d2", "score": "0.5465746", "text": "def parts\n @parts ||= begin\n ary = string.split(/said/i, 2)\n if ary.size == 2 && ary[0].size > 31\n [string]\n else\n ary\n end\n end\n end", "title": "" }, { "docid": "25341ddb6fb2e8d123bd89e746c7735b", "score": "0.54537314", "text": "def extract\n _, *ret = *self.match(/\\A([^\\s!]+)(?:!([^\\s@]+)@(\\S+))?\\z/)\n ret\n end", "title": "" }, { "docid": "a8fad65165673d586a8d2b3732ba6902", "score": "0.54382473", "text": "def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "title": "" }, { "docid": "bd0507b8a7fe3042321633e847930289", "score": "0.54295933", "text": "def split_by_key_and_value(text)\n text.match(/(^[^:]+):([^$]*)/)\n end", "title": "" }, { "docid": "df658d09e850076abf9ab539bc52ae55", "score": "0.54211694", "text": "def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end", "title": "" }, { "docid": "f58b35380e0dec82d474585849df2e4e", "score": "0.5404932", "text": "def process_part(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users.delete user if channel.users.key? user\n end", "title": "" }, { "docid": "be22e470423628b8abf991c1f3041099", "score": "0.5384215", "text": "def line_split str\n content = str.split(': ')[1] || ''\n if content.match /\\//\n content.split('/').map(&:strip).reject(&:empty?)\n else\n content\n end\n end", "title": "" }, { "docid": "9574c4a6e410a17192fd060eb1b3e050", "score": "0.5374915", "text": "def codes_from_message(message_array)\n message_array.collect { |st| st.split(':')[1] if st.include?(':') }.compact\n end", "title": "" }, { "docid": "629ab5090abd3615db91c968041af9c9", "score": "0.53717214", "text": "def parse_message(msg, user, room)\n if msg =~ REGEX\n execute_command(msg, user, room)\n elsif @afk_users.any?{ |i| msg =~ /#{i}/ }\n room.speak(\"[Status] #{user}: user #{@afk_users.select{ |i| msg =~ /#{i}/ }.first} is afk.\")\n end\n end", "title": "" }, { "docid": "4c9ae3cd773c016e65cc98647540886e", "score": "0.53583324", "text": "def parse_snmp_users(text)\n text.split(\"\\n\\n\").map do |user_s|\n user_s.scan(/^(\\w+).*?: (.*)/).each_with_object({}) do |(h, v), m|\n key = SNMP_USER_PARAM[h.downcase.intern] || h.downcase.intern\n m[key] = case key\n when :privacy then v =~ /AES/ ? :aes128 : :des\n when :version then v.sub('v2c', 'v2').intern\n when :auth then v.downcase.intern\n when :roles then v.sub(/ \\(.*?\\)/, '')\n else v.downcase\n end\n end\n end\n end", "title": "" }, { "docid": "510389670e6b69c6ece1c13e4bb5113e", "score": "0.53574455", "text": "def test_parser_handles_single_delim_with_text_email_array\n text = 'To Name'\n delim = ApiParser.email_delim\n\n email_array_assert [text, text], \"#{text}#{delim}#{text}\"\n end", "title": "" }, { "docid": "10800c196de91edd059104407fc7a270", "score": "0.5354901", "text": "def command_from_text(text, username = nil)\n return unless text\n match = text.match CMD_REGEX\n return unless match\n return if match[3] && username != true && match[3] != username\n [match[1], text.split.drop(1)]\n end", "title": "" }, { "docid": "9bb0508deba9ccf92d62c9537f570626", "score": "0.5354316", "text": "def parse_prefix(prefix)\n nick_and_user, host = String(prefix).split \"@\", 2\n\n if host.nil?\n if nick_and_user.include? \".\"\n servername = nick_and_user\n else\n nickname = nick_and_user\n end\n else\n nickname, user = nick_and_user.split \"!\", 2\n end\n\n [nickname, user, host || servername]\n end", "title": "" }, { "docid": "08b37ec9532887462e128941663639ba", "score": "0.53429353", "text": "def parse(message)\n if message.start_with? \":\"\n prefix, command, parameters = message[1..-1].strip.split(\" \", 3)\n else\n command, parameters = message.strip.split(\" \", 2)\n end\n\n if parameters.nil?\n parameters = []\n elsif parameters.start_with? \":\"\n trailing = parameters[1..-1]\n parameters = []\n else\n parameters, trailing = parameters.split(\" :\", 2)\n parameters = parameters.split(\" \")\n end\n\n return [prefix, command, parameters.compact, trailing]\n end", "title": "" }, { "docid": "a3640389d597a0060fe7b448f846dc2e", "score": "0.53409225", "text": "def extract_mentions( text )\n regex = /(?:^|\\s)@(\\w*)(?:\\s|\\z|$)/\n usernames_array = text.scan(regex).flatten\n ids = User.where(username: usernames_array).pluck(:id) - [current_user.id] if usernames_array\n ids.blank? ? false : ids\n end", "title": "" }, { "docid": "093eef9d2e15fa09f46364d1d8023d31", "score": "0.53405786", "text": "def eval_first_msg(umsg,sock)\n user_info = umsg.split(\" \")\n if umsg =~ /user_info:/\n @user_info.push({:nickname => user_info[1],:role => \"client\", :channels => [], :mode => \"pull\", :time => Time.now})\n sock.write(\"Welcome #{user_info[1]}\\n\")\n @@connection.insert_user user_info[1]\n @user_info.last[:channels] = @@connection.fill_channels_user(user_info[1])\n elsif (umsg =~ /source_info:/) \n @user_info.push({:nickname => user_info[1],:role => \"editor\",:status => \"logging\"}) \n sock.write(\"password:\\n\")\n elsif (umsg =~ /admin_info:/ )\n @user_info.push({:nickname => user_info[1],:role => \"admin\", :status => \"logging\"}) \n sock.write(\"password:\\n\")\n end \n end", "title": "" }, { "docid": "283b8b70b185613f9674836e3937f4af", "score": "0.5336695", "text": "def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#', '').split(',').map(&:strip)\n end", "title": "" }, { "docid": "91a683de8e25f9cccb56d20c9b9b46c1", "score": "0.53256106", "text": "def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end", "title": "" }, { "docid": "f5aa51ff5adfab12e5967e496c612811", "score": "0.53182906", "text": "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", "title": "" }, { "docid": "faf9acf883915740af40f23cdf224845", "score": "0.5317563", "text": "def unpack(data)\n data.to_s.split(\"/\")\n end", "title": "" }, { "docid": "649fb67585b4dd86b1f7c40ef981f332", "score": "0.5314221", "text": "def split_by_separator(affi_string, auth_id)\n tokens = []\n if affi_string.include?(\",\") and affi_string.include?(\";\")\n tokens = affi_string.split(\";\")\n tokens.each do |token|\n if token.include?(\",\")\n split_idx = tokens.find_index(token)\n temp_tkns = token.split(\",\")\n tokens = tokens[1..split_idx-1].concat(temp_tkns).concat(tokens[split_idx+1..])\n end\n end\n elsif affi_string.include?(\",\")\n tokens = affi_string.split(\",\")\n elsif affi_string.include?(\";\")\n tokens = affi_string.split(\";\")\n end\n\n if tokens != []\n return create_affi_obj(tokens, auth_id)\n else\n return nil\n end\nend", "title": "" }, { "docid": "b6eb7a4788a1b530cd434aa14f8783ed", "score": "0.53115386", "text": "def parse\n csv_emails.split(/,?\\s/).uniq\n end", "title": "" }, { "docid": "7635da9a09d8c3e4e5d203ab3d49230a", "score": "0.53097934", "text": "def parse_user_list(msg_details)\n # we expect records separated by ;\n eol_flag = false\n state = :data_slice\n records_part = msg_details.split(\";\")\n if records_part.size == 0\n @log.error(\"user_list format error\")\n state = :error\n eol_flag = false\n return state, eol_flag\n end\n records_part.reverse!\n header_part = records_part.pop\n \n header_arr = header_part.split(\",\")\n if header_arr.size >= 2\n # a list is empty if the third elemt is the string \"empty\"\n # format is: \"0,eof,empty\"\n if header_arr[1] =~ /empty/\n # list is empty\n @log.debug(\"user_list is empty\")\n state = :list_empty\n eol_flag = true\n return state, eol_flag\n end\n else\n @log.error(\"user_list header format error\")\n state = :error\n eol_flag = false\n return state, eol_flag\n end\n\n #exams header\n list_ix = header_arr[0].to_i\n # check if it is the first list slice\n if list_ix == 0\n state = :first_slice\n end \n\n # process records\n @last_parsed_userlist_data = []\n record_item = records_part.pop\n while record_item\n record_data = record_item.split(\",\")\n if record_data\n if record_data.size == 4\n user_info_hash = {:name => record_data[0], \n :lag => record_data[1], :type => record_data[2], :stat => record_data[3]}\n @last_parsed_userlist_data << user_info_hash\n # update also the global pg_list\n nick = record_data[0]\n @userlist_table[nick] = user_info_hash\n else\n @log.warn \"user_list: ignored record malformed #{record_item}\"\n end \n end\n record_item = records_part.pop\n end\n\n # insert recognized records\n if @last_parsed_userlist_data.size > 0\n @log.debug \"user_list: recognized #{@last_parsed_userlist_data.size} users\"\n else\n @log.error \"user_list: no user found, but list not empty\"\n end\n\n # if the list of pending game is terminated then request a list of user\n if header_arr[1] =~ /eof/\n eol_flag = true\n end\n return state, eol_flag\n end", "title": "" }, { "docid": "c02b685263c9a903f519894d83a255d2", "score": "0.52985764", "text": "def parse\n @email_parser = email_parser.scan(/\\w+@\\w+.\\w+/)\n @email_parser.uniq\n end", "title": "" }, { "docid": "f7ac58ca8089f168ace27567958a2af4", "score": "0.52781695", "text": "def parse_mail_from( data )\n mailfrom, esmtp_info = data.split(\"\\0\", 2 )\n return [mailfrom, esmtp_info.split(\"\\0\")]\n end", "title": "" }, { "docid": "69225bc74863eb41f6d19ba313aefed4", "score": "0.5271081", "text": "def split_userinfo(ui)\n return nil, nil unless ui\n user, password = ui.split(':', 2)\n\n return user, password\n end", "title": "" }, { "docid": "4e15fa8c8982c8f2f2a8f97c1e619b4d", "score": "0.5270977", "text": "def tweet(str)\n arr = []\n scans = str.scan(/(@\\w+)|(#\\w+)/)\n scans.each do |x|\n x.each do |y|\n if y\n arr.push y\n end\n end\n end\n arr.join ' '\nend", "title": "" }, { "docid": "96f2c05279da2245311fc3d796291dd7", "score": "0.52695566", "text": "def parse_rcpt_to( data )\n mailto, esmtp_info = data.split(\"\\0\", 2 )\n return [mailto, esmtp_info.split(\"\\0\")]\n end", "title": "" }, { "docid": "4e816a6956963ef48a56adb59d72b142", "score": "0.5269184", "text": "def scan_message(message)\n out = []\n out << 'recall_hold' if message =~ /Recall/i\n out << 'recall_hold' if message =~ /hold /\n out << 'borrow_direct' if message =~ /Borrow/\n out << 'ill' if message =~ /ILL/\n out << 'in_process' if message =~ /In Process/\n # ReCAP Partners\n out << 'offsite_valet' if message =~ /scsb/\n out\n end", "title": "" }, { "docid": "3c7f97959a7669bf323945725d7650c1", "score": "0.52388114", "text": "def id_split(item)\n case item\n when Array then array = item.flat_map { |v| id_split(v) }\n when String then array = item.split(/[ \\t]*[,;\\n]+[ \\t]*/)\n when PublicationIdentifier then array = Array.wrap(item)\n else array = Array.wrap(item).map(&:to_s)\n end\n array.compact_blank!\n end", "title": "" }, { "docid": "8328952fd9ccfb68a081d8ab5803abbe", "score": "0.5227815", "text": "def words\n message.split\n end", "title": "" }, { "docid": "e6958bcb2b5ebaf8cfad0a9cc2580d0f", "score": "0.52248484", "text": "def members\n subscribers.split\n end", "title": "" }, { "docid": "66960b6b391b7202f864917e3aeedb08", "score": "0.52189773", "text": "def ipsplit(str)\n interface, address, defrouter = str.split(':')\n return interface, address, defrouter\n end", "title": "" }, { "docid": "4a6b1e1faf0249bb70eda5d60239a991", "score": "0.52045274", "text": "def parse message\n\t\t\treturn nil unless message.valid_encoding?\n\t\t\tmessage = message.dup\n\t\t\tprefix = message.slice!(/\\S+/)\n\t\t\treturn nil unless prefix\n\t\t\tid, command = prefix.scan(/(\\d+:)?(\\w+)/).flatten\n\t\t\tid = id.delete(\":\").to_i if id\n\t\t\tid = nil if id == 0\n\t\t\tif message.include?(':')\n\t\t\t\tmessage = Hash[*message.scan(/(\\w+):([^:\\s]+)/).flatten].symbolize_keys if message.include?(':')\n\t\t\t\tmessage.each_key {|k| message[k] = message[k].to_i if message[k].is_numeric?}\n\t\t\telse\n\t\t\t\tmessage.delete!(' ')\n\t\t\tend\n\t\t\treturn [id, command, message]\n\t\tend", "title": "" }, { "docid": "5649a1aa9ed4ce72c677f337c00c0527", "score": "0.519174", "text": "def split pattern=$;, *more\n arr = super\n i = 0\n interval = 0\n interval = (self.length - arr.join.length) / (arr.length - 1) if\n arr.length > 1\n\n arr.map do |str|\n ds = self.class.new str\n ds.meta = @meta[i,str.length]\n i += str.length + interval\n ds\n end\n end", "title": "" }, { "docid": "c64275e1105be2b54a6c2a94af2301dd", "score": "0.51912814", "text": "def split_url\n match = /(?:(?:git|ssh)@(.*):|(?:https?:\\/\\/(.*?)\\/))(.*).git/.match(url)\n match.captures.compact if match\n end", "title": "" }, { "docid": "8cbc3723d003c1fab1092650d980cde8", "score": "0.5185537", "text": "def parse\n\t\tparsed = @email.split(\" \")\n\t\tparsed.each do |email|\n\t\t\tif email[-1] == \",\"\n\t\t\t\temail.chomp!(\",\")\n\t\t\tend\n\t\tend\n\t\tparsed.uniq\n\tend", "title": "" }, { "docid": "ff28d1da7abb98b82a7c5eaa6ea74d5c", "score": "0.51836216", "text": "def basic_parse(msg) \n\t\tcase msg\n\t\t#Received PING from Server. Send PONG\n\t\twhen /^PING :(.*)$/\n\t\t\tsend(\"PONG #{$~[1]}\")\n\t\t\tdo_not_put = true \n\t\t# if message from another user, parse to have user: message pretty stuff\n\t\twhen /^:(.*)!(.*) PRIVMSG (.*) :(.*)$/\n\t\t\tputs \"#{$~[1]}: #{$~[4]}\"\n\t\t\tprint(\"--> \")\n\t\t# This is generally the final message sent by Twitch after a successful connection. So let's tell\n\t\t# the user that we're connected\n\t\twhen /^:(.*) 366 (.*)$/\n\t\t\tputs msg\n\t\t\tprint(\"Connected... --> \")\n\t\t# If we don't match anything above, then just display the message as is\n\t\telse\n\t\t\tputs msg\n\t\tend\n\tend", "title": "" }, { "docid": "d3fa19f76d2db33bf97493f2b126310a", "score": "0.51776606", "text": "def split_info(object)\n\t\treturn object.match('(\\d+)\\s+(.*).md$') || object.match('(\\d+)\\s+(.*)$') || [object, 0, object]\n\tend", "title": "" }, { "docid": "e48258278c23f9838148e5815a8cc313", "score": "0.5173012", "text": "def preprocess_message(message, bot)\n # ignore if message is not from you\n return [false, '', ''] if message.from.id != Config.config['user']['tg_id']\n\n command_data = message.entities.find { |entity| entity.type == 'bot_command'}\n return [false, '', ''] if command_data.nil? # message to bot without command\n\n if command_data.offset != 0\n bot.api.send_message(chat_id: message.chat.id, text: 'Please give bot command first in your message :)')\n return [false, '', '']\n end\n\n long_command = message.text[0, command_data.length]\n command, bot_name = split_command_botname(long_command)\n text = message.text[command_data.length + 1, message.text.length]\n\n # ignore message cause it was adressed to another bot\n return [false, '', ''] if !bot_name.nil? && bot_name != Config.config['bot']['username']\n\n [true, command, text]\nend", "title": "" }, { "docid": "521d3d43b712b095e15017f3c2392276", "score": "0.51677716", "text": "def follow_message(users,mobile)\n users = users.split(',')\n\n message = \"Followed by \"\n\n if mobile\n message << users.first\n else\n if users.length <= 2\n message << users[0..1].join(\" and \")\n elsif users.length == 3\n message << users[0..1].join(\", \") + \" and 1 other\" \n else\n message << users[0..1].join(\", \") + \" and #{users.length - 2} others\" \n end\n end\n \n end", "title": "" }, { "docid": "745c5331ad1e32cb7f71a31ed3e271e5", "score": "0.5166889", "text": "def fields(string)\n string.split(/\\W+/)\nend", "title": "" }, { "docid": "cbf81377a77b289f382e7ea366bfa2e5", "score": "0.5166866", "text": "def message_split(name)\n messages = @data[name]\n\n char_me = 0\n char_them = 0\n\n messages.each do |msg|\n begin\n if msg[2].to_i == 2\n char_me = char_me + msg[1].size\n else\n char_them = char_them + msg[1].size\n end\n rescue\n next\n end\n end\n\n puts \"My char count: #{char_me} | Their char count: #{char_them}\"\n\n end", "title": "" }, { "docid": "ad4405aff6016a7926846f94ea30745a", "score": "0.5157678", "text": "def test_parser_handles_multiple_delim_no_text_email_array\n delim = ApiParser.email_delim\n\n email_array_assert ['', '', ''], \"#{delim}#{delim}\"\n email_array_assert ['', '', '', ''], \"#{delim}#{delim}#{delim}\"\n email_array_assert ['', '', '', '', ''], \"#{delim}#{delim}#{delim}#{delim}\"\n end", "title": "" }, { "docid": "6f72e252bd7351c47c20250a38b56dad", "score": "0.51550776", "text": "def sentence_to_array (string)\n string_split = string.split('.')\n string_split.map! do |words|\n words.split('!') \n end\n string_split.flatten!\n\n string_split.map! do |words|\n words.split('?') \n end\n string_split.flatten\nend", "title": "" }, { "docid": "a84278b06035f68e3c6112109f5359c6", "score": "0.51548314", "text": "def parseChat\n messages = Array.new\n unless @fields.empty?\n @fields[0].each do |message|\n messages << ChatMessage.new(\n message[0],\n message[1],\n self.class.normalizeData(message[2]),\n message[3].to_i,\n message[4].to_i,\n message[5].to_i,\n message[6].to_i,\n )\n end\n end\n return messages.reverse\n end", "title": "" }, { "docid": "4f2b88b5edfaecab5b2eeac6a67e7085", "score": "0.51433784", "text": "def split(pattern=$;, limit=0) end", "title": "" }, { "docid": "4f2b88b5edfaecab5b2eeac6a67e7085", "score": "0.51433784", "text": "def split(pattern=$;, limit=0) end", "title": "" }, { "docid": "bfa73b1d04f5738b5cb1d6fb7444b2d1", "score": "0.5117974", "text": "def split_port(host_string)\n #TODO figure out why the call to Simplib.split_port doesn't work, so\n # we don't have to replicate that code\n# require 'puppetx/simp/simplib'\n# host,port = PuppetX::Simp::Simplib.split_port(host_string)\n# # remove [] for IPv6\n# host.gsub!('[', '')\n# host.gsub!(']', '')\n\n return [nil,nil] if host_string.nil? or host_string.empty?\n\n # CIDR addresses do not have ports\n return [host_string, nil] if host_string.include?('/')\n\n # IPv6 Easy\n if host_string.include?(']')\n host_pair = host_string.split(/\\]:?/)\n host_pair[1] = nil if host_pair.size == 1\n\n # remove '[' and ']' from IPv6 address\n host_pair[0].gsub!('[', '')\n host_pair[0].gsub!(']', '')\n # IPv6 Fallback\n elsif host_string.count(':') > 1\n host_pair = [host_string, nil]\n # Everything Else\n elsif host_string.include?(':')\n host_pair = host_string.split(':')\n else \n host_pair = [host_string, nil]\n end\n\n host_pair\n end", "title": "" }, { "docid": "5a062dcea565a5f382e396056c7a9002", "score": "0.5108282", "text": "def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend", "title": "" }, { "docid": "120170b1c8ef7dd7a338c892a5b21c08", "score": "0.51067257", "text": "def _separate args, pattern=nil #/^[a-zA-Z]/ \n tag = nil\n items = []\n args.each do |arg| \n if arg =~ /^[0-9\\.]+$/\n items << arg\n else\n tag = arg\n if pattern\n die \"#{@action}: #{arg} appears invalid.\" if arg !~ pattern\n end\n end\n end\n items = nil if items.empty?\n return tag, items\n end", "title": "" }, { "docid": "ccb63fe0ffa416e4e6c4b3e30fa9fd6f", "score": "0.51058984", "text": "def test_parser_handles_no_delim_with_text_email_array\n text = 'To Name'\n\n email_array_assert text, text\n end", "title": "" }, { "docid": "6994b7b95d7ca993ccd208fdcecc7a00", "score": "0.5105697", "text": "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", "title": "" }, { "docid": "b4b66d7b0e677808f7491b4701e2b3ff", "score": "0.51012295", "text": "def parse_mentions(mentions, server = nil)\n array_to_return = []\n # While possible mentions may be in message\n while mentions.include?('<') && mentions.include?('>')\n # Removing all content before the next possible mention\n mentions = mentions.split('<', 2)[1]\n # Locate the first valid mention enclosed in `<...>`, otherwise advance to the next open `<`\n next unless mentions.split('>', 2).first.length < mentions.split('<', 2).first.length\n\n # Store the possible mention value to be validated with RegEx\n mention = mentions.split('>', 2).first\n if /@!?(?<id>\\d+)/ =~ mention\n array_to_return << user(id) unless user(id).nil?\n elsif /#(?<id>\\d+)/ =~ mention\n array_to_return << channel(id, server) unless channel(id, server).nil?\n elsif /@&(?<id>\\d+)/ =~ mention\n if server\n array_to_return << server.role(id) unless server.role(id).nil?\n else\n @servers.each_value do |element|\n array_to_return << element.role(id) unless element.role(id).nil?\n end\n end\n elsif /(?<animated>^a|^${0}):(?<name>\\w+):(?<id>\\d+)/ =~ mention\n array_to_return << (emoji(id) || Emoji.new({ 'animated' => !animated.nil?, 'name' => name, 'id' => id }, self, nil))\n end\n end\n array_to_return\n end", "title": "" }, { "docid": "2655c2dc67765a734269dfe42e8048ac", "score": "0.5086897", "text": "def fields(text) \n p text.split(/[,\\s]+/)\nend", "title": "" }, { "docid": "7b7646a954b5cea79a684838dfe71355", "score": "0.5083293", "text": "def parse_title_and_author(msg, full = true)\n author, msg = parse_userlevel_author(msg, remove: true)\n title, msg = parse_userlevel_title(msg, remove: true, full: full) # Keep last! (title can be whole msg if no \"for\" is found)\n [title, author, msg]\nend", "title": "" }, { "docid": "96137001d1fef7049f51636d5b4f0ca7", "score": "0.50772524", "text": "def split_colors\n array = []\n remainder = @sha.split('') # Yes, it's not the remainder now, but it will be at the return statement.\n 6.times { array << remainder.slice!(0, 6).to_s }\n return array, remainder.to_s\n end", "title": "" }, { "docid": "a1ca3dbd087282bd9611ee619a1dfd0b", "score": "0.5077039", "text": "def fields(string)\n string.split(/[,\\t ]+/)\nend", "title": "" }, { "docid": "f2090324d866f9da9ffbb4f8382779cb", "score": "0.5063837", "text": "def parse \n \n list = @email_list.split.map {|email| email.split(\",\")}\n list.flatten.uniq\n ##list.uniq\n \n end", "title": "" }, { "docid": "682d62064feb1286d9fd678ce9e2f540", "score": "0.50631386", "text": "def pubsub_auth_msg_2_auth_info(msg)\n msg_split = msg.split(/(?<!\\\\),/)\n service_id = msg_split.first.sub('service_id:'.freeze, ''.freeze)\n creds = Credentials.from(\n msg_split[1..-2].join(',').sub('credentials:'.freeze, ''.freeze))\n metric = msg_split.last.sub('metric:'.freeze, ''.freeze)\n\n res = { service_id: service_id, credentials: creds, metric: metric }\n res.map do |k, v|\n # Credentials are already unescaped\n [k, v.is_a?(Credentials) ? v : v.gsub(\"\\\\,\", ','.freeze)\n .gsub(\"\\\\:\", ':'.freeze)]\n end.to_h\n end", "title": "" }, { "docid": "03cd05e1c8fb74fb2dd5eb3802723369", "score": "0.5057379", "text": "def split_by_delimiter\n dn_string.split(delimiter).reject(&:empty?)\n end", "title": "" }, { "docid": "1e0744f2cfbb00aa1177c6a3a36d8554", "score": "0.5051829", "text": "def get_artifact_tokens_from_msg\n return {} unless (@raw_commit and @raw_commit.key?(\"message\"))\n\n tokens = {}\n\n matches = msg.scan(/\\[(\\w+:)?(\\S\\S)(\\d+)\\]/)\n matches.each do |token|\n # token[0] -> state\n # token[1] -> artifact descriptor\n # token[2] -> artifact id\n\n next unless (token[1] and token[2]) # required data\n\n # initialize array for every new artifact type, then populate it\n tokens[token[1]] = {} unless tokens.key?(token[1])\n tokens[token[1]][token[1]+token[2]] = \n token[0].nil? ? nil : token[0].chomp(':')\n end\n\n return tokens\n end", "title": "" }, { "docid": "1b12fdb19303353d357735a0fcae4051", "score": "0.5037673", "text": "def parse_title string\n return string.split(' : ')\nend", "title": "" }, { "docid": "a8d6f4ee1c5293764d6310ca50d9ad87", "score": "0.502875", "text": "def mentions\n @mentions ||= begin\n regex = /@([\\w]+\\s[\\w]+)/ \n body.scan(regex).flatten\n end\n end", "title": "" }, { "docid": "db572eaa77928e74a329280173a5a5b2", "score": "0.50234175", "text": "def yourwelcome(body)\n body.split\n\n\n \nend", "title": "" }, { "docid": "5ebd1c6c15e2e3e196c92f819a1d86f4", "score": "0.501676", "text": "def split_value(value)\n arr = value.split(pattern)\n # If the result of split is empty, it was probably an empty string.\n if arr.empty?\n return [value]\n end\n\n arr\n end", "title": "" } ]
c90922797b6fec8d71d7329fc822555d
TODO: pull process_const from obfuscator TODO: pull process_colon2 from obfuscator TODO: pull process_cvar from obfuscator TODO: pull process_dasgn_curr from obfuscator Function definition
[ { "docid": "a4f55f98b810b5564fda9ea6bf45a791", "score": "0.53900546", "text": "def process_defn(exp)\n make_function exp\n end", "title": "" } ]
[ { "docid": "58397bf1c6395f5d82d945f73d228fba", "score": "0.5713111", "text": "def third_party_processors; end", "title": "" }, { "docid": "92a50dee1dc081a758fd9025b5361845", "score": "0.5594366", "text": "def process_directives\n end", "title": "" }, { "docid": "29d0e928d729b1d9f905517e7d8060aa", "score": "0.557076", "text": "def process\n @constants.each do |k,v|\n @constants.each do |k2,v2|\n @constants[k2] = Utility.sub_constants(v2, k, v)\n end\n end\n end", "title": "" }, { "docid": "c4a672fdf8cd627e4839bfccda02aa9a", "score": "0.55397916", "text": "def obfuscate(text); end", "title": "" }, { "docid": "356bca0411fed0b950c92dd90d0234f1", "score": "0.5498265", "text": "def constants() end", "title": "" }, { "docid": "9de1e8410d725f02debe704f15f3950c", "score": "0.5489605", "text": "def process_dasgn_curr(exp) # TODO: audit against obfuscator\n var = exp.shift\n @env.add var.to_sym, exp.c_type\n return var.to_s\n end", "title": "" }, { "docid": "860461c8c460c91708931bb7ddd1a390", "score": "0.54793733", "text": "def precompiled(local_keys); end", "title": "" }, { "docid": "74808f334f484567c38570a21b98eb96", "score": "0.5431238", "text": "def functions\n {\n OpenProcess: Fiddle::Function.new(KERNEL32['OpenProcess'],\n [Fiddle::TYPE_INT, Fiddle::TYPE_CHAR, Fiddle::TYPE_INT], Fiddle::TYPE_INT),\n TerminateProcess: Fiddle::Function.new(KERNEL32['TerminateProcess'], [Fiddle::TYPE_INT, Fiddle::TYPE_INT],\n Fiddle::TYPE_CHAR),\n GetProcessID: Fiddle::Function.new(GHRL_DLL['GetProcessID'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP),\n GetModuleBaseAddress: Fiddle::Function.new(GHRL_DLL['GetModuleBaseAddress'],\n [Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP], Fiddle::TYPE_UINTPTR_T),\n RPMChar: Fiddle::Function.new(GHRL_DLL['RPMChar'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_CHAR),\n RPMInt: Fiddle::Function.new(GHRL_DLL['RPMInt'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_VOIDP),\n RPMBuf: Fiddle::Function.new(GHRL_DLL['RPMBuf'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],\n Fiddle::TYPE_VOIDP),\n WPMChar: Fiddle::Function.new(GHRL_DLL['WPMChar'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_CHAR],\n Fiddle::TYPE_SIZE_T),\n WPMInt: Fiddle::Function.new(GHRL_DLL['WPMInt'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT],\n Fiddle::TYPE_SIZE_T),\n WPMBuf: Fiddle::Function.new(GHRL_DLL['WPMBuf'], [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT],\n Fiddle::TYPE_SIZE_T)\n\n }\n end", "title": "" }, { "docid": "fa5cfd52f1c5caf14fc1dec16355907d", "score": "0.5420219", "text": "def process_cvar(exp)\n # TODO: we should treat these as globals and have them in the top scope\n name = exp.shift\n return name.to_s\n end", "title": "" }, { "docid": "520fee21274df35eebc152742201dcc4", "score": "0.53788936", "text": "def process\n return if @processed\n\n in_count = 0\n mark = -1\n start_of_chunk = -1\n last_of_chunk = -1\n chunk_name = ''\n chunk_loc = -1\n chunk_level = @define_hash[:register_level][:val]\n chunk_unused = @define_hash[:register_unused][:val]\n chunk_width = @define_hash[:register_width][:val]\n stack = [true]\n def_name = def_arg = def_rest = def_val = def_ref = def_kind = nil\n # true accepting input\n # false rejecting input\n # nil rejecting input due to nested #ifdef/#ifndef\n while in_count < @input.length\n l = input[in_count].chomp\n l_in_count = in_count\n while (in_count < @input.length) && (match = /\\\\[ \\t]*/.match(l))\n l[match.begin(0), match.end(0)] = @input[in_count].chomp # question: should we add a space before the next line?\n in_count += 1\n end\n skip = false\n #print \"in=#{in_count} out=#{@lines.length} mark=#{mark} start=#{start_of_chunk} '#{l}'\\n\"\n\n if /^#+[ \\t]/.match(l)\n mark = @lines.length\n elsif /^=+[ \\t]/.match(l)\n mark = @lines.length\n elsif (m = /^#define[ \\t]+(\\w+)[ \\t]*(\\([\\w, ]*\\))?[ \\t]+(.*)$/.match(l))\n def_name = m[1]\n def_arg = m[2]\n def_rest = m[3]\n if stack[-1]\n value = {}\n value[:arg] = def_arg.gsub(/[\\(\\)]/, '') if def_arg\n if def_rest && def_rest != '' # value and possibly ref\n if (m2 = /^(.*)[ \\t]+\\/\\*[ \\t]*([-A-Z0-9][- A-Z0-9]*)([-A-Z0-9])[ \\t]*\\*\\/[ \\t]*$/.match(def_rest)) # value and ref both present\n def_val = m2[1]\n def_ref = m2[2]\n def_kind = m2[3]\n value[:val] = def_val\n value[:ref] = def_ref + def_kind\n value[:kind] = def_kind\n @device_hash[def_name] = value if value[:kind] == 'D'\n @register_hash[def_name] = value if (value[:kind] == 'R' || value[:kind] == 'A')\n if /^[DRA]$/.match(value[:kind])\n if start_of_chunk >= 0 && last_of_chunk >= 0\n @chunks << {:start => start_of_chunk,\n :end => last_of_chunk,\n :key => chunk_loc,\n :name => chunk_name,\n :unused => chunk_unused,\n :level => chunk_level,\n :width => chunk_width}\n print \"chunk=#{@chunks[-1]}\\n\"\n end\n start_of_chunk = mark + 1\n chunk_name = def_name\n chunk_loc = @lines.length\n chunk_unused = @define_hash[:register_unused][:val]\n chunk_level = @define_hash[:register_level][:val]\n chunk_width = @define_hash[:register_width][:val]\n end\n last_of_chunk = @lines.length\n else\n value[:val] = def_rest # no ref present\n end\n end\n @define_hash[def_name] = value\n mark = @lines.length\n end\n\n elsif (m = /^#undef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n @define_hash.delete(def_name) if stack[-1]\n\n elsif (m = /^#ifdef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n if stack[-1].nil?\n stack.push(nil)\n else\n stack.push(@define_hash.has_key?(def_name))\n end\n skip = true\n\n elsif (m = /^#ifndef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n if stack[-1].nil?\n stack.push(nil)\n else\n stack.push(!@define_hash.has_key?(def_name))\n end\n skip = true\n\n elsif /^#else[ \\t]*$/.match(l)\n if stack[-1] != nil\n stack[-1] = !stack[-1]\n end\n skip = true\n\n elsif /^#endif[ \\t]*$/.match(l)\n stack.pop if stack.length > 1\n skip = true\n end\n\n if stack[-1] && !skip\n @src_map[@lines.length] = l_in_count\n @lines << l\n end\n in_count += 1\n end\n\n if start_of_chunk > 0\n @chunks << {:start => start_of_chunk,\n :end => last_of_chunk,\n :key => chunk_loc,\n :name => chunk_name,\n :unused => chunk_unused,\n :level => chunk_level,\n :width => chunk_width}\n end\n @processed = true\n\n end", "title": "" }, { "docid": "4298383aa834201f26397def90d60792", "score": "0.5371818", "text": "def cvars; end", "title": "" }, { "docid": "f89499535434c6e199ca03319fcf3c7b", "score": "0.5370921", "text": "def single_exploit\n end", "title": "" }, { "docid": "a606ff314b37ba47be08b757ff538b5e", "score": "0.5353371", "text": "def processor; end", "title": "" }, { "docid": "f39e9e4f38218dcb1cecaedc9f5837a7", "score": "0.5351096", "text": "def exploit\n end", "title": "" }, { "docid": "bdc4cb65bf43d0010425f5fb3c8b6606", "score": "0.53391063", "text": "def processor=(_arg0); end", "title": "" }, { "docid": "4f3b230557cf9f347342b1140e1abf62", "score": "0.5277394", "text": "def extract_magic_comments(processed_source); end", "title": "" }, { "docid": "8d9bd8d3d8b966450f8a783c30ab0ba8", "score": "0.5275501", "text": "def compilevardec\n\n end", "title": "" }, { "docid": "de308949671e57d0cebc3512b2383699", "score": "0.52589345", "text": "def processed_source=(_); end", "title": "" }, { "docid": "de308949671e57d0cebc3512b2383699", "score": "0.52589345", "text": "def processed_source=(_); end", "title": "" }, { "docid": "cf107c33990e05004a4ad140c98170e6", "score": "0.5254764", "text": "def pre_process\n end", "title": "" }, { "docid": "0e006e91bad8b8bf3080165f8005dff3", "score": "0.52398956", "text": "def do_constants\n @content.scan(%r%\\Wrb_define_\n ( variable |\n readonly_variable |\n const |\n global_const )\n \\s*\\(\n (?:\\s*(\\w+),)?\n \\s*\"(\\w+)\",\n \\s*(.*?)\\s*\\)\\s*;\n %xm) do |type, var_name, const_name, definition|\n var_name = \"rb_cObject\" if !var_name or var_name == \"rb_mKernel\"\n handle_constants type, var_name, const_name, definition\n end\n\n @content.scan(%r%\n \\Wrb_curses_define_const\n \\s*\\(\n \\s*\n (\\w+)\n \\s*\n \\)\n \\s*;%xm) do |consts|\n const = consts.first\n\n handle_constants 'const', 'mCurses', const, \"UINT2NUM(#{const})\"\n end\n\n @content.scan(%r%\n \\Wrb_file_const\n \\s*\\(\n \\s*\n \"([^\"]+)\",\n \\s*\n (.*?)\n \\s*\n \\)\n \\s*;%xm) do |name, value|\n handle_constants 'const', 'rb_mFConst', name, value\n end\n end", "title": "" }, { "docid": "3ccddab704b9e6f0f916d8afa623cc00", "score": "0.52378845", "text": "def precompiled(locals); end", "title": "" }, { "docid": "b05c4116c5b84fa11246ce2cd0e5e9e9", "score": "0.5213679", "text": "def preproc; end", "title": "" }, { "docid": "b4477840f60c555433469704ab1e5bae", "score": "0.52074873", "text": "def extract_code!\n data = @data\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2 }\n id\n end\n data\n end", "title": "" }, { "docid": "a1b28c4fcf31b18bca8c4c21755bba48", "score": "0.52067626", "text": "def preprocess\n lineno = 0\n shouldWrite = false\n inFunction = false\n printer = File.open(RB_FILE,'w')\n scanner = File.open(TEX_FILE,'r')\n if printer && scanner\n printer.puts RB_REQUIRE\n scanner.each_line do |line|\n lineno = lineno + 1\n if (line.include? TEX_ENV_01_E) && !determineTexCommented(line, TEX_ENV_01_E)\n puts \"Encountered #{TEX_ENV_01_E} on line #{lineno}\"\n shouldWrite = false\n end\n if shouldWrite\n stripped = line.strip\n if (stripped.include? TEX_MOD) && !determineRubyCommented(stripped, TEX_MOD) && !inFunction\n printer.print appendLineNumberToTexPrintCall(stripped, lineno)\n elsif (stripped.include? RB_CLASS_CREATE) && !determineRubyCommented(stripped, RB_CLASS_CREATE) && !inFunction\n printer.print appendLineNumberToInitialization(stripped, lineno)\n elsif (stripped.include? RB_METHOD_S) && !determineRubyCommented(stripped, RB_METHOD_S) && !inFunction\n puts \"Processing function definition: found line containing #{stripped}\"\n inFunction = true\n extracted = extractFunctionMeta stripped\n $fcnref.store(extracted[0], extracted[1])\n $defstack.push 1\n if (stripped.include? '(') && (stripped.include? ')')\n puts \"Injection into formatted def as \\( \\)! Boo!\"\n else\n puts \"Injection into formatted def as _,_! This is preferrable.\"\n end\n printer.print appendLineNumberArgToFunctionDefinition stripped\n elsif inFunction\n puts \"Parsing #{stripped} inside function...\"\n printer.print stripped\n if (line.include? TEX_MOD) && !determineRubyCommented(line, \"Tex\")\n printer.print \", #{RBTEX_INSERT_LINE}\"\n end\n RB_KEYWORD_END.each do |kwd|\n if line.include? kwd\n puts \"Encountered '#{kwd}'; pushing onto stack...\"\n $defstack.push 1\n break\n end\n end\n if line.include? 'end'\n puts \"Encountered 'end'; popping off of stack...\"\n $defstack.pop\n end\n inFunction = $defstack.any?\n else\n print \"STRIPPED: #{stripped}\\t\"\n deffed = false\n printer.print stripped\n $fcnref.each do |fcn, args|\n if stripped.include? fcn\n if (line.include? '(') && (line.include? ')')\n\n else\n printer.print (args != 0) ? (\", #{lineno}\") : (\" #{lineno}\")\n break\n end\n end\n end\n end\n printer.puts \"\"\n end\n if (line.include? TEX_ENV_01_S) && !determineTexCommented(line, TEX_ENV_01_S)\n puts \"Encountered #{TEX_ENV_01_S} on line #{lineno}\"\n $rbenvs = $rbenvs + 1\n shouldWrite = true\n end\n end\n end\n printer.close\n scanner.close\n return 0\nend", "title": "" }, { "docid": "72475958d12fb4b09c10945fd67148e0", "score": "0.5202054", "text": "def process_defn(exp)\n raise if @result_name\n method_name = exp.shift || raise\n exp = exp.shift || raise\n\n method_body = want_result do\n case exp.first\n when :ivar\n process(s(:block, exp))\n when :attrset\n process(s(:block, s(:args, :_), s(:iasgn, exp[1], s(:lvar, :_))))\n when :scope, :block, :fbody\n process(exp)\n else\n raise\n end\n end\n\n str = \"\"\n\n if @argument_variables.empty?\n str << \"function(){\"\n else\n args_str = ([block_name()] + @arguments_no_splat).join(\",\")\n str << \"function(#{args_str}){\"\n end\n\n raise if @local_variables.include?(@model.encode_self)\n raise if @argument_variables.include?(@model.encode_self)\n\n #\n # Add \"self\" to the local variables\n #\n @local_variables.add(@model.encode_self)\n @local_variables_need_no_initialization.add(@model.encode_self)\n\n #\n # declare local variables (except arguments)\n #\n to_declare = (@local_variables - @argument_variables).to_a\n to_declare << @result_name if @result_name\n unless to_declare.empty?\n str << \"var \" + to_declare.join(\",\") + sep()\n end\n\n #\n # initialize all local variables (that need initialization) to nil\n #\n to_initialize = (@local_variables - @argument_variables - @local_variables_need_no_initialization).to_a\n to_initialize << @result_name if @result_name\n unless to_initialize.empty?\n str << to_initialize.join(\"=\")\n str << \"=#{@model.encode_nil}#{sep()}\"\n end\n\n #\n # initialize \"self\"\n #\n str << \"#{@model.encode_self}=this#{sep()}\"\n\n #\n # If a block argument is given (&block) convert it to nil if it is\n # undefined. \n #\n if @block_arg_name\n str << \"#{@block_arg_name}=#{block_name()}==null?#{@model.encode_nil}:#{block_name()}#{sep()}\"\n end\n\n #\n # generate initialization code for each read instance variable\n #\n @read_instance_variables.each do |iv|\n str << \"if(#{@model.encode_self}.#{iv}==null)#{@model.encode_self}.#{iv}=#{@model.encode_nil}#{sep()}\"\n end\n\n # \n # Used in a zsuper call to refer to the methods \"arguments\"\n # \"arguments\" itself does not work due to iterators using functions.\n if @arguments_name\n str << \"var #{@arguments_name}=arguments#{sep()}\"\n end\n\n method_body << \"#{sep()}return #{@result_name}\" if @result_name\n\n if @iterators_used\n str << \"try{\" \n str << method_body \n\n #\n # Declare variable x?\n # No, catch introduced a new scope, so we don't have to\n # use a local or temporary variable here! \n #\n x = exception_name()\n iter_jump = @model.encode_globalattr(\"iter_jump\")\n return_value = @model.encode_attr(\"return_value\")\n scope = @model.encode_attr(\"scope\")\n uid = unique_method_scope()\n\n str << \"}catch(#{x}){\"\n # scope == null or scope == uid\n str << \"if(#{x} instanceof #{iter_jump} && (!#{x}.#{scope} || #{x}.#{scope}==#{uid}))return #{x}.#{return_value}#{sep()}\"\n str << \"throw(#{x})}\"\n else\n str << method_body\n end\n\n str << \"}\"\n\n return str\n end", "title": "" }, { "docid": "9a42ccd446507a38d03ca972ca1e63e8", "score": "0.5198394", "text": "def process_declaration declaration\n tokens = declaration.split(' ')\n\n return nil if tokens.include?('static')\n declaration = tokens.delete_if { |t| t == 'inline'}.join(' ')\n\n tokens = declaration.split('(')\n arg_list = tokens.last.split(')').first\n\n # Remove variable names\n args = arg_list.split(',')\n args = args.map do |arg|\n arg_tokens = arg.strip.split(' ')\n arg_tokens[0...arg_tokens.size-1].join(' ')\n end\n\n tokens[tokens.size-1] = args.join(',') + ')'\n\n tokens.join('(') + \";\"\n end", "title": "" }, { "docid": "9cd3add16446f81e18c1db8f37f9af9b", "score": "0.5192582", "text": "def third_party_processors\n self.class.constants - [:KramdownParser, :PRIORITIES]\n end", "title": "" }, { "docid": "3e18b4f9736912ac08695c8e2e3858de", "score": "0.5190222", "text": "def process_const(exp)\n resultify(@model.lookup_constant(constify(exp, :const)))\n end", "title": "" }, { "docid": "63b9aa9f78d36959627285ce2f52f6b4", "score": "0.5187794", "text": "def processTags(files)\n files.each do |file|\n count = 0\n File::readlines(file).each do |line|\n count+=1\n\n # function sym (\n line.gsub(/function ([\\w_$]+)([\\s]*)\\(/) {|match|\n puts $1 << \"\\t\" << file << \"\\t\" << '/' << match << '/' << ';\"'\n match\n }\n\n # obj.prototype.sym =\n line.gsub(/([\\w_$]+)\\.prototype\\.([\\w_$]+)([\\s]*)=/) {|match|\n puts $2 << \"\\t\" << file << \"\\t\" << '/' << match << '/' << ';\"'\n match\n }\n\n # this.sym = [new] [Ff]unction\n line.gsub(/this\\.([\\w_$]+)([\\s]*)=([\\s]*)(new[\\s])*[Ff]unction/) {|match|\n puts $1 << \"\\t\" << file << \"\\t\" << '/' << match << '/' << ';\"'\n match\n }\n\n # goog.namespace.sym =\n line.gsub(/goog\\.([\\w_$]+)\\.([\\w_$]+)([\\s]*)=/) {|match|\n puts $2 << \"\\t\" << file << \"\\t\" << '/' << match << '/' << ';\"'\n match\n }\n\n # sym : [new] [Ff]unction\n line.gsub(/([\\w_$]+)([\\s]*):([\\s]*)(new[\\s])*[Ff]unction[\\W]/) {|match|\n puts $1 << \"\\t\" << file << \"\\t\" << '/' << match << '/' << ';\"'\n match\n }\n end\n end\n return\nend", "title": "" }, { "docid": "850c832c3148d92bc60cf92f58586763", "score": "0.51874083", "text": "def get_filecode()\n \"__EMIT_#{ARGV[0].gsub(/[^\\w]/, \"_\").upcase}__\"\nend", "title": "" }, { "docid": "eef6687450cfabecad43ce8f4b3da713", "score": "0.51835924", "text": "def generate_argument_code\n 'const ' + @type.to_s + '& ' + code_name\n end", "title": "" }, { "docid": "7cf9288c23c3a23c5b00687a55039ef8", "score": "0.51716626", "text": "def do_methods\n @content.scan(%r%rb_define_\n (\n singleton_method |\n method |\n module_function |\n private_method\n )\n \\s*\\(\\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\(|\\(METHOD\\))?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.(?:cpp|c|y)))?\n %xm) do |type, var_name, meth_name, function, param_count, source_file|\n\n # Ignore top-object and weird struct.c dynamic stuff\n next if var_name == \"ruby_top_self\"\n next if var_name == \"nstr\"\n\n var_name = \"rb_cObject\" if var_name == \"rb_mKernel\"\n handle_method(type, var_name, meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(%r%rb_define_global_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.[cy]))?\n %xm) do |meth_name, function, param_count, source_file|\n handle_method(\"method\", \"rb_mKernel\", meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(/define_filetest_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)/xm) do |meth_name, function, param_count|\n\n handle_method(\"method\", \"rb_mFileTest\", meth_name, function, param_count)\n handle_method(\"singleton_method\", \"rb_cFile\", meth_name, function,\n param_count)\n end\n end", "title": "" }, { "docid": "df5323d7d3b1d0842aadb0b8b46e6476", "score": "0.51675624", "text": "def processing_instruction(name, content); end", "title": "" }, { "docid": "df5323d7d3b1d0842aadb0b8b46e6476", "score": "0.51675624", "text": "def processing_instruction(name, content); end", "title": "" }, { "docid": "3ade9216e47cc1916cf5c77d83d98647", "score": "0.5158907", "text": "def process_code(text)\n begin\n results = text.clone\n # processing code function\n text.scan(/\\${i2x.code\\((.*?)\\)}/).each { |k|\n k.each { |m|\n puts \"\\n\\tProcessing: #{m}\"\n results[\"${i2x.code(#{m})}\"] = eval(m.to_s).to_s\n }\n } if text.include? 'i2x.code'\n rescue Exception => e\n Services::Slog.exception e\n end\n results\n end", "title": "" }, { "docid": "2c521e70bab560091b424898a63e17be", "score": "0.5155417", "text": "def process_const(exp)\n name = exp.shift\n return name.to_s\n end", "title": "" }, { "docid": "5a0654b56e5d9b93e4250d0cfce015d8", "score": "0.51548475", "text": "def process_lasgn(exp) # TODO: audit against obfuscator\n out = \"\"\n\n var = exp.shift\n value = exp.shift\n # grab the size of the args, if any, before process converts to a string\n arg_count = 0\n arg_count = value.length - 1 if value.first == :array\n args = value\n\n exp_type = exp.c_type\n @env.add var.to_sym, exp_type\n\n if exp_type.list? then\n assert_type args, :array\n\n raise \"array must be of one type\" unless args.c_type == CType.homo\n\n args.shift # :arglist\n # REFACTOR: this (here down) is the only diff w/ super\n out << \"#{var} = rb_ary_new2(#{arg_count});\\n\"\n args.each_with_index do |o,i|\n out << \"rb_ary_store(#{var}, #{i}, #{process o});\\n\"\n end\n else\n out << \"#{var} = #{process args}\"\n end\n\n out.sub!(/;\\n\\Z/, '')\n\n return out\n end", "title": "" }, { "docid": "a0272ad3271aeda8c1f14a490b06743e", "score": "0.5153327", "text": "def parseFile(player, fName)\n typetoi = { \"DAT\" => 0, \"MOV\" => 1, \"ADD\" => 2, \"SUB\" => 3, \"JMP\" => 4, \"JMZ\" => 5, \"DJZ\" => 6, \"CMP\" => 7}\n modetoi = { \"\\#\" => 0, \"\\$\" => 1, \"\\@\" => 2}\n bufCore = [] # Holds the compiled programs for each player\n f = File.open(fName, \"r\") # Open fName for reading\n puts \"Parsing file: \" + fName\n f.each_line do |line| \n puts line\n line.slice!(/;.*/) # Delete comments\n line1 = line.upcase\n typeIndex = /[A-Z][A-Z][A-Z]/ =~ line1 # Get Type\n if typeIndex != nil # Type exists\n type = $~[0]\n puts \" Type: \" + type\n line1 = $~.post_match # Trim out the type\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line1 # Get First Field\n \n if numIndex == nil\n puts \"Error, no Fields\"\n else\n fieldA = $~[0].to_i\n end #numIndex...\n \n line1 = $~.pre_match # Before the first field\n line2 = $~.post_match # After the first field\n \n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for first field\n \n if modeIndex == nil\n modeA = \"$\"\n else\n modeA = $~[0]\n end # if modeIndex\n puts \" ModeA: \" + modeA # Print the assembled instruction\n puts \" FieldA: #{fieldA}\"\n\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line2 # Get Second Field\n \n if numIndex == nil\n fieldB = fieldA # Copy first field & mode if no second\n modeB = modeA\n else\n fieldB = $~[0].to_i\n\n line1 = $~.pre_match # Before the second field\n\n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for second field\n if modeIndex == nil\n modeB = \"$\"\n else\n modeB = $~[0]\n end\n end # if numIndex...\n \n puts \" ModeB: \" + modeB\n puts \" FieldB: #{fieldB}\"\n puts \" Opcode: #{typetoi[type]}, #{modetoi[modeA]}, #{fieldA}, #{modetoi[modeB]}, #{fieldB}\"\n bufCore << [typetoi[type], modetoi[modeA], fieldA, modetoi[modeB], fieldB, player]\n end #if typeIndex...\n # Instruction Regexp: /[A-Za-z]+|[#$@]|[[-|+]\\d+]/ \n # Comment Regexp: /;.*/ \n end #each_line\n f.close\n puts \"Core Dump, player[#{player}]:\" # Write out the compiled program\n bufCore.each do |element| \n puts \" #{element[0]}, #{element[1]}, #{element[2]}, #{element[3]}, #{element[4]}\"\n end #bufCore.each\n puts\n bufCore\n end", "title": "" }, { "docid": "5be5781d059d8ca36156d3e96c45297e", "score": "0.5138445", "text": "def gather_call_parms( line, p )\n\n return if line.length < 2 #empty line, just a \\n\n\n _line = line[7..71]\n\n if _line =~ / USING +.*$/\n $&.split.each do |parm|\n p << parm.tr( \"\\.\", '' )\n end\n else # we've past the USING phrase\n _line.split.each do |parm|\n p << parm.tr(\"\\.\", '')\n end\n end\n print \"DEBUG: gather_call() > #{p}\\n\" \n\n $stmt_ends_in_dot = true if endof_curr_stmt?( _line )\nend", "title": "" }, { "docid": "984a7274f2f076ac059e746e0bdc2924", "score": "0.5136532", "text": "def compiledo\n\n end", "title": "" }, { "docid": "969cf6f86aae0712d4d9c47c3f342319", "score": "0.51297694", "text": "def code_point=(_); end", "title": "" }, { "docid": "4134fc1f4684033c58b142ebe03c95e8", "score": "0.51242536", "text": "def valid_processors; end", "title": "" }, { "docid": "220f31877f2eeceda0703fc80262b66a", "score": "0.5118839", "text": "def parse_obfuscations(obfuscations)\n obfuscations.each_pair.with_object({}) do |field_and_strategy, hash|\n field, strategy = field_and_strategy\n strategy = strategy.to_sym\n field.to_s.match(/\\./) ? hash[field.to_s] = strategy : hash[field] = strategy\n end\n end", "title": "" }, { "docid": "cff814ce008f9fc03b80a70f6e646fce", "score": "0.5110327", "text": "def autofinish; end", "title": "" }, { "docid": "25fbe1c7d94d2a9b14868013e9327acd", "score": "0.5104056", "text": "def _reduce_609(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "title": "" }, { "docid": "f32cc8630cd886a7a8528901005150cb", "score": "0.510079", "text": "def process_static(exp)\n return exp.shift\n end", "title": "" }, { "docid": "a0f5b679bbf5906acdc24a8325979072", "score": "0.5097657", "text": "def post_process\n @method_suffix = \"\"\n @arity = @words.length\n @bareword_slots = []\n @words.each_with_index do |word|\n case word\n when '*'\n @arity = MULTIPLE_ARGS \n @method_suffix += \"_star\"\n @bareword_slots << nil\n when Purugin::CommandParser::Syntax::Variable\n @bareword_slots << nil\n else\n # FIXME: Invalid syntax possible..error now or later?\n @method_suffix += \"_#{word}\"\n @bareword_slots << word\n end\n end\n @method_suffix = \"_#{name}\" if name # If name specified for command use that.\n end", "title": "" }, { "docid": "222c5789716e187173ef3c9f8104ca2e", "score": "0.50961244", "text": "def funcify\n unless File.exists?('.projectProtoMap') and File.exists?('.projectFileMap')\n puts \"'.projectProtoMap' and/or '.projectFileMap' not found. Please run creatify first.\"\n exit(1)\n end\n\n File.open(\".projectProtoMap\", \"r\").each_line do\n |line|\n pMatch = line.match(/^(\\d+):(.*?)([^\\s^\\*]*)\\((.*)\\);$/)\n\n if pMatch\n puts \"Found prototype: #{line.chomp}\"\n project = pMatch[1]\n returnType = pMatch[2]\n funcName = pMatch[3]\n args = pMatch[4].scan(/(\\w+),|(\\w+)$/)\n args.length.times do\n |a|\n if args[a][0]\n args[a] = args[a][0]\n elsif args[a][1]\n args[a] = args[a][1]\n end\n end\n File.open(\".projectFileMap\", \"r\").each_line do\n |l2|\n fMatch = l2.match(/^(\\d+):\\s*(.*\\.c)$/)\n if fMatch && fMatch[1] == project\n puts \"Putting into file: #{l2.chomp}\"\n File.open(fMatch[2],\"w\") do\n |cfile|\n cfile.puts \"#include \\\"holberton.h\\\"\"\n cfile.puts\n cfile.puts \"/**\"\n cfile.puts \" * #{funcName} - function description\"\n args.each do\n |arg|\n cfile.puts \" * @#{arg}: parameter description\"\n end\n cfile.puts \" * Return: return description\" unless returnType == \"void \"\n cfile.puts \" */\"\n\n cfile.puts line.split(\":\")[-1].chomp.match(/([^;]*)/)[1]\n cfile.puts \"{\"\n cfile.puts \"\"\n cfile.puts \"}\"\n end\n end\n end\n puts \"\"\n end\n end\nend", "title": "" }, { "docid": "0914203507f664de694e65165b11b9cc", "score": "0.50943923", "text": "def preprocess(&block); end", "title": "" }, { "docid": "e76653e5e9548e40abedbabe8826e480", "score": "0.5090704", "text": "def constants\n @method_compilers.inject([]){|sum ,comp| sum + comp.constants }\n end", "title": "" }, { "docid": "7a57ff9e15f79c0064cbd0f0352f9db6", "score": "0.50838137", "text": "def method_source(mnemonic, flags, sample, prefix)\n\t\"\"\"// Mnemonic: #{sample}\n// Sets Flags: #{flags}\nfunc (p *GBProcessor) #{prefix}#{mnemonic}(opcode byte, params ...byte) {\n\n}\"\"\"\nend", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.50795364", "text": "def probers; end", "title": "" }, { "docid": "1672ac2918a8f74e779f534ca3b65e07", "score": "0.50755376", "text": "def change_prefix_2_debug(code, variables)\n debug_code = code\n variables.each_with_index do |var, index|\n debug_code = debug_code.gsub(Regexp.new(\"\\\\b#{var}line#{VM_PREFIX}\\\\s*==\"),\n \" #{var} ==\")\n #\n debug_code = debug_code.gsub(Regexp.new(\"\\\\b#{var}line#{VM_PREFIX}\\\\s*=\"),\n \" spawn(fun() -> a#{VM_PREFIX}_performdebugs(#{index}) end)! #{var} =\")\n full_debug_code = ''\n debug_code.each_line do |line|\n my_array = scan_for_index_start_and_end(line, Regexp.new(\"\\\\b#{var}line#{VM_PREFIX}\"))\n my_array.reverse_each do |stuff|\n stop = line.index(regex_stop_or_semicolon, stuff[:ends])\n arrow = line.index(regex_arrow_with_function, stuff[:ends])\n if arrow && stop && arrow > stop\n # do nothing, because variable is not a left-hand side\n # of a function\n elsif arrow\n arrow_end = line.index(')', arrow) + 1\n line = line.insert(arrow_end, \", a#{VM_PREFIX}_performdebugs(#{index}, #{var}) \")\n end\n end\n full_debug_code += line\n end\n debug_code = full_debug_code\n end\n debug_code\nend", "title": "" }, { "docid": "1e38fc53b07b11d3577e06587d84e28a", "score": "0.5075238", "text": "def parse_all\n #check for skipping the block using add on module...\n parse_spc\n if @skiper.select{|f|send(f)}.length>0\n p \"skip > #{@row}\" if @dbg[:parse]\n else\n @plt_opt= '' \n #rtn= true if @selector.select{|f|send(f)}.length>0\n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%]*\\{.*\\}=*) *([^\\n]*)\\n/) \n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n rtn = true if shortcut_equal( /(^[\\t ]*)=([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)()\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+ )([^\\n]*)\\n/) \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+)()\\n/) \n \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]* )([^\\n]*)\\n/) \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]*)()\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]* )([^\\n]*)\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]*)()\\n/) \n rtn = true if parse_hot\n rtn = true if merge_hot\n rtn = true if merge_w2x\n rtn = true if parse_set_var\n rtn = true if parse_set_mem\n rtn = true if parse_get_mem\n rtn = true if inline_tag\n rtn = true if parse_end\n if parse_tags\n rtn = nil\n elsif !rtn\n auto_close \n end\n end\n rtn\n end", "title": "" }, { "docid": "b4ec0671885ea1f3af1c76ec3bb40471", "score": "0.50689054", "text": "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "b4ec0671885ea1f3af1c76ec3bb40471", "score": "0.50689054", "text": "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "b4ec0671885ea1f3af1c76ec3bb40471", "score": "0.50689054", "text": "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "1f7beecd4454485478deac9215b7e109", "score": "0.50671566", "text": "def _reduce_664(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.restarg(val[0], val[1]) ]\n \n result\nend", "title": "" }, { "docid": "fc6830702ec29ccc3ccfe01ced5ac90e", "score": "0.5067014", "text": "def wafcap_common\n self.gsub(/select/i, \"SELECT\".wafcap).gsub(/union/i, \"UNION\".wafcap).gsub(/update/i, \"UPDATE\".wafcap).gsub(/insert/i, \"INSERT\".wafcap).gsub(/delete/i, \"DELETE\".wafcap).gsub(/[, ]concat/i, \"CONCAT\".wafcap).gsub(/group_concat/i, \"GROUP_CONCAT\".wafcap).gsub(/information_schema/i, \"INFORMATION_SCHEMA\".wafcap).gsub(/order/i, \"ORDER\".wafcap).gsub(/having/i, \"HAVING\".wafcap).gsub(/between/i, \"BETWEEN\".wafcap).gsub(/\\swhere\\s/i, \"WHERE\".wafcap).gsub(/from/i, \"FROM\".wafcap).gsub(/like/i, \"LIKE\".wafcap).gsub(/cast/i, \"CAST\".wafcap).gsub(/convert/i, \"CONVERT\".wafcap).gsub(/substring/i, \"SUBSTRING\".wafcap).gsub(/sleep/i, \"SLEEP\".wafcap).gsub(/benchmark/i, \"BENCHMARK\".wafcap)\n end", "title": "" }, { "docid": "a8afbb0dfdd614acd146c295293eb2f5", "score": "0.5065328", "text": "def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "a8afbb0dfdd614acd146c295293eb2f5", "score": "0.5065328", "text": "def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "cf72502a4e2c0f68e18d6476b6e4a919", "score": "0.5054284", "text": "def buzzword; end", "title": "" }, { "docid": "cf72502a4e2c0f68e18d6476b6e4a919", "score": "0.5054284", "text": "def buzzword; end", "title": "" }, { "docid": "bfaa4f0b3e7ad94d9834018f4e3906ca", "score": "0.5039806", "text": "def __replace_eval__(line, gen_code)\n # class_eval\n if line =~ \n /(.*)((class_eval)|(module_eval)|(instance_eval)|(eval)) ?\\(?\"(.*)\"\\)? ?(.*)/\n printf \"%s%s {%s} %s\\n\", $1, $2, gen_code[:code], $8\n end\nend", "title": "" }, { "docid": "2f68d7a546d93594b67d202097917ff1", "score": "0.50355446", "text": "def allow_production=(_arg0); end", "title": "" }, { "docid": "047f2d49179096427b5e2dc36a800ba7", "score": "0.5034592", "text": "def meta_exec(line, name, constant, path, meta_code = Cache_meta_without_hue)\n module_eval(\n format(\n meta_code,\n cache_name: name,\n cache_constant: constant,\n cache_path: path\n ),\n __FILE__,\n line\n )\n end", "title": "" }, { "docid": "1bd59d89268e69458c91ec44619e5e73", "score": "0.5031261", "text": "def _reduce_587(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "37db0fe60d82b7b4555c500d9d9c44e9", "score": "0.5027713", "text": "def make_const(prop, data, name)\n if name.empty?\n puts \"\\n/* '#{prop}' */\"\n else\n puts \"\\n/* '#{prop}': #{name} */\"\n end\n if origprop = $const_cache.key(data)\n puts \"#define CR_#{prop} CR_#{origprop}\"\n else\n $const_cache[prop] = data\n pairs = pair_codepoints(data)\n puts \"static const OnigCodePoint CR_#{prop}[] = {\"\n # The first element of the constant is the number of pairs of codepoints\n puts \"\\t#{pairs.size},\"\n pairs.each do |pair|\n pair.map! { |c| c == 0 ? '0x0000' : sprintf(\"%0#6x\", c) }\n puts \"\\t#{pair.first}, #{pair.last},\"\n end\n puts \"}; /* CR_#{prop} */\"\n end\nend", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "6a580931a1781238fd4518fdb62728d7", "score": "0.502329", "text": "def process; end", "title": "" }, { "docid": "49bea8df56d95e9d58ad43a9d4b43849", "score": "0.5016752", "text": "def process_lasgn(exp) # TODO: audit against obfuscator\n out = \"\"\n\n var = exp.shift\n value = exp.shift\n # grab the size of the args, if any, before process converts to a string\n arg_count = 0\n arg_count = value.length - 1 if value.first == :array\n args = value\n\n exp_type = exp.c_type\n @env.add var.to_sym, exp_type\n\n if exp_type.list? then\n assert_type args, :array\n\n raise \"array must be of one type\" unless args.c_type == CType.homo\n\n # HACK: until we figure out properly what to do w/ zarray\n # before we know what its type is, we will default to long.\n array_type = args.c_types.empty? ? 'void *' : self.class.c_type(args.c_types.first)\n\n args.shift # :arglist\n# TODO: look into alloca\n out << \"#{var} = (#{array_type}) malloc(sizeof(#{array_type}) * #{arg_count});\\n\"\n args.each_with_index do |o,i|\n out << \"#{var}[#{i}] = #{process o};\\n\"\n end\n else\n out << \"#{var} = #{process args}\"\n end\n\n out.sub!(/;\\n\\Z/, '')\n\n return out\n end", "title": "" }, { "docid": "4b6622d14606fd63ae917932e9bfba79", "score": "0.50110143", "text": "def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "4b6622d14606fd63ae917932e9bfba79", "score": "0.50110143", "text": "def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "4b6622d14606fd63ae917932e9bfba79", "score": "0.50110143", "text": "def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "c390555681e5057a3a39e88834ea05d4", "score": "0.5007724", "text": "def cleanprint(arg)\n\tstatic=arg\n\t#print \"------\\nProcessing #{static}\\n\"\n\tretval=\"\"\n\tquote=static.split('\"')\n\tif quote[1]!=nil\n\t\tif \"OPCODE \"==quote[0] #the split includes the space\n\t\t\tretval=\"[[#{quote[0]}\\\"#{quote[1]}\\\"]]\"\n\t\telse\n\t\t\tretval=\"[[#{quote[0]}]]\\\"#{quote[1]}\\\"\"\n\t\tend\n\telse\n\t\tretval=\"[[#{static}]]\"\n\tend\n\t#print \"Ended with #{retval}\\n-------\\n\"\n\treturn retval\nend", "title": "" }, { "docid": "acb84cf7ec5cb9f480913c612a384abb", "score": "0.5007121", "text": "def probers=(_arg0); end", "title": "" }, { "docid": "70d9f4be394eb687eb41249f43d0bf25", "score": "0.5006685", "text": "def code=(_arg0); end", "title": "" }, { "docid": "70d9f4be394eb687eb41249f43d0bf25", "score": "0.5006685", "text": "def code=(_arg0); end", "title": "" }, { "docid": "3c7f5d5f9dc46b1700f1073490cd6583", "score": "0.5006276", "text": "def php_builtins\n out = {}\n\n download_and_read_docs do |file|\n title = Regexp.last_match[1] if file =~ /<title>(.*?) Functions<\\/title>/\n\n next unless title\n\n functions = file.scan(/<a href=\"function\\..*?\\.html\">(.*?)<\\/a>/)\n\n # The functions array looks like this:\n #\n # [[\"is_soap_fault\"],\n # [\"is_soap_fault\"],\n # [\"use_soap_error_handler\"],\n # [\"is_soap_fault\"]]\n #\n # Let's convert it to sth. like this:\n #\n # [\"is_soap_fault\"],\n # \"is_soap_fault\",\n # \"use_soap_error_handler\",\n # \"is_soap_fault\"]\n #\n functions.map!(&:first)\n\n out[title.to_sym] = functions.uniq\n end\n\n out\nend", "title": "" }, { "docid": "1a86fc212e8eadcdcfaca640d9d9e1f1", "score": "0.50023764", "text": "def function_definition\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n\n value = nil\n\n\n name = nil\n type = nil\n a = nil\n\n\n begin\n # at line 51:5: OPEN type= variable_type name= IDENT ( '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')' )? ( CLOSE | NL (a= statement )* CLOSE )\n match( OPEN, TOKENS_FOLLOWING_OPEN_IN_function_definition_350 )\n @state.following.push( TOKENS_FOLLOWING_variable_type_IN_function_definition_354 )\n type = variable_type\n @state.following.pop\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_function_definition_358 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = FunctionDefinitionEval.new(name.text, type) \n # <-- action\n end\n\n # at line 52:3: ( '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')' )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == T__34 )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 52:5: '(' (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )? ')'\n match( T__34, TOKENS_FOLLOWING_T__34_IN_function_definition_366 )\n # at line 52:9: (type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )* )?\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == IDENT || look_16_0.between?( TYPE_BOOL, TYPE_VOID ) )\n alt_16 = 1\n end\n case alt_16\n when 1\n # at line 53:5: type= variable_type name= IDENT ( ',' type= variable_type name= IDENT )*\n @state.following.push( TOKENS_FOLLOWING_variable_type_IN_function_definition_376 )\n type = variable_type\n @state.following.pop\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_function_definition_380 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_argument(type, name.text) \n # <-- action\n end\n\n # at line 54:5: ( ',' type= variable_type name= IDENT )*\n while true # decision 15\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == T__40 )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 54:6: ',' type= variable_type name= IDENT\n match( T__40, TOKENS_FOLLOWING_T__40_IN_function_definition_389 )\n @state.following.push( TOKENS_FOLLOWING_variable_type_IN_function_definition_393 )\n type = variable_type\n @state.following.pop\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_function_definition_397 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_argument(type, name.text) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 15\n end\n end # loop for decision 15\n\n\n end\n match( T__35, TOKENS_FOLLOWING_T__35_IN_function_definition_409 )\n\n end\n # at line 56:3: ( CLOSE | NL (a= statement )* CLOSE )\n alt_19 = 2\n look_19_0 = @input.peek( 1 )\n\n if ( look_19_0 == CLOSE )\n alt_19 = 1\n elsif ( look_19_0 == NL )\n alt_19 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 19, 0 )\n\n end\n case alt_19\n when 1\n # at line 56:5: CLOSE\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_function_definition_418 )\n\n when 2\n # at line 56:13: NL (a= statement )* CLOSE\n match( NL, TOKENS_FOLLOWING_NL_IN_function_definition_422 )\n # at line 56:16: (a= statement )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0.between?( IDENT, IF ) || look_18_0 == RETURN || look_18_0 == WHILE )\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 56:17: a= statement\n @state.following.push( TOKENS_FOLLOWING_statement_IN_function_definition_427 )\n a = statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_statement(a) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_function_definition_434 )\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__, 8 )\n\n\n end\n\n return value\n end", "title": "" }, { "docid": "14e1363b91f43c87d20825db5f2d5287", "score": "0.50004464", "text": "def _reduce_541(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2263ec8cfc45856217fe946c862b31c2", "score": "0.4998128", "text": "def processed_source; end", "title": "" }, { "docid": "2db49a06e81dc6f129cd052fb30f468d", "score": "0.49923593", "text": "def intern() end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4351fb7f6b3c58539d1126d19fb8b07b", "score": "0.0", "text": "def forma_pagamento_params\n params.require(:forma_pagamento).permit(:descricao)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74939764", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6955084", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69205093", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6891745", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67835", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6742323", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.66817623", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6635011", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66280156", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66248137", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.6561888", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6489396", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64763314", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64523757", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.63985187", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6379674", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.636227", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6337434", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6335199", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.63245684", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63194174", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6313726", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63134545", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6304745", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6299775", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.62989247", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.6294581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62786806", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.62717277", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.62658894", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6254184", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.625358", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62506795", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.62342095", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62271494", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62269396", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226112", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6224588", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.62000334", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.619004", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6182373", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.61777395", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61629707", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160594", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61548823", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6153307", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61359197", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61332136", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6117462", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.6113605", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61102164", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6085571", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.608522", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6084166", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.60775006", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6073921", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6067218", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065894", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6064601", "text": "def need_params\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6064436", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.60631806", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6061806", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6060409", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6056974", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6047898", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.604599", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041073", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60329294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6029157", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.602574", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.60209215", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.60183305", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6016583", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.6013783", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.6007249", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6005397", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6003378", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6001586", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.5999887", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.5998492", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.5992997", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5992662", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.59919816", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59903735", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59890324", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
756214d7dd9032279de91b2f6533e7fc
Mapping from dynamo document to api value
[ { "docid": "ec8ffd7f5f72d240ff2da298fdbbc13f", "score": "0.0", "text": "def api_value(val, data)\n case val\n when 'alcoholInteraction'\n data['alcohol_interaction']\n when 'availableGeneric'\n data['available_generic']\n when 'brandNames'\n return [] if data['brand_names'][0] == data['rxcui']\n RxcuiLookup.top_concepts(data['brand_names'], 5) || []\n when 'brandedDoseForms'\n data['branded_dose_form'] || []\n when 'clinicalDoseForms'\n data['clinical_drug_dose_form'] || []\n when 'conditionsTreated'\n conditions(data)\n when 'contraindicatedConditions'\n data['contraindicated_conditions']&.values&.reduce(:+)&.map(&:downcase)&.uniq || []\n when 'drugClasses'\n data['drug_classes'] || []\n when 'drugForms'\n drug_forms(data) || []\n when 'drugInteractions'\n data['normal_interactions']&.uniq || []\n when 'drugSchedule'\n data['addiction_drug_schedule']\n when 'drugScheduleDescription'\n Description.substance_schedule(data['addiction_drug_schedule'])\n when 'hasOTC'\n data['availiability'] == 'No prescription needed'\n when 'ingredientIn'\n data['multiple_ingredients'] || []\n when 'isBrand'\n data['concept_type'] == 'brand_name'\n when 'isPrescribable'\n data['can_be_prescribed']\n when 'name'\n data['name']\n when 'generic'\n data['active_compound_group']\n when 'genericStrength'\n data['available_strengths'][0]\n when 'overdoseWarning'\n data.dig('free_text', 'overdose')\n when 'pathname'\n pathname\n when 'photo'\n image_url\n when 'pregnancyCategory'\n data['pregnancy_category']\n when 'pregnancyCategoryDescription'\n Description.pregnancy(data['pregnancy_category'])\n when 'severeDrugInteractions'\n data['severe_interactions']&.uniq || []\n when 'similarDrugs'\n data['similar_drugs']&.map { |d| d['rxcui'] }&.compact || []\n when 'synonyms'\n canonical_name = data['canonical_name']&.downcase\n canonical_name.nil? || canonical_name == name.downcase ? [] : [data['canonical_name']]\n when 'topComparisonDrug' # TODO: top comparison drug\n top_comp = Medication.find_by_rxcui(data['similar_drugs']&.slice(0)&.dig('rxcui').to_i)\n comp_data = top_comp&.comparison_values || {}\n unless comp_data.empty?\n comparison_interactions = (comp_data['severeDrugInteractions'] + comp_data['drugInteractions']).to_set\n main_interactions = (api_value('severeDrugInteractions', data) + api_value('drugInteractions', data)).to_set\n comp_data['sharedInteractions'] = (comparison_interactions.intersection(main_interactions)).to_a\n comp_data['comparisonInteractionsUnique'] = (comparison_interactions - main_interactions).to_a\n comp_data['mainInteractionsUnique'] = (main_interactions - comparison_interactions).to_a\n comparison_conditions = comp_data['conditionsTreated'].to_set\n main_conditions = conditions(data).to_set\n comp_data['sharedConditions'] = (comparison_conditions.intersection(main_conditions)).to_a\n comp_data['comparisonConditionsUnique'] = (comparison_conditions - main_conditions).to_a\n comp_data['mainConditionsUnique'] = (main_conditions - comparison_conditions).to_a\n end\n comp_data\n when 'type'\n # data['concept_type']&.tr('_', ' ')\n data['active_compound_group'].to_i == rxcui ? 'generic drug' : 'branded drug'\n when 'url'\n pathname\n when 'usage'\n data.dig('free_text', 'dosage_instructions') || []\n when 'warning'\n data.dig('free_text', 'warnings_and_precautions')\n end\n end", "title": "" } ]
[ { "docid": "392598703eed6ea0a3f00ddedf4407b0", "score": "0.5772668", "text": "def get(type,key)\n document = @table.items.query(:hash_value => key,\n :range_value => type).first\n #TODO - sort, and return in rev\n document ? Rufus::Json.decode(document.attributes[:doc]) : nil\n end", "title": "" }, { "docid": "f1f5ff9999bee226d58e7c7eb3b94620", "score": "0.5723962", "text": "def default_item_mapping\n {\n properties: {\n # _id is \"{id}-{state}\"\n id: {\n type: 'string',\n store: 'yes',\n index: 'not_analyzed'\n },\n state: {\n type: 'string',\n store: 'yes',\n index: 'not_analyzed'\n },\n updated_at: {\n type: 'date'\n }\n }\n }\n end", "title": "" }, { "docid": "b2d1ae935f0bbaa635d9db850ef0bab8", "score": "0.5676708", "text": "def result\n calling_mapper.for(Property.new(value.key, \"id-#{value.value.id}\")).result\n end", "title": "" }, { "docid": "0827afde175b080094d381e5e4f986e9", "score": "0.56433326", "text": "def to_dynamo\n self.class.dynamodb_config.mapper.marshal_into_item(self)\n end", "title": "" }, { "docid": "2bf69bd340785e23eeebf8e5e0ebab9d", "score": "0.5609402", "text": "def result\n calling_mapper.for(Property.new(value.key, \"integer-#{value.value}\")).result\n end", "title": "" }, { "docid": "347e6ea561e7035b32db57f48e0f62fb", "score": "0.5591248", "text": "def map(doc)\n end", "title": "" }, { "docid": "f01f7f1e4a982d227d38b5b998af28b9", "score": "0.55869716", "text": "def to_dynamo_value(value)\n value.to_s\n end", "title": "" }, { "docid": "2816b969d81febd8ba51ffd29c2bee7d", "score": "0.55217385", "text": "def mongoize\n {'type'=>value.class.name, 'value'=>JSON.parse(value.to_json(except: [:_id, :modifier_id]))}\n end", "title": "" }, { "docid": "1dcc2a0d48a8dc038e7e2cec109be835", "score": "0.5446573", "text": "def process_value(content, object)\n if content.is_a?(Index::Attribute) && content.type == :timestamp\n return object[content.name].to_time.to_i\n end\n object[content.name]\n end", "title": "" }, { "docid": "8247badef3c747e6549a2642f7bc9b8e", "score": "0.5433248", "text": "def value_for_item(it)\n it.data[uuid]\n end", "title": "" }, { "docid": "4761a30574236e29552326f1bef0c977", "score": "0.5385196", "text": "def from_dynamo_value(value)\n value.to_s\n end", "title": "" }, { "docid": "ac181b6e3e737760d26b2aa317949213", "score": "0.53714484", "text": "def map_attr(name, opts = {})\n opts[:dynamodb_type] = 'M'\n attr(name, Marshalers::MapMarshaler.new(opts), opts)\n end", "title": "" }, { "docid": "6029369362811a428d701eec0ef94406", "score": "0.534145", "text": "def serializer(struct, doc)\n out = {}\n struct.each do |key, value|\n tkey = get_key(key)\n out[tkey[:key]] = get_value(struct, doc, tkey, value)\n end\n\n # retrun\n out\nend", "title": "" }, { "docid": "ce7b28de57e6b84b57611575e1c318f5", "score": "0.5336473", "text": "def value_wb_attributes(row, location, indicator, doc_slug = nil)\n doc_slug ||= row[:document]&.parameterize&.gsub('-', '_')\n {\n location: location,\n indicator: indicator,\n sector: @sectors_index[row[:subsector]],\n value: row[:responsetext],\n document_id: Indc::Document.where(slug: doc_slug).pluck(:id).first\n }\n end", "title": "" }, { "docid": "77bf7fa4d89512d7d1ed9c236187a431", "score": "0.5335724", "text": "def dyno_typed_key(key:, val:)\n field_type = self.fields[key].options[:type]\n return (TinyDyno::Adapter.aws_attribute(field_type: field_type, value: val))\n end", "title": "" }, { "docid": "bb1091910ac1bf4aace7ca08e91258e6", "score": "0.5324236", "text": "def call(ctx, document:, **)\n return unless document.key?(@name)\n ctx[:value] = document[@name]\n true\n end", "title": "" }, { "docid": "36dc3ea52cd221de2498d801a8a200f7", "score": "0.5317177", "text": "def [](dynamodb_attr)\n object_attr = self.class.dynamodb_config.attribute_map[dynamodb_attr]\n object_attr.present? ? send(object_attr) : nil\n end", "title": "" }, { "docid": "3a4d36d6dba8fc7d8ed5e31e8e63acfa", "score": "0.53108895", "text": "def result\n calling_mapper.for(Property.new(value.key, \"datetime-#{JSON.parse(to_datetime(value.value).to_json)}\")).result\n end", "title": "" }, { "docid": "73967a5cfd81b9fc71f3432f5844ea96", "score": "0.53102994", "text": "def dynamo_ruby_payload(payload)\n payload&.deep_transform_keys do |key|\n key.to_s.underscore.to_sym\n end\n end", "title": "" }, { "docid": "01014cd6debf37995fa2f613976c884f", "score": "0.5300208", "text": "def value_map\n \n end", "title": "" }, { "docid": "565be917205a7877aaf00e378b685e63", "score": "0.52968264", "text": "def from_dynamo_value(value)\n value.to_i\n end", "title": "" }, { "docid": "b4d9da28daf253e1861e2e39a7fbfc4a", "score": "0.5274945", "text": "def convert_id(doc)\n doc[:id] = doc['id'].try(:first) if doc\n doc\n end", "title": "" }, { "docid": "d760c825fe36bbb7d7288a04aa82b375", "score": "0.5273648", "text": "def dynamodb_key\n self.class.dynamodb_key(hash_key, range_key)\n end", "title": "" }, { "docid": "4e8398077d81e14eb01d431e2ccc72e9", "score": "0.5270335", "text": "def mongoize\n value\n end", "title": "" }, { "docid": "a0a91122d6678a3bd0ace60d96eb69ce", "score": "0.52619046", "text": "def add_index_value(table_name, obj, opts = {})\n if Dynamoid::Config.partitioning?\n # existing = Dynamoid::Adapter.read(table_name, obj.hash_key, { :range_key => values[:range_value] })\n #ids = ((existing and existing[:ids]) or Set.new)\n #Dynamoid::Adapter.write(self.table_name, {:id => values[:hash_value], :ids => ids.merge([obj.hash_key]), :range => values[:range_value]})\n elsif Dynamoid::Config.remove_empty_index?\n key = opts.delete(:id)\n if obj.range_value\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}.#{obj.range_value}\"])}\n else\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}\"])}\n end\n \n adapter.update_item(table_name, key, opts, &add_block)\n else\n key = opts.delete(:id)\n if obj.range_value\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}.#{obj.range_value}\"])}\n else\n add_block = Proc.new{|item| item.add(:ids => [\"#{obj.hash_key}\"])}\n end\n adapter.update_item(table_name, key, opts, &add_block)\n end\n end", "title": "" }, { "docid": "6e96817c1c64317c50f0e24961822dc2", "score": "0.523874", "text": "def v2j(field)\n return @rmapper[field]\n end", "title": "" }, { "docid": "12510869756d8bc11d0212ae8803868d", "score": "0.5228764", "text": "def result\n value.statement.object = Valkyrie::ID.new(value.statement.object.to_s)\n calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result\n end", "title": "" }, { "docid": "bad3fae15b35c71055b433ab4940ce2a", "score": "0.5220077", "text": "def get_actual_value(actual, key)\n if Hash === actual\n actual[key]\n elsif Mongo::Operation::Result === actual && !actual.respond_to?(key.to_sym)\n actual.documents.first[key]\n else\n actual.send(key)\n end\n end", "title": "" }, { "docid": "9e534e545f227e884c4d53bd995bcd32", "score": "0.52182", "text": "def [](field_name); end", "title": "" }, { "docid": "2869b2c3aa4f245d74a2d4b9b4f9fa98", "score": "0.52133864", "text": "def typed_value_for(key, value)\n fields.key?(key) ? fields[key].mongoize(value) : value.mongoize\n end", "title": "" }, { "docid": "7f5814f1e496085bc5921b0e28befbad", "score": "0.5184287", "text": "def [](field)\n self.data[field.to_s]\nend", "title": "" }, { "docid": "aafba817016c72a5168647fba927948e", "score": "0.51695645", "text": "def attributes_for_index\n data_as_elasticsearch\n end", "title": "" }, { "docid": "994b8553a4a8cde10e048a79b4ed2474", "score": "0.51672035", "text": "def result\n calling_mapper.for(Property.new(value.key, \"uri-#{value.value}\")).result\n end", "title": "" }, { "docid": "7d1cc1d2fdb16617a8e4c7bf99b28af8", "score": "0.5162577", "text": "def map_attr(name, opts = {})\n opts[:dynamodb_type] = \"M\"\n opts[:mutation_tracking] = true if opts[:mutation_tracking].nil?\n attr(name, Attributes::MapMarshaler, opts)\n end", "title": "" }, { "docid": "ee36c63265dd3181a146e769840a5386", "score": "0.51554465", "text": "def id value\n self.find { |i| i['id'] == value }['doc']\n end", "title": "" }, { "docid": "b7cc339a38d2e70ab828a5f0238d9066", "score": "0.5149036", "text": "def assemble_collection_specific\n # @json[\"fieldname_k\"] = some_value_or_method\n end", "title": "" }, { "docid": "cc95329a14e3d5f4afd44620a565cc0f", "score": "0.5135722", "text": "def to_dynamodb_type key,value\n return nil if value.nil?\n ret=case self.fields[key.to_sym][:type]\n when :string then value.to_s\n when :symbol then value.to_s\n when :integer then value.to_i\n when :set_integers then value.map{|a|a.to_i}.to_a\n when :set_strings then value.map{|a|a.to_s}.to_a\n when :datetime then (value==\"\") ? nil : value.to_datetime.utc.to_s\n when :date then (value==\"\") ? nil : value.to_date.to_s\n else\n raise InvalidAttributeType\n end\n ret\n end", "title": "" }, { "docid": "9b581bcbeb62b94c4eac68546c5b879a", "score": "0.51356345", "text": "def result\n value.statement.object = value.adapter.uri_to_id(value.statement.object)\n calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result\n end", "title": "" }, { "docid": "90a8cb39af281e29f9d3688f922cd598", "score": "0.5135266", "text": "def extract_attributes_from_document(record, data, permitted_params, aliases_document)\n data\n .slice(*permitted_params)\n .each_with_object({}) do |(attribute_name, val), attributes|\n attribute_name = attribute_name.to_sym\n actual_attribute_name = actual_field(attribute_name, record.class)\n\n if attribute_name != actual_attribute_name\n aliases_document[attribute_name] = true\n end\n\n attributes[actual_attribute_name] = val\n end\n end", "title": "" }, { "docid": "1f3298bc424bf1bffd925e82f92cf210", "score": "0.51247644", "text": "def value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "e83aa1ccfd8648a648c9c3bb20cb54a4", "score": "0.5116928", "text": "def mongoize\n { value: @value, unit: @unit, _type: 'QDM::Quantity' }\n end", "title": "" }, { "docid": "6898a9059bed66b65bd6fe160f9928ef", "score": "0.51156366", "text": "def map_to_mongoid(result)\n result[name.to_sym] =\n self.in(_giza_id: result[:matches].map { |match| match[:doc] })\n result\n end", "title": "" }, { "docid": "a1bf26907641a7755545e86e47a52a56", "score": "0.5115546", "text": "def property_to_rest_mapping\n {\n :rel_expiry => :relexpiry,\n :mem_limit => :memlimit,\n }\n end", "title": "" }, { "docid": "bf1dd631b47a91d966337f14577390b4", "score": "0.5098793", "text": "def result\n CompositeSolrRow.new(\n value.value.map do |val|\n calling_mapper.for(Property.new(value.key, val, value.value)).result\n end\n )\n end", "title": "" }, { "docid": "e68c4e69bcdfaef9f1d20d2b27e8667a", "score": "0.5092271", "text": "def attr_mapping_key()\n \"#{@document_key}<amapping\"\n end", "title": "" }, { "docid": "0792a61a0a63d2c1677f6ebb415a3adf", "score": "0.50808215", "text": "def to_dynamo_value_hash\n self.attributes.each_with_index({}) do |k, v|\n self.class.columns[k].to_dynamo_value_hash(v)\n end\n end", "title": "" }, { "docid": "efbb56df67d115deca0cb68a3264c410", "score": "0.50758153", "text": "def convert\n map do |item|\n if item['doc']\n document = item['doc']\n elsif item['id']\n document = { _id: item['id'] }\n revision = item['value']['rev'] || item['value']['_rev']\n document['_rev'] ||= revision if revision\n else\n raise \"Couldn't find _id for document in list #{item.inspect}\"\n end\n \n if document.is_a? ChillDB::Document\n document\n elsif document.respond_to? :to_hash\n revision = item['value']['_rev'] || item['value']['rev'] || item['doc']['_rev']\n document['_rev'] ||= revision if revision\n document = ChillDB::Document.new(@database, document.to_hash)\n else\n raise \"Cannot convert #{document.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "70e6624a3cd73473ca5fd020c55474a8", "score": "0.50669974", "text": "def as_couch_json\n _attributes.inject({}) {|h, (k,v)| h[k] = v.respond_to?(:as_couch_json) ? v.as_couch_json : v; h}\n end", "title": "" }, { "docid": "f1058b222fad1003c5c83a570a024167", "score": "0.5056165", "text": "def as_indexed_json(*)\n # TODO: fix ES problems with #as_flattened_jsonld\n as_jsonld\n end", "title": "" }, { "docid": "a4f04fba7a2d388b3b39c5555cbbac6d", "score": "0.50500864", "text": "def query_values_notation; end", "title": "" }, { "docid": "a4f04fba7a2d388b3b39c5555cbbac6d", "score": "0.5048174", "text": "def query_values_notation; end", "title": "" }, { "docid": "84f74a35cb6c1f3e9a0516a5993742a1", "score": "0.50480074", "text": "def result_key_for(value); end", "title": "" }, { "docid": "df1539efde9b8a3a43ad3ede2d96720f", "score": "0.5047013", "text": "def __to_json_map__\n @value\n end", "title": "" }, { "docid": "df1539efde9b8a3a43ad3ede2d96720f", "score": "0.5047013", "text": "def __to_json_map__\n @value\n end", "title": "" }, { "docid": "df1539efde9b8a3a43ad3ede2d96720f", "score": "0.5047013", "text": "def __to_json_map__\n @value\n end", "title": "" }, { "docid": "df1539efde9b8a3a43ad3ede2d96720f", "score": "0.5047013", "text": "def __to_json_map__\n @value\n end", "title": "" }, { "docid": "613945b5582a01ea1c22f2ca9ed66f6a", "score": "0.5045183", "text": "def get_field_deserializers()\n return {\n \"index\" => lambda {|n| @index = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"set\" => lambda {|n| @set = n.get_string_value() },\n }\n end", "title": "" }, { "docid": "a024d0e8e11937d71b061ac40eb68a97", "score": "0.5036374", "text": "def mongoize(object)\n case object\n when nil then nil\n when QDM::Attribute then object.mongoize\n when Hash\n object = object.symbolize_keys\n data_element = QDM.const_get(object[:_type]).new\n data_element.attribute_names.each do |field|\n data_element.send(field + '=', object[field.to_sym])\n end\n data_element.mongoize\n else object\n end\n end", "title": "" }, { "docid": "6c9a323462249135a75e9adaab9ec4ab", "score": "0.5033755", "text": "def typecast_hash_value(field, key, value)\n case key\n when \"$exists\"\n Serialization.mongoize(value, Boolean)\n when \"$size\"\n Serialization.mongoize(value, Integer)\n else\n typecast_value_for(field, value)\n end\n end", "title": "" }, { "docid": "f9991deb12b63c1b5312baef49ed6a9f", "score": "0.5031335", "text": "def j2v(field)\n return @v1mapper[field]\n end", "title": "" }, { "docid": "b67904a5a3638d760ab12114acfcaad1", "score": "0.5028183", "text": "def doc\n return model.build_from_database(self['_source']) if self['_source']\n doc_id = (value.is_a?(Hash) && value['_id']) ? value['_id'] : self.id\n doc_id ? model.get(doc_id) : nil\n end", "title": "" }, { "docid": "977120d48e34b82d4df2c9e29530f04d", "score": "0.501607", "text": "def as_indexed_json(_options = {})\n {\n \"id\" => uuid,\n \"uuid\" => uuid,\n \"doi\" => doi.downcase,\n \"user_id\" => orcid,\n \"source_id\" => source_id,\n \"error_messages\" => error_messages,\n \"claim_action\" => claim_action,\n \"put_code\" => put_code,\n \"state_number\" => state_number,\n \"aasm_state\" => aasm_state,\n \"claimed\" => claimed,\n \"created\" => created,\n \"updated\" => updated,\n \"user\" => user\n }\n end", "title": "" }, { "docid": "cf9915036d9fbf4a6c4fa7736720870d", "score": "0.50106144", "text": "def value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "cf9915036d9fbf4a6c4fa7736720870d", "score": "0.50106144", "text": "def value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "cf9915036d9fbf4a6c4fa7736720870d", "score": "0.50106144", "text": "def value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "cf9915036d9fbf4a6c4fa7736720870d", "score": "0.50106144", "text": "def value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "84d98ca48e70e78ca5c4ad553b4e5d52", "score": "0.5009265", "text": "def result\n value.statement.object = value.statement.object.value.to_i\n calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result\n end", "title": "" }, { "docid": "234f3193aa22d1f3e2e75914d94364ec", "score": "0.50045264", "text": "def encode_value(value)\n (value.is_a?(Document) ? value : RawData(value).save!).raw_uuid\n end", "title": "" }, { "docid": "c7a5054ac2b6174a89784877ba293277", "score": "0.4996154", "text": "def map_data(name, data) ; data end", "title": "" }, { "docid": "8cb1120592f9bf8bd9d4dee4ec4a0f0a", "score": "0.49952212", "text": "def value_for(row, key)\n end", "title": "" }, { "docid": "5cde4cdcba83737c3d590b251c99905f", "score": "0.49888936", "text": "def set_attributes_from_data\n return unless data.is_a?(Hash) || data.is_a?(CouchRest::Document)\n data.each do |k,v|\n k = k.to_sym\n next if k == :_id || k == :_rev\n if schema.column_names.include?(k)\n set_attribute(k, v)\n end\n end\n end", "title": "" }, { "docid": "dedff5661c26612d8e1ab81affde074f", "score": "0.4983424", "text": "def apply_mapping(source, target, mapper_obj)\n target[attr_key] = convert_value(source[@column_or_index], mapper_obj)\n rescue StandardError => e\n raise MappingError.new \"Error while mapping #{@column_or_index} to #{attr_key}: #{e.message}\",\n e,\n \"#{@column_or_index}#{source.row_index + 1}\",\n attr_key,\n mapper_obj\n end", "title": "" }, { "docid": "7ff4f28b77cc8d567c81024f2d0bf685", "score": "0.4980225", "text": "def replacement_value\n case edit_type\n when 'SET'\n value\n when 'ADD'\n a = Healthtap::NoSql.attribute_value(document.table_name,\n item_hash, attribute_path) || []\n a.append(value)\n when 'DELETE'\n a = Healthtap::NoSql.attribute_value(document.table_name,\n item_hash, attribute_path) || []\n a - [value]\n end\n end", "title": "" }, { "docid": "0479f6414495f95e0e964d52f141265d", "score": "0.4978164", "text": "def get(field)\n _doc[field.to_s]\n end", "title": "" }, { "docid": "0479f6414495f95e0e964d52f141265d", "score": "0.4978164", "text": "def get(field)\n _doc[field.to_s]\n end", "title": "" }, { "docid": "14b49d57186888713ba9cfe91948e231", "score": "0.49779382", "text": "def to_search_mapping\n { index: { _id: id, data: __elasticsearch__.as_indexed_json } }\n end", "title": "" }, { "docid": "f8eabcb5369459d3b46183696984c58e", "score": "0.4973996", "text": "def [](o); @attributes[o.to_s]; end", "title": "" }, { "docid": "35bc3ebac054f6e6af1a487e615a5df9", "score": "0.49729782", "text": "def to_dynamo_value_hash(value)\n #adapter.attribute_definition(DYNAMO_TYPE, to_dynamo_value)\n { self.class::DYNAMO_TYPE.downcase.to_sym => self.to_dynamo_value(value) }\n end", "title": "" }, { "docid": "5d3045740510786e17b75097ddd2e224", "score": "0.4970205", "text": "def oid_value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "951354b7a79f9edb815287fda904525c", "score": "0.4968762", "text": "def result\n value.statement.object = ::DateTime.iso8601(value.statement.object.to_s).utc\n calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result\n end", "title": "" }, { "docid": "541a4cb7bed18f05bdb67455fb5f633b", "score": "0.49667472", "text": "def to_index_document\n georss = calc_bounding_box\n {\n uuid: doi,\n dc_identifier_s: doi,\n dc_title_s: default_title,\n dc_creator_sm: creator_names.map(&:strip),\n dc_type_s: type,\n dc_description_s: description_text_for(Datacite::Mapping::DescriptionType::ABSTRACT).to_s.strip,\n dc_subject_sm: subjects,\n dct_spatial_sm: geo_location_places,\n georss_box_s: (georss ? georss.to_s : nil),\n solr_geom: bounding_box_envelope,\n solr_year_i: publication_year,\n dct_issued_dt: issued_date,\n dc_rights_s: license_name,\n dc_publisher_s: publisher,\n dct_temporal_sm: dct_temporal_dates,\n dryad_related_publication_name_s: related_publication_name,\n dryad_related_publication_id_s: related_publication_id,\n dryad_author_affiliation_name_sm: author_affiliations,\n dryad_author_affiliation_id_sm: author_affiliation_ids,\n dryad_dataset_file_ext_sm: dataset_file_exts,\n dcs_funder_sm: dataset_funders,\n updated_at_dt: updated_at_str\n }\n end", "title": "" }, { "docid": "bf33c04d4c62272381073434b9a2d4a0", "score": "0.4963912", "text": "def [](value)\n resource[value]\n end", "title": "" }, { "docid": "b42776596aa91930b513c44a1d225ca5", "score": "0.49613968", "text": "def store_attribute(target, column, value)\n value = column.encode_value(value)\n\n case column\n when Redpear::Schema::Score\n column.members[id] = value unless value.nil?\n when Redpear::Schema::Index\n column.members(value).add(id) unless value.nil?\n target[column] = value\n when Redpear::Schema::Column\n target[column] = value\n end\n\n value\n end", "title": "" }, { "docid": "28cf2afa8c1be4c1cf02e25a3f4a6c01", "score": "0.49572206", "text": "def mongoize(object)\n case object\n when nil then nil\n when QDM::Quantity then object.mongoize\n when Hash\n object = object.symbolize_keys\n QDM::Quantity.new(object[:value], object[:unit]).mongoize\n else object\n end\n end", "title": "" }, { "docid": "382fc594e4dafab9f5c09d725a6ee640", "score": "0.49549142", "text": "def from_search(resp)\n resp['response']['docs'].map do |doc|\n s = new(:id => doc['id'])\n doc['fields'].each do |key, value|\n case key\n when /^custom_(.*)/\n s.custom[$1] = value\n else\n s[key] = value\n end\n end\n s\n end\n end", "title": "" }, { "docid": "f5581d0e36eb279f5c51f59495bef78a", "score": "0.49531728", "text": "def typed_value_for(key, value)\n raise MissingAttributeError if fields[key].nil?\n TinyDyno::Adapter.simple_attribute(field_type: self.fields[key].options[:type], value: value)\n end", "title": "" }, { "docid": "773e6f6d7468c5ed607d0266eeb6a8c5", "score": "0.49531102", "text": "def [](key)\n convert(super(prep(key)))\n end", "title": "" }, { "docid": "6a4eb59edcd2d8af94f0ea31d3ad757d", "score": "0.49515614", "text": "def map_attrs(payload)\n mappings = @model_data.fetch('mappings', {})\n\n mappings.each do |k, v|\n payload.merge!(v => payload.delete(k))\n end\n\n payload\n end", "title": "" }, { "docid": "3e851c524e50d910a34bd96d1368a44c", "score": "0.4947592", "text": "def raw_value(obj); end", "title": "" }, { "docid": "e1abee5cd55381a66ae810a8acc0bd01", "score": "0.49462998", "text": "def encode_field(field)\n value = self.send(field)\n # DynamoDB doesn't accept nils.\n # TODO - what happens if we previously have a value, and want to nil it out?\n return nil if value.nil? || (value.respond_to?(:blank?) && value.blank?)\n\n data_type = self.class.persistent_field_type(field)\n\n # Default to String data type\n data_type_code = 'S'\n case data_type\n when :dynamo_key\n # Has_one, belongs_to values are actually stored as DynamoKey objects, so convert to String.\n value = value.to_s\n when :dynamo_keys\n # Has_many associations are stored as Arrays of DynamoKey objects.\n value = Base64.strict_encode64(::Dynamite::DynaPack.pack(value))\n data_type_code = 'B' if ::Dynamite.config.public_environment?\n when :serialized\n # Marshal.dump will produce binary values that DynamoDB can't handle.\n # Use strict encoding to avoid newlines which cause problems (at least with Fake Dynamo)\n value = Base64.strict_encode64(Marshal.dump(value))\n data_type_code = 'B' if ::Dynamite.config.public_environment?\n when :numbers\n # Must be a unique set of numbers.\n data_type_code = 'NS'\n when :strings\n # Must be a unique set of strings.\n data_type_code = 'SS'\n when :number, :time, :boolean\n data_type_code = 'N'\n case data_type\n when :time\n value = value.to_i\n when :boolean\n value = value ? '1' : '0'\n end\n # number values are still sent as strings\n # this means that times are first converted to numbers, then to strings\n value = value.to_s\n end\n {data_type_code => value}\n end", "title": "" }, { "docid": "c206ae1d16a1902e06bf0095a2048d24", "score": "0.49323332", "text": "def mongoize\n @units ? {:amount => @amount, :units => @units} : {:amount => @amount}\n end", "title": "" }, { "docid": "c206ae1d16a1902e06bf0095a2048d24", "score": "0.49323332", "text": "def mongoize\n @units ? {:amount => @amount, :units => @units} : {:amount => @amount}\n end", "title": "" }, { "docid": "f0432a4d243c9832313f933b792f0a87", "score": "0.49295098", "text": "def get_city_data(city)\n search_city = city\n puts city\n\n dynamo_db = Aws::DynamoDB::Client.new\n\tparams = {\n \ttable_name: \"WorldCities\",\n \texpression_attribute_names: {\n \t\t\"CityName\" => \"CityName\",\n \t\t\"Latitude\" => \"Latitude\", \n \t\t\"Longitude\" => \"Longitude\", \n \t\t}, \n \tprojection_expression: \"CityName, Latitude, Longitude\", \n \tfilter_expression: \"CityName = :city\",\n \texpression_attribute_values: {\n \t\t\":city\" => search_city\n \t}\n }\n\n result = dynamo_db.scan(params)\n puts \"Query succeeded.\"\n\n return result\n\nend", "title": "" }, { "docid": "06d41bedd17d5e825bbe4547e3785edc", "score": "0.49284077", "text": "def mongoize\n @localized_values.each_with_object({}) do |(key, value), h|\n h[key.to_s] = {\n 'value' => value.current_value,\n 'versions' => value.versions.map do |v|\n { 'version' => v.version, 'value' => v.value }\n end\n }\n end\n end", "title": "" }, { "docid": "8808c737e07c3736610028cb063c4ae0", "score": "0.49280113", "text": "def as_json(*args)\n h = _doc.merge(\"_type\"=>_table)\n #h[\"id\"] = h.delete(\"_id\")\n h\n end", "title": "" }, { "docid": "4bb3be38aef6eb8e6bea0227a967f0fa", "score": "0.49273872", "text": "def value_transformation; end", "title": "" }, { "docid": "0780f9f93a5931b68b117dd0587b6f9a", "score": "0.4924557", "text": "def result\n value.statement.object = value.statement.object.to_s\n calling_mapper.for(Property.new(statement: value.statement, scope: value.scope, adapter: value.adapter)).result\n end", "title": "" }, { "docid": "18844ac2d8c999c0d87ce297eb0e0766", "score": "0.49155417", "text": "def api_results\n visible_fields = @collection.visible_fields_for(@current_user, snapshot_id: @snapshot_id)\n\n fields_by_es_code = visible_fields.index_by &:es_code\n\n items = results()\n\n items.each do |item|\n properties = item['_source']['properties']\n item['_source']['identifiers'] = []\n item['_source']['properties'] = {}\n\n properties.each_pair do |es_code, value|\n field = fields_by_es_code[es_code]\n if field\n item['_source']['properties'][field.code] = field.api_value(value)\n end\n end\n end\n\n items\n end", "title": "" }, { "docid": "18844ac2d8c999c0d87ce297eb0e0766", "score": "0.49155417", "text": "def api_results\n visible_fields = @collection.visible_fields_for(@current_user, snapshot_id: @snapshot_id)\n\n fields_by_es_code = visible_fields.index_by &:es_code\n\n items = results()\n\n items.each do |item|\n properties = item['_source']['properties']\n item['_source']['identifiers'] = []\n item['_source']['properties'] = {}\n\n properties.each_pair do |es_code, value|\n field = fields_by_es_code[es_code]\n if field\n item['_source']['properties'][field.code] = field.api_value(value)\n end\n end\n end\n\n items\n end", "title": "" }, { "docid": "181d7a73582e8327ffb625dffdfa4e2b", "score": "0.49115175", "text": "def value\n nr.value[map]\n end", "title": "" }, { "docid": "4719b8a98ad014a4e748af7155aa18a1", "score": "0.49102163", "text": "def generic_field_value(name:, operation:, role:, item: nil, sample: nil, row: nil, column: nil)\n type = sample ? 'sample' : 'json'\n field_type = generic_field_type(name: name, type: type)\n\n field_value = FieldValue.new(\n name: name,\n child_item_id: item&.id,\n child_sample_id: sample&.id,\n role: role,\n parent_class: 'Operation',\n parent_id: operation.id,\n field_type_id: field_type.id,\n row: row,\n column: column\n )\n field_value.save\n field_value\n end", "title": "" } ]
8eb6889caea43a1db47e9735fd72d070
Is this a backwards, linear update?
[ { "docid": "36404ed6bf19696e10d6a4ff27696cd9", "score": "0.0", "text": "def backwards?\n remote == ancestor\n end", "title": "" } ]
[ { "docid": "6e4256ea6ab3a80028639656b35330c3", "score": "0.64440465", "text": "def mirror_update pt\n pt.x = pt.x * (-1)\nend", "title": "" }, { "docid": "82df0cc99632d2ebf15cdab4fe6ac44b", "score": "0.6010816", "text": "def should_reverse?\n stops_remaining_in_direction?\n end", "title": "" }, { "docid": "41f4add2780ec0b8d209c0db08b7d12f", "score": "0.5954979", "text": "def backward?\n true\n end", "title": "" }, { "docid": "9d2b685f23d4bba0785c8ba7b0715dad", "score": "0.57969165", "text": "def propagate_backward\n @Delta = []\n\n # l = L\n @Delta[@L] = @Y - @D\n\n # l = (L-1)..1\n [*(1...@L)].reverse.each do |l|\n f_u = Matrix.columns( @U[l].t.to_a.map { |u| @layers[l].activate_(u) } )\n w_d = @layers[l+1].W.t * @Delta[l+1]\n @Delta[l] = @layers[l].J.times.map do |j|\n @N.times.map do |n|\n f_u[j, n] * w_d[j, n]\n end\n end.tap { |ary| break Matrix[*ary] }\n end\n end", "title": "" }, { "docid": "489ab711be285dab6e22197f6e114478", "score": "0.5736606", "text": "def reversed?\n end", "title": "" }, { "docid": "4adef28f45704b396571999745a8c932", "score": "0.5697146", "text": "def linear?\n !circular?\n end", "title": "" }, { "docid": "48bb4ffee17a826c04add8a1a08a3893", "score": "0.5682128", "text": "def add_reversed?\n @add_reversed\n end", "title": "" }, { "docid": "0537a1a86324c8203d2e19e3e618a502", "score": "0.55849546", "text": "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "title": "" }, { "docid": "0537a1a86324c8203d2e19e3e618a502", "score": "0.55849546", "text": "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "title": "" }, { "docid": "12a9de08d40893752376f9c919d496e9", "score": "0.546755", "text": "def changed?\n !!@previous\n end", "title": "" }, { "docid": "8f3e0e84a8f9b22400d7f5118e405685", "score": "0.54350156", "text": "def update_transition?\r\n # Abort loop if transition processing\r\n if $game_temp.transition_processing\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "5d120e2f5432be20d3a0860411454551", "score": "0.5378959", "text": "def calculate_flip_affect(var)\r\n num_of_clauses = @num_clauses \r\n @assignments[var] = !@assignments[var] #do hypothetical flip (undone before return)\r\n \r\n #See if any clauses are affected by the change.\r\n #-1 for clauses that were true and became false \r\n #+1 for clauses that were false and became true\r\n #0 for clauses not affected\r\n for clause_index in 0...@variables_to_clauses[(2*var)-1].size() #Check effects to all clauses containing V\r\n clause = @clauses_to_variables[@variables_to_clauses[(2*var)-1][clause_index]]\r\n is_sat = false\r\n for i in 0...clause.size()\r\n if((clause[i] > 0 and @assignments[clause[i]]) or (clause[i] < 0 and !@assignments[(-1)*clause[i]])) #is it sat?\r\n is_sat = true\r\n break #The clause is SAT, check next one without looking at more variables within the clause\r\n end\r\n end\r\n #If it wasn't SAT, was it SAT before?\r\n if is_sat\r\n if(@active_clauses[@variables_to_clauses[(2*var)-1][clause_index]])#Was it false before\r\n num_of_clauses -= 1 #Yup, it was. We gained a clause, +1\r\n end\r\n else\r\n if(!@active_clauses[@variables_to_clauses[(2*var)-1][clause_index]])#Was it true before\r\n num_of_clauses += 1 #Yup, it was. We lost a clause -1\r\n end\r\n end\r\n end #end clause loop\r\n \r\n for clause_index in 0...@variables_to_clauses[(2*var)].size() #Check effects to all clauses containing -V\r\n clause = @clauses_to_variables[@variables_to_clauses[(2*var)][clause_index]]\r\n is_sat = false\r\n for i in 0...clause.size()\r\n if((clause[i] > 0 and @assignments[clause[i]]) or (clause[i] < 0 and !@assignments[(-1)*clause[i]])) #is it sat?\r\n is_sat = true\r\n break #The clause is SAT, check next one without looking at more variables within the clause\r\n end\r\n end\r\n #if it wasnt SAT, was it SAT before?\r\n if is_sat\r\n if(@active_clauses[@variables_to_clauses[(2*var)][clause_index]])#Was it false before\r\n num_of_clauses -= 1 #Yup, it was. We gained a clause, +1\r\n end\r\n else\r\n if(!@active_clauses[@variables_to_clauses[(2*var)][clause_index]])#Was it true before\r\n num_of_clauses += 1 #Yup, it was. We lost a clause -1 \r\n end\r\n end\r\n end #end clause loop\r\n \r\n #undue assignment\r\n @assignments[var] = !@assignments[var]\r\n return @num_clauses - num_of_clauses\r\n end", "title": "" }, { "docid": "64937b42f1b9d69decd23615919d4678", "score": "0.53592974", "text": "def move_backward\r\r\n last_direction_fix = @direction_fix\r\r\n @direction_fix = true\r\r\n @move_poll+= [[reverse_dir(@direction), false]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n @direction_fix = last_direction_fix\r\r\n end", "title": "" }, { "docid": "829a1c5d67668c7b6d49ec358650c280", "score": "0.53524506", "text": "def fixed_step?\n prev_step, prev = nil, nil\n self.indices.sort.each do |i|\n if prev\n curr_step = i - prev\n if prev_step\n return false if prev_step != curr_step\n end\n \n prev_step = curr_step\n end\n \n prev = i\n end\n \n return prev_step\n end", "title": "" }, { "docid": "92ac19c68f21c949961bc41ad8ef0577", "score": "0.5348911", "text": "def backwards_move?\r\n self.color == \"white\" ? @y0 < @y1 : @y0 > @y1\r\n end", "title": "" }, { "docid": "b357397109b8958c61b553b8770b5651", "score": "0.53238636", "text": "def revive?(life_state, live_neighbors)\n life_state == false && live_neighbors >= 3 && live_neighbors <= 3\nend", "title": "" }, { "docid": "01731d3e1210c7573d1467fa65c24982", "score": "0.53238374", "text": "def updateable?\n return true if @cursor == STOP\n now = Time.now\n @last_update ||= now\n now - @last_update > UPDATE_DELAY\n end", "title": "" }, { "docid": "fac6917274b086756b39ce161bfc4724", "score": "0.5295469", "text": "def update?\n if @w_up_to_date && true #all up_to_date-caches!!!\n @up_to_date = true\n return @up_to_date\n end\n false\n end", "title": "" }, { "docid": "06a34561c1cd4aa567f3f1d944ec3487", "score": "0.5290391", "text": "def backward\n direction(:backward)\n end", "title": "" }, { "docid": "4b9146ac1f727c5be475d77fe1172f11", "score": "0.5247715", "text": "def stale!\n if stale?\n update\n true\n else\n false\n end\n end", "title": "" }, { "docid": "8f14efd9872501ddd146f5ab93723b55", "score": "0.5243316", "text": "def rev?\r\n return @rev\r\n end", "title": "" }, { "docid": "1d85cb703a8d1f907fe7ce75d2d788e0", "score": "0.52373445", "text": "def update_2prev(player,i)\n if i == 2\n @game_scores[player - 1][-2] = 20 + @frame_scores[player - 1][i][0]\n # puts \"line #{__LINE__} - 2prev:\\t#{@game_scores[player - 1].inspect}\"\n else\n @game_scores[player - 1][-2] = @game_scores[player - 1][-3] + 20 + @frame_scores[player - 1][i][0]\n # puts \"line #{__LINE__} - 2prev:\\t#{@game_scores[player - 1].inspect}\"\n end \nend", "title": "" }, { "docid": "1d85cb703a8d1f907fe7ce75d2d788e0", "score": "0.52373445", "text": "def update_2prev(player,i)\n if i == 2\n @game_scores[player - 1][-2] = 20 + @frame_scores[player - 1][i][0]\n # puts \"line #{__LINE__} - 2prev:\\t#{@game_scores[player - 1].inspect}\"\n else\n @game_scores[player - 1][-2] = @game_scores[player - 1][-3] + 20 + @frame_scores[player - 1][i][0]\n # puts \"line #{__LINE__} - 2prev:\\t#{@game_scores[player - 1].inspect}\"\n end \nend", "title": "" }, { "docid": "5e35537228863effc15a7cd827367e0d", "score": "0.5234765", "text": "def reverted?\n version != last_version\n end", "title": "" }, { "docid": "9d1c3cee31cf5238d8e765d137dcbf89", "score": "0.52252305", "text": "def back(steps)\n forward(-steps)\n end", "title": "" }, { "docid": "561eb2e125dcdb5160659edada0252dc", "score": "0.52069235", "text": "def reverse?\n @reverse\n end", "title": "" }, { "docid": "561eb2e125dcdb5160659edada0252dc", "score": "0.52069235", "text": "def reverse?\n @reverse\n end", "title": "" }, { "docid": "2071690bbaf7783a23a2d0cbbf08c487", "score": "0.5195178", "text": "def reverse_inplace(s)\n if s.length <= 1\n return s\n else\n rs = reverse(s[1..-1])\n rs += s[0]\n rs\n end \nend", "title": "" }, { "docid": "2ecc3feb08a6cd23dab94bef4c0903b1", "score": "0.5192119", "text": "def any_updates?\n change_history.size > 1\n end", "title": "" }, { "docid": "2ecc3feb08a6cd23dab94bef4c0903b1", "score": "0.5192119", "text": "def any_updates?\n change_history.size > 1\n end", "title": "" }, { "docid": "9df79d3cef312eae63955290ce182f8c", "score": "0.51838577", "text": "def reverse!\n @upwards = !@upwards\n skip!(2)\n end", "title": "" }, { "docid": "c8f91370c58c7ae823946d416af49cf8", "score": "0.5171538", "text": "def flipud\n reverse(0)\n end", "title": "" }, { "docid": "1be0f83a9a0386dc41f68c2b5c85f502", "score": "0.51684463", "text": "def reverse_inplace(s)\n return s if s.length <= 1\n gnirts = reverse_inplace(s[1..-1])\n gnirts += s[0]\nend", "title": "" }, { "docid": "2e83c039db16dceaf398591457ce6fc6", "score": "0.51476985", "text": "def reverse?(other)\n (from_end == other.to_end and\n to_end == other.from_end and\n overlap == other.reverse_overlap)\n end", "title": "" }, { "docid": "b0deedcb9ae9d1b51f9bf2f920c04359", "score": "0.51429725", "text": "def accelBackward\n @vel_y += @VELOCITY\n end", "title": "" }, { "docid": "fdf93d92c6c2c7323de210ae2aded813", "score": "0.5141212", "text": "def S\n @y -= 1\n end", "title": "" }, { "docid": "809d158351ae1dd26a7ac0d280883a7d", "score": "0.5128242", "text": "def pali?(arg)\n arg == arg.reverse\nend", "title": "" }, { "docid": "5cff296525e8bd0801e027ffa8c6057d", "score": "0.5119235", "text": "def moveBackward\n case @currentDir\n when :north\n decrementY\n when :south\n incrementY\n when :east\n decrementX\n when :west\n incrementX\n end\n\n #if new current position has obstacle, move back and report it\n if @grid.obstacles.include?(@currentPos)\n puts \"Cannot move backward. Obstacle present behind at (#{@currentPos.x}, #{@currentPos.y})\"\n moveForward\n return false\n end\n\n true\n end", "title": "" }, { "docid": "b007ae221fba0c0ea52a2e80d0a56dc4", "score": "0.5115284", "text": "def update_phase!()\n @involved_entities.each do |involved_entity|\n return false unless ( !involved_entity.has_to_update || execute_update!( involved_entity.entity_class ) )\n end\n return true\n end", "title": "" }, { "docid": "ed1a08c8576fd39fb6792ce469c2c87f", "score": "0.51092535", "text": "def reverse_inplace(s)\n return s if s.length == 1 || s.empty? || s[0] == s[-1]\n while s.length > 0\n x = s[0]\n y = s[-1]\n s[-1] = x\n s[0] = y\n return reverse_inplace(s[1..-2])\n end\nend", "title": "" }, { "docid": "09b619742b0bebc74e4ac8eeb2577c29", "score": "0.51077026", "text": "def reverse()\n #This is a stub, used for indexing\nend", "title": "" }, { "docid": "1ab763a20133af9ab264eec7ce57b77a", "score": "0.510339", "text": "def vertical_move\n @initial_pos[0] == @final_pos[0] \n end", "title": "" }, { "docid": "f217f0134991418f40128ad2312d0a3b", "score": "0.5097723", "text": "def updated?\n false\n end", "title": "" }, { "docid": "923353929b7da2cdb059a11ea45cca5f", "score": "0.50897473", "text": "def test_update_with_LTZ;\n a=[[1,0,1],[0,1,0]]\n show(a)\n a[1][2]=-3\n end", "title": "" }, { "docid": "d022e1469121e012b5af5c21427997b5", "score": "0.5087282", "text": "def right_optimizable?\n !right.equal?(operation.right)\n end", "title": "" }, { "docid": "93cb7c445c1b954477a851c25267c541", "score": "0.50839704", "text": "def reverse\n @x = -@x\n @y = -@y\n self\n end", "title": "" }, { "docid": "f824047a611a04c47357b520bec7c923", "score": "0.5082596", "text": "def step_back\n\t\tputs \"step back\"\n\t\t\n\t\t# @time_travel_i == @history.length-1\n\t\t# puts \"turn: #{@wrapped_object.update_counter.current_turn}\" \n\t\t# puts \"target: #{@history.length-1}\"\n\t\t\n\t\t# @forecasting_lock # <-- if true, currently calculating forecast\n\t\t\n\t\t\n\t\tif self.state_name == :forecasting\n\t\t\treturn if @forecasting_lock\n\t\t\t\n\t\t\t# can't travel to t=0 ; the initial state is not renderable\n\t\t\tif @time_travel_i > 1\n\t\t\t\t@time_travel_i -= 1\n\t\t\tend\n\t\telsif self.state_name == :forecasting_error\n\t\t\t# can't travel to t=0 ; the initial state is not renderable\n\t\t\tif @time_travel_i > 1\n\t\t\t\t@time_travel_i -= 1\n\t\t\tend\n\t\telsif self.state.include? \"timeline\"\n\t\t\t# (already in time traveling mode)\n\t\t\t# step backwards in time\n\t\t\t\n\t\t\t# can't travel to t=0 ; the initial state is not renderable\n\t\t\tif @time_travel_i > 1\n\t\t\t\t@time_travel_i -= 1\n\t\t\tend\n\t\telse\n\t\t\t# (not currently time traveling)\n\t\t\t# start time traveling\n\t\t\treturn if self.state_name == :running\n\t\t\t\t# + :running is for actively executing code. pause execution first.\n\t\t\t\n\t\t\tself.begin_time_travel()\n\t\t\tputs \"time traveling to: #{self.state}\"\n\t\tend\n\tend", "title": "" }, { "docid": "8f578413d5d8e5f1ab3fa0e9263c4752", "score": "0.5074443", "text": "def update?\n true\n end", "title": "" }, { "docid": "8735066c790244fc5b30be610db76c00", "score": "0.5071213", "text": "def samedirection?(vector2)\n end", "title": "" }, { "docid": "065e36ed6b941b57d3869324702d7f3f", "score": "0.5068956", "text": "def updated?() updated.present?; end", "title": "" }, { "docid": "dfb281b9e632f049bb0de8be4b7877f8", "score": "0.5068322", "text": "def reciprocal_array?\n !set_reciprocal_to_self?\n end", "title": "" }, { "docid": "07935600e350885de1d93a220c96f758", "score": "0.50623846", "text": "def reverse_inplace(s)\n return s if s.length <= 1\n return s[-1] + reverse(s[0...-1])\n end", "title": "" }, { "docid": "9ab4918af49b5cd9a113f653db9df709", "score": "0.50589865", "text": "def reverse!\n raise \"can't modify frozen object\" if frozen?\n @x, @y = -@x, -@y\n @hash = nil\n self\n end", "title": "" }, { "docid": "76a93fc4c590088a0aba46ae3c864f55", "score": "0.50568277", "text": "def update\n advance( (Time.new - @updated).to_i )\n end", "title": "" }, { "docid": "57c863a88f43b69b9d4c802b73dec325", "score": "0.50550526", "text": "def update?\n false\n end", "title": "" }, { "docid": "57c863a88f43b69b9d4c802b73dec325", "score": "0.50550526", "text": "def update?\n false\n end", "title": "" }, { "docid": "749a16dffd958eacabf2b484dbdcdef5", "score": "0.50534856", "text": "def invert() end", "title": "" }, { "docid": "554fb9ce658a1b49ad258067df902ce2", "score": "0.5053435", "text": "def can_decrement_step\n !step_flow.previous_step.nil?\n end", "title": "" }, { "docid": "ed46e61645fd15721f08595c6c86c43f", "score": "0.50495505", "text": "def reverse_inplace(s)\n return s if s.length == 0\n return reverse(s[1..-1]) + s[0]\nend", "title": "" }, { "docid": "297c28a598ee6102665c8835c9da17fe", "score": "0.5046715", "text": "def reverse_inplace(s)\n return s if s.length <= 1\n return reverse_inplace(s[1..-1]) + s[0]\nend", "title": "" }, { "docid": "b40b76061205cbdec4d62cf82c7c9b53", "score": "0.50393933", "text": "def invert(list)\n for i in 0..list.length-1\n list[i] *= -1 unless list[i] == 0\n end\n list\nend", "title": "" }, { "docid": "a80ee59dbc267de68e1724df9d311472", "score": "0.50367105", "text": "def W\n @x -= 1\n end", "title": "" }, { "docid": "7bfc68bec44b80f3d50559bfb8f9f4c3", "score": "0.502743", "text": "def reciprocal_array?\n false\n end", "title": "" }, { "docid": "82427ec986e1249e80aed7b82e76600b", "score": "0.502351", "text": "def check_delta2\n (0...@nvertex).each do |v|\n next unless @label[@in_blossom[v]] == MWMGeneral::LBL_FREE\n bd = nil\n bk = nil\n @neighb_end[v].each do |p|\n k = p / 2 # Note: floor division\n w = @endpoint[p]\n next unless @label[@in_blossom[w]] == MWMGeneral::LBL_S\n d = slack(k)\n if bk.nil? || d < bd\n bk = k\n bd = d\n end\n end\n option1 = bk.nil? && @best_edge[v].nil?\n option2 = !@best_edge[v].nil? && bd == slack(@best_edge[v])\n unless option1 || option2\n raise \"Assertion failed: Free vertex #{v}\"\n end\n end\n end", "title": "" }, { "docid": "4e48ec145b06dbd21170227bc14d0ec9", "score": "0.5014068", "text": "def reverse_inplace(s)\n\treturn reverse_helper(s, 0, (s.length - 1))\nend", "title": "" }, { "docid": "7c6f870850e514606b525ce45e42ce29", "score": "0.5011803", "text": "def waypoints_changed?\n changed = false\n waypoints.each do |waypoint|\n changed |= waypoint.changed? || waypoint.marked_for_destruction?\n end\n changed\n end", "title": "" }, { "docid": "b0cda038bbc437899692a4cfa9af43e4", "score": "0.500357", "text": "def rev?\n if @rxint or @txint or (@rxstate == REV) or (@txstate == REV)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "6a9e6ee9a2873bfefe4f5ae3d5abe5a9", "score": "0.50020194", "text": "def reverse_inplace(s)\n return s if s.empty?\n return (s[1..-1]).reverse + s[0]\nend", "title": "" }, { "docid": "f8e71896d70262884216890654d3c57d", "score": "0.4998635", "text": "def reverse_inplace(s)\n\n if s.length == 0\n return s\n else \n return s[s.length-1] + reverse(s[0, s.length-1])\n end\n\nend", "title": "" }, { "docid": "c425ddb942c27f88c897d003be19a61e", "score": "0.49922135", "text": "def reciprocal_array?\n false\n end", "title": "" }, { "docid": "3a36eb0bbae55ec9a592fe900bc71d63", "score": "0.49860808", "text": "def changed?\n\t\tchanged = (@price_new != @price_old)\n\t\t@price_old = @price_new\n\t\treturn changed\n\tend", "title": "" }, { "docid": "e059a9b5f537be198059f779667415b1", "score": "0.4981656", "text": "def bound_vy(vy) return 0 end", "title": "" }, { "docid": "d62e2268b7cd03cd39f77c7454b794c8", "score": "0.49803966", "text": "def invert; end", "title": "" }, { "docid": "8fd1b3d254fa268a48979f603e97704d", "score": "0.49792933", "text": "def reverse_inplace(s)\n if s.length <= 1\n return s \n else \n return s[s.length - 1] + reverse(s[0..-2])\n end\nend", "title": "" }, { "docid": "c7b8b750d93df38033a5ecf81185e986", "score": "0.49787247", "text": "def normalize!\n if self[2] < 0\n self[0], self[2] = self[0]+self[2], -self[2]\n end\n if self[3] < 0\n self[1], self[3] = self[1]+self[3], -self[3]\n end\n self\n end", "title": "" }, { "docid": "23759583ce6682d3637a95fcb5ceddf1", "score": "0.4978357", "text": "def data_changed?(current_data, previous_data)\n if current_data && previous_data\n current_data != previous_data\n else\n true\n end\n end", "title": "" }, { "docid": "fc1e28a7c779fe52e160906de129ef9b", "score": "0.49732795", "text": "def inverse; end", "title": "" }, { "docid": "fc1e28a7c779fe52e160906de129ef9b", "score": "0.49732795", "text": "def inverse; end", "title": "" }, { "docid": "fb97f51df5d80054c949caf441d7f021", "score": "0.4973113", "text": "def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend", "title": "" }, { "docid": "73f8cf38f0a002b977da8034dc7c6588", "score": "0.49627975", "text": "def reverse_inplace(s)\n return reverse_helper(s, 0 , s.length - 1) \nend", "title": "" }, { "docid": "6cc38ef90cce6d855d322bd644246941", "score": "0.49578336", "text": "def rev(a)\n for i in 0...a.length/2\n a[i], a[-i-1] = a[-i-1], a[i]\n end\n a\nend", "title": "" }, { "docid": "5a358ecf843120144a5b983359382be7", "score": "0.49575263", "text": "def test_backward_node\n loss = DNN::Losses::MeanSquaredError.new\n y = Numo::SFloat[[0, 1]]\n t = Numo::SFloat[[2, 4]]\n loss.forward_node(y, t)\n grad = loss.backward_node(Numo::SFloat[1])\n assert_equal Numo::SFloat[[-2, -3]], grad.round(4)\n end", "title": "" }, { "docid": "7419acde05aad94519365d72a36f546e", "score": "0.49520355", "text": "def reverse_polarity\n case @value\n when :+\n @value = :-\n return true\n when :-\n @value = :+\n return true\n end\n false\n end", "title": "" }, { "docid": "0d3c477eddf17db5f3ceffca6d1dde63", "score": "0.49509257", "text": "def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend", "title": "" }, { "docid": "0d3c477eddf17db5f3ceffca6d1dde63", "score": "0.49509257", "text": "def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend", "title": "" }, { "docid": "19a419803c1346d58baa20c7dae4219f", "score": "0.49476254", "text": "def reverse_inplace(s)\n return reverse_helper(s, 0, s.length-1)\nend", "title": "" }, { "docid": "281c57f815a38e9e759cb8106bf8c9b6", "score": "0.4947412", "text": "def reverse_inplace(s)\n b = 0\n e = s.length - 1\n reverse_inplace_helper(b,e,s)\n return s\nend", "title": "" }, { "docid": "f3ae52282ac54ba68e737f5cdfe6b5e3", "score": "0.49472955", "text": "def reverse_inplace(s)\n return s if s.length == 0\n return s if s.length == 1\n\n reverse_helper(s, 0, s.length - 1)\n return s\nend", "title": "" }, { "docid": "993b222c08a3e87026244ec572ee3987", "score": "0.49437237", "text": "def update(index, val)\n i = index\n b_l = i/@len\n @b[b_l] = @b[b_l] - @nums[i] + val\n @nums[i] = val\n end", "title": "" }, { "docid": "71e56a65a43333b574d949d8b41a6741", "score": "0.4941555", "text": "def reverse_inplace(s)\n if s.size < 2\n return s\n end\n return reverse_inplace(s[1..-1]) + s[0]\nend", "title": "" }, { "docid": "c300b26c952b366648dc543c2115b0e6", "score": "0.49382985", "text": "def decrement!\n self.left_half -= 1\n # TODO: This breaks if the length of a palindrome changes, as odd doesn't update\n self\n end", "title": "" }, { "docid": "02c6d1c5b89bb798af9af20ace11dd38", "score": "0.4935202", "text": "def back(steps)\n forward(-steps)\n end", "title": "" }, { "docid": "97decead643df284d684a02dca3261a7", "score": "0.49351165", "text": "def changed_notably?\n if ignored_attr_has_changed?\n timestamps = @record.send(:timestamp_attributes_for_update_in_model).map(&:to_s)\n (notably_changed - timestamps).any?\n else\n notably_changed.any?\n end\n end", "title": "" }, { "docid": "81b37fcdb6b4cac9ba969eaa62b57226", "score": "0.49333143", "text": "def reached_new_level?\n return false unless points_awarded && points_awarded_changed?\n\n level_after_update.level_number > level_before_update.level_number\n end", "title": "" }, { "docid": "25f069ffd15f34f2eee8c9a2b49a9a4c", "score": "0.4932428", "text": "def phase_shift? ; false ; end", "title": "" }, { "docid": "76c540f9867a397f4b8f203a7e2c2772", "score": "0.49310106", "text": "def reverse_pass(array, compare)\n swapped = false\n (array.length - 2).downto(0) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend", "title": "" }, { "docid": "b009a6339c1ce9f9c9a09bee264c8b28", "score": "0.4929225", "text": "def inverted; invert = true; self; end", "title": "" }, { "docid": "87fd3ead2a9dea304706ee4108646e5c", "score": "0.4927283", "text": "def reverse!(arr)\n (arr.size / 2).times { |idx| arr[idx], arr[-1 - idx] = arr[-1 - idx], arr[idx] }\n arr\nend", "title": "" }, { "docid": "8760e0537f8e8db7deccf14906e6946c", "score": "0.49254784", "text": "def last_non_null_velocity\n raise VelocityAlwaysEqualToZero if !has_started?\n historic_velocity.reverse.find do |velocity|\n velocity != 0\n end\n end", "title": "" }, { "docid": "8df962ed466cec7bfd69586965801977", "score": "0.4915175", "text": "def update?\n state == STATE_UPDATE\n end", "title": "" }, { "docid": "c7654d2c07fb14ee199b96d3968616cb", "score": "0.4914643", "text": "def new?\n !rev\n end", "title": "" } ]
e22df8c3aa7533b02f5621c552720e5d
Called when a call is made and the circuit is open. Raises a CircuitBrokenException exception.
[ { "docid": "a8bfcc948eec8301808de09233d9f26a", "score": "0.7610255", "text": "def on_circuit_open(circuit_state)\n @logger.info(\"on_circuit_open: raising for #{circuit_state.inspect}\")\n\n raise CircuitBreaker::CircuitBrokenException.new('Circuit broken, please wait for timeout', circuit_state)\n end", "title": "" } ]
[ { "docid": "5823ba807977222fef7485a2f89e6e8c", "score": "0.7534557", "text": "def on_circuit_open(circuit_state)\n @logger.debug(\"on_circuit_open: raising for #{circuit_state.inspect}\") if @logger\n\n raise CircuitBreaker::CircuitBrokenException.new(\"Circuit broken, please wait for timeout\", circuit_state)\n end", "title": "" }, { "docid": "0a2cd405d58df1fa1baceb2631afdb7a", "score": "0.6163405", "text": "def handle(circuit_state, method, *args, &block)\n if is_tripped(circuit_state)\n @logger.info(\"handle: breaker is tripped, refusing to execute: #{circuit_state.inspect}\")\n on_circuit_open(circuit_state)\n end\n\n begin\n out = nil\n Timeout.timeout(@invocation_timeout, CircuitBreaker::CircuitBrokenException) do\n out = method.call(*args, &block)\n on_success(circuit_state)\n end\n rescue Exception => e\n on_failure(circuit_state) unless @excluded_exceptions.include?(e.class)\n raise\n end\n return out\n end", "title": "" }, { "docid": "992784e01123c757b954a6f5b83a2f5c", "score": "0.6123524", "text": "def call(*args, &block_arg)\n case(state)\n when 'open'\n if time_to_retry?\n do_retry(*args, &block_arg)\n else\n raise CircuitOpen\n end\n when 'closed'\n do_call(*args, &block_arg)\n end\n end", "title": "" }, { "docid": "567d60324ddfa4dfb891d27e26afe0f7", "score": "0.60163796", "text": "def handle(circuit_state, method, *args)\n if is_tripped(circuit_state)\n @logger.debug(\"handle: breaker is tripped, refusing to execute: #{circuit_state.inspect}\") if @logger\n on_circuit_open(circuit_state)\n end\n\n circuit_state.increment_call_count\n begin\n out = nil\n Timeout.timeout(@invocation_timeout, CircuitBreaker::CircuitBrokenException) do\n out = method[*args]\n on_success(circuit_state)\n end\n rescue Exception => e\n on_failure(circuit_state) unless @excluded_exceptions.include?(e.class)\n raise\n end\n return out\n end", "title": "" }, { "docid": "46605561eb311f9160515166c1739e70", "score": "0.5773713", "text": "def error(current_request_number)\n will_notify_notifier_opened = false\n\n @state_lock.synchronize do\n if open?\n debug \"ignoring late error response (circuit is open)\", name, current_request_number\n return\n end\n\n debug \"request failed. #{@strategy.inspect}\", name, current_request_number\n @strategy.error\n\n if @strategy.should_open?\n info \"opening circuit\", name, current_request_number\n open!\n will_notify_notifier_opened = true\n end\n end\n\n # We don't want to be doing this while holding the lock\n if will_notify_notifier_opened\n @notifier.opened\n end\n end", "title": "" }, { "docid": "edf13dece94f817d5ab2b23f59a943ac", "score": "0.5456359", "text": "def call!\n context.fail_hard!\n call\n end", "title": "" }, { "docid": "3385d88a4421cd2fd35e569c4b464d7b", "score": "0.5394833", "text": "def open(circuit, opened_at)\n send_chain(:open, circuit, opened_at) do |e|\n options.notifier.notify(:storage_failure, circuit: circuit, action: :open, error: e)\n end\n end", "title": "" }, { "docid": "fe49477a6c6f95c9855122cfaa5c0226", "score": "0.53392977", "text": "def _handle(call)\n self.busy!\n call.done!\n self.free!\n self.update(last_active: DateTime.now)\n puts \"Call #{call} handled by #{self.attributes}\"\n end", "title": "" }, { "docid": "b367aece298e1d70cf9bca8255f8f1d5", "score": "0.5313824", "text": "def hangUp()\n if @activeCall == nil\n raise 'No active call to hang up.'\n end\n self.hangUp(@activeCall)\n end", "title": "" }, { "docid": "393d0b3b2cd7020ea774e23a7e865feb", "score": "0.53031796", "text": "def perform\n ensure_state :connected\n yield\n # Some buggy Rubies continue to raise this exception\n rescue IO::WaitWritable\n :wait_writable\n # Due to SSL, we may need to write to complete a read (e.g. handshaking, renegotiation)\n rescue IO::WaitReadable\n :wait_readable\n rescue => ex\n # TODO: more specific exceptions\n raise Socketry::Error, ex.message, ex.backtrace\n end", "title": "" }, { "docid": "4860e01ceab7b147429ec3c3e6e85b41", "score": "0.52612704", "text": "def incomingCall\n sys.SetFromHeader(formatNum(@cname || @cid,true), nil, Host) # Set FromName & FromHost for sys.Dial\n\n # Forward call to the bindings (ATA / softphone)\n # Change FromURI when forwarding to @local, or else Bria won't find contact in its phonebook!\n\n callswitch(\"#{@user}@local[fu=#{@cid}]\",45) unless (30..745) === @t.hour*100 + @t.min # reject incoming calls from 0:30a to 7:45a\n\n @code, @reason = 480, \"#{@user} is asleep\" unless @code # if nothing else, must be the night hour\n @code = 486 if @trunk =~ /IPCOMM/i ## *** temporary fix for IPCOMMS ***\nend", "title": "" }, { "docid": "5bc6e12cc0d147f1e897e97c81a0f2b0", "score": "0.52527887", "text": "def on_success(circuit_state)\n @logger.debug(\"on_success: #{circuit_state.inspect}\") if @logger\n\n if circuit_state.closed?\n @logger.debug(\"on_success: reset_failure_count #{circuit_state.inspect}\") if @logger\n circuit_state.reset_failure_count\n end\n\n if circuit_state.half_open?\n @logger.debug(\"on_success: reset circuit #{circuit_state.inspect}\") if @logger\n circuit_state.reset\n end\n end", "title": "" }, { "docid": "cfda0a6ce5fc0342c0efabb220046361", "score": "0.5232284", "text": "def _raise_not_connected!\n raise Beaneater::NotConnected, \"Connection to beanstalk '#{@host}:#{@port}' is closed!\"\n end", "title": "" }, { "docid": "106d3dfc1ae78834d509a4d04ccc4517", "score": "0.5191382", "text": "def on_failure(circuit_state)\n @logger.debug(\"on_failure: circuit_state = #{circuit_state.inspect}\") if @logger\n\n circuit_state.increment_failure_count\n\n if trip_checker.tripped?(circuit_state) || circuit_state.half_open?\n # Set us into a closed state.\n @logger.debug(\"on_failure: tripping circuit breaker #{circuit_state.inspect}\") if @logger\n circuit_state.trip\n end\n end", "title": "" }, { "docid": "94e73f902a49a2994c16bdafd90ed175", "score": "0.51504284", "text": "def raise_not_connected!\n raise NotConnected, \"Connection to beanstalk '#{@host}:#{@port}' is closed!\"\n end", "title": "" }, { "docid": "28c5043bc8f22b3b1aa1854e9fa25133", "score": "0.513133", "text": "def hold\n begin\n @conn ||= @connection_proc.call\n yield @conn\n rescue Exception => e\n # if the error is not a StandardError it is converted into RuntimeError.\n raise(@convert_exceptions && !e.is_a?(StandardError) ? RuntimeError.new(e.message) : e)\n end\n end", "title": "" }, { "docid": "8f3392b1a92e29c2d930cd0851988fe1", "score": "0.513037", "text": "def on_failure(circuit_state)\n current_state = circuit_state.current_state\n\n @logger.debug(\"on_failure: state=#{current_state}: #{circuit_state.inspect}\")\n\n circuit_state.increment_failure_count\n\n if is_failure_threshold_reached(circuit_state) || circuit_state.half_open?\n # Set us into a closed state.\n @logger.info(\"on_failure: state=#{current_state} tripping circuit breaker #{circuit_state.inspect}\")\n circuit_state.trip\n end\n end", "title": "" }, { "docid": "d2f53bdf8afcf52277897ca86b909a71", "score": "0.51196146", "text": "def connect\n begin\n connection = CreditCardServer.connect(...)\n yield connection # <--- this is when the block argument runs; in this case, `connection.send(amount, credit_card_number)`\n rescue IOError => e\n Logger.log \"Could not submit order #{@order_number} to the server: #{e}\"\n return nil\n ensure\n connection.close\n end\nend", "title": "" }, { "docid": "b75a87e7641a0c1994c0cc4e99b37c71", "score": "0.508369", "text": "def method_missing(method_name, *arguments, &block)\n unless adaptor.connected?\n Logger.warn \"Cannot call unconnected adaptor '#{name}', attempting to reconnect...\"\n adaptor.reconnect\n return nil\n end\n adaptor.send(method_name, *arguments, &block)\n rescue Exception => e\n Logger.error e.message\n Logger.error e.backtrace.inspect\n return nil\n end", "title": "" }, { "docid": "448bb67aab6aad5b536a81538518f0c7", "score": "0.50816995", "text": "def call\n raise \"Not Implemented\"\n end", "title": "" }, { "docid": "cb884d0e46f7f2536cec1a3729cbc1ba", "score": "0.50763214", "text": "def fail!(active_call)\n raise attach_to_call(active_call).grpc_error\n end", "title": "" }, { "docid": "cb884d0e46f7f2536cec1a3729cbc1ba", "score": "0.50763214", "text": "def fail!(active_call)\n raise attach_to_call(active_call).grpc_error\n end", "title": "" }, { "docid": "2db9be47ab2f9fd4c3be742cb370d5c4", "score": "0.5072766", "text": "def _raise_not_connected!\n raise \"Connection to allq '#{@host}:#{@port}' is closed!\"\n end", "title": "" }, { "docid": "a504b1191443c810646accc968a5d1cb", "score": "0.5064609", "text": "def on_success(circuit_state)\n @logger.debug(\"on_success: #{circuit_state.inspect}\")\n\n if circuit_state.closed?\n @logger.debug(\"on_success: state=closed reset_failure_count #{circuit_state.inspect}\")\n circuit_state.reset_failure_count\n end\n\n if circuit_state.half_open?\n @logger.info(\"on_success: state=half_open reset #{circuit_state.inspect}\")\n circuit_state.reset\n end\n end", "title": "" }, { "docid": "0d8fde751e28a5af184ca03fdc528e12", "score": "0.5029377", "text": "def open_door\n if is_open == true\n raise OPEN_ERROR\n elsif is_unlocked == false\n raise LOCK_ERROR\n else\n @is_open = true\n print \"Door opened\\n\"\n end\n end", "title": "" }, { "docid": "b4808828fb5547b68d50ec526ccdd981", "score": "0.5004423", "text": "def connection_to_target_failed\n if params[:CallStatus] == 'busy' || params[:CallStatus] == 'no-answer'\n @call = Call.find(params[:id])\n @call.connect_to_target\n end\n render :xml => Twilio::Verb.hangup\n end", "title": "" }, { "docid": "31d496b7b3a33eb9c7fd883707ba5b81", "score": "0.50023484", "text": "def call!\n raise NotImplementedError\n end", "title": "" }, { "docid": "1f6d772b7f33d1bb2828c893dadea9eb", "score": "0.49896204", "text": "def ensure_connected!\n raise \"Not connected\" unless connected?\n end", "title": "" }, { "docid": "67e3814dc91731105025900323adfc3b", "score": "0.49766427", "text": "def connect\n faulty_run { super }\n end", "title": "" }, { "docid": "8f27e6353280ebe13b2e3c3c8e8369fe", "score": "0.49689013", "text": "def call_with_circuit_interface(args, **circuit_options)\n strategy_call(args, **circuit_options) # FastTrack#call\n end", "title": "" }, { "docid": "ada023ec27d84d406a12920aa2d9f846", "score": "0.49674588", "text": "def run\n get_control\n\n yield\n rescue DRb::DRbConnError => e\n raise if @once\n notice \"lost connection: #{e.message}\"\n\n @service.stop\n @service = nil\n\n sleep 10\n\n retry\n rescue ThreadError => e\n # HACK work around ruby 2.0.0p0 bug when starting a forked service\n retry if e.message =~ /is not locked/\n\n return # queue empty\n rescue SignalException, SystemExit\n raise\n rescue Exception => e\n error \"#{e.message} (#{e.class}) - #{e.backtrace.first}\"\n\n raise\n end", "title": "" }, { "docid": "5329196ac4c9a242092240eaab7a2883", "score": "0.49651167", "text": "def on_connection_interruption(&block)\n super(&block)\n end", "title": "" }, { "docid": "08b553c2c9bfc5cd9587ace4cef4c9e6", "score": "0.4964933", "text": "def busy_handler( data=nil, &block ) # :yields: data, retries\n result = @driver.busy_handler( @handle, data, &block )\n Error.check( result, self )\n end", "title": "" }, { "docid": "0ed675f1af37999cd258304717cd587c", "score": "0.49340892", "text": "def connect\n @retries_left = RETRY_COUNT\n require 'pebble' unless defined?(::Pebble)\n begin\n @pebble = ::Pebble::Watch.new(parent.connection_id, connect_to)\n @pebble.connect\n super\n return true\n rescue Errno::EBUSY, Errno::ECONNREFUSED => e\n @retries_left -= 1\n if @retries_left > 0\n retry\n else\n Logger.error e.message\n Logger.error e.backtrace.inspect\n return false\n end\n end\n end", "title": "" }, { "docid": "249c542cac7ac6e6b6481a74303d8a0e", "score": "0.49021873", "text": "def bailout\n @handle.release_interface(0) if @handle\n @handle.close if @handle\n end", "title": "" }, { "docid": "6d5375022744cac561d013f91a9f542d", "score": "0.4899555", "text": "def connection_failure_handler\n Proc.new do |settings|\n EventMachine.stop if EventMachine.reactor_running?\n raise ConnectionError, \"can't connect to RabbitMQ\"\n end\n end", "title": "" }, { "docid": "11fed65451345f22bb6da8df9aa3b3dc", "score": "0.48987535", "text": "def call\n raise NotImplementedError,\n \"#call must be overridden when subclassing BaseConductor\"\n end", "title": "" }, { "docid": "333193d9679cc3d4c4aa4710b99a49ae", "score": "0.48722255", "text": "def call(_fd)\n raise CAS::CASError, \"Not Implemented. This is a virtual method\"\n end", "title": "" }, { "docid": "ced798eeabefbfbe31807661de2255fc", "score": "0.48701206", "text": "def client_connection_failed\n if @http\n @allow_throttle = false\n @http.resume\n @http.on_error(\"Thin client failed\")\n end\n end", "title": "" }, { "docid": "df28448cf8655f6fd5a7fe5273819d80", "score": "0.48590863", "text": "def trigger\n Callable.new(\n state_machine.send(set_state_method)\n ).bind(\n context\n ).call(state_machine.target(context), self)\n rescue StandardError => error\n callback = state_machine.find_error_callback(error, self)\n raise unless callback\n\n Callable.new(callback).bind(context).call(error, self)\n end", "title": "" }, { "docid": "847b3899af098c52deed3552097324de", "score": "0.48428312", "text": "def new_circuit_state\n ::CircuitBreaker::CircuitState.new\n end", "title": "" }, { "docid": "847b3899af098c52deed3552097324de", "score": "0.48428312", "text": "def new_circuit_state\n ::CircuitBreaker::CircuitState.new\n end", "title": "" }, { "docid": "266db5e66a1e3e5769d28815a06e1d67", "score": "0.48398006", "text": "def call\n raise \"beware of dog!\"\n end", "title": "" }, { "docid": "e5f495aac03b8cb19f39b4a088b003a1", "score": "0.4832518", "text": "def go!\n raise NotImplementedError.new('OH NOES!')\n end", "title": "" }, { "docid": "ab18cc45284807e3e4150930e61c3268", "score": "0.48301125", "text": "def call( count )\n raise NotImplementedError, \"The busy handler call(N) method must be implemented\"\n end", "title": "" }, { "docid": "6d72330b47941b46a2129444ea984e86", "score": "0.48238808", "text": "def update\n super\n if @call_close && self.openness == 0 && @close_method\n @call_close = false\n @close_method.call\n end\n end", "title": "" }, { "docid": "ff8fc51a1e7604739f6138dea12ad006", "score": "0.48136303", "text": "def invoke_on_connection connection,method_name,options = {}\n raise NoServerAvailable.new(\"No BackgrounDRb is found running\") unless connection\n connection.send(method_name,options)\n end", "title": "" }, { "docid": "24b5cffbefff17f677088910e0683839", "score": "0.48120764", "text": "def on_error(reason)\n close_connection\n raise RuntimeError, reason\n end", "title": "" }, { "docid": "1c25fe78d2ac95e388cce1a4391326e2", "score": "0.48013213", "text": "def close(circuit)\n send_chain(:close, circuit) do |e|\n options.notifier.notify(:storage_failure, circuit: circuit, action: :close, error: e)\n end\n end", "title": "" }, { "docid": "20aa3262f86042c26b34d68b717c65a5", "score": "0.4796824", "text": "def handle_new_connection(connection)\n logger.debug? && logger.debug(\"Beats inputs: accepting a new connection\",\n :peer => connection.peer)\n\n LogStash::Util.set_thread_name(\"[beats-input]>connection-#{connection.peer}\")\n\n connection_handler = LogStash::Inputs::BeatsSupport::ConnectionHandler.new(connection, self, @buffered_queue)\n @connections_list[connection] = connection_handler\n\n # All the errors handling is done here\n @circuit_breaker.execute { connection_handler.accept }\n rescue Lumberjack::Beats::Connection::ConnectionClosed => e\n logger.warn(\"Beats Input: Remote connection closed\",\n :peer => connection.peer,\n :exception => e)\n rescue LogStash::Inputs::BeatsSupport::CircuitBreaker::OpenBreaker,\n LogStash::Inputs::BeatsSupport::CircuitBreaker::HalfOpenBreaker => e\n logger.warn(\"Beats input: The circuit breaker has detected a slowdown or stall in the pipeline, the input is closing the current connection and rejecting new connection until the pipeline recover.\",\n :exception => e.class)\n rescue Exception => e # If we have a malformed packet we should handle that so the input doesn't crash completely.\n @logger.error(\"Beats input: unhandled exception\", \n :exception => e,\n :backtrace => e.backtrace) \n ensure\n transformer = LogStash::Inputs::BeatsSupport::EventTransformCommon.new(self)\n\n connection_handler.flush do |event|\n # handle the basic event enrichment with tags\n # since at that time we lose all the context\n transformer.transform(event)\n event.tag(\"beats_input_flushed_by_end_of_connection\")\n @output_queue << event\n end\n\n @connections_list.delete(connection)\n @logger.debug? && @logger.debug(\"Beats input: clearing the connection from the known clients\",\n :peer => connection.peer)\n end", "title": "" }, { "docid": "1a58ce3ad21b081f289c7bccc47db788", "score": "0.47961175", "text": "def connect_check(method_name, &block)\n begin\n if check_client_failed == false\n block.call\n end\n rescue Exception => ex\n # log the error\n log_error \"Event machine unexpected exception in #{method_name}, request failed: #{ex.message} - #{EMUtils.small_back_trace(ex, 10)}\"\n # drop the client connection\n drop_client_connection rescue nil\n end\n end", "title": "" }, { "docid": "a7cf425b90620d69cd70199f26d59a2d", "score": "0.47875795", "text": "def open(circuit, opened_at)\n @storage.open(circuit, opened_at)\n rescue StandardError => e\n options.notifier.notify(:storage_failure, circuit: circuit, action: :open, error: e)\n false\n end", "title": "" }, { "docid": "4dae10664b325128a0c21894a14e926d", "score": "0.47782007", "text": "def reopen(circuit, opened_at, previous_opened_at)\n send_chain(:reopen, circuit, opened_at, previous_opened_at) do |e|\n options.notifier.notify(:storage_failure, circuit: circuit, action: :reopen, error: e)\n end\n end", "title": "" }, { "docid": "ac9fd7cb517f463ce8862c0ccaf18bec", "score": "0.47770455", "text": "def closed(error); end", "title": "" }, { "docid": "aa56a5047b53eb6699077a86f031319c", "score": "0.47751075", "text": "def on_link_remote_open(event)\n if !event.link.local_active? # Copy remote terminus data to local\n event.link.source.replace(event.link.remote_source);\n event.link.target.replace(event.link.remote_target);\n end\n delegate(event.link.sender? ? :on_sender_open : :on_receiver_open, event.link)\n event.link.open if event.link.local_uninit?\n add_credit(event)\n rescue StopAutoResponse\n end", "title": "" }, { "docid": "7a6df9a9e1e48e4e5f8191ac51ba606f", "score": "0.47717637", "text": "def place_item_in_cabinet item\n puts '*opens cabinet*'\n item.call\n puts '*closes cabinet*'\nend", "title": "" }, { "docid": "bcf75584eb798892b2a5f6aab4f2465d", "score": "0.47625902", "text": "def connect(*args)\n faulty_run { super }\n end", "title": "" }, { "docid": "e91226fbcd31a0c16548b215df183aa0", "score": "0.4756938", "text": "def run\n set_state :connected\n start_reader\n wait_for_reader # run until disconnected\n rescue RSMP::ConnectionError => e\n log e, level: :error\n rescue StandardError => e\n notify_error e, level: :internal\n ensure\n close\n end", "title": "" }, { "docid": "1e0d97d2ef587f640f32a5bd68313493", "score": "0.47559002", "text": "def hangup\n @current_call.hangup\n AGI_SUCCESS_PREFIX + \"1\\n\"\n rescue => e\n log_error(this_method, e)\n end", "title": "" }, { "docid": "4d10497a0aebbf21b6f6ad5333aa283a", "score": "0.47542477", "text": "def handle_frame(ch_number, method)\n @logger.debug { \"Session#handle_frame on #{ch_number}: #{method.inspect}\" }\n case method\n when AMQ::Protocol::Channel::OpenOk then\n @continuations.push(method)\n when AMQ::Protocol::Channel::CloseOk then\n @continuations.push(method)\n when AMQ::Protocol::Connection::Close then\n if recover_from_connection_close?\n @logger.warn \"Recovering from connection.close (#{method.reply_text})\"\n clean_up_on_shutdown\n handle_network_failure(instantiate_connection_level_exception(method))\n else\n clean_up_and_fail_on_connection_close!(method)\n end\n when AMQ::Protocol::Connection::CloseOk then\n @last_connection_close_ok = method\n begin\n @continuations.clear\n rescue StandardError => e\n @logger.error e.class.name\n @logger.error e.message\n @logger.error e.backtrace\n ensure\n @continuations.push(:__unblock__)\n end\n when AMQ::Protocol::Connection::Blocked then\n @blocked = true\n @block_callback.call(method) if @block_callback\n when AMQ::Protocol::Connection::Unblocked then\n @blocked = false\n @unblock_callback.call(method) if @unblock_callback\n when AMQ::Protocol::Connection::UpdateSecretOk then\n @continuations.push(method)\n when AMQ::Protocol::Channel::Close then\n begin\n ch = synchronised_find_channel(ch_number)\n # this includes sending a channel.close-ok and\n # potentially invoking a user-provided callback,\n # avoid doing that while holding a mutex lock. MK.\n ch.handle_method(method)\n ensure\n if ch.nil?\n @logger.warn \"Received a server-sent channel.close but the channel was not found locally. Ignoring the frame.\"\n else\n # synchronises on @channel_mutex under the hood\n self.unregister_channel(ch)\n end\n end\n when AMQ::Protocol::Basic::GetEmpty then\n ch = find_channel(ch_number)\n ch.handle_basic_get_empty(method)\n else\n if ch = find_channel(ch_number)\n ch.handle_method(method)\n else\n @logger.warn \"Channel #{ch_number} is not open on this connection!\"\n end\n end\n end", "title": "" }, { "docid": "b35d7fe864f8e5b041d72f923e8361f9", "score": "0.4753465", "text": "def once_open(&block)\n @channel_is_open_deferrable.callback do\n # guards against cases when deferred operations\n # don't complete before the channel is closed\n block.call if open?\n end\n end", "title": "" }, { "docid": "1910a88c0e7436c009f4cf17a9c3fcf5", "score": "0.4740017", "text": "def hold_connection\n \n end", "title": "" }, { "docid": "1c6df1dd03a23b620ea03ad0feb6cfb6", "score": "0.47228968", "text": "def heres_your_socket(instantiated_coolio_socket)\n instantiated_coolio_socket.call_back_to_this self\n @wrapped_coolio = instantiated_coolio_socket\n end", "title": "" }, { "docid": "e0c8aa2f392d6e50d9f6fd487a34768f", "score": "0.4722599", "text": "def open\n raise 'This lock is already open!' unless @closed\n @closed = false\n @cv.signal\n nil\n end", "title": "" }, { "docid": "1d9a1fc55fa48900dac8766c1511556e", "score": "0.4721975", "text": "def open\n change_status(LineOfCredit::Status::OPEN)\n\n open_accounts!\n end", "title": "" }, { "docid": "1c0c7e862b16bb416107680877a35482", "score": "0.47207204", "text": "def chipRestart(connection, bool_xcpufreeze, bool_powerStayOn, bool_reEnableUart)\r\n raise \"FUNCTION HAS TO BE OVERLOADED!\"\r\nend", "title": "" }, { "docid": "d854bc6d4a1d0e15d63ad824b4d4a16e", "score": "0.47203574", "text": "def launch\n batten_hatches\n light_seatbelt_sign\n true\nrescue\n puts \"Exception intercepted\"\n false\nend", "title": "" }, { "docid": "2cf0d21d091dc500e47132971754a41a", "score": "0.47104782", "text": "def broken?; end", "title": "" }, { "docid": "2cf0d21d091dc500e47132971754a41a", "score": "0.47104782", "text": "def broken?; end", "title": "" }, { "docid": "b8f56e45c320433bf4bf8e868ab4eb7a", "score": "0.4710272", "text": "def connect()\n fail_unless_overridden\n end", "title": "" }, { "docid": "ec13037892973c64f304aac90212f949", "score": "0.47091892", "text": "def close\n wrap_state_closed_error { cnx.close if cnx && !cnx.closed? }\n end", "title": "" }, { "docid": "833a7f6208831a88a35783b38ff69fae", "score": "0.47037503", "text": "def do_open_failed(reason_code, description)\n if @on_open_failed\n @on_open_failed.call(self, reason_code, description)\n else\n raise ChannelOpenFailed.new(reason_code, description)\n end\n end", "title": "" }, { "docid": "f1cbf889497a9fda0c7960b69a01cb33", "score": "0.4701212", "text": "def check_if_alive!\n unless alive?\n raise Errors::ConnectionFailure, \"Socket connection was closed by remote host\"\n end\n end", "title": "" }, { "docid": "f5db6984106e2f9747e8c14b5b9b028d", "score": "0.47004703", "text": "def open(circuit, opened_at)\n redis do |r|\n opened = compare_and_set(r, state_key(circuit), ['closed', nil], 'open', ex: options.circuit_ttl)\n r.set(opened_at_key(circuit), opened_at, ex: options.circuit_ttl) if opened\n opened\n end\n end", "title": "" }, { "docid": "7f54e873a529d5ee1dc1214663ba4e08", "score": "0.46993056", "text": "def check_connection\n unless established?\n close if close_wait?\n initialize\n end\n end", "title": "" }, { "docid": "0f2bf7f522cf6501a60074ac93c11d03", "score": "0.4695636", "text": "def open\n if self.newly_created?\n @status = :opening\n @frame = Protocol::OPENING_FRAME\n else\n raise StateMachineError.new(@status, :opening)\n end\n end", "title": "" }, { "docid": "3563fdcc70a08d999fa441fa725d00a7", "score": "0.4694407", "text": "def exception(ex)\n notify_change('copier_failed', @component_name)\n\n super\n end", "title": "" }, { "docid": "c6072570dca8ef58d9264c7c4b917067", "score": "0.4693378", "text": "def call(*args)\n @client.call!(*args)\n rescue *ECONN\n explore!\n retry\n end", "title": "" }, { "docid": "bf07b6e86fe29ec21d25744324a501a8", "score": "0.46920374", "text": "def monitor(url)\n check_state\n @current_call.startCallRecording url\n AGI_SUCCESS_PREFIX + \"0\\n\"\n rescue => e\n log_error(this_method, e)\n end", "title": "" }, { "docid": "fe46df587fb0f755fbc454904d04bb66", "score": "0.4690697", "text": "def io(&block)\n return super unless @faulty_circuit\n\n reply = super\n if reply.is_a?(::Redis::CommandError)\n if reply.message.start_with?('BUSY')\n reply = BusyError.new(reply.message)\n end\n end\n\n reply\n end", "title": "" }, { "docid": "ecbec6a38bca334d60f21f6318eb77ec", "score": "0.4679874", "text": "def busy?(connection)\n raise \"Should be implemented in child class\"\n end", "title": "" }, { "docid": "948d6bcf04f05521c8c288994663162b", "score": "0.46780267", "text": "def method_missing(method_name, *arguments, &block)\n connection.send(method_name, *arguments, &block)\n rescue Exception => e\n Logger.error e.message\n Logger.error e.backtrace.inspect\n return nil\n end", "title": "" }, { "docid": "bf905aff1f65b657a9b7a74a981d06b9", "score": "0.46777734", "text": "def break!\n @broken = true # instance variables are accessible in all methods \n end", "title": "" }, { "docid": "4badc31fe2da34873452b476876c9d2a", "score": "0.46741855", "text": "def run\n \n # accept the incomming call\n answer()\n\n # hangup if maintenance mode is active but not authorized\n authorize_maintainance_mode if MAINTENANCE_MODE\n\n # store basic caller information (name, number, set retries to 0)\n store_initial_caller_info if $currentCall.isActive\n # $currentCall is a global variable which is passed through from the tropo application\n # and contains all information about the current incomming call\n\n ## plays the \"welcome\" message\n #say(isay(\"step1\")) if $currentCall.isActive\n\n #wait(100) if $currentCall.isActive\n\n # retries getting the site till successful, or kicks out the user after too many retries\n # after it ran successfully we have a @site instance variable with the chosen site\n get_site_info if $currentCall.isActive\n\n \n \n \n \n # gets current incident code\n # stores the incident action, or kicks out after several retries\n get_incident_code_and_type! if $currentCall.isActive\n\n# # either asks for the amount of money\n# # or in emergency sends report to call the number\n# incident_action! if $currentCall.isActive\n byenow!\n \n \n # report = build_report caller_info\n end", "title": "" }, { "docid": "432787f37e16aabb4934ff7e70ad3f53", "score": "0.46709996", "text": "def charge(amount, credit_card_number)\n begin\n connection = CreditCardServer.connect(...)\n connection.send(amount, credit_card_number) ### see change below\n rescue IOError => error\n Logger.log(\"Could not submit order #{@order_number} to the server: #{error}\")\n return nil\n ensure\n connection.close\n end\nend", "title": "" }, { "docid": "e8bfe6eff6084eaaa15257e2d4ec8074", "score": "0.467003", "text": "def on_workitem\n ScriptoriaCore.logger.info \"On workitem\"\n attempt_retry unless make_callback_request!(:active)\n super\n rescue Exception => e\n ScriptoriaCore.logger.error \"Got error #{e.inspect} for #{workitem.inspect}\"\n raise e\n end", "title": "" }, { "docid": "793062bf097ab6c8aead945707ffab69", "score": "0.46651155", "text": "def on_breaker_open\n PubSub.logger.info \"#{@@current_breaker} detected more than #{NUM_ERRORS_THRESHOLD} errors\"\\\n \"during last #{ERROR_WINDOW} seconds. Will pause execution for #{REENABLE_AFTER} seconds\"\n end", "title": "" }, { "docid": "03d6054900948a4523984db5deac14a7", "score": "0.46637952", "text": "def on_open_failed(&block)\n channels.each { |channel| channel.on_open_failed(&block) }\n self\n end", "title": "" }, { "docid": "64609cb84b9680d01881f3fc5d05da1d", "score": "0.4661858", "text": "def processCall\n prefix, number = getInput { checkValidNumber Cfg.get.prefixes }\n iNo = internationalize Cfg.get.country_code, number\n product = chooseProduct Cfg.get.prefixes[prefix], Cfg.get.providers[prefix]\n \n hangup :thankYou unless product\n \n accountNo, pin = getInput { checkAccount }\n voucher = @bizmodel.consume(accountNo, pin, product)\n \n @bizmodel.notifyViaSMS(iNo, \"Your recharge code for #{number} is #{voucher}. Have a nice day!\", \n Cfg.get.sms_api_id, Cfg.get.sms_user, Cfg.get.sms_password) if voucher \n \n hangup :thankYou\n \n # handle exceptions by letting the user know what went wrong, then hanging up\n # is there a cleaner way?\n rescue Exceptions::InsufficientBalance\n hangup :insufficientBalance\n rescue Exceptions::OutOfStock\n hangup :outOfStock\n rescue Exceptions::BadCredentials \n hangup :badCredentials\n rescue Exceptions::VoucherAlreadyUsed\n hangup :voucherAlreadyUsed\n rescue Exceptions::BruteForce\n hangup :bruteForce\n rescue Exceptions::TransactionFailed\n hangup :transactionFailed\n rescue Exceptions::InvalidInput\n hangup :invalidInput\n rescue Exception => e\n info \"Exception: #{e.message}\\n#{e.backtrace}\"\n hangup :systemError\n end", "title": "" }, { "docid": "f5e27d2683466aa8223771d2d86ec95a", "score": "0.4661794", "text": "def watch_labor_status\n\tlab_state = :closed\n\n\twhile true do\n\tbegin\n\t\tdebug 5, \"Connecting to lapd...\"\n\t\tlapd_socket = TCPSocket.new('rl', 2343);\n\t\tlapd_socket.puts \"watch POWER_COUCH\"\n\t\n\t\twhile true do \n\t\t\tTimeout::timeout(120) do # implement keepalive (and conn_check!)\n\t\t\tbegin\n\t\t\t\tline = lapd_socket.gets\n\t\t\t\tif line.nil? then raise \"Lost connectin to lapd\"; end\n\t\t\t\tdebug 7, \"Got lapd line: #{line}\"\n\n\t\t\t\tif line =~ /^info POWER_COUCH (\\d)/ then\n\t\t\t\t\tlab_state = :open if $1 == \"1\";\n\t\t\t\t\tlab_state = :closed if $1 == \"0\";\n\n\t\t\t\t\tdebug 1, \"Labor-State is now \\\"#{lab_state}\\\"\"\n\t\t\t\t\tif lab_state == :open then\n\t\t\t\t\t\tpres = Jabber::Presence.new(:chat).set_status( \"Offen!\" ) \n\t\t\t\t\telse\n\t\t\t\t\t\tpres = Jabber::Presence.new(:xa).set_status( \"Geschlossen...\" ) \n\t\t\t\t\tend\n\n\t\t\t\t\t@client.send( pres )\n\t\t\t\tend\n\n\t\t\trescue Timeout::Error => e\n\t\t\t\tlapd_socket.puts \"get LAMP_COUCHFLUTER\"\n\t\t\trescue => e\n\t\t\t\traise\n\t\t\tend end\n\t\tend \n\trescue => e\n\t\tdebug 1, \"Connection to lapd failed: #{e}\"\n\t\tdebug 1, \"Waiting some time, then try again...\"\n\t\tsleep(10)\n\tend end\nend", "title": "" }, { "docid": "230b0a1e9cf8e9b15d98b5c2adb8b035", "score": "0.46587008", "text": "def retry_call endpoint\r\n\t \t@retries_left -= 1\r\n\r\n\t \tsleepTime = (50 + rand(950)) / 1000\r\n\t \tsleep(sleepTime)\r\n\r\n\t \tcall(endpoint)\r\n\t end", "title": "" }, { "docid": "ba33499266409588e496a6105f7aca5f", "score": "0.46584916", "text": "def send_request\n setup_connection\n send_request_with_lazy_pirate unless error?\n end", "title": "" }, { "docid": "be7499d85dfab6468bfb29bc05e0b25d", "score": "0.46555907", "text": "def call!\n acknowledge!\n AcknowledgeFailure.new(@response.data['error']) unless valid?\n end", "title": "" }, { "docid": "b9b6337e0c235ac5503ca5fffe78c2f9", "score": "0.46411508", "text": "def connect!\n raise \"Waithook connection already started\" if @started\n @started = true\n @client.connect!.wait_handshake!\n self\n end", "title": "" }, { "docid": "5d2012c212b73ec2be0d387d8c8e3a93", "score": "0.46398157", "text": "def hangup\n @current_call.hangup\n @agi_response + \"1\\n\"\n rescue => e\n log_error(this_method, e)\n end", "title": "" }, { "docid": "4a88a9ce01183da8efd947b4c6247ebd", "score": "0.46386063", "text": "def initialize(device = '/dev/ttyUSB0', speed = 19200, bitrate = 125000, mask = 0xffffffff, code = 0x0)\n responses = []\n @serial = SerialPort.new(device, speed)\n\n issue_command(:close_channel)\n\n responses << issue_command(:standard_setup, { :bitrate => bitrate })\n responses << issue_command(:acceptance_mask, { :mask => mask })\n responses << issue_command(:acceptance_code, { :code => code })\n responses << issue_command(:open_channel)\n\n responses.each do |response|\n if !response or response.return_code != 13 # CR\n raise \"initialization failed (#{response.class} returned (#{response.return_code}), please reset adapter\"\n end\n end\n\n @serial\n end", "title": "" }, { "docid": "a51014fd76628fafeccd8515064aae5a", "score": "0.4638492", "text": "def connectivity_check()\n if not @perform_connectivity_check\n return\n end\n\n @logger.debug(\"Performing connectivity check against the Scalyr API\")\n\n body = create_multi_event_request([], nil, nil, nil)[:body]\n\n begin\n @client_session.send_ping(body)\n rescue Scalyr::Common::Client::ClientError, Manticore::ResolutionFailure => e\n if not e.message.nil? and (e.message.include?(\"nodename nor servname provided\") or\n e.message.downcase.include?(\"name or service not know\"))\n raise LogStash::ConfigurationError,\n format(\"Received error when trying to communicate with Scalyr API. This likely means that \" \\\n \"the configured value for 'scalyr_server' config option is invalid. Original error: %s\",\n e.message)\n end\n\n # For now, we consider rest of the errors non fatal and just log them and don't propagate\n # them and fail register\n @logger.warn(\"Received error when trying to send connectivity check request to Scalyr\",\n :error => e.message)\n rescue Scalyr::Common::Client::ServerError => e\n if e.code == 401\n raise LogStash::ConfigurationError,\n format(\"Received 401 from Scalyr API during connectivity check which indicates \" \\\n \"an invalid API key. Server Response: %s\", e.body)\n end\n\n rescue => e\n @logger.warn(\"Received non-fatal error during connectivity check\", :error => e.message)\n end\n end", "title": "" }, { "docid": "acd680d854ef4e116074d6602bcf6fb7", "score": "0.46380043", "text": "def open?; true && !@connection_impl.nil? && @connection_impl.isOpen; end", "title": "" }, { "docid": "594e180e7b8bdc3ddd2668b6dbba841b", "score": "0.46358293", "text": "def call\n raise NotImplementedError, \"Please define call() in #{self}\"\n end", "title": "" }, { "docid": "280a92b5b46206ebacba9a062cbe3bb0", "score": "0.46327657", "text": "def open_charge_port!\n tesla.open_charge_port!(self)\n end", "title": "" } ]
56f354513c6ec2dc8ec94defaafae944
GET /cmtvotes/new GET /cmtvotes/new.json The new method defined provides the view for the user to vote on a comment. It provides the cmtvotes view with the comment information for the user to vote
[ { "docid": "65269fe5c0f4d4afdff7300b7bc87e56", "score": "0.7367657", "text": "def new\n @cmtvote = Cmtvote.new\n @tempcmt = Comment.find(params[:id])\n @tempost = @tempcmt.post_id\n @@ctemp = @tempcmt.id\n @@ptemp = @tempcmt.post_id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cmtvote }\n end\n end", "title": "" } ]
[ { "docid": "1451e9579f808dccf578b2098d625d3c", "score": "0.77455425", "text": "def new\n @commentvote = Commentvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commentvote }\n end\n end", "title": "" }, { "docid": "8b2113e8d41a99fb14805abcb9600967", "score": "0.77021945", "text": "def new\n @comment_vote = CommentVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_vote }\n end\n end", "title": "" }, { "docid": "ce820ddafc88a8a4516dc911e1cc9a37", "score": "0.7581807", "text": "def new\n @vote_for_comment = VoteForComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote_for_comment }\n end\n end", "title": "" }, { "docid": "57bbe873650d9816746cddca97a2a137", "score": "0.7579223", "text": "def new\n @api_v1_comment_vote = CommentVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v1_comment_vote }\n end\n end", "title": "" }, { "docid": "010918e25f0ee5d8f5b36d0b88ae5ab3", "score": "0.75124234", "text": "def new\n \n @voter = User.find_by_id(params[:user_id])\n @voteable = Comment.find_by_id(params[:comment_id])\n if !@voter.voted_on?(@voteable)\n if params[:vote] == \"up\"\n @voter.vote_for(@voteable)\n else\n @voter.vote_against(@voteable)\n end\n status = @voteable.plusminus\n else\n status = \"already_voted\"\n end\n \n if request.xhr?\n render :json => {:status => status, :vote => params[:vote]}.to_json\n else\n redirect_to :back\n end\n \n end", "title": "" }, { "docid": "6bd2f92095c240dff2a6545be22e8764", "score": "0.7196459", "text": "def new\n @c_vote = CVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @c_vote }\n end\n end", "title": "" }, { "docid": "abb0a593d8857ac7719e0a365539f326", "score": "0.701833", "text": "def new\n @vote = votes.new\n \n @users = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "502c5c42fa302a66fa5363f37d8be365", "score": "0.6889987", "text": "def new\n @vote_reply = VoteReply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote_reply }\n end\n end", "title": "" }, { "docid": "2e5a52acbb666b01c7001b766c158967", "score": "0.68337923", "text": "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", "title": "" }, { "docid": "2c4881cc45d6e81e9ab1f117484d2d42", "score": "0.6784753", "text": "def new\n\t\t@comment = Comment.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @comment }\n\t\tend\n\tend", "title": "" }, { "docid": "df4d5b6cea1bdfa484c7e687dfcbd050", "score": "0.6783024", "text": "def new\n\t\t@comment = Comment.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @comment }\n\t\tend\n\tend", "title": "" }, { "docid": "6d072fc9f6c5d0675ea3f080e26b123d", "score": "0.6764111", "text": "def new\n @vote = @vote || Vote.new\n @vote_contents = NCI::Views::Vote.to_hash(@vote)\n end", "title": "" }, { "docid": "666b78577133a411635c3cc8b611e673", "score": "0.6757723", "text": "def new\n @vote = Vote.new\n @votation = Vote.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "e5e1a6dcec514500cd99937dda6c43e1", "score": "0.6757077", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.slim\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "7236f26f3c54b2821ba36ae0c0ab06ab", "score": "0.67281896", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "7236f26f3c54b2821ba36ae0c0ab06ab", "score": "0.67281896", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "7236f26f3c54b2821ba36ae0c0ab06ab", "score": "0.67281896", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "7236f26f3c54b2821ba36ae0c0ab06ab", "score": "0.67281896", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "0748c6d5d221c02bff4c78b8d93381a1", "score": "0.6677345", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vote }\n end\n end", "title": "" }, { "docid": "2aafc9559a3b382af635fd46e394461b", "score": "0.6631991", "text": "def create\n comment = Comment.find(comment_vote_params[:comment_id])\n if current_user == comment.user\n return render json: {}, status: :forbidden\n elsif CommentVote.where(:comment_id => comment, :user_id => current_user).exists?\n return render json: {}, status: :conflict\n else\n json_voting_create(comment, comment_vote_params, CommentVote)\n end\n end", "title": "" }, { "docid": "127311693c85c817a0f2ff45c07ef61f", "score": "0.66220397", "text": "def new\n @version_comment = VersionComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version_comment }\n end\n end", "title": "" }, { "docid": "1a53e6f3654e9ce35771ba8b4ac93455", "score": "0.66119194", "text": "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comments }\n end\n end", "title": "" }, { "docid": "c2f96a613cdfd6b2a7af8dba427e925b", "score": "0.66005486", "text": "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", "title": "" }, { "docid": "cbb00a6a8cb4501f614fa8e1041b9578", "score": "0.6600365", "text": "def new\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", "title": "" }, { "docid": "cbb00a6a8cb4501f614fa8e1041b9578", "score": "0.6600365", "text": "def new\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", "title": "" }, { "docid": "cbb00a6a8cb4501f614fa8e1041b9578", "score": "0.6600365", "text": "def new\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", "title": "" }, { "docid": "cbb00a6a8cb4501f614fa8e1041b9578", "score": "0.6600365", "text": "def new\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", "title": "" }, { "docid": "0627b58a045bb9b63e8f132ba67b6b7f", "score": "0.65859556", "text": "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", "title": "" }, { "docid": "b7b560ab9edfd4e287f2f9759c72fd55", "score": "0.65676004", "text": "def new\n @comment = @post.comments.new\n @comment.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "title": "" }, { "docid": "87855ea783423460475ef33f3c803805", "score": "0.6566517", "text": "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment, root: false }\n end\n end", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "6c7d7a3e7c92adc73426128a00c4c793", "score": "0.65618587", "text": "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", "title": "" }, { "docid": "8a8d97d6192bef13204128bcb00203ab", "score": "0.6557163", "text": "def new\n @t_comment = @ticket.t_comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t_comment }\n end\n end", "title": "" }, { "docid": "2e54d4d5f5b28a13081ff464c4c5657d", "score": "0.6546805", "text": "def new\n @post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_vote }\n end\n end", "title": "" }, { "docid": "2e54d4d5f5b28a13081ff464c4c5657d", "score": "0.6546805", "text": "def new\n @post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_vote }\n end\n end", "title": "" }, { "docid": "2e54d4d5f5b28a13081ff464c4c5657d", "score": "0.6546805", "text": "def new\n @post_vote = PostVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_vote }\n end\n end", "title": "" }, { "docid": "94a74f82b38121310bbe80e8e94a26a2", "score": "0.6546768", "text": "def create\n jsonString = request.body.read\n jsonHash = JSON.parse(jsonString)\n #CHECK IF VOTE EXIST. IF EXIST, EDIT Vote Integer. IF NOT, CREATE Vote.\n if CommentVote.where(user_id: jsonHash['user_id'], comment_id: jsonHash['comment_id']).any?\n #Vote Entry Exist. Update Vote\n @comment_vote = CommentVote.where(user_id: jsonHash['user_id'], comment_id: jsonHash['comment_id'])\n if @comment_vote.update(vote: jsonHash[\"vote\"])\n render json: {comment_vote: @comment_vote, total_votes: total_votes(jsonHash['comment_id'])}, status: 200\n else\n render json: {'error': @comment_vote.errors}, status: 401\n end\n else\n #Vote Entry Don't Exist. Create Vote\n @comment_vote = CommentVote.new(jsonHash.slice('vote', 'user_id', 'comment_id'))\n if @comment_vote.save\n render json: {comment_vote: @comment_vote, total_votes: total_votes(jsonHash['comment_id'])}, status: 200\n else\n render json: {'error': @comment_vote.errors}, status: 401\n end\n end\n end", "title": "" }, { "docid": "fc42fc0b7fa41eba9add16d89f38fe05", "score": "0.6541006", "text": "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", "title": "" }, { "docid": "bfe3a2c256e9edd1fef2efed3abfa4fb", "score": "0.651536", "text": "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", "title": "" }, { "docid": "bfe3a2c256e9edd1fef2efed3abfa4fb", "score": "0.651536", "text": "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", "title": "" }, { "docid": "443890ea6c8c0f1796bd3806255ca74e", "score": "0.651023", "text": "def create\n @commentvote = Commentvote.new(params[:commentvote])\n\n respond_to do |format|\n if @commentvote.save\n format.html { redirect_to @commentvote, notice: 'Commentvote was successfully created.' }\n format.json { render json: @commentvote, status: :created, location: @commentvote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commentvote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a60560092a484c4d8f3c456b0eca308", "score": "0.6506999", "text": "def new\r\n @comment = Comment.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @comment }\r\n end\r\n end", "title": "" }, { "docid": "a8a00278b3c896e78ae17b03f9dc8db3", "score": "0.6503157", "text": "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", "title": "" }, { "docid": "a8a00278b3c896e78ae17b03f9dc8db3", "score": "0.6503157", "text": "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", "title": "" }, { "docid": "0afa62391e40ef932669685c64483ebe", "score": "0.64982116", "text": "def commentVote\n CommentVote.find(params[:id])\n end", "title": "" }, { "docid": "bd7cbffde9dfd76d431008d1a9f5fbf4", "score": "0.6476867", "text": "def new\n @vote_for_post = VoteForPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote_for_post }\n end\n end", "title": "" }, { "docid": "e3767278e948472ced4f46e7711249a9", "score": "0.64740443", "text": "def new\n @comment = current_user.comments.new\n end", "title": "" }, { "docid": "aa7cf0cd592c6664dfe92c6635e91301", "score": "0.64705056", "text": "def create\n @comments_vote = CommentsVote.new(params[:comments_vote])\n\n respond_to do |format|\n if @comments_vote.save\n format.html { redirect_to @comments_vote, notice: 'Comments vote was successfully created.' }\n format.json { render json: @comments_vote, status: :created, location: @comments_vote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comments_vote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d3514e7a4f7721e11b7537f4065429c", "score": "0.64645016", "text": "def new\n @comments_vote = CommentsVote.new\n @comments_vote.comment_id = params[:comment_id]\n @comments_vote.user_id = session[:current_user_id]\n if Comment.find(params[:comment_id]).user_id == session[:current_user_id]\n flash[:notice] = \"The user cannot vote his own replies\"\n redirect_to :controller => 'posts', :action => 'index' and return\n else\n if CommentsVote.find_by_comment_id_and_user_id(params[:comment_id], session[:current_user_id])\n flash[:notice] = \"You have already voted\"\n redirect_to :controller => 'posts', :action => 'index' and return\n else\n\n if @comments_vote.save\n redirect_to :controller => 'posts', :action => 'index' and return\n else\n flash[:notice] = \"Error!\"\n redirect_to :controller => 'posts', :action => 'index' and return\n end\n redirect_to :controller => 'posts', :action => 'index' and return\n end\n end\n end", "title": "" }, { "docid": "50df860ed54823cb8a49cb222410b448", "score": "0.64619654", "text": "def new\n @comment = UserComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "title": "" }, { "docid": "50df860ed54823cb8a49cb222410b448", "score": "0.64619654", "text": "def new\n @comment = UserComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "title": "" }, { "docid": "055ca9f4e5ce1457fdf04978880af49d", "score": "0.64494336", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vote }\n end\n end", "title": "" }, { "docid": "295dc3bf1a57ccbe908d26f96ecc2c47", "score": "0.6447332", "text": "def show\n @cmtvote = Cmtvote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cmtvote }\n end\n end", "title": "" }, { "docid": "c51f631f7ce4d1a04a4d5ee77b75a7e9", "score": "0.6445032", "text": "def new\n @comment = Comment.new\n respond_with(@comment)\n end", "title": "" }, { "docid": "4ee3f3db98cccb93fb68d666af33fe37", "score": "0.64413667", "text": "def new\n @uservote = Uservote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uservote }\n end\n end", "title": "" }, { "docid": "0f4e14f38bca1b5f56c1bcb8df57ae87", "score": "0.6429899", "text": "def new\n @vote = Vote.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @vote }\n #end\n end", "title": "" }, { "docid": "7637145c4b34207ef99d555eb21ebab0", "score": "0.6419698", "text": "def new\n @vote = Vote.new\n end", "title": "" }, { "docid": "7637145c4b34207ef99d555eb21ebab0", "score": "0.6419698", "text": "def new\n @vote = Vote.new\n end", "title": "" }, { "docid": "db173d122a217eea18d22ef0fb8b3ed1", "score": "0.64115125", "text": "def new\n @comment = Review.new\n respond_with(@comment)\n end", "title": "" }, { "docid": "cf3ad9c30f9b9e9b8165cdd22611fe6a", "score": "0.6394585", "text": "def new\n @comments = Comment.new\n end", "title": "" }, { "docid": "01cf415e8af63b6be0d96097b2241a1e", "score": "0.6388275", "text": "def new\n @comment = Comment.new\n @comment.user_id = current_user.id\n\n\n respond_to do |format|\n format.js # new.html.erb\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "title": "" }, { "docid": "58c3cae2f4ce065bb29062b6cca0062c", "score": "0.6379047", "text": "def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" }, { "docid": "4913e0387da9d34ea40dfe35a28542ad", "score": "0.6376177", "text": "def new\n @api_v1_comment = @post.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_v1_comment }\n end\n end", "title": "" }, { "docid": "66840250fe8b1a606062719d73921d29", "score": "0.63723886", "text": "def create\n if(Comment.find(params[:comment_vote][:comment_id]).user_id.to_i != params[:comment_vote][:user_id].to_i) # only vote if it's not the same user who wrote the comment!\n @api_v1_comment_vote=CommentVote.find_by_comment_id_and_user_id(params[:comment_vote][:comment_id], params[:comment_vote][:user_id])\n if @api_v1_comment_vote.nil?\n @api_v1_comment_vote = CommentVote.new(params[:comment_vote])\n else\n @api_v1_comment_vote.vote = params[:comment_vote][:vote]\n end\n \n respond_to do |format|\n if @api_v1_comment_vote.save\n #format.html { redirect_to @api_v1_post_vote, notice: 'Post vote was successfully created.' }\n format.json { render json: @api_v1_comment_vote, status: :created }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @api_v1_comment_vote.errors.messages.values, status: 400 }\n end\n end\n else\n render json: \"Can't vote for yourself.\", status: 400\n end\n end", "title": "" }, { "docid": "d9edd10c318453ff9528e5e4caa8e951", "score": "0.63592523", "text": "def new\n @vote = Vote.new\n Constituency.where(\"user_id = ?\", current_user.id).each do |con|\n @const = con\n end\n #@committee = Committee.all.map do |commi|\n\t#[commi.id]\n #end\n @constituency = Constituency.all.map do |consti|\n [consti.id]\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote }\n end\n end", "title": "" }, { "docid": "16890cfae79e3ecd3fa195e4d6aeed09", "score": "0.63520545", "text": "def new\n @simple_vote = SimpleVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @simple_vote }\n end\n end", "title": "" }, { "docid": "87d88833f9b44eebbbd551c444f39f40", "score": "0.6349373", "text": "def create\n innerComment = InnerComment.find(inner_comment_vote_params[:inner_comment_id])\n if current_user == innerComment.user\n return render json: {}, status: :forbidden\n elsif InnerCommentVote.where(:inner_comment_id => innerComment, :user_id => current_user).exists?\n return render json: {}, status: :conflict\n else\n json_voting_create(innerComment, inner_comment_vote_params, InnerCommentVote)\n end\n end", "title": "" }, { "docid": "e2d9d41e24e87271662821f9d8580637", "score": "0.6339171", "text": "def new\n @upvote = Upvote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upvote }\n end\n end", "title": "" }, { "docid": "c307c0475c85c42cd42aec2a9e07909f", "score": "0.6323702", "text": "def create\n @vote_for_comment = VoteForComment.new(params[:vote_for_comment])\n\n respond_to do |format|\n if @vote_for_comment.save\n format.html { redirect_to @vote_for_comment, notice: 'Vote for comment was successfully created.' }\n format.json { render json: @vote_for_comment, status: :created, location: @vote_for_comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vote_for_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73d672c2fd045feb5715a839f39bfd63", "score": "0.6309318", "text": "def new\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", "title": "" }, { "docid": "26f7544f1536452479493189fd290972", "score": "0.6301226", "text": "def new\n @comment = Comment.new\n @comment.remote_ip = request.remote_ip\n @comment.referrer = request.referrer\n @comment.user_agent = request.env[\"HTTP_USER_AGENT\"]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "d4f1204203826a6077cf1c36fac1968c", "score": "0.6293365", "text": "def new\n @vote_log = VoteLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vote_log }\n end\n end", "title": "" }, { "docid": "577facadf823bc314844cc59d976a422", "score": "0.62890375", "text": "def new\n\tif not current_user then redirect_to \"/\"and return 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", "title": "" }, { "docid": "295af798c1475edc457108b2fa6f201e", "score": "0.62827545", "text": "def new\n @p_vote = PVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @p_vote }\n end\n end", "title": "" }, { "docid": "580f60a31ee28f0bb11d5e7e1fdd6c42", "score": "0.6282456", "text": "def new\n @comment = Comment.new\n @post_id = params[:post_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "title": "" }, { "docid": "9c5e2c86eb3aa418ed8a664e44e7b8a5", "score": "0.62808836", "text": "def set_comment_vote\n @comment_vote = CommentVote.find(params[:id])\n end", "title": "" }, { "docid": "9c5e2c86eb3aa418ed8a664e44e7b8a5", "score": "0.62808836", "text": "def set_comment_vote\n @comment_vote = CommentVote.find(params[:id])\n end", "title": "" }, { "docid": "925ab84d7ded067528b63bd9b957d0e0", "score": "0.6275548", "text": "def create #test this\n\t\tif current_user && current_user.activated?\n\t\t\tcomment = Comment.create params[:comment]\n\t\t\tcurrent_user.comments << comment\n\t\t\tcomment.attempt_upvote_from current_user\n\t\t\tif comment.comment_type == \"question\" #top level question\n\t\t\t\trender partial: \"show\", locals: {question: comment, ama: comment.ama} and return\n\t\t\telsif comment.comment_type == \"reply\" #reply from mentor\n\t\t\t\t# UserMailer.comment(comment.root.user, current_user, comment).deliver\n\t\t\t\trender partial: \"reply\", locals: {reply: comment} and return\n\t\t\telse #response to the reply from mentor\n\t\t\t\trender partial: 'comment', locals: {comment: comment} and return\n\t\t\tend\n\t\telse\n\t\t\t# need implementation\n\t\t\trender \"not activated yet\"\n\t\tend\n\tend", "title": "" }, { "docid": "6f035e8adcbfd4052bb4e567466c364a", "score": "0.62728363", "text": "def new\n @commentable = find_commentable\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_comment }\n end\n end", "title": "" }, { "docid": "19bfde203372dd7bcef89b19af0ff818", "score": "0.6258416", "text": "def new\n @regularcomment = Regularcomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @regularcomment }\n end\n end", "title": "" } ]
bcfb08ecb014675ae1e955d8dade2426
file related utilities collect filenames recursively
[ { "docid": "f356d91806efe3cb288a0ec1b11c7eef", "score": "0.0", "text": "def collect_files(str, regex = nil)\r\n regex ||= //\r\n text_array = Array.new\r\n Find.find(str) do |f|\r\n text_array << f if regex =~ f\r\n end\r\n text_array.sort\r\n end", "title": "" } ]
[ { "docid": "d9554f85713e2194f73e212b2b59e5ba", "score": "0.71964324", "text": "def collect_files\n globs = self.files\n globs = globs.map{ |glob| Dir[glob] }.flatten.uniq\n globs = globs.map do |glob|\n if File.directory?(glob)\n Dir[File.join(glob, '**/*')]\n else\n glob\n end\n end\n list = globs.flatten.uniq.compact\n list = list.reject{ |path| File.extname(path) == '.html' }\n list = list.select{ |path| File.file?(path) }\n list\n end", "title": "" }, { "docid": "d9554f85713e2194f73e212b2b59e5ba", "score": "0.71964324", "text": "def collect_files\n globs = self.files\n globs = globs.map{ |glob| Dir[glob] }.flatten.uniq\n globs = globs.map do |glob|\n if File.directory?(glob)\n Dir[File.join(glob, '**/*')]\n else\n glob\n end\n end\n list = globs.flatten.uniq.compact\n list = list.reject{ |path| File.extname(path) == '.html' }\n list = list.select{ |path| File.file?(path) }\n list\n end", "title": "" }, { "docid": "9297b21e3e76b2537680e45d3416e87f", "score": "0.71281207", "text": "def files\n proper_files(Dir.entries(Dir.pwd))\nend", "title": "" }, { "docid": "2624137c12f71027495309a9bea5a3e6", "score": "0.7083592", "text": "def files\n Dir.each_child(path).map{|filename| filename}\n end", "title": "" }, { "docid": "75db6537d873b2c0ec30a5713445000a", "score": "0.6987186", "text": "def get_filenames( root )\n Dir.entries( root ).map { |tmpfile| File.join( root, tmpfile ) }.reject { |path| File.directory? path }\n end", "title": "" }, { "docid": "5d14e48b8206a781a54544962464a6e5", "score": "0.6959802", "text": "def files\n files = perform_recursion\n\n # Now strip off the leading path, so each file becomes relative, and remove\n # any slashes that might end up at the beginning of the path.\n result = files.collect { |file| file.sub(%r{^#{Regexp.escape(@path)}/*}, '') }\n\n # And add the path itself.\n result.unshift(\".\")\n\n result\n end", "title": "" }, { "docid": "d43c1bfb020751e99063d537ea1125ed", "score": "0.692515", "text": "def retrieve_file_list\n Dir.glob(Array(name).map {|filename| pathify_file(filename)})\n end", "title": "" }, { "docid": "e0da5b450bb3228fe4c7e3fe0fe32efc", "score": "0.69087064", "text": "def getfiles(path) \n re = [] \n allre = [] \n Dir.foreach(path) do |f| \n allre << f \n end \n allre.each do |f| \n fullfilename = path + \"/\" + f \n if f == \".\" or f == \"..\" \n elsif File.directory?(fullfilename) \n resub = [] \n resub = getfiles(fullfilename) \n \n if resub.length > 0 \n ref = {} \n ref[f] = resub \n re << ref \n end \n elsif File.exist?(fullfilename) and (f =~ /\\.rb$/) # only rb file \n re << f \n end \n end \n return re \n end", "title": "" }, { "docid": "d36f6a5ac9269cf322e5a72a4070798a", "score": "0.6816253", "text": "def find_all_files(re)\n entries.map do |pn|\n if pn.directory?\n if pn.basename =~ /^\\.\\.?$/\n []\n else\n pn.find_all_files(re)\n end\n elsif pn.file?\n if pn.basename =~ re\n pn\n else\n []\n end\n end\n end.flatten\n end", "title": "" }, { "docid": "d36f6a5ac9269cf322e5a72a4070798a", "score": "0.6816253", "text": "def find_all_files(re)\n entries.map do |pn|\n if pn.directory?\n if pn.basename =~ /^\\.\\.?$/\n []\n else\n pn.find_all_files(re)\n end\n elsif pn.file?\n if pn.basename =~ re\n pn\n else\n []\n end\n end\n end.flatten\n end", "title": "" }, { "docid": "c17f9e4e44f795352238d76e2ebedd5e", "score": "0.67941695", "text": "def files\n\t\tcontents.select { |entry| !entry.dir? }\n\tend", "title": "" }, { "docid": "a86a3ca12776b9a011896e0e56dd6a90", "score": "0.67847353", "text": "def files\n children(:no_dirs => true)\n end", "title": "" }, { "docid": "5d2c0cdd3372996d8652d243ecafdbff", "score": "0.67620224", "text": "def process_files_recurse(aDir) \n\t\t@@tempFiles = []\n\n\t\tDir.foreach( aDir ) { |f|\n\t\t\tmyPath = \"#{aDir}\\/#{f}\"\n\t\t\tif FileTest.directory?(myPath) and f != '.' and f != '..' and f != 'zz_archive'\n\t\t\t\t process_files_recurse(myPath)\n\t\t\telse\n\t\t\t\t@@tempFiles.push(myPath) if f.match(/\\.yaml\\Z/)\n\t\t\tend\n\t\t} # Find.find( aDir ) { |f|\n\n\t\tsortedTempFiles = @@tempFiles.sort \n\t\t\n\t\t@@files.push(sortedTempFiles)\n\t\t@@directories.push([aDir[/[^\\/]+$/],sortedTempFiles[sortedTempFiles.length - 1]])\n\n\tend", "title": "" }, { "docid": "9cfa38fd3c3af9d251bbf45ea12dcaee", "score": "0.6758195", "text": "def process_files( aDir )\n\tunless FileTest.directory?(aDir)\n\t\tputs \"Error. Invalid input for report directory: #{aDir}.\"\n\t\texit\n\tend # unless\n\n\t@@files = []\n\t@@directories = []\n\n\t##\n\t# The actual bit that does the recursing through the dir tree\n\n\tdef process_files_recurse(aDir) \n\t\t@@tempFiles = []\n\n\t\tDir.foreach( aDir ) { |f|\n\t\t\tmyPath = \"#{aDir}\\/#{f}\"\n\t\t\tif FileTest.directory?(myPath) and f != '.' and f != '..' and f != 'zz_archive'\n\t\t\t\t process_files_recurse(myPath)\n\t\t\telse\n\t\t\t\t@@tempFiles.push(myPath) if f.match(/\\.yaml\\Z/)\n\t\t\tend\n\t\t} # Find.find( aDir ) { |f|\n\n\t\tsortedTempFiles = @@tempFiles.sort \n\t\t\n\t\t@@files.push(sortedTempFiles)\n\t\t@@directories.push([aDir[/[^\\/]+$/],sortedTempFiles[sortedTempFiles.length - 1]])\n\n\tend # def process_files_recurse (aDir) \n\n\tprocess_files_recurse(aDir)\n\n\tfiles = @@files.sort.flatten\n\tdirectories = @@directories[0..(@@directories.length - 2)].sort_by { |e| e.nil? ? 'z' : e[0] } \n\n\treturn files,directories\n\nend", "title": "" }, { "docid": "d7598e4d14d067949a07373ff8cf9992", "score": "0.67275596", "text": "def with_each_file_in(path, &proc)\n return if path == (RAILS_ROOT + LocalizeExt.localize_root)\n return if File.basename(path)[0] == 46 #dot\n Pathname.new(path).children(true).each do |file|\n file_name = file.to_s\n if File.file?(file_name)\n proc.call(file_name) \n else\n with_each_file_in(file_name, &proc)\n end\n end\n end", "title": "" }, { "docid": "65681d1b999c4631a8ea37b7278e723e", "score": "0.67152697", "text": "def files\n Dir[\"#{path}/*\"].map{|filename|\n filename.gsub(\"#{path}/\",\"\")\n }\n end", "title": "" }, { "docid": "5a90f8e229e31c423c4ef312f319a0b9", "score": "0.67145675", "text": "def collect_files(file_name)\n regexp = file_regexp(file_name)\n naive_list = Dir.glob(\"#{file_name}*\")\n file_list = naive_list.select { |f| regexp.match(f) }\n file_list.map { |f| File::Undetermined.new(f) }.sort\n end", "title": "" }, { "docid": "5908e6b990d44b79297ec578b1724069", "score": "0.67071486", "text": "def list_files(dir = @pathname)\r\n filenames = Dir.entries(dir) - IGNORE # dir not @pathname\r\n\r\n filenames.flat_map do |name|\r\n path = dir.join(name)\r\n\r\n if File.directory?(path)\r\n list_files(path)\r\n else\r\n path.relative_path_from(@pathname)\r\n end\r\n end\r\n end", "title": "" }, { "docid": "3b72155c8f3ceb41a9b88ef001041f19", "score": "0.6703812", "text": "def files\n return [] unless directory.present? && File.directory?(directory)\n Dir[File.join(directory, '*')].inject([]) do |accum, val|\n accum << { name: File.basename(val), directory: File.directory?(val)}\n accum\n end\n end", "title": "" }, { "docid": "701540f42808efea884489ded2c65c21", "score": "0.6696723", "text": "def all_files\n list(\".\").select { |p| file? p }.map { |p| expand_path(p) }\n end", "title": "" }, { "docid": "c25b534b24db0faed335ef11ac78b1a8", "score": "0.66922593", "text": "def files \n @files = Dir.glob File.join \"#{@dir}/images\", '**', '**' # get all files recursively from 'images'\n @files -= Dir.glob File.join \"#{@dir}/images\", '*.txt' # remove pages\n @files -= Dir.glob File.join \"#{@dir}/images\", '*.site' # remove config.site \n @files.reject! {|i| File.directory?(i)} # remove directories, keep just the files (ie 'dir1', 'dir1/dir11')\n @files.reject! {|i| i.include?('.txt')} # remove descriptors\n @files.map! {|i| remove_prefix i, \"#{@dir}\"} # remove 'inu.ro/images/' prefix\n \n @files\n end", "title": "" }, { "docid": "be320a8dfe3fad0ee928d80370b4b45c", "score": "0.669219", "text": "def collect_filepaths\n exp_str = filextension2regexpstr \n @cm.files.select{|path| path =~ Regexp.new(exp_str,true) }\n end", "title": "" }, { "docid": "571142217da2b5bff1781bfb7597a904", "score": "0.66891134", "text": "def globs_for(path); end", "title": "" }, { "docid": "326695b7db1f4d38f5361436acb4fdf1", "score": "0.66782784", "text": "def files\n\t\tfiles_paths = get_directory_files('')\n\t\t\n\t\tfiles_paths\n\tend", "title": "" }, { "docid": "a4321c7213255b72f48fa9892af688e6", "score": "0.6665977", "text": "def interesting_files\n # Start with a set of all files in `dir_name` given to us by\n # our superclass\n files = Set.new(all_files_in(source_realpath.to_s).\n map! { |filename| Pathname.new(filename) })\n\n # We cache mapping of realpath to \"our\" file name, to allow\n # other ignoring rules work on full file names. Key is a\n # realpath as string, value is array of files having that\n # realpath.\n realpath_files = {}\n\n fs_root = Pathname.new('/')\n files.each do |path|\n realpath = path.realpath\n if ignored?(realpath)\n files.delete(path)\n else\n realpath_s = realpath.to_s\n realpath_files[realpath_s] ||= []\n realpath_files[realpath_s] << path\n end\n end\n\n # Reject a list of realpaths from files that are ignored by git\n if use_gitignore?\n git_root = Pathname.new(git.git_work_tree)\n files.each_slice(512) do |some_files|\n gitignored_real =\n git.ls_files( { :others => true,\n :ignored => true,\n :exclude_standard => true,\n :full_name => true },\n '--', *some_files ).lines.map do |ln|\n git_root.join(ln.strip).realpath.to_s\n end\n gitignored_files = realpath_files.values_at(*gitignored_real)\n gitignored_files.flatten!\n files.subtract(gitignored_files)\n end\n end\n\n files\n end", "title": "" }, { "docid": "99c57eac9d6b4f6105e41c3ec816c29e", "score": "0.6663128", "text": "def flatten_files(directoryname,filename)\n # If the filename turns out to be a directory...\n if Dir.exist?(\"#{directoryname}/#{filename}\")\n # do a recursive call to the parent method, unless the directory is . or ..\n directory_to_filenames(\"#{directoryname}/#{filename}\") unless ['.','..'].include?(filename)\n else\n # Otherwise check if its actually a file and return its filepath.\n \"#{directoryname}/#{filename}\" if File.exists?(\"#{directoryname}/#{filename}\")\n end\n end", "title": "" }, { "docid": "f33771ef0e0bb088ed56fc4b00490ce0", "score": "0.66631156", "text": "def files_resolved\n list = files.flatten\n list = list.map{ |f| Dir[f] }.flatten\n list = list.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n list = list.flatten.uniq\n list = list.map{ |f| File.expand_path(f) } \n list\n end", "title": "" }, { "docid": "6586c87c01ab759791f11c2616f74aed", "score": "0.66568655", "text": "def get_files(directory_name)\n files = []\n Dir.foreach(directory_name) do |file|\n next if file.match(/^\\.{1,2}$/) # ignore '.', '..'\n path = directory_name + \"/\" + file\n path.gsub!(/^\\.\\//,\"\") # remove the leading ./\n if File.directory?(path)\n files += get_files(path)\n else\n files.push(path)\n end\n end\n files\nend", "title": "" }, { "docid": "a015ccec6c760148112a38c62d33340b", "score": "0.66438645", "text": "def base_file_list path\n\t\tres = []\n\t\tDir[path + '*'].each do | f |\n\t\t\tres << f.split('/').last\n\t\tend\n\t\tres.sort.reverse\n\tend", "title": "" }, { "docid": "370800b11ccf02a51c3d8f1b8b481616", "score": "0.66334486", "text": "def file_list\n Array(@path).inject(Set.new) do |list, _path|\n next list unless File.exists?(_path)\n if File.directory?(_path)\n list = list | sanitized_directory(_path)\n else\n list << _path if keep_file?(_path)\n end\n list\n end.to_a\n end", "title": "" }, { "docid": "be1a8e080c188f8a2b7de2ed89edfb85", "score": "0.6627572", "text": "def get_dotfiles\n files = []\n Dir.glob(File.join(ROOT_DIR, 'base', '*'), File::FNM_DOTMATCH) do |f|\n unless f.end_with? '.' or File.directory? f # TODO handle directories\n f = File.basename f\n yield f if block_given?\n files << f\n end\n end\n files\nend", "title": "" }, { "docid": "b577a02d0006a346247b324f82315344", "score": "0.660308", "text": "def collect_files(path)\n if File.directory?(path)\n Dir[file + '*.yml*']\n else\n Array.wrap(path)\n end\n end", "title": "" }, { "docid": "6de5311e399871bac4144a5b5aee7942", "score": "0.6593769", "text": "def traverse_files(&block); end", "title": "" }, { "docid": "6de5311e399871bac4144a5b5aee7942", "score": "0.6593769", "text": "def traverse_files(&block); end", "title": "" }, { "docid": "95b4ce8c1129186dccfd6106e754d060", "score": "0.65908253", "text": "def all\n Pathname.new(dir).entries.select{|e| (dir + e).file?}.map do |entry|\n by_filename(entry.to_s)\n end.select {|page| page.valid?}\n end", "title": "" }, { "docid": "c0afa0e43ccfcce84658dc9fe2f801ea", "score": "0.6584613", "text": "def files\n @files ||= search_directories.flat_map do |dir|\n relative_dir = Pathname.new(dir).relative_path_from(dir_path).to_s\n Dir.glob(::File.join(dir, @pattern).tr('\\\\', '/')).map do |file|\n next unless ::File.file?(file)\n\n { name: ::File.basename(file), dir: relative_dir }\n end.compact\n end\n end", "title": "" }, { "docid": "50d0fb4ba305e6c25382dfbf24d51823", "score": "0.65735734", "text": "def traverse_files\n result = []\n Find.find(*config[:paths]) do |path|\n next if File.directory?(path)\n next if config[:include] and !config[:include].any? { |glob| File.fnmatch(glob, path) }\n next if config[:exclude].any? { |glob| File.fnmatch(glob, path) }\n result << yield(path)\n end\n result\n end", "title": "" }, { "docid": "d4663494897877b477bc3e2faac48267", "score": "0.65627044", "text": "def find_files(dir = Pathname.pwd)\n Dir.foreach(dir) do |f|\n next if ['.','..'].include?(f)\n current_file = dir + f\n if File.directory?(current_file)\n puts current_file\n find_files(current_file)\n else\n puts current_file\n end\n end\nend", "title": "" }, { "docid": "d146f08709f64a9b340c6b7eb40fee26", "score": "0.656094", "text": "def filenames; end", "title": "" }, { "docid": "e76f270ea4be938c5852b6bf1e22cb14", "score": "0.6558077", "text": "def files\n files = []\n\n Dir.glob(::File.join(@dir, @pattern).tr('\\\\', '/')) do |file|\n next unless ::File.file?(file)\n files.push(name: ::File.basename(file))\n end\n\n files\n end", "title": "" }, { "docid": "37882d82efa081223cae20a59342abd0", "score": "0.65465355", "text": "def collect_files(dir)\n Dir[File.join(dir,'**/*')].reject do |f|\n basename = File.basename(f)\n basename.start_with?('_') or basename.start_with?('.')\n end\n end", "title": "" }, { "docid": "3c80702df11654699c07b29914a21964", "score": "0.6545538", "text": "def files\n entries = []\n Dir.entries(@dir_path).each do |e|\n entries.push e if File.file? \"#{@dir_path}/#{e}\"\n end\n entries\n end", "title": "" }, { "docid": "b1e525f8ff2af2e948db037f18c49d3a", "score": "0.65322196", "text": "def read_files\n contains = Dir.new(@basedir).entries\n @log.info(\"**** #{contains.count().to_s} files in directory #{@basedir} *****\")\n @out.info(\"**** #{contains.count().to_s} files in directory #{@basedir} *****\")\n # Process each file in the list\n begin\n contains.each do |name|\n if verify_file_name(name)\n @count += 1\n @old_name = name\n process_file\n end\n end\n rescue => err\n @log.fatal(\"Caught exception; exiting\")\n @log.fatal(err)\n @out.fatal(\"Caught exception; exiting\")\n @out.fatal(err)\n end\n end", "title": "" }, { "docid": "9f16680750d8df72074348eb8475dea9", "score": "0.65312463", "text": "def traverse_files\n result = []\n Find.find(*search_config[:paths]) do |path|\n next if File.directory?(path)\n next if search_config[:include] and !search_config[:include].any? { |glob| File.fnmatch(glob, path) }\n next if search_config[:exclude].any? { |glob| File.fnmatch(glob, path) }\n result << yield(path)\n end\n result\n end", "title": "" }, { "docid": "3d5cb1bee4c93e7d3f3be60b6143cc84", "score": "0.652991", "text": "def files\n @file_array = [] \n Dir.foreach(@path) do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\n @file_array\n end", "title": "" }, { "docid": "dfbb83e4d40acb52126582fc96241eca", "score": "0.6523611", "text": "def find_file_names(directory)\n file_names = Array[]\n temp = Dir.entries(directory)\n temp.each do |symbol|\n if (symbol != '.') && (symbol != '..')\n file_names.push(symbol)\n end\n end\n file_names\nend", "title": "" }, { "docid": "5d2d5f20bc354ad3b570515dcad8e6a3", "score": "0.652089", "text": "def scan_directories\n self.directories.each do |dir|\n ::Dir.new(dir.path).each do |file|\n unless file == '.' || file == '..'\n if dir.file_name_regexp===file\n puts dir.callback.class\n add ::File.join(dir.path, file), dir.file_name_regexp, &dir.callback\n end\n end\n end\n end\n end", "title": "" }, { "docid": "5ea6d394382b509f56f66363bfb75d58", "score": "0.65166974", "text": "def process_files(files, options)\n\n files.each do |f|\n # Do not recurse into excluded directories\n if options.recursive and f.directory? and !options.exclude.include?(f.basename.to_s)\n puts \"Entering Directory: #{f.basename}\" if $DEBUG\n process_files(f.children, options)\n else\n FilenameFu.doit(f, options) unless f.directory? or options.exclude.include?(f.basename.to_s)\n end\n end\n\nend", "title": "" }, { "docid": "e77343be080b6d63a9bf571df87c8964", "score": "0.6499303", "text": "def files\n Enumerator.new do |yielder|\n @dirs.each do |dir|\n scan_dir(\"\", dir, yielder)\n end\n end\n end", "title": "" }, { "docid": "b1f85db7c40a120a4167f60ba2f37afe", "score": "0.6498295", "text": "def files\n ::Dir.entries(@path).select{|entry| File.file? file_path(entry) }.reject{|entry| entry.match(/^\\./) }.map{|entry| self.file(entry) }\n end", "title": "" }, { "docid": "b01630f91fc4b16d2e990bc455af4061", "score": "0.6488266", "text": "def files(dir)\n filenames = []\n\n @content.each do |path|\n if path =~ /^#{dir.to_s}$/ \n Dir.glob(\"#{site}/#{path}/*\").each do |file|\n filenames << File.basename(file)\n end\n end\n end\n\n filenames.reverse\n end", "title": "" }, { "docid": "a660ecbdd72f8ee1516efa85ac7d10d3", "score": "0.64876634", "text": "def get_all_files(dir, path = '/', acc = Hash.new {|h,k| h[k] = [] })\n dir['contents'].each do |x|\n get_all_files(x,\"#{path}/#{x['name']}\", acc) unless x['contents'].nil? || x['contents'].empty?\n x['path'] = path\n acc[x['hash']] << x unless x['hash'].nil?\n end\n acc\nend", "title": "" }, { "docid": "548a1975722e3806c652d6b5c24b2655", "score": "0.6486025", "text": "def files\n docs = Dir.entries(data_path)\n docs.shift(2) # removes '.' and '..'\n docs\nend", "title": "" }, { "docid": "6de9908aa1a1fc97c1382c2f69b52057", "score": "0.64829004", "text": "def list_files\n\t\tresult = []\n\t\t@path.each_child { |path|\n\t\t\tresult << path if File::file?(path)\n\t\t}\n\t\treturn result\n\tend", "title": "" }, { "docid": "c40b158d213573a8212fc28eb348e6b2", "score": "0.64825904", "text": "def files(arg)\n objs = Array.new\n if KEYS[:special][:all].include?(arg)\n KEYS[:standard].keys.each {|key|\n objs << tae_obj(key.to_s)\n }\n else\n objs << tae_obj(arg)\n end\n objs.each { |obj|\n obj[:file_extensions].each { |ext|\n files = @recursive ? Dir[\"#{@input}**/*.#{ext}\"] : Dir[\"#{@input}*.#{ext}\"]\n files.each {|file|\n obj[:files] << file\n } # May do a 2d array (by file type) for sort\n }\n }\n @files = objs\n end", "title": "" }, { "docid": "051311f398ec535ec69c24a4934e29f4", "score": "0.6482584", "text": "def files\n Traversal.new(@start_dir).map do |dir|\n filename = File.join(dir, @filename)\n File.exist?(filename) ? filename : nil\n end.compact.reverse\n end", "title": "" }, { "docid": "70380c25141a81a838ba3355a482a733", "score": "0.6481402", "text": "def local_files\n files = []\n %w/json rb/.each do |ext|\n files << Dir[\"#{@path}/*.#{ext}\", \"#{@path}/*/*.#{ext}\", \"#{@path}/*/*/*.#{ext}\"] \n end\n files.flatten.sort.uniq\n end", "title": "" }, { "docid": "1c16f9d5141f112b39af6971e96462e8", "score": "0.64762515", "text": "def get_all_files()\n Dir[file_path + \"/*\"]# return of array\n end", "title": "" }, { "docid": "1c16f9d5141f112b39af6971e96462e8", "score": "0.64762515", "text": "def get_all_files()\n Dir[file_path + \"/*\"]# return of array\n end", "title": "" }, { "docid": "684ba4fe3648134d5b7afe5f6f399720", "score": "0.64617723", "text": "def collect_leaf_files(obj)\n deps = []\n\n each_resource(obj) do |item, props|\n if is_file?(item)\n deps << props\n else\n deps.concat(collect_leaf_files(props))\n end\n end\n\n deps\n end", "title": "" }, { "docid": "7e9e00f68c57f5e4ef76ac7c22ffd323", "score": "0.6454093", "text": "def ls_files\n ls.select(&:file?)\n #Dir.glob(\"#{path}*\", File::FNM_DOTMATCH).map { |s| Path.new(s, :type=>:file) }\n end", "title": "" }, { "docid": "5ed81fd3bc0510d181aaa2cbb60468f4", "score": "0.64394516", "text": "def find_all_files(path)\n files = []\n Dir.foreach(path) do |item|\n next if item == '.' or item == '..'\n files << path + '/' + item\n end\n return files\nend", "title": "" }, { "docid": "194e2b1050e5f68e75bd0ae0674e35d4", "score": "0.6438078", "text": "def files\n # RPM stores the file metadata split across multiple tags.\n # A single path's filename (with no directories) is stored in the \"basename\" tag.\n # The directory a file lives in is stored in the \"dirnames\" tag\n # We can find out what directory a file is in using the \"dirindexes\" tag.\n #\n # We can join each entry of dirnames and basenames to make the full filename.\n return tags[:basenames].zip(tags[:dirindexes]).map { |name, i| File.join(tags[:dirnames][i], name) }\n end", "title": "" }, { "docid": "a880062f4938d3cd2965ffea19d9eb01", "score": "0.6437985", "text": "def files\n Find.find(Dir.pwd).select { |f| File.file? f }\n .map { |f| f.sub Dir.pwd << \"/\" , \"\" }\n end", "title": "" }, { "docid": "e04d38bbbf12b2d8cb4234b2a3343a15", "score": "0.64183766", "text": "def files_recursive(dirname, file_name_regexp=/.*/, &callback)\n paths = []\n \n Find.find(dirname) do |path|\n if FileTest.directory?(path)\n directories << MonitoredItems::Store.new({:path => ::File.expand_path(path), :file_name_regexp => file_name_regexp, :callback=>callback})\n ::Find.prune if ::File.basename(path)[0] == ?. # Don't look any further into directies beginning with a dot.\n else\n paths << path if file_name_regexp === path # Amend the return array if the file found matches the regexp\n end\n end\n \n return paths\n end", "title": "" }, { "docid": "9ea45c92d4caefb9810498ab7e4b3767", "score": "0.64162", "text": "def collect_files( source )\n not_readable_or_not_regular = Array.new\n source_tmp = Array.new\n source.each do |element|\n\tif File.exists?( element ) \n\t if CSTools.is_directory_dereference_links?( element )\n\t s2, nr2 = collect_files( Dir.glob( \"#{ element }/*\" ).sort )\n\t not_readable_or_not_regular << nr2\n\t source_tmp << s2\n\t elsif CSTools.is_file_dereference_links?( element )\n\t source_tmp << element\n\t else\n\t not_readable_or_not_regular << element\n\t @logger.debug( \"No regular file: #{ element }\" )\n\t end\n\telse\n\t not_readable_or_not_regular << element\n\t @logger.debug( \"Not readable: #{ element }\" )\n\tend\n end\n return source_tmp.flatten.compact.dup, not_readable_or_not_regular.flatten.compact.dup\n end", "title": "" }, { "docid": "8db049e30144d9a41b8c94fd222e65ad", "score": "0.64146405", "text": "def find_files()\n\t$files = Dir.glob('*.*')\nend", "title": "" }, { "docid": "139645de82c33d650d238fbcfa98828a", "score": "0.6413198", "text": "def files\n #get all file names from the path\n file_array = []\n Dir.foreach(@path) {|file| file_array << file }\n file_array.slice(2,file_array.length-1)\n end", "title": "" }, { "docid": "449e52c6904d4987659b2de48c55c6c5", "score": "0.6409756", "text": "def files(dir)\n (Pathname.new(dir).children - subdirectories(dir)).sort\n end", "title": "" }, { "docid": "b2db5dc7f19a81fa724fce1d35af5f47", "score": "0.64061016", "text": "def get_files(filepath)\n Dir[filepath]\nend", "title": "" }, { "docid": "6b8283665ba9fa656933f33d0e802a60", "score": "0.64026535", "text": "def filenames\n map(&:filename).map(&:to_s)\n end", "title": "" }, { "docid": "5a451ea16b8754176aa8bc50a9217342", "score": "0.640091", "text": "def files\n #dir gives array but contains pathname so we need to gsub it out\n #the /**/*.mp3 is just recursive short cut to include all subfolders and files with .mp3 extention\n Dir[\"#{path}/**/*.mp3\"].collect{|p| p.gsub(\"#{path}/\",\"\")}\n end", "title": "" }, { "docid": "dc91a18a2b0ad2d09fe57ce5412eae06", "score": "0.6400025", "text": "def create_filename_list (param)\n ar = []\n Dir::glob(param){|f|\n next unless FileTest.file?(f)\n ar << f\n }\n return ar\nend", "title": "" }, { "docid": "867dd6c51326dd2368b0b94b95a2a639", "score": "0.63857555", "text": "def get_file_list(filepath)\n Dir.entries(filepath)\nend", "title": "" }, { "docid": "5e9531fafe60e1f7e2d0f3a27e51997f", "score": "0.6384788", "text": "def get_files_by_name(files)\n files_by_name = {} ## Will hold filename => ProjectFile mapping.\n files.each do |file|\n if file.is_directory\n files_by_name.merge!(get_files_by_name file.sub_tree)\n else\n files_by_name[file.path] = file\n end\n end\n files_by_name\n end", "title": "" }, { "docid": "23511bcc3a6e026e51a9d6ebdfe01822", "score": "0.63693887", "text": "def getFilesInDirTranslator(path)\n files = []\n\n #search for all of the files in the directory\n Dir.foreach(path) do |filename|\n #dont include parent files\n next if filename == '.' || filename == '..'\n\n #dont include files that are not vm files\n next unless filename.to_s.include?(\"vm\")\n\n #push the file to the list\n files.push(path+\"/\"+filename)\n end\n\n return files\nend", "title": "" }, { "docid": "80a6411676d4a467fbb7846261514733", "score": "0.6360969", "text": "def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n\n\n # binding.pry \n end", "title": "" }, { "docid": "c4a6dd9c79b321d920e6b0a4e8e7efdb", "score": "0.63609433", "text": "def files\n here = Pathname( caller.first.split( ':' ).shift )\n tsort.map { |file| path[ file ].relative_path_from( here ) }\n end", "title": "" }, { "docid": "35dc481aa0635ae533236d55a4f8e2f9", "score": "0.63600767", "text": "def findfiles ( dir, name )\r\n list = []\r\n require 'find'\r\n Find.find(dir) do |path|\r\n Find.prune if [\".\",\"..\"].include? path\r\n case name\r\n when String\r\n list << path if File.basename(path) == name\r\n when Regexp\r\n list << path if File.basename(path) =~ name\r\n else\r\n raise ArgumentError\r\n end\r\n end\r\n return list\r\nend", "title": "" }, { "docid": "314afb081d1ae353949e3f1511126b5e", "score": "0.6355742", "text": "def list_files_recursive(uri)\n list_files(uri, true)\n end", "title": "" }, { "docid": "ff0618a51349666fa9f373c0188dabc0", "score": "0.63555425", "text": "def _get_auto_files(subdir)\n absolute_dir = \"#{$SAKURADIR}/lib/#{subdir}\"\n Dir.new(absolute_dir).select{|f| f.match( /\\.rb$/ )}.map{|x| subdir + File.basename(x,'.rb') }\n end", "title": "" }, { "docid": "9c04bf443e86cb04e4fc52437b80595d", "score": "0.63547844", "text": "def files\n Dir.entries(path) - %w[. ..]\n end", "title": "" }, { "docid": "d49e0c0e7c2a31846fd7c59b39280212", "score": "0.635235", "text": "def recurse dir, &proc\n Dir::entries(dir).sort.each do |e|\n next if e == \".\" \n next if e == \"..\" \n\n e = e.force_encoding(\"utf-8\")\n\n if dir == \"/\"\n e = \"/\" + e\n else \n e = dir + \"/\" + e\n end\n \n if $excl.include?(e)\n next \n end\n\n f = FileX::new(e)\n\n begin\n if f.file?\n yield(f)\n elsif f.link?\n yield(f)\n elsif f.directory?\n recurse(e,&proc)\n elsif f.type == \"socket\"\n else\n puts \"wtf: \" + f.name + \" : \" + f.type\n end\n rescue Interrupt => ex\n $stderr.puts \"interrupted\"\n exit!(-2)\n rescue Exception => ex\n $stderr.puts \"error processing %s: %s\" % [e,ex]\n raise ex\n end\n end\nend", "title": "" }, { "docid": "a987b9b3b88ef11cf4f9300b1f012fa0", "score": "0.6350356", "text": "def f files\n files.map do |path|\n Dir.glob(path)\n end.flatten.uniq.join(' ')\nend", "title": "" }, { "docid": "49a2879915a59841fc1229e47abeb957", "score": "0.63498586", "text": "def filenames\n pattern = File.join(data_path, '*')\n Dir[pattern].map { |path| File.basename(path) }\nend", "title": "" }, { "docid": "c8719bf06ac936b3159650322b3d727f", "score": "0.63456166", "text": "def find_datafiles( root='.' )\n files = []\n ## todo/check: include all subfolders - why? why not?\n Dir.glob( root + '/**/*.csv' ).each do |file|\n files << file\n end\n files\nend", "title": "" }, { "docid": "9d2b0f1edd53a1a4674e123802750969", "score": "0.6338918", "text": "def filenames\n map(&:filename)\n end", "title": "" }, { "docid": "ad20a5a61ac9055c76c35721b3256641", "score": "0.63388085", "text": "def file_list\n return Dir[File.join(@dir, '**', FILE_EXT)]\nend", "title": "" }, { "docid": "7d46a6dc2f1a90c4ed888d00926c4709", "score": "0.63341886", "text": "def list_of_app_deployed_files(root_dir, name_to_cut)\r\n fscd = FileScanDir.new\r\n fscd.is_silent = true\r\n fscd.scan_dir(root_dir)\r\n res_names = []\r\n #each file need to be specified like without keyword File:\r\n # File \"app\\\\src\\\\cuperativa_gui.rb\"\r\n old_rel_dir_path = nil\r\n fscd.result_list.each do |file_src|\r\n name = file_src.gsub(name_to_cut, \"\")\r\n rel_dir_path = File.dirname(name) # note: not work with \\ intead of / on the path\r\n \r\n name.gsub!('/', \"\\\\\")\r\n puts str_path_file = \"#{name}\"\r\n if rel_dir_path != old_rel_dir_path\r\n puts \"Path changed to: #{rel_dir_path}\"\r\n adptrel_dir_path = \"\\\\#{rel_dir_path.gsub('/', \"\\\\\")}\" # need: \\app\\src\\network\r\n res_names << { :filename => str_path_file, :out_path => adptrel_dir_path, \r\n :delete_path => old_rel_dir_path }\r\n old_rel_dir_path = rel_dir_path\r\n else\r\n res_names << { :filename => str_path_file }\r\n end\r\n end\r\n p res_names.last[:delete_path] = old_rel_dir_path\r\n return res_names\r\n end", "title": "" }, { "docid": "d20f2c1324a724cf1cba99988b1985c9", "score": "0.6331837", "text": "def all_files\n other_files + file_path.to_a\n end", "title": "" }, { "docid": "b59925e177466f00a0195244c99428f6", "score": "0.6329989", "text": "def filepaths\n ::Dir.glob(DIR.join('*/*')).sort_by { |i| File.basename i }\n end", "title": "" }, { "docid": "0c6215961c911151389ae3d85e85c843", "score": "0.6322458", "text": "def scan\n Dir.glob(File.join(dir, '*')) { |path|\n next if IGNORE.include?(path)\n \n if FileTest.directory?(path)\n subdirs << path\n else\n filename = File.basename(path)\n next if filename == INDEX_HTML\n filenames << filename\n end\n }\n end", "title": "" }, { "docid": "18a18f3f9e95028f324506db4f9a4c9b", "score": "0.6309147", "text": "def grouped(files); end", "title": "" }, { "docid": "1651174563e0052604db22d860ee62b6", "score": "0.6307444", "text": "def collect_files(dir_list)\n files = Array.new\n dir_list.each do |dir_name|\n files += Dir::glob(\"#{dir_name}/*\")\n end\n files\n end", "title": "" }, { "docid": "98580b82bbd69139508013d0b77e7222", "score": "0.63047856", "text": "def list\n returning Array.new do |names|\n Dir.entries(basedir).each do |filename|\n if File.file?(File.join(basedir, filename))\n names << filename\n end\n end\n end\n end", "title": "" }, { "docid": "03d85d6637b30ebc02e9c9cb63d54e62", "score": "0.630423", "text": "def find_files\n Dir[\"#{base_path}/*.json\"]\nend", "title": "" }, { "docid": "6bf972b4c98acaf7ba754c0962ae8258", "score": "0.62991345", "text": "def filenames_by_name(records)\n records.select { |record| record[:name] =~ /\\.rb$/ }.inject({}) { |memo, record| memo[File.basename(record[:name], \".rb\")] = record[:full_path]; memo }\n end", "title": "" }, { "docid": "e4508065d3d510b21768b688a06be152", "score": "0.6298107", "text": "def get_file_descriptions_by_ext_by_fname\n file_descriptions_by_ext_by_fname = {}\n Dir.foreach(\".\") {|fname|\n message_exit(\"Error: '#{fname}' seems to be a broken symbolic link!\\nPlease fix and then run this program again\") if File.broken_symlink?(fname)\n next if File.directory?(fname)\t# Ignore any subdirectories\n next if IGNORE_FILE_REGEX_LIST.inject(false){|skip,regex| skip ||= fname =~ regex}\n\n ext = File.extname(fname)\n file_descriptions_by_ext_by_fname[ext] = {} unless file_descriptions_by_ext_by_fname[ext]\n file_descriptions_by_ext_by_fname[ext][fname] = \"\"\t# Empty description\n }\n file_descriptions_by_ext_by_fname\nend", "title": "" }, { "docid": "a0e234ab205a3178df1f67a7734a57e3", "score": "0.62936807", "text": "def all_files_below_rec(dirname)\n if (File.file?(dirname))\n [dirname]\n elsif (File.directory?(dirname))\n entries = Dir.new(dirname).entries.reject{ |entry| entry == \".\" || entry == \"..\" }\n entries.map{ |entry| all_files_below(File.join(dirname, entry)) }\n end\n end", "title": "" }, { "docid": "2f64d2f11a587976ce25ef90c6ebbdf0", "score": "0.62936413", "text": "def traverse(path)\n Dir.foreach(path) do |item|\n next if item == '.' or item == '..'\n realpath = path + '/' + item\n next if File.symlink?(realpath)\n if File.directory?(realpath)\n $dirs.push(realpath)\n traverse(realpath) # go deeper\n elsif $file_extensions_to_render.include?(File.extname(item))\n $files_to_render.push(realpath)\n elsif $file_extensions_to_copy.include?(File.extname(item))\n $files_to_copy.push(realpath)\n end\n end\nend", "title": "" }, { "docid": "17eaf83afce7e484c808562f3eb0c2a4", "score": "0.6286184", "text": "def get_files\n\tdir = Dir.pwd + '/views/posts'\n\tfiles = []\n\tif File.directory?(dir)\n\t\tDir.foreach(\"#{dir}\") do |item|\n\t \t\tnext if item == '.' or item == '..'\n\t \t\tfiles << File.basename(item, '.*')\n\t\tend\n\tend\n\tfiles\nend", "title": "" } ]
faad4afbc89981087b28f2e48e7ab1de
Allows you to set matrix elements one by one
[ { "docid": "c55eedb35272fe03dcc29f9b21b7ed5a", "score": "0.0", "text": "def []=(row, column, value)\n @rows[row][column] = value\n end", "title": "" } ]
[ { "docid": "50781f8c5b25df7f1ecc904464601db1", "score": "0.698452", "text": "def set(row, column, value)\n @matrix[row][column] = value\n end", "title": "" }, { "docid": "28ca1d60150dd8fd271f552acb4e6e46", "score": "0.6817378", "text": "def set(m)\n 0.upto(m.row_size - 1) do |i|\n 0.upto(m.column_size - 1) do |j|\n self[i, j] = m[i, j]\n end\n end\n self.wrap = m.wrap\n end", "title": "" }, { "docid": "af45db55c70813c65e159a27af8c9f89", "score": "0.646182", "text": "def set_cell(matrix,cell,state,x,y)\r\n cell=Cell.new(state,x,y)\r\n matrix[[cell.x,cell.y]]=cell\r\nend", "title": "" }, { "docid": "ac7cafa0c1dbc6095d2820cbbe165160", "score": "0.6421375", "text": "def matrix\n end", "title": "" }, { "docid": "03e09f749251c846a62fafffb81744c0", "score": "0.6355479", "text": "def set_matrix\n @matrix = Matrix.find(params[:id])\n end", "title": "" }, { "docid": "2ae9ea5ef5abc8a0209752a7164d8858", "score": "0.6326609", "text": "def apply(matrix, line, column, value)\n matrix[line, column] = value\n end", "title": "" }, { "docid": "2a43c5cae0cc2354d1d9afb1021ad97e", "score": "0.6305641", "text": "def set_zeros_in_columns(matrix, row)\n matrix.length.times { |column_index| matrix[row][column_index] = 0 }\nend", "title": "" }, { "docid": "edc56d051123ab34db3eada12ba394b6", "score": "0.62846833", "text": "def set_matrix\n @matrix = Matrix.find(params[:id])\n end", "title": "" }, { "docid": "2bb21493d947d2db8f7fc889528a4854", "score": "0.62674767", "text": "def __sparse_initial_set__(ary) #:nodoc:\n self[0...self.shape[0],0...self.shape[1]] = ary\n end", "title": "" }, { "docid": "f436f7f1a452bba8d371c6781754227c", "score": "0.6246108", "text": "def [](index)\n\n @rowSize = (index >= @rowSize) ? index + 1 : @rowSize\n @matrix[index] = [] if (@matrix[index] == nil)\n @matrix[index]\n\n end", "title": "" }, { "docid": "b9e7cdadd2e3c2d9e0184e01d93fb7f6", "score": "0.61540306", "text": "def set_zeros_in_rows(matrix, column)\n row_index = 0\n while !matrix[row_index].nil?\n matrix[row_index][column] = 0\n row_index += 1\n end\nend", "title": "" }, { "docid": "fd90bb1ba63244b41f4ab0ae60a4f357", "score": "0.6145769", "text": "def []=(x, y, mark)\n @matrix[y][x] = mark\n end", "title": "" }, { "docid": "f6c2d3d6155bca99143dce15714f0f99", "score": "0.61207044", "text": "def set!(row, col, val)\n validate_pos(row, col)\n @fm[row*@cols+col] = val\n end", "title": "" }, { "docid": "49653d101c82e9718fad2d9cbed03f12", "score": "0.607237", "text": "def replace_existing_element(matrix,element, current_row, current_col)\r\n matrix[current_row][current_col] = element\r\n end", "title": "" }, { "docid": "7c9c5565434fc2920fe7633d8366108f", "score": "0.6064391", "text": "def []=(i, j, value)\n raise ArgumentError, \"value must be Numeric\" if not value.is_a? Numeric\n raise ArgumentError, \"i must be Integer\" if not i.is_a? Integer\n raise ArgumentError, \"j must be Integer\" if not j.is_a? Integer\n\n if i >= @rows || j >= @cols || i < 0 || j < 0\n raise RuntimeError, \"[#{i}, #{j}] OutOfBound [#{@rows-1}, #{@cols-1}]\"\n end\n\n @matrix[i * @cols + j] = value\n return\n end", "title": "" }, { "docid": "7c9c5565434fc2920fe7633d8366108f", "score": "0.6064391", "text": "def []=(i, j, value)\n raise ArgumentError, \"value must be Numeric\" if not value.is_a? Numeric\n raise ArgumentError, \"i must be Integer\" if not i.is_a? Integer\n raise ArgumentError, \"j must be Integer\" if not j.is_a? Integer\n\n if i >= @rows || j >= @cols || i < 0 || j < 0\n raise RuntimeError, \"[#{i}, #{j}] OutOfBound [#{@rows-1}, #{@cols-1}]\"\n end\n\n @matrix[i * @cols + j] = value\n return\n end", "title": "" }, { "docid": "cd9b29c843a7a086b0254e6a2e7c67c5", "score": "0.6057259", "text": "def matrix_replace(row, column, newvalue)\n self[row*9 + column] = newvalue\n end", "title": "" }, { "docid": "509d842f717b1cd9e8b2d3f6bdcb7679", "score": "0.6053691", "text": "def set_one(row,col)\n\t\tpixels[row][col] = 1\n\tend", "title": "" }, { "docid": "41cc3ce0579dd791d75223c0b3d80169", "score": "0.6040033", "text": "def set_zeroes(matrix)\n row = Array.new(matrix.length, false)\n col = Array.new(matrix[0].length, false)\n \n (0...matrix.length).each do |i|\n (0...matrix[0].length).each do |j|\n if matrix[i][j] == 0\n row[i] = true\n col[j] = true\n end\n end\n end\n (0...matrix.length).each do |i|\n (0...matrix[0].length).each do |j|\n if row[i] || col[j]\n matrix[i][j] = 0\n end\n end\n end\n matrix\nend", "title": "" }, { "docid": "69770bff510079b31dcb02d42e01ba24", "score": "0.60275525", "text": "def square!\n\t\tself.each_with_index do |elem, i|\n\t\t\tself[i] = elem * elem\n\t\tend\n\tend", "title": "" }, { "docid": "744de5f526d02252285762190c9080e3", "score": "0.6005621", "text": "def set_zero(matrix)\n array = []\n cols = matrix[0].size\n matrix.size.times do \n array << Array.new(cols)\n end\n\n matrix.each_with_index do |rows_array, row_index|\n catch :outerrow do\n rows_array.each_with_index do |element, col_index|\n if element == 0\n 0.upto(cols - 1) do |col|\n array[row_index][col] = 0\n end\n\n 0.upto(cols - 1) do |row|\n array[row][col_index] = 0\n end\n throw :outerrow\n else\n if array[row_index][col_index] != 0\n array[row_index][col_index] = element\n end\n end\n end\n end\n end\n\n array\nend", "title": "" }, { "docid": "681c352df618f1781e4b2c132decb664", "score": "0.5991039", "text": "def setmatrixcolumnvalue(c,i,val)\r\n\t\t\tif @matrix[c][i]==\"_\"\r\n\t\t\t\t@matrix[c][i] = val\r\n\t\t\tend\r\n\t\tend", "title": "" }, { "docid": "29f96d8b175c0053a9571d9829a33a5b", "score": "0.59880626", "text": "def Matrix3dSetComponentByRowAndColumn(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743919, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_I4, VT_I4, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "title": "" }, { "docid": "7435791352ae7143ead707d2d847071f", "score": "0.5979202", "text": "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n return matrix\nend", "title": "" }, { "docid": "5c1c3bfff829c233ba48da975221fdd9", "score": "0.5978573", "text": "def assign(matrix, rows, cols)\n\t\t\tunless (_ = @assign_cache[cols]).nil?\n\t\t\t\treturn _\n\t\t\tend\n\n\t\t\treturn [] if rows.empty?\n\n\t\t\ti = rows.first\n\t\t\trow = matrix[i]\n\t\t\tcols.each do |j|\n\t\t\t\tnext unless row[j].zero?\n\n\t\t\t\tc = assign(matrix, rows[1..-1], cols - [j])\n\t\t\t\treturn @assign_cache[cols] = c.unshift([i, j]) if c\n\t\t\tend\n\n\t\t\treturn @assign_cache[cols] = false\n\t\tend", "title": "" }, { "docid": "047bda8ede902347a6ad81de59092352", "score": "0.5967941", "text": "def initialize_matrix(rows, columns)\n # create the matrix using the rows and columns\n matrix = Array.new(rows){Array.new(columns)}\n\n # initialize the matrix\n rows.times do |row|\n columns.times do |column|\n matrix[row][column] = 1\n end\n end\n\n return matrix\nend", "title": "" }, { "docid": "dbf86991b48199ce9fa450994b5f5e6c", "score": "0.5955606", "text": "def set(x,y)\n @board[x][y] = 1\n return self\n end", "title": "" }, { "docid": "085937429c3a6a8b0de4ec52e1bfb29d", "score": "0.59120435", "text": "def []=(i, j, v)\n\t\t@rows[i][j] = v\n\tend", "title": "" }, { "docid": "2cc7da2cea7feb9f61100cfc92239730", "score": "0.58979166", "text": "def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend", "title": "" }, { "docid": "9fd9f09d8c2a683bc90335b7778491f1", "score": "0.5871477", "text": "def set(i, j, val)\n @pos[i][j] = val\n end", "title": "" }, { "docid": "4ed3368d3f8f4c305111ed7d1c2b216b", "score": "0.5866922", "text": "def Transform3dSetMatrixComponentByRowAndColumn(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743945, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_I4, VT_I4, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "title": "" }, { "docid": "11892c2c51c8495d777f748885d14537", "score": "0.5866053", "text": "def blank_matrix(matrix)\n matrix.map do |element_array|\n element_array.map {|element| element = 1 ? element = 0 : element = 0 }\n end\n end", "title": "" }, { "docid": "4246834c6b602b037857f5c7ac47526d", "score": "0.58558655", "text": "def add_rows! *rows\r\n matrix_new = add_rows *rows\r\n @rows = matrix_new.to_a\r\n end", "title": "" }, { "docid": "109be93cab87ddc4d67f73a70d91cac6", "score": "0.58470637", "text": "def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end", "title": "" }, { "docid": "8b3a1369c875b71a60ff86982cb881a7", "score": "0.58423305", "text": "def transpose(matrix)\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[0][1], matrix[1][1], \n matrix[2][1], matrix[0][2], matrix[1][2], matrix[2][2] = \n matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], \n matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2] \nend", "title": "" }, { "docid": "463b700450957250210ad3a17077a5e1", "score": "0.5837327", "text": "def [](i)\n\t\t@matrix[i]\n\tend", "title": "" }, { "docid": "ae3aca553c6ba767965a1da921f46ef6", "score": "0.58303493", "text": "def set(row = @row, col = @col, val)\n row, col = wrap(row, col)\n @cells[row][col] = val\n end", "title": "" }, { "docid": "1f667c922deb43cf24e1b072cbe82efd", "score": "0.5827861", "text": "def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \t@filas.times{ |i|\n \t\t@columnas.times{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend", "title": "" }, { "docid": "88901dd4f531f6c009062f2b5ee91b34", "score": "0.58153325", "text": "def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend", "title": "" }, { "docid": "93c08b78aafceac8e536aa498ae01563", "score": "0.5774139", "text": "def initMatrix(a)\n\t\tfor i in 0..5\n\t\tcolumn = []\n\t\ta[i] = column\n\t\t\tfor j in 0..5\n\t\t\tcolumn[j] = \" \"\n\t\t\tend\n\t\tend\n\treturn a\t\n\tend", "title": "" }, { "docid": "431222d619ab7416c4d6e0101b78a938", "score": "0.5773111", "text": "def set_pieces\n @pieces.each do |piece|\n y , x = piece.location\n @rows[y][x] = piece\n end\n end", "title": "" }, { "docid": "a1ea37d0c8be54fc3d4773d1763b4748", "score": "0.5744189", "text": "def set_all_cell_adjacent_mines\n @board.each_with_index do |row, row_index|\n @board[row_index].each_with_index do |column, column_index|\n set_cell_adjacent_mines(row_index,column_index)\n end\n end\n end", "title": "" }, { "docid": "56aa858f2cbd5021f07d319a529915cb", "score": "0.5733187", "text": "def set_values(array)\n @row = array\n end", "title": "" }, { "docid": "9bad6fcac5ea49c461e01b96761d7064", "score": "0.5726981", "text": "def state=matrix\n @current_state=matrix\n end", "title": "" }, { "docid": "1c9f77564939227b48994b25a76fd828", "score": "0.57262963", "text": "def set_zeroes(matrix)\n marked_rows = []\n marked_cols = []\n\n matrix.each_with_index do |row_arr, row_idx|\n row_arr.each_with_index do |cell, col_idx|\n if cell == 0\n marked_rows << row_idx unless marked_rows.include?(row_idx)\n marked_cols << col_idx unless marked_cols.include?(col_idx)\n end\n end\n end\n\n matrix.each_with_index do |row_arr, row_idx|\n row_arr.each_with_index do |_, col_idx|\n if marked_rows.include?(row_idx) || marked_cols.include?(col_idx)\n matrix[row_idx][col_idx] = 0\n end\n end\n end\n\n matrix\nend", "title": "" }, { "docid": "378b5ba0be36e1ed4ea9246a409e9859", "score": "0.5719369", "text": "def test_update_with_rg;\n a=[[[1,0,1],[0,1,0]]]\n show(a)\n a[0][1]=[1,1]\n end", "title": "" }, { "docid": "fc491839e19efd77cb7b85fdf14e1b2e", "score": "0.5715729", "text": "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "title": "" }, { "docid": "403bd7a60c67a00a8dea9f47f1e863b2", "score": "0.570247", "text": "def exercise_1113 (matrix)\n end", "title": "" }, { "docid": "5c949438dd154dd5a9805f85c18d062a", "score": "0.57007176", "text": "def []= (row, col, val)\n _set(gsl, row, col, val)\n end", "title": "" }, { "docid": "d6112c16242b493ae73307f92d96582b", "score": "0.5686083", "text": "def set_cell(args)\n arr = @rows.flatten\n arr[arr.find_index(args[:position])] = args[:piece]\n @rows = arr.enum_for(:each_slice, 3).to_a\n end", "title": "" }, { "docid": "41bfee25729d7e8240b7e601a4b0ff4f", "score": "0.568355", "text": "def set_data_matrix(matrix, data_matrix = DATAMATRIX_KEY)\n @map[data_matrix] = matrix.to_a\n end", "title": "" }, { "docid": "6df9acf71b1d43695aa5c8f71b166d20", "score": "0.56833905", "text": "def x(escalar)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end", "title": "" }, { "docid": "38e0ff5e31194845b6839e8df52a3956", "score": "0.56784594", "text": "def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend", "title": "" }, { "docid": "24394047ea90cffed3ec1c5f9f3badff", "score": "0.56729066", "text": "def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend", "title": "" }, { "docid": "1667be8cec079fe5e01510651d285e68", "score": "0.5672056", "text": "def new_matrix(row_dimension, column_dimension)\n Array.new(row_dimension) do\n Array.new(column_dimension) do\n @cell = [' ', 'X'].sample\n end\n end\nend", "title": "" }, { "docid": "dd77c3f3d10ff4eaf115b9e07ffced58", "score": "0.56660485", "text": "def setcoordxform(mat)\n raise if mat.size != 6\n\n super(mat)\n end", "title": "" }, { "docid": "23dc2809bad55879ceed34c8c9db6772", "score": "0.5649257", "text": "def setArr(arr) #=> pierwsza funkcja przypisuje wartosc indeksu plus jeden dla kazdego elementu tablicy\n\n\t(0..arr.length-1).each do |i|\n\n\t\tarr[i] = i + 1\n\n\tend\n\nend", "title": "" }, { "docid": "f199f85a586899fafd0dcfec3e49a2b6", "score": "0.56476724", "text": "def matriz_clave\n @m_clave=Array.new(4){Array.new()}\n i,j,contador=0,0,0\n @k.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_clave[i][j] = x\n i+=1\n contador+=1\n end\n @m_clave\n end", "title": "" }, { "docid": "e47411bbdd206a427bee8fd4c5b3f670", "score": "0.56426364", "text": "def zero_matrix(matrix)\n\nend", "title": "" }, { "docid": "05b57bf4dffd3e6f8ec3c58b1e8e4ce5", "score": "0.56353414", "text": "def [](i)\r\n\t\t@m_Matrix[i]\r\n\tend", "title": "" }, { "docid": "e24da64d748e03e0af81946dad9710a7", "score": "0.5633324", "text": "def step\n new_board = Array.new(@size) { Array.new(@size, false) }\n\n (0...@size).each do |x|\n (0...@size).each do |y|\n new_board[x][y] = compute_cell_fate(x, y)\n end\n end\n\n @board = new_board\n end", "title": "" }, { "docid": "c035d44f1ab906e5a195a3d8061d1f21", "score": "0.56309056", "text": "def transpose(matrix)\n new_matrix = Array.new(3) { Array.new }\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |element, element_index|\n # binding.pry\n new_matrix[element_index][row_index] = element\n end\n end\n new_matrix\nend", "title": "" }, { "docid": "890bc2dc4d0213827730a1ec828bb132", "score": "0.56302536", "text": "def fifteen \n size_x = 10 \n size_y = 10\n row = []\n for i in 1..size_x\n row.push(0)\n end\n\n @@mat = []\n\n for i in 1..size_y\n @@mat.push(row.clone)\n end\n \n move(0,0)\n\n return @@mat[size_x-1][size_y-1]\n\nend", "title": "" }, { "docid": "baeff7ccf896da7353332394487ef928", "score": "0.5620525", "text": "def load(arg)\n index = 0\n @mat.each do | _ ,row|\n (0..row.length-1).each do |i|\n row[i] = arg[index]\n index += 1\n end\n end\n end", "title": "" }, { "docid": "ba9742167200c794f758cbf242d41644", "score": "0.5597717", "text": "def set(index, element)\n @array_list.set(index, element)\n end", "title": "" }, { "docid": "aea456728f6be904e5b5c7f6ccd064d1", "score": "0.5590621", "text": "def set_element_at(row_idx, column_idx, value)\n target_row = row_at(row_idx)\n element = Element.new(value, row_idx, column_idx, self)\n target_row[column_idx] = element\n end", "title": "" }, { "docid": "0562263f099b14820709b58629c730b8", "score": "0.5584151", "text": "def fill_square(n, set, idx)\n set[idx] = n\n end", "title": "" }, { "docid": "8240ceaca9022570c3ceb2982d1c4f98", "score": "0.5582046", "text": "def []=(index, element); end", "title": "" }, { "docid": "5edd04cbe34ec8be51d31ead45354020", "score": "0.55815375", "text": "def element=(element); end", "title": "" }, { "docid": "7e016492d2e73cad460f066933811b56", "score": "0.5577074", "text": "def swap_line!(matrix, i, j)\n matrix[i], matrix[j] = matrix[j], matrix[i]\n matrix.each { |array| array[i], array[j] = array[j], array[i] }\nend", "title": "" }, { "docid": "6b51e08409085d7b936eda018d362c48", "score": "0.5575423", "text": "def []=(row, column, value)\n end", "title": "" }, { "docid": "2f14823fb1a2a7c7dcf95b0d6e19cf26", "score": "0.55711627", "text": "def trasponer\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\tfila << pos[j][i]\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@ncol, @nfil, elemento)\n\t\tend", "title": "" }, { "docid": "353eaacd2acb49cd83a96ed0323a2f4a", "score": "0.5568971", "text": "def set_valores_num\n valor = 1\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n @matrix[i][j] = valor\n valor += 1\n j += 1\n end\n i += 1\n end\n end", "title": "" }, { "docid": "06cec46b38bbb2758749cd4f2ef3b869", "score": "0.55661845", "text": "def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend", "title": "" }, { "docid": "8ec37375de57851330e0fd36f9195daa", "score": "0.55596894", "text": "def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end", "title": "" }, { "docid": "99f237a7b289e621dfb1cce71059be08", "score": "0.55571824", "text": "def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end", "title": "" }, { "docid": "91185814e10444ec3391f2fefae5c40c", "score": "0.5551459", "text": "def matrix_addition_reloaded(*matrices)\n\nend", "title": "" }, { "docid": "5d4ad57ace236aee8f524b3a2543dcae", "score": "0.5549245", "text": "def matrix_addition_reloaded(*matricies)\n addition = matricies[0]\n \n i = 1\n while i < matricies.length\n return nil if matricies[i].length != addition.length\n addition = matrix_addition(addition, matricies[i])\n \n i += 1\n end\n \n addition\nend", "title": "" }, { "docid": "353e9a9f5624ffe2d99207cf8bc63746", "score": "0.5549078", "text": "def __set(i, e)\n\t\tUtil.__set(@m, i, e)\n\t\treturn\n\tend", "title": "" }, { "docid": "6626e981dae51a0b831538df1ec43a1f", "score": "0.55436", "text": "def clone\n Matrix.rows(@rows)\n end", "title": "" }, { "docid": "8ebd140bb0d9b96dd00e68de430c5f83", "score": "0.55320495", "text": "def matrix_clone\n @matrix_clone ||= matrix.map { |row| row.clone }\n end", "title": "" }, { "docid": "5dc1c49c719d29efac873a3fc9a1b002", "score": "0.55278385", "text": "def *(mat)\n end", "title": "" }, { "docid": "f62ee2fe25cd2ec274c2ba6ada838ca0", "score": "0.5525549", "text": "def move_to_next_generation\n @x.times{ |r|\n @y.times{|c| \n @mat[r][c].step_generation\n }\n } \n end", "title": "" }, { "docid": "02b61009d16a1621be8a3bde7b2fcadd", "score": "0.5516258", "text": "def mset(*_arg0); end", "title": "" }, { "docid": "14bf3cdfd55fccddacc523e1ba649bdf", "score": "0.55134135", "text": "def []=(row, column, obj)\n raise IndexError, \"row #{row} is out of bounds\" if row < -rows_count\n raise IndexError, \"column #{column} is out of bounds\" if column < -columns_count\n expand(row+1, column+1)\n @values[row][column] = obj\n end", "title": "" }, { "docid": "33602e4308b58a86f08d656aa1cf5b6f", "score": "0.55115736", "text": "def fill\n\t\t# Go through each item\n\t\t@items.length.times do |i|\n\t\t\t@items.length.times do |offset|\n\t\t\t\tleft = i - offset\n\t\t\t\tright = i + offset\n\n\t\t\t\t# The equation is the following:\n\t\t\t\t# value of 46 given to the item staying on the current item\n\t\t\t\t# As you move right and left item, the value is given by 50 - (distance from center note + 2)^2\n\t\t\t\tval = 50 - ((offset + 1) ** 2)\n\t\t\t\tval = 0 if val < 0\n\n\t\t\t\tif left >= 0\n\t\t\t\t\t@matrix[[i, left]] = val\n\t\t\t\tend\n\n\t\t\t\tif right < @items.length\n\t\t\t\t\t@matrix[[i, right]] = val\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "8a02ba22920a53185ab40ae9173a1052", "score": "0.55059665", "text": "def matrix(x, y, z)\n sub_array = []\n y.times do\n sub_array.push(z);\n end\n #sub_array\n array = [];\n x.times do\n array.push(sub_array)\n end\n array\nend", "title": "" }, { "docid": "653b560c170ec390d62183a7a1fa6e8e", "score": "0.5505931", "text": "def msetnx(*_arg0); end", "title": "" }, { "docid": "10545615048e739f0a5d59493499c6a8", "score": "0.54993737", "text": "def []=(*args)\n if args.length == 2\n @grid[args[0]] = args[1]\n else\n @grid[args[0]][args[1]] = Cell.new(args[2], @dimension)\n end\n end", "title": "" }, { "docid": "85d871a00972891b21e4c31332e5b2ac", "score": "0.5490476", "text": "def *(o)\n\t if(self.col == o.row)\n \t\t matres = self.class.new(self.row,self.col)\n# \t\t\t for i in 0...self.row\n# \t\t\t for j in 0...o.col\n# \t\t for k in 0...self.col\n\n\t\t\t i = 0\n \t\t\t (0..(self.row - 1)).collect {\n \t\t\t 0.upto(o.col - 1) do |j|\n\t\t\t k = 0\n \t\t (self.col - 1).times {\n \t\t\tmatres[i,j] += self[i,k] * o[k,j]\n\t\t\t k += 1\n\t\t\t }\n\t\t\t end\n# \t\t end\n# end\n# end\n\n\t\t\ti += 1\n\t\t\t}\n matres\n end\n end", "title": "" }, { "docid": "7a633405cbec007c99a6f409060f6f4f", "score": "0.5486097", "text": "def swap_line!(matrix, i, j)\n\tmatrix[i], matrix[j] = matrix[j], matrix[i]\n\tmatrix.each { |array| array[i], array[j] = array[j], array[i] }\nend", "title": "" }, { "docid": "bb2e8f8361f843f4f3f6e52de79348af", "score": "0.54665715", "text": "def mset(*args); end", "title": "" }, { "docid": "00bfb10af026ecb6edc8a314c38d38c0", "score": "0.5461621", "text": "def run(list, rows)\n raise \"Cannot make a square matrix out of #{list.size} elements and #{rows} rows.\" unless list.size % rows == 0\n r.inverseFromList(:x => list, :y => rows)\n end", "title": "" }, { "docid": "8c4a7c49a3b26ad26f073f16dad668fa", "score": "0.54419994", "text": "def redesign\n x = @mat[0].length\n y = @mat.size\n (1..y-2).each do |i|\n (1..x-2).each do |j|\n @mat[i][j] = \"0\"\n end\n end\n\n divide(1,x-2,1,y-2)\n end", "title": "" }, { "docid": "d33b3976fb289a1e872411c76dac5feb", "score": "0.54353166", "text": "def matrix(arg); return Matrix::new(arg); end", "title": "" }, { "docid": "550be09df7cd6412f2043bbcdd6cf71b", "score": "0.5431535", "text": "def test_update_with_GT1;\n a=[[1,0,1],[0,1,0]]\n show(a)\n a[1][2]=1.1\n end", "title": "" }, { "docid": "117aa00206c9750f028dbbf992883210", "score": "0.54268914", "text": "def sets\n rows = @board.each_slice(9).to_a # rows\n cols = rows.transpose\n (rows + cols + boxes).each do |set|\n set.delete(\"0\")\n end\n end", "title": "" }, { "docid": "5da6ce646751dc52dcf8aaf4657cf559", "score": "0.54234034", "text": "def [](i,j) \n @matriz[i][j]\nend", "title": "" }, { "docid": "e4c396d843f38658199915c9b99fa4fa", "score": "0.54229146", "text": "def fill!(values)\n values = values.to_a if values.respond_to? :to_a\n if nrows == 1 then\n raise \"values must have #{ncols} elements\" unless values.length == ncols\n elsif ncols == 1 then\n raise \"values must have #{nrows} elements\" unless values.length == nrows\n else\n values = values.flatten(1) if values.length > 0 and values[0].is_a? Array\n raise \"values must have #{nrows}x#{ncols} (= #{nrows*ncols}) elements\" unless values.length == nrows*ncols\n end\n nrows.times do |rowid|\n row = @rows[@rownames.keys[rowid]]\n colnames.each.with_index do |colname, j| row[colname] = values[rowid*ncols + j] end\n end\n self\n end", "title": "" }, { "docid": "ed89df24cac49edd37dcc3802e1d1a6f", "score": "0.54113716", "text": "def put(elm)\n resize\n\n i = self.length\n i = @bitmap.next_cell + 1 while i == self.length\n\n begin\n self[i] = elm\n @bitmap.mark_cell(i - 1)\n rescue Exception => e\n # TODO: what about ignoring the operation?\n raise e\n end\n i\n end", "title": "" }, { "docid": "9d0637493d1fa419e11e8c75c7febc94", "score": "0.54070324", "text": "def turn\n\t\tnew_grid = Array.new(@size + 1) { Array.new(@size + 1)}\n\t\t0.upto(@size) do |row|\n\t\t\t0.upto(@size) do |column|\n\t\t\t\tnew_grid[column][@size - row] = @grid[row][column]\n\t\t\tend\n\t\tend\n\t\t@grid = new_grid\n\tend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4f4c7d662a9c6c5bfe47f12f1d0ba6ff", "score": "0.0", "text": "def set_meta\n @meta = Meta.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
609eb39f892550a11ef673e363c7a4cc
c o l u m n _ n a m e s _ f o r _ l o g Depending on which FMS functions are enabled, the columns in the Stats.log may shift, so we need to check which columns are in use.
[ { "docid": "d2a50e25eb3d020fbd3d3e874dc396d3", "score": "0.0", "text": "def column_names_for_log (path)\n\n begin\n file = File.open(path, \"r\")\n # The column names are typically on the first line of log file.\n lines = file.readlines(path,512)\n rescue\n columns = []\n else\n # Chop first line at tabbed columns.\n columns = lines[0].split(\"\\t\")\n end\n\n return columns\nend", "title": "" } ]
[ { "docid": "c77c855d6badc33ef1b0c55b9181b9f5", "score": "0.5771892", "text": "def nsf?\n (chron_columns.size <= 1) && (measure_columns.size >= 1) && columns.none? {|col| !col.chron? && !col.dimension? && !col.measure?}\n end", "title": "" }, { "docid": "854b58d3d6cc1fcb6f74f8287888a9e2", "score": "0.55405855", "text": "def undefined_columns\n updates = {}\n open_log(\"log/ddl-undefined.log\")&.each_line do |line|\n if match = line.match(/sample: { event_name: ([a-z_.]+), undefined: \\[(.*)\\]/i)\n event_name_str, undefined = match.captures\n event_name = event_name_str.to_sym\n updates[event_name] ||= {}\n #sample = undefined.delete('\"').delete(' ').split(',')\n sample = undefined[1..-1].split('\", \"') \n sample.each do |s|\n column_str, value = s.strip.split(':::')\n column = column_str.to_sym\n key = updates.dig(event_name, column)\n\n # check if current value is larger than stored value, keep largest/length\n updates[event_name][column] = if !!key && key[:value]&.size.to_i > value&.size.to_i\n { value: key[:value], type: key[:value]&.class, size: key[:size] }\n else\n { value: value, type: undefined_type_test?(value), size: value&.size.to_i }\n end\n end\n end\n end\n puts \"\\n\\n### updates for events, columns not defined\"\n updates.each do |event_name, columns|\n puts \"#{event_name}\"\n columns.each do |column, params|\n puts \" #{column}: { type: '#{params[:type]}', size: #{params[:size]} } # #{params[:value]}\"\n end\n end\n end", "title": "" }, { "docid": "a8cd596e6507dd01907b07b396d52b0d", "score": "0.5403662", "text": "def per_column_statistics?\n @per_column_statistics == true\n end", "title": "" }, { "docid": "5696411735c758e01ac1acf44d391900", "score": "0.5316034", "text": "def effected_columns(data)\n @columns.select {|idx| !(@columns[idx].value & data).empty? }\n end", "title": "" }, { "docid": "5a69ea45d574231cb508fda3cd536f12", "score": "0.524442", "text": "def should_log?(log)\n # Does not support metrics with dimensions.\n log.metric && !log.dimensions && meets_log_level?(log) && !filtered?(log)\n end", "title": "" }, { "docid": "d6e203924af4b0deebce9ee66650ee02", "score": "0.5231389", "text": "def column_deltas; end", "title": "" }, { "docid": "ed9a8d540947a9cec53863dd8d16010e", "score": "0.52218527", "text": "def columns_taken_over_to_forms\n final_columns.select {|c| include_in_forms?(c) && !exclude_from_forms?(c)}\n end", "title": "" }, { "docid": "db0c356eba4705d3d55c1c1c7f6fce8a", "score": "0.5206167", "text": "def column_limit_reached?\n column_width_calculator.total(:width_xl) >= 12\n end", "title": "" }, { "docid": "0322730ed8970deb6e999aebda7f17f1", "score": "0.52000356", "text": "def check_columns_for_winner\n # TODO\n end", "title": "" }, { "docid": "6ac9ea2af30702c29019dda877dc49fa", "score": "0.5088978", "text": "def check_db_cols(xls_cols, db_cols)\n\tdb_cols.each do |col|\n\t\tunless xls_cols.keys.include? col or $db_column_rules.keys.include? col\n\t\t\tprint \"Database column #{col} is not present in spreadsheet -- values will be NULL.\\n\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "05b6761030f9a16b25dae5fe06c2cbfd", "score": "0.5081207", "text": "def column?\n not floating?\n end", "title": "" }, { "docid": "f5b5f0e30e87ade6f859e4f794440df1", "score": "0.507459", "text": "def ddl_warnings\n updates = []\n open_log(\"log/ddl-warnings.log\")&.each_line do |line|\n if match = line.match(/((?:live_|ims_)[a-z_]+).([a-z_]+)\\s--\\s(.*)/i)\n event_name, column, value = match.captures\n sample = warnings_type_test(column)\n sample = sample.size == 1 ? sample.first.strip : 'too many choices'\n updates << \"#{event_name} | #{column} | #{sample}\"\n end\n end\n puts \"### updates for schema column length\"\n updates.uniq.sort.each { |line| puts line }\n end", "title": "" }, { "docid": "3827cde89306275f049b0815b657d8d4", "score": "0.5029329", "text": "def check_xls_cols(xls_cols, db_cols)\n\txls_cols.keys.each do |key|\n\t\tunless db_cols.include? key or $db_column_rules.values.flatten.include? key\n\t\t\tprint \"Spreadsheet column #{key} is not present in database -- values will be ignored.\\n\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "43915adcc1f216167f04cb42be583e67", "score": "0.50280094", "text": "def initialize_flog\n self.flog_threshold ||= timebomb 1500, 1000 # 80% of average :(\n end", "title": "" }, { "docid": "e64d9cd33b25101eb241289b630d2a45", "score": "0.50148773", "text": "def col_max; 0; end", "title": "" }, { "docid": "e560c5a4da8b68a493be01580e01021d", "score": "0.5008607", "text": "def should_log?(log)\n log.metric && meets_log_level?(log) && !filtered?(log)\n end", "title": "" }, { "docid": "8a9dd1bd5f329f227eacebf39422b7ba", "score": "0.49970427", "text": "def stats_columns source = nil\n if source ## only for this source\n return columns_name source\n else ## all columns\n @all_columns ||= @monitor.sources.inject([]) do |col,s|\n col += columns_name s\n col\n end\n return @all_columns\n end\n end", "title": "" }, { "docid": "55ee1ebd81798591f99388c81764a522", "score": "0.49900946", "text": "def check_col\n\n\nend", "title": "" }, { "docid": "a66f3fc95846198e9ce65cb384606ab0", "score": "0.49806917", "text": "def should_log?(log)\n log.metric && meets_log_level?(log) && !filtered?(log)\n end", "title": "" }, { "docid": "a53c173f431daef0851560a567f7cbd6", "score": "0.4947878", "text": "def column_deltas=(_arg0); end", "title": "" }, { "docid": "dc68dfbd06cfa69e05514f6ba323059f", "score": "0.4934876", "text": "def test_for_invalid_columns(columns)\n invalid_columns = columns.select { |c| !VALID_COLUMNS.include?(c) }\n raise \"Invalid column(s) found: #{invalid_columns.join(\",\")}\" unless invalid_columns.empty? \n end", "title": "" }, { "docid": "bd54eb34a077d9b401dd2048525323c3", "score": "0.49302563", "text": "def col_max; 1; end", "title": "" }, { "docid": "bd54eb34a077d9b401dd2048525323c3", "score": "0.49302563", "text": "def col_max; 1; end", "title": "" }, { "docid": "bd54eb34a077d9b401dd2048525323c3", "score": "0.49302563", "text": "def col_max; 1; end", "title": "" }, { "docid": "fc111adbbbe6d556a2ecfb0561525ef6", "score": "0.49276453", "text": "def columns_used\n @columns_used ||= []\n end", "title": "" }, { "docid": "35ab0228dcab9d4fc1c2d7f5d833dc20", "score": "0.49054268", "text": "def define_default_columns\n\n def elapsed(rec)\n ((rec.firsttry.to_i+rec.retries.to_i) == 0) ? \"?\" : formattedNumber(rec.elapsedmilliseconds.to_i/(rec.firsttry.to_i+rec.retries.to_i), 2)\n end\n\n def msg_per_bulkgroup(rec)\n (rec.bulkgroups == 0) ? \"?\" : formattedNumber((rec.firsttry+rec.retries).to_f / rec.bulkgroups, 2)\n end\n\n def elapsed_per_bulkgroup(rec)\n (rec.bulkgroups.to_i == 0) ? \"?\" : formattedNumber(rec.elapsedmilliseconds.to_i/1000.0/rec.bulkgroups.to_i, 2)\n end\n\n def SLA_title_warning(rec)\n if rec['id_ofmessagetype']\n if msgType(rec.id_ofmessagetype).waitlimitwarning\n \"Limit für Warnung = #{msgType(rec.id_ofmessagetype).waitlimitwarning} Minuten\"\n else\n 'Kein Limit für Warnung definiert für diesen Messagetyp'\n end\n end\n end\n\n def SLA_title_alert(rec)\n if rec['id_ofmessagetype']\n if msgType(rec.id_ofmessagetype).waitlimitalert\n \"Limit für Alert = #{msgType(rec.id_ofmessagetype).waitlimitalert} Minuten\"\n else\n 'Kein Limit für Alert definiert für diesen Messagetyp'\n end\n end\n end\n\n [\n {:caption=>\"Incoming\", :data=>proc{|rec| formattedNumber(rec.incoming)}, :title=>\"Anzahl der eingehenden Messages\", :align=>'right'},\n {:caption=>\"First Try Success\", :data=>proc{|rec| formattedNumber(rec.firsttrysuccess)}, :title=>\"Anzahl der beim ersten Versuch erfolgreich verarbeiteten Messages\", :align=>'right'},\n {:caption=>\"Retry Success\", :data=>proc{|rec| formattedNumber(rec.retrysuccess)}, :title=>\"Anzahl der nach Wiederholung erfolgreich verarbeiteten Messages\", :align=>'right'},\n {:caption=>\"Final Errors\", :data=>proc{|rec| link_errors(rec, formattedNumber(rec.finalerror))}, :title=>\"Anzahl der nach x Wiederholungen als fehlerhaft markierten Messages\", :align=>'right'},\n {:caption=>\"Divide and Conquer\",:data=>proc{|rec| formattedNumber(rec.divideandconquer)}, :title=>\"Anzahl der Divide&Conquer-Vorgänge nach Persist-Fehlern\", :align=>'right'},\n {:caption=>\"Compressions\", :data=>proc{|rec| formattedNumber(rec.compressions)}, :title=>\"Anzahl der bei Verdichtung nach BulkCriteria gelöschten Messages (Wenn OFMessageType.YN_ProcessUniqueOnlyOnce=Y)\", :align=>'right'},\n {:caption=>\"Retry Transaction\", :data=>proc{|rec| formattedNumber(rec.retrytx)}, :title=>\"Anzahl Neustart der Verarbeitung von Tx-Gruppen nach Aussteuern fehlerhafter Messages bei handleMessage\", :align=>'right'},\n {:caption=>\"First Try\", :data=>proc{|rec| formattedNumber(rec.firsttry)}, :title=>\"Anzahl der erstmaligen Berarbeitungsversuche von Messages\", :align=>'right'},\n {:caption=>\"Retry\", :data=>proc{|rec| formattedNumber(rec.retries)}, :title=>\"Anzahl der wiederholten Berarbeitungsversuche von Messages\", :align=>'right'},\n {:caption=>\"First Try Error\", :data=>proc{|rec| link_errors(rec, formattedNumber(rec.firsttryerror))}, :title=>\"Anzahl der nach erstem Verarbeitungsversuch wegen Fehler in Queue zurückgestellten Messages\", :align=>'right'},\n {:caption=>\"Retry Error\", :data=>proc{|rec| link_errors(rec, formattedNumber(rec.retryerror))}, :title=>\"Anzahl der nach wiederholtem Verarbeitungsversuch wegen Fehler in Queue zurückgestellten Messages\", :align=>'right'},\n {:caption=>\"Elapsed total\", :data=>proc{|rec| formattedNumber(rec.elapsedmilliseconds.to_i/1000)}, :title=>\"Verarbeitungszeit total im Betrachtungszeitraum in Sekunden\", :align=>'right'},\n {:caption=>\"Elapsed / Msg\", :data=>proc{|rec| elapsed(rec)}, :title=>\"Verarbeitungszeit je Message in Millisekunden\", :align=>'right'},\n {:caption=>\"Bulk-Groups\", :data=>proc{|rec| formattedNumber(rec.bulkgroups)}, :title=>\"Anzahl durch Worker verarbeitete Bulk-Groups\", :align=>'right'},\n {:caption=>\"Msg. / Bulkgroup\", :data=>proc{|rec| msg_per_bulkgroup(rec)}, :title=>\"Durchschn. Anzahl Messages je Bulkgroup\", :align=>'right'},\n {:caption=>\"Elapsed / Bulkgroup\",:data=>proc{|rec| elapsed_per_bulkgroup(rec)}, :title=>\"Verarbeitungszeit je Bulkgroup in Sekunden\", :align=>'right'},\n {:caption=>\"SLA Warnings\", :data=>proc{|rec| fn(rec.sla_warnings)}, :title=>\"Anzahl Warnungen wegen Überschreiten der SLA-Zeiten zwischen Einstellen und Verarbeitung von Messages\", :data_title=>proc{|rec| \"%t: #{SLA_title_warning(rec)}\"}, :align=>'right'},\n {:caption=>\"SLA Alerts\", :data=>proc{|rec| fn(rec.sla_alerts)}, :title=>\"Anzahl Alerts wegen Überschreiten der SLA-Zeiten zwischen Einstellen und Verarbeitung von Messages\", :data_title=>proc{|rec| \"%t: #{SLA_title_alert(rec)}\"}, :align=>'right'},\n ]\n end", "title": "" }, { "docid": "e86fa8d0eadb12e49b57d606672a2af6", "score": "0.48917806", "text": "def setLog( log, shiftAge = 0, shiftSize = 102400 )\n @logDev = log\n @shiftAge = shiftAge\n @shiftSize = shiftSize\n true\n end", "title": "" }, { "docid": "8796f7ed6a8417dd59129d839f27e07d", "score": "0.48901063", "text": "def lock_column_instance_filter\n super if @values[:xmin]\n end", "title": "" }, { "docid": "ef9a616758fb639e73103a23d195c0ba", "score": "0.48459983", "text": "def table_update?\r\r\n EVENT_LIMIT && @events.size > EVENT_LIMIT && Theo::AntiLag::Optimize_XY\r\r\n end", "title": "" }, { "docid": "0fcdfdae5b0775d0ff2e06a376c5aad6", "score": "0.48450083", "text": "def should_log?(log)\n log.metric && super\n end", "title": "" }, { "docid": "2d3591154bcc7e4d5f7f7023c449c1bc", "score": "0.48425668", "text": "def timeseries?\n !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?\n end", "title": "" }, { "docid": "71f84eb48af706433878355a78048e3a", "score": "0.4840781", "text": "def user_table_has_more_than_base_columns?\n ActiveRecord::Base.connection.columns('users').count > 3\n end", "title": "" }, { "docid": "46af3a8d9b3e4d79aea53a45fa6007ea", "score": "0.48200953", "text": "def col_max;\n 1;\n end", "title": "" }, { "docid": "3b91d945e3bab6ece4af9ebb1e3a4961", "score": "0.47984946", "text": "def fvmi?\n measure_mode == 0\n end", "title": "" }, { "docid": "a8e409edfb46438bad7d1a63e96a972b", "score": "0.47898248", "text": "def supports_log_exports_to_cloudwatch_logs\n data[:supports_log_exports_to_cloudwatch_logs]\n end", "title": "" }, { "docid": "30e7f150ebb8478eb9c682bf27c04e42", "score": "0.47887117", "text": "def test_log\n test_values = LARGE_RANGE_VALUES.reject do |x|\n # reject minus and zero values\n x[0,1] == '-' || x == '0'\n end\n compare_with_float(test_values, OraNumber,\n Proc.new {|n| Math::log(n)},\n Proc.new {|n| OCI8::Math::log(n)})\n compare_with_float(test_values, OraNumber,\n Proc.new {|n| Math::log(n)/Math::log(3)},\n Proc.new {|n| OCI8::Math::log(n, 3)})\n end", "title": "" }, { "docid": "1acaa9e6058eedc8287f3c437054f2a5", "score": "0.4787704", "text": "def log_metric_only?\n true\n end", "title": "" }, { "docid": "a77153e79795eca3061aa6daaebb29a1", "score": "0.47858185", "text": "def status_column_count\n\t\t1\n\tend", "title": "" }, { "docid": "355371c1fd5295aa7da7366d9656fbb8", "score": "0.4784206", "text": "def loglike_data\n loglike=0\n @nr.times do |i|\n @nc.times do |j|\n res=@matrix[i,j].quo(@total)\n if (res==0)\n res=1e-16\n end\n loglike+= @matrix[i,j] * Math::log(res )\n end\n end\n loglike\n end", "title": "" }, { "docid": "6d7b00fe58477b1c6e31cb694280113d", "score": "0.47828162", "text": "def verify_columns\n raise \"First column name of the Grades spreadsheet should be #{ASSIGNMENT_TITLE}\" unless @grades_sheet[TITLE_ROW, GRADES_ASSIGNMENT_COL].gsub(/\\s+/, \" \") == ASSIGNMENT_TITLE\n raise \"Second column name of the Grades spreadsheet should be #{MAX_POINTS_TITLE}\" unless @grades_sheet[TITLE_ROW, GRADES_POINTS_COL].gsub(/\\s+/, \" \") == MAX_POINTS_TITLE\n raise \"Third column name of the Grades spreadsheet should be #{DUE_DATE_TITLE}\" unless @grades_sheet[TITLE_ROW, GRADES_DUE_DATE_COL].gsub(/\\s+/, \" \") == DUE_DATE_TITLE\n end", "title": "" }, { "docid": "c406dee3a2e57a4805f0b8bad803b054", "score": "0.47822216", "text": "def sql_truncations\n updates = {}\n open_log(\"log/sql-truncations.log\")&.each_line do |line|\n if match = line.match(/([a-z_]+).([a-z_]+) {\\ssupplied: (\\d+), expecting: (\\d+) }/i)\n event_name_str, column_str, supplied, expected = match.captures\n column = column_str.to_sym\n event_name = event_name_str.to_sym\n updates[event_name] ||= {}\n key = updates.dig(event_name, column)\n\n # check if current value is larger than stored value, keep largest/length\n updates[event_name][column] = if !!key && key[:supplied]&.to_i > supplied&.to_i\n { supplied: key[:supplied], expected: key[:expected] }\n else\n { supplied: supplied, expected: expected }\n end\n end\n end\n puts \"\\n\\n### sql data truncated on insert, update column length\"\n updates.each do |event_name, columns|\n puts \"#{event_name}\"\n columns.each do |column, params|\n puts \" #{column}: { supplied: '#{params[:supplied]}', expecting: '#{params[:expected]}' }\"\n end\n end\n end", "title": "" }, { "docid": "d518428b84f5ec0cb8562d35c8cd3b49", "score": "0.47696853", "text": "def truncated_metrics; end", "title": "" }, { "docid": "d518428b84f5ec0cb8562d35c8cd3b49", "score": "0.47696853", "text": "def truncated_metrics; end", "title": "" }, { "docid": "eaef94d7731f35bb6f1883b743cf3843", "score": "0.47644088", "text": "def column_delta; end", "title": "" }, { "docid": "d7b00723f9d02d44198265b62ce9b4d1", "score": "0.47643042", "text": "def formattable?\n not(@log.nil?) and @log.formattable?\n end", "title": "" }, { "docid": "6820f59ef2b16419b075bba83c55019a", "score": "0.4762354", "text": "def pos_mysql_master_log_info\n size - 2_000\n end", "title": "" }, { "docid": "d09a169241ae4dda2baa1efee75080a9", "score": "0.47491372", "text": "def unrecognized_columns\n column_fields.select { |_, f| f.nil? }.map(&:first)\n end", "title": "" }, { "docid": "67d6dbfe659686d190bf22475d16da7a", "score": "0.47408327", "text": "def check_columns\n\t\twin_test = false\n\t\t(0..2).each do |i|\n\t\t\tif @board_state[i] === @board_state[i+3] && @board_state[i+3] === @board_state[i+6]\n\t\t\t\twin_test = true\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\treturn win_test\n\tend", "title": "" }, { "docid": "52a36d827944181503c8a551810c2284", "score": "0.47400373", "text": "def are_quant_sheet_colums_valid?(sheet)\n \n (0..23).each do |i|\n \n correct_name = case\n when i == 0 then \"No\"\n when i == 1 then \"Type\"\n when i == 2 then \"DILocation\"\n when i == 3 then \"Topic\"\n when i == 4 then \"HeaderInstruction\"\n when i == 5 then \"Passage\"\n when i == 6 then \"QueText\"\n when i == 7 then \"QueImage\"\n when i == 8 then \"SolText\"\n when i == 9 then \"SolImage\"\n when i == 10 then \"Quantity-A\"\n when i == 11 then \"Quantity-B\" \n when i == 12 then \"Options\"\n when i == 13 then \"Correct\"\n when i == 14 then \"Option1\"\n when i == 15 then \"Option2\"\n when i == 16 then \"Option3\"\n when i == 17 then \"Option4\"\n when i == 18 then \"Option5\"\n when i == 19 then \"Option6\"\n when i == 20 then \"Option7\"\n when i == 21 then \"Option8\"\n when i == 22 then \"Option9\"\n when i == 23 then \"Option10\" \n end\n \n if sheet.row(0).at(i).to_s != correct_name\n @error_messages << \"Invalid Excel\" << (\"Sheet => #{sheet.name},Incorrect Column # #{(i+1).to_s} => #{sheet.row(0).at(i).to_s},Required Column => #{correct_name}\")\n return false\n end \n\n end\n\n return true\n \n end", "title": "" }, { "docid": "250388f660f0749007dd67e1481bd969", "score": "0.47370008", "text": "def stats?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "98731ea4627b66e44f016546a83129e9", "score": "0.47307438", "text": "def available_columns\n super\n\n index_tyear = @available_columns.find_index {|column| column.name == :tyear}\n\n # Already overriden\n return @available_columns if index_tyear\n\n ################\n # Smile Specific #379708 Liste entrées de temps : colonne semaine\n\n index = @available_columns.find_index {|column| column.name == :tweek}\n\n # + TYEAR\n # spent_on_column = base.available_columns.detect{|c| c.name == :spent_on}\n @available_columns.insert (index + 1), QueryColumn.new(:tyear,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(:label_year)\n )\n\n # + TMONTH\n @available_columns.insert (index + 1), QueryColumn.new(:tmonth,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(:label_month)\n )\n\n # + WDAY\n @available_columns.insert (index + 1), QueryColumn.new(:wday,\n :sortable => [\"#{TimeEntry.table_name}.spent_on\", \"#{TimeEntry.table_name}.created_on\"],\n :groupable => true,\n :caption => l(\"datetime.prompts.day\")\n )\n\n # TWEEK : groupable\n tweek_column = @available_columns.detect{|c| c.name == :tweek}\n\n if tweek_column\n tweek_column.groupable = \"#{TimeEntry.table_name}.tyear || '-' || #{TimeEntry.table_name}.tweek\"\n end\n # END -- Smile Specific #379708 Liste entrées de temps : colonne semaine\n #######################\n\n @available_columns\n end", "title": "" }, { "docid": "6ad71715765b66cd3061864db571ebe8", "score": "0.4716248", "text": "def log_check mess, is_op = nil ; LogCheck.mess(mess, is_op) end", "title": "" }, { "docid": "8b33c17628811d9d2a190ba7fab63a0d", "score": "0.47010377", "text": "def requested_cols\n 1\n end", "title": "" }, { "docid": "296a9145379c7d66638690282c256c86", "score": "0.469873", "text": "def fix_too_many_lonely_zeros_in_columns\n\t\tproblematic_rows = self.get_problematic_rows_per_problematic_column\n\t\tself.zero_fewest_problematic_rows(problematic_rows)\n\tend", "title": "" }, { "docid": "296a9145379c7d66638690282c256c86", "score": "0.469873", "text": "def fix_too_many_lonely_zeros_in_columns\n\t\tproblematic_rows = self.get_problematic_rows_per_problematic_column\n\t\tself.zero_fewest_problematic_rows(problematic_rows)\n\tend", "title": "" }, { "docid": "13d377ec75045a773e9b35563d7c6b4f", "score": "0.46958977", "text": "def log_table_comm(str)\n\t\t\t@log.warn(str)\n\t\tend", "title": "" }, { "docid": "431ee2917e51c26acadc1af09af87bf8", "score": "0.4695011", "text": "def requested_cols\n end", "title": "" }, { "docid": "751ea00ec693be7c0a5bc3d50d3b753d", "score": "0.46923923", "text": "def any_column_win?\n column_win?(1) || column_win?(2) || column_win?(3)\n end", "title": "" }, { "docid": "acb10c8a83b75869c616d6d6298dd25f", "score": "0.46854365", "text": "def available_columns\n column_options.reject{|column| viable_report_columns.map(&:column_name).include? column.name.to_s}\n end", "title": "" }, { "docid": "1bed125dde1b294f12d20ae392b9d0e7", "score": "0.4680079", "text": "def has_log?\n !!@log\n end", "title": "" }, { "docid": "33b9fb583eb6f9238506ddc3feb2a657", "score": "0.46603402", "text": "def table_columns_to_observe\n @table_columns_to_observe ||= AdminActivityChangeLogger::TABLE_ALLOWED_KEYS_MAPPING[table_name][:columns]\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "13465354af139af26acc7b0f631e7556", "score": "0.46594644", "text": "def col_max\n 1\n end", "title": "" }, { "docid": "8d1e1c140538c804b90e19b943f8ae10", "score": "0.4654762", "text": "def logs_this_week?\n weekly_logs.any?\n end", "title": "" }, { "docid": "e941206cd60c75f3604b1a8e247fdf15", "score": "0.4653083", "text": "def allow_format_columns\n return @allow_format_columns\n end", "title": "" }, { "docid": "88be56a6d67251efc7feaa3a8ec0ddaf", "score": "0.46519282", "text": "def should_log?(log)\n meets_log_level?(log) && !filtered?(log)\n end", "title": "" }, { "docid": "31ea14d81184b19e5c7fd7fe28dfe54e", "score": "0.46480674", "text": "def col_max\n return 1\n end", "title": "" }, { "docid": "9fd21b1a070453b780afa421d61df34a", "score": "0.46304598", "text": "def fbe_extra\n 0\n end", "title": "" }, { "docid": "9fd21b1a070453b780afa421d61df34a", "score": "0.46304598", "text": "def fbe_extra\n 0\n end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "f1ee3425256c689e2b4d4e79355d6566", "score": "0.46206173", "text": "def columns; end", "title": "" }, { "docid": "e7cb037cd3e7c41528cabb01b6b87b33", "score": "0.46097612", "text": "def should_log_summary(level, is_fault)\n # Fault summaries log at WARN.\n return level <= Logger::WARN if is_fault\n # Success summaries log at INFO.\n return level <= Logger::INFO\n end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.46087766", "text": "def column_count; end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.46087766", "text": "def column_count; end", "title": "" }, { "docid": "e0b9348c8e323f8d1b1abb6078a89aab", "score": "0.46087766", "text": "def column_count; end", "title": "" }, { "docid": "94926db84302188525bbbb1c5121ba22", "score": "0.4607364", "text": "def columns_name source\n @monitor.stats.columns.map { |c| column_name(c,source) }\n end", "title": "" }, { "docid": "74fcadc8116c5e888e814cee79c4ebc7", "score": "0.4604764", "text": "def _save_update_all_columns_hash\n v = super\n v.delete(:xmin)\n v\n end", "title": "" }, { "docid": "7678928dbfcc080f7733d5b658ac18cc", "score": "0.46042278", "text": "def retrieve_columns\n # TODO: determinate columns depending on season formulas and/or details\n # [:season_individual_points, :season_relay_points]\n\n # To find significant columns, for now, consider columns\n # which have at least one score\n # Cycle between three season point columns\n # to check if score is stored\n columns = []\n [:season_individual_points, :season_relay_points, :season_team_points].each do |column|\n columns << column if @season.meeting_team_scores.where(\"#{column} > 0\").exists?\n end\n columns\n end", "title": "" }, { "docid": "c48afb72b2e75e7f001e282eb07d5733", "score": "0.46026212", "text": "def kases_count_column?\n columns.to_a.map {|a| a.name.to_sym}.include?(:kases_count)\n end", "title": "" }, { "docid": "22bfb86d72c9d83c78ad35be8aea2ff7", "score": "0.46026123", "text": "def fix_ef_summary\n coef_vec = Daru::Vector.new @fix_ef\n sd_vec = Daru::Vector.new self.fix_ef_sd\n z_vec = Daru::Vector.new self.fix_ef_z\n p_vec = Daru::Vector.new self.fix_ef_p(method: :wald)\n \n return Daru::DataFrame.new([coef_vec, sd_vec, z_vec, p_vec], \n order: [:coef, :sd, :z_score, :WaldZ_p_value])\n end", "title": "" }, { "docid": "edd9b1689a43d2fc7dd771849b608596", "score": "0.45940652", "text": "def buff_modificator; features_sum(:buff_durability); end", "title": "" }, { "docid": "21397c5c5a6ff100f52923aceb28fb67", "score": "0.45938143", "text": "def mark_used_columns\n sql_bind_variables.each { |col, value| mark_as_used(col) unless value.nil? }\n end", "title": "" }, { "docid": "ab8c98984d82eee625315cdad81f1587", "score": "0.45923147", "text": "def global_summary?\n !self.columns.select{|c| !c.global_summary.nil?}.empty?\n end", "title": "" }, { "docid": "3df7a2965b36d2f53205225f3b6ebb69", "score": "0.45920137", "text": "def pos_mysql_master_log_info\n size - 2000\n end", "title": "" }, { "docid": "b4a9d68d09e572964bf6dad9bfce14ee", "score": "0.4589865", "text": "def col_max\n 2;\n end", "title": "" }, { "docid": "80d8c413f8684e3786b26a0bfde3453b", "score": "0.45895267", "text": "def es_heat_by_mode_vs_time_graphkit\nend", "title": "" }, { "docid": "ba57dc9cf039a6c6495586851db440db", "score": "0.45885378", "text": "def col_max\n return 2\n end", "title": "" }, { "docid": "ba57dc9cf039a6c6495586851db440db", "score": "0.45885378", "text": "def col_max\n return 2\n end", "title": "" }, { "docid": "ba57dc9cf039a6c6495586851db440db", "score": "0.45885378", "text": "def col_max\n return 2\n end", "title": "" }, { "docid": "ba57dc9cf039a6c6495586851db440db", "score": "0.45885378", "text": "def col_max\n return 2\n end", "title": "" } ]
30b8803c48a3960f4bddb676b6da0e86
Memoize the output of a find in a threadsafe manner.
[ { "docid": "3dc45da40376752b8077a92c06eda3a1", "score": "0.0", "text": "def add_index(name, indexable)\n @lock.synchronize do\n @indexes[name] = indexable\n end\n end", "title": "" } ]
[ { "docid": "fa8baa38455c3e17942c755cd4896235", "score": "0.62660944", "text": "def pure_find(task)\n file.rewind\n current_line = ''\n first_c = 0\n last_c = 0\n file.each_char.with_index do |c, idx|\n if c == LINE_SEP\n current_line =~ /^([^\\s]+)#{SEPARATOR}/\n to_cache($1, record: current_line, first_c: first_c, last_c: last_c)\n from_cache(task) if task == $1\n current_line = ''\n first_c = idx + 1\n last_c = first_c\n else\n current_line << c\n last_c = idx\n end\n end\n { record: NOT_FOUND, first_c: nil, last_c: nil }\n end", "title": "" }, { "docid": "e870af34f4a8e9b074411dfc5ff5bf24", "score": "0.61101687", "text": "def uncached_find_files; end", "title": "" }, { "docid": "5ad3aae23031e7d9e910d562cb98a114", "score": "0.5918954", "text": "def find ; end", "title": "" }, { "docid": "1d46ba401805247f47350858f5b30715", "score": "0.58653694", "text": "def find(_dict)\n fail 'MemorySet does not support chaining yet!'\n end", "title": "" }, { "docid": "2b8bf85a581a9154c7acc69c2f317e4a", "score": "0.5827312", "text": "def __memoized; end", "title": "" }, { "docid": "adef238f311ec8fdbdb36546e4db4a24", "score": "0.58092064", "text": "def cache_or_find( opts = {} )\n key = keyify( opts )\n @cache.fetch key do |key|\n @cache[key] = yield\n end\n end", "title": "" }, { "docid": "62057304fbc2009a66cb3be6b5703910", "score": "0.5775418", "text": "def find; end", "title": "" }, { "docid": "62057304fbc2009a66cb3be6b5703910", "score": "0.5775418", "text": "def find; end", "title": "" }, { "docid": "1c19f6f6b8d34773ae95b5529e7bbeed", "score": "0.5746034", "text": "def get_memoized(arg)\n get_unmemoized(arg)\n end", "title": "" }, { "docid": "99adaee70657cc6ba8fd1eba09173bf8", "score": "0.5702548", "text": "def find_in_buffer(val)\n return nil unless @buffer\n @results ||= {}\n return @results[val] if @results.has_key?(val)\n index = @buffer.index search_string(val)\n return (@results[val] = nil) unless index\n index = index / row_bytesize\n @results[val] = self[index]\n end", "title": "" }, { "docid": "147485588eab60e292509a495349cd5a", "score": "0.56707275", "text": "def find(*args, &block); end", "title": "" }, { "docid": "147485588eab60e292509a495349cd5a", "score": "0.56707275", "text": "def find(*args, &block); end", "title": "" }, { "docid": "7384081668122105ecf5f52f3796572c", "score": "0.5616082", "text": "def perform_find\n response = self.perform_get.uniq\n response.map! { |a| self.class.item(a) }\n response.each { |a| a.customer_id ||= self.customer_id }\n response\n end", "title": "" }, { "docid": "ed59fbc562d35907cd5e5cd2538dd8fb", "score": "0.5600336", "text": "def memoize_conditionally; end", "title": "" }, { "docid": "a53959fed10a7510fa0ff03cc24ecac9", "score": "0.55627394", "text": "def __memoize_cache__\n @__memoize_cache__\n end", "title": "" }, { "docid": "469290c70e3119c185e22277898fab82", "score": "0.55566555", "text": "def find(name)\n cache(name) { @children.find { |x| safe_find(x, name) } || failure }\n end", "title": "" }, { "docid": "9d4fd73ae6b8aebe9304d6f8b3cca168", "score": "0.55485076", "text": "def slow_dance(find, array)\n array.each_with_index do |tile, index|\n return index if tile == find\n end\nend", "title": "" }, { "docid": "1a3812e56a32b223cc8bfd304b564d79", "score": "0.5488015", "text": "def memoize\n lambda do |*args|\n @memo ||= {}\n @memo[args.hash] ||= call(*args)\n end\n end", "title": "" }, { "docid": "a303d19c060d327b1bfdb2e46cede6ff", "score": "0.54765886", "text": "def do_search\n result = nil\n query = \"findme OR #{WORDS.random_word}\"\n time = Benchmark.realtime do\n result = Content.find_id_by_contents query\n end\n # time, no of hits\n [ time, result.first, query ]\n end", "title": "" }, { "docid": "1a0835a37e272b98822d1a287c6e58a8", "score": "0.54667985", "text": "def cache_finder\n @c_all_cached_objects = Array.new\n find(:all, @c_options).each{|instance| @c_all_cached_objects[instance.id] = instance}\n end", "title": "" }, { "docid": "2e5a8513525d7f497825c57f9e88d1ca", "score": "0.54624885", "text": "def flush_find_cache\n self.class.send(:cache_find_bys).each do |attribute_names|\n find_attributes = attribute_names.map { |attr_name| [attr_name, attribute_was(attr_name)] }\n self.class.instance_exec(find_attributes) do |find_attributes|\n finder_cache.delete(cache_key_for(find_attributes))\n end\n end\n nil\n end", "title": "" }, { "docid": "200665a1278725431eeca37bed605d12", "score": "0.54374933", "text": "def find &compare\n reset_progress_check\n @search_boundary.reset\n line = find_next_newline\n while making_progress?\n comp_value = compare.call(line)\n if comp_value == 0 # found matching line\n backtrack_to_first_line_match compare\n return @file\n else\n @search_boundary.send(comp_value < 0 ? :cursor_back : :cursor_forward)\n line = find_next_newline\n end\n end\n if @exact_match\n nil\n else\n backtrack_to_gap compare\n return @file.eof? ? nil : @file\n end\n end", "title": "" }, { "docid": "15d48681e5beffdfc65de44b84b31cfb", "score": "0.54355896", "text": "def find_cache_by_ref(ref_attr, ref_val)\n key_ref = KeyGen.cache_key_ref(name, ref_attr, ref_val)\n if (id = Rails.cache.read(key_ref))\n find_cache(id)\n else\n item = where(ref_attr => ref_val).limit(1).first\n if item\n Rails.cache.write(key_ref, item.send(primary_key.to_sym))\n Rails.cache.write(KeyGen.cache_key(name, item.send(primary_key.to_sym)), item)\n end\n item\n end\n end", "title": "" }, { "docid": "b154c847b1bf651f801a94fca9d035c5", "score": "0.54292417", "text": "def find_every(*args)\t\n \t\tif !args.delete(:nocache)\n\t\t\tRails.cache.fetch(gen_cache_id(self.change_index + \"/\" + args.to_s)) { orig_find_every(*args) }\n\t\telse\n\t\t\torig_find_every(*args)\n\t\tend\n\tend", "title": "" }, { "docid": "a207cf1dff9dea7c7cf6f2c98819f8ed", "score": "0.5428179", "text": "def memoize\n cache = {} # An empty cache. The lambda captures this in its closure.\n lambda {|*args|\n # notice that the hash key is the entire array of arguments!\n unless cache.has_key?(args) # if no cached result for these args\n cache[args] = self[*args] # compute and cache the result\n end\n cache[args] # return the result from cache\n }\n end", "title": "" }, { "docid": "2c7dad040070eb095ed485725a0f46e1", "score": "0.5422321", "text": "def find options ={}\n results = @db.find options[:attribute ], options[:criteria]\n results.each{|r| @cache.add r}\n\n results\n end", "title": "" }, { "docid": "52884a6298251d060573be742d8f0b13", "score": "0.5402958", "text": "def memo; end", "title": "" }, { "docid": "a337b342b869932d1305b99e15a63222", "score": "0.5377028", "text": "def find(ids)\n ids = [ids] unless ids.is_a?(Array)\n cached = Set.new\n ids_miss = Array.new\n \n # Find items that are cached and remove ids from the query \n ids.each {|id|\n item = cache[id]\n unless item.nil?\n cached.add item\n else\n ids_miss.push id\n end\n } \n \n fetched = find_all(ids_miss)\n fetched.each {|item|\n cache.store(item.id, item)\n }\n return cached + fetched\n end", "title": "" }, { "docid": "e8f4f3eae2c4e4dd316d85dd2e7a4e94", "score": "0.5374726", "text": "def find_elem use_cache = nil, must_exist = true\n use_cache = @cache if use_cache.nil?\n if use_cache\n @cached_elem ||= find_elem_directly\n else\n @cached_elem = find_elem_directly\n end\n\n if @temporary\n e = @cached_elem\n @cached_elem = nil\n e\n else\n @cached_elem\n end\n end", "title": "" }, { "docid": "03a31ad149cf1fc2dd96be4c12efccc3", "score": "0.5370835", "text": "def find(h)\n @find += 1\n @mutex.synchronize do\n @que.detect { |x| x[:id] == h[:id] }\n end\n end", "title": "" }, { "docid": "fe56c84bef0685b08d68e8db3a8be1c8", "score": "0.53650403", "text": "def find(&checker)\n answer = nil\n each do |n|\n if checker.call(n)\n answer = n\n end\n end\n return answer\n end", "title": "" }, { "docid": "d020ad911a2800108b73c6420286391d", "score": "0.53537", "text": "def mem(key)\n nil == find(key)\n end", "title": "" }, { "docid": "7aae2fb53b5d3be2fecded453250165c", "score": "0.53505087", "text": "def find_terms(name)\n return @cache[name] if @cache[name]\n results = []\n @find_methods.each do |method|\n result = __send__(:\"find_#{method}\", name)\n unless result.empty?\n results.concat(result)\n break unless @return_all\n end\n end\n if @return_all\n results = results.uniq\n end\n @cache[name] = results\n end", "title": "" }, { "docid": "4cd07663a5fe119b594d2c9a6231b25a", "score": "0.53450274", "text": "def find # FIXME: ifnone\n each do |e|\n r = yield(e)\n return e if r != false\n end\n return nil\n end", "title": "" }, { "docid": "8b8b035d315f3ef798022f24f18885a8", "score": "0.5344226", "text": "def find(options = T.unsafe(nil), &block); end", "title": "" }, { "docid": "8b8b035d315f3ef798022f24f18885a8", "score": "0.5344226", "text": "def find(options = T.unsafe(nil), &block); end", "title": "" }, { "docid": "1b88c23c61f251785cc610d22247a847", "score": "0.53392637", "text": "def search_repeated_files\n repetitions = first_run\n return repetitions if repetitions.empty? || @fast\n second_run(repetitions)\n end", "title": "" }, { "docid": "f40071279e38be0fbf2fe171cffb1a6c", "score": "0.5332381", "text": "def _memoize goal, index, result, position = parse_results[index]\r\n if result\r\n position[:found_order] = [] unless position.has_key?(:found_order)\r\n position[:found_order] << goal\r\nposition[goal.to_s] = source_text[index...result] if result - index < 40 && goal.is_a?(Symbol)\r\n end\r\n position[goal] = result if result || goal.is_a?(Symbol)\r\n result\r\n end", "title": "" }, { "docid": "72fc5718c6381456491f4ec97bc2da42", "score": "0.5331187", "text": "def find_every_with_cache(options)\n if cacheable?\n Query::Select.perform(self, options, scope(:find))\n else\n find_every_without_cache(options)\n end\n end", "title": "" }, { "docid": "868a42e576acb41bd88280035bdc7026", "score": "0.5316763", "text": "def find_by_key(data)\n self.set_requests\n return self.get_duplicates(data)\n end", "title": "" }, { "docid": "c701456e5dbadb0c725c1c2cfd8bbe96", "score": "0.52962023", "text": "def my_find(collection)\n i = 0 \n find = []\n while i < collection.length\n return collection[i] if yield(collection[i])\n i += 1\n end\nend", "title": "" }, { "docid": "0c88f040e6ec0979cfef893cc25ac226", "score": "0.52567947", "text": "def find(value)\n \n end", "title": "" }, { "docid": "61f1d91b28672919c184bfa2bb58b292", "score": "0.5255442", "text": "def people\n # Cache the results in memory\n @people ||= find_people\n end", "title": "" }, { "docid": "054f51d03a8f7057d936b009c919e647", "score": "0.52516794", "text": "def find_for(key, list)\n timer { look_up(list, key) }\n anagrams_found!\n end", "title": "" }, { "docid": "cc053d71d28eb34108be3a498ced08c8", "score": "0.5245654", "text": "def find_via_cache(key, *arguments)\n cache_read(key) || find_via_reload(key, *arguments)\n end", "title": "" }, { "docid": "15fc4f2ee79c9d202b4d20d48ed61853", "score": "0.524468", "text": "def search_random\r\n valid_chars = ('0'..'9').to_a + ('a'..'f').to_a\r\n current = rand(2 ** 128 - 1).to_s(16).rjust(32,'0')\r\n puts \"start performing random search...\" if @verbose\r\n # Repeat until Ctrl+c\r\n loop do\r\n @speed.start\r\n # Performance relevant part; just compare and change string\r\n @file.chunk_size.times do\r\n if current == Digest::MD5.hexdigest(current)\r\n puts \"found one! #{current}\" if @verbose\r\n @file.hit(current)\r\n end\r\n # Just change one random char of the hash\r\n current[rand(32)] = valid_chars[rand(16)]\r\n end\r\n puts \"Speed for last #{@file.chunk_size} random hashes:\" +\r\n \" #{@speed.stop} hashes/s\" if @verbose\r\n end\r\n end", "title": "" }, { "docid": "62647264782c66d66c782616d1daade0", "score": "0.52295005", "text": "def my_find(collection)\n i = 0\n while i < collection.size\n return collection[i] if yield(collection[i])\n i += 1\n end\n # p collection[i]\nend", "title": "" }, { "docid": "6c97f61c7f8ec0a512a15b31d62b6ba9", "score": "0.5225195", "text": "def find_with_nested_set(*args)\n result = find(*args)\n if result.respond_to?(:cache_nested_set)\n result.cache_nested_set\n elsif result.respond_to?(:each)\n result.each do |node|\n node.cache_nested_set\n end\n end\n result\n end", "title": "" }, { "docid": "0702036fcff58c0514240cb1632f1775", "score": "0.5225168", "text": "def my_find(collection)\ni = 0\nwhile i < collection.length #while i < 100\n return collection[i] if #if true\nyield(collection[i]) #yield(1)\n i = i + 1\nend\nend", "title": "" }, { "docid": "6a2134fd6d9982dc95756bcc5967471c", "score": "0.52184844", "text": "def find_all needle, options = {}\n options[:align] ||= 1\n options[:limit] ||= @find_limit\n\n if needle.is_a?(Fixnum)\n # silently convert to DWORD\n needle = [needle].pack('L')\n end\n\n r = []\n if options[:align] == 1\n # fastest find?\n processed_bytes = 0\n sections.each do |section|\n next unless section.data # skip empty sections\n section.data.scan(needle) do\n r << $~.begin(0) + section.va\n end\n processed_bytes += section.vsize\n return r if processed_bytes >= options[:limit]\n end\n end\n r\n end", "title": "" }, { "docid": "6044d2c21f46ac23dda17f56db3f8803", "score": "0.5210144", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i = i + 1\n end\n end", "title": "" }, { "docid": "c248dfac4549d47298e0b95efa06c2a7", "score": "0.52016723", "text": "def searching\n if searching?\n Facter.debug \"Caught recursion on %s\" % @name\n\n # return a cached value if we've got it\n if @value\n return @value\n else\n return nil\n end\n end\n\n # If we've gotten this far, we're not already searching, so go ahead and do so.\n @searching = true\n begin\n yield\n ensure\n @searching = false\n end\n end", "title": "" }, { "docid": "749cab540c615a0949461f757a407304", "score": "0.5196887", "text": "def find(ifnone = nil)\n self.each { |o| return o if yield(o) }\n ifnone.call if ifnone\n end", "title": "" }, { "docid": "6922f6038f3f342d78fa3d33132bf3b8", "score": "0.51793456", "text": "def cache_search_results(term)\n term_dir = File.join(CACHE_BASE_DIR, \"search\", term)\n\n FileUtils.mkdir_p(term_dir)\n\n GithubApi::search_repositories_pager(term: term) do |response, page|\n unless response.success?\n Rails.logger.debug \"Bad response #{ response.code }\"\n next\n end\n\n if response.parsed_response[\"items\"].size == 0\n Rails.logger.debug \"Search returned no repos\".red\n next\n end\n\n outfile = File.join(term_dir, \"#{ page }.json\")\n File.open(outfile, \"w\") do |f|\n f.puts response.body\n end\n end\n end", "title": "" }, { "docid": "2110c8fcb18e845eb719e86231837817", "score": "0.51761276", "text": "def search_results(page, per_page)\n Rails.cache.fetch(cache_key(page, per_page), expires_in: 1.day) do\n search_target(page, per_page)\n end\n end", "title": "" }, { "docid": "23a147d99ebb3d04c942ad99bd5458c3", "score": "0.51712275", "text": "def my_find(collection)\n i = 0 \n while i<collection.length \n return collection[i] if yield(collection[i])\n i += 1 \n end\nend", "title": "" }, { "docid": "0f630581bd643e3d85a6255d7d89ca9a", "score": "0.516943", "text": "def find_one_with_tiny_cache(id)\n return find_one_without_tiny_cache(id) unless tiny_cache_enabled?\n return find_one_without_tiny_cache(id) unless select_all_column?\n\n id = id.id if ActiveRecord::Base === id\n\n # if ::ActiveRecord::IdentityMap.enabled? && cachable? && record = from_identity_map(id)\n # return record\n # end\n\n if cachable?\n if record = @klass.read_tiny_cache(id)\n return record \n end\n end\n\n if cachable_without_conditions?\n if record = @klass.read_tiny_cache(id)\n return record if where_match_with_cache?(where_values, record)\n end\n end\n\n record = find_one_without_tiny_cache(id)\n record.write_tiny_cache\n record\n end", "title": "" }, { "docid": "14151328bbc40fdf9bf27cfbcf3ce3c0", "score": "0.51370233", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i += 1\n end\nend", "title": "" }, { "docid": "2561f0acb131503d91d37138acc2d920", "score": "0.5136127", "text": "def my_find(collection)\ni = 0\nwhile i < collection.length\n return collection[i] if yield(collection[i])\n i = i + 1\n end\nend", "title": "" }, { "docid": "754c1a96ec6e7764ea4db91a91236a17", "score": "0.5134289", "text": "def search\r\n start, stop = next_chunk\r\n # Big loop from :start to :max in status.yaml\r\n while start < stop\r\n @speed.start\r\n # Loop for smaller chunks; it's the only relevant part for performance\r\n (start..stop).each do |number|\r\n current = number.to_s(16).rjust(32,'0')\r\n if current == Digest::MD5.hexdigest(current)\r\n puts \"found one! #{current}\" if @verbose\r\n @file.hit(current)\r\n end\r\n end\r\n @file.last = stop\r\n speed_string = \"with #{@speed.stop} hashes/s\"\r\n start, stop = next_chunk(speed_string)\r\n end\r\n puts \"reached maximum of #{@file.max}...\" if @verbose\r\n end", "title": "" }, { "docid": "9d2a0ccdd74f1ab1522f7660f2cc8fdc", "score": "0.51311046", "text": "def my_find(collection)\n \n i = 0 \n \n while i < collection.size\n \n if yield(collection[i])\n return collection[i]\n end\n \n i += 1\n \n end\n\nend", "title": "" }, { "docid": "190a13f748e86be132910314747a00be", "score": "0.5123527", "text": "def memoize(fn)\n cache = {} \n lambda {|*args|\n return cache[args] if cache.has_key?(args)\n cache[args] = fn.call(*args)}\nend", "title": "" }, { "docid": "bcfa67b004b07fec00f97db6f9b4ca91", "score": "0.51185197", "text": "def find(*args); end", "title": "" }, { "docid": "bcfa67b004b07fec00f97db6f9b4ca91", "score": "0.51185197", "text": "def find(*args); end", "title": "" }, { "docid": "18fb7f5154665ca2de6900945d84e148", "score": "0.51176614", "text": "def faster_solution(query, occurence_hash)\n occurence_hash[query]\nend", "title": "" }, { "docid": "b6a738f29b2311e05dbc9aa746556096", "score": "0.5116913", "text": "def locate(sha)\n return if @cache.include?(sha)\n\n sha_start = 8 + (256 * 4)\n crc_start = sha_start + (20 * @fanout[255])\n offset_start = crc_start + (4 * @fanout[255])\n b1 = sha.sha[0].ord\n ns = b1 == 0 ? 0 : @fanout[b1 - 1]\n ne = @fanout[b1]\n\n # sha table, crc table, offset table\n\n lo=ns\n hi=ne\n\n while lo < hi\n mid = (lo + hi)/2\n @idx.pos = sha_start + (mid * 20)\n psha = @idx.read(20)\n if psha < sha.sha\n lo = mid + 1\n elsif psha > sha.sha\n hi = mid\n else\n @idx.pos = crc_start + (mid * 4)\n crc = @idx.read(4).unpack('N')[0]\n @idx.pos = offset_start + (mid * 4)\n off = @idx.read(4).unpack('N')[0]\n @cache[sha] = {:off => off, :crc => crc}\n return\n end\n end\n @cache[sha] = false # Signify we don't have it!\n end", "title": "" }, { "docid": "3087c7ddb0839160a462836ffc7d2dbb", "score": "0.5113769", "text": "def __memoized # :nodoc:\n @__memoized ||= {}\n end", "title": "" }, { "docid": "477051114883df10809becc7c8c96668", "score": "0.51072973", "text": "def after_find\n self.cache_record unless self.class.cache_records\n end", "title": "" }, { "docid": "fb8e015249b97bf57c7ae371db2d0a16", "score": "0.51054054", "text": "def find(identifiers, options = {})\n return [] if identifiers.empty?\n Array(yield(identifiers)).tap do |objects|\n verify_equal_key_and_value_counts!(identifiers, objects)\n cache_all(identifiers, objects, options)\n end\n end", "title": "" }, { "docid": "679a9bda0db897dadfe81caa786c872f", "score": "0.5103893", "text": "def find (&block)\n result = nil\n found = false \n\n each do |ele|\n if block.call(ele) \n result = ele \n found = true\n break\n end\n end\n found ? result : nil\n end", "title": "" }, { "docid": "32e720ebcc17d3a52ef2cbc2e6b4edd8", "score": "0.50971854", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i += 1\n end\nend", "title": "" }, { "docid": "7ab5a156f8037f3aaa6ae55976217c23", "score": "0.5095499", "text": "def find &block\n each do |ele|\n if yield ele\n ele\n end\n nil\n end\n end", "title": "" }, { "docid": "ecca20041115c0588d1c5c3e7cf6d885", "score": "0.5094023", "text": "def find_with_model_cacher(*args)\nlogger.debug \"CachedModel.find #{args.to_json}\"\n args[0] = args.first.to_i if args.first =~ /\\A\\d+\\Z/\n # Only handle simple find requests. If the request was more complicated,\n # let the base class handle it, but store the retrieved records in the\n # local cache in case we need them later.\n if args.length != 1 or not Fixnum === args.first then\n # Rails requires multiple levels of indirection to look up a record\n # First call super\n records = find_without_model_cacher(*args)\n # Then, if it was a :all, just return\n return records if args.first == :all\n return records if RAILS_ENV == 'test'\n case records\n when Array then\nlogger.debug \"CachedModel.find STORE\"\n records.each { |r| r.cache_store }\n end\n return records\n end\n\n return find_without_model_cacher(*args)\n end", "title": "" }, { "docid": "8f275cd33e2baec3a6a11800c2b39ba3", "score": "0.50906855", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i = i + 1\n end\nend", "title": "" }, { "docid": "8f275cd33e2baec3a6a11800c2b39ba3", "score": "0.50906855", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i = i + 1\n end\nend", "title": "" }, { "docid": "8f275cd33e2baec3a6a11800c2b39ba3", "score": "0.50906855", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n return collection[i] if yield(collection[i])\n i = i + 1\n end\nend", "title": "" }, { "docid": "1c9f14b61394a67e9994fbee567a15dc", "score": "0.5080254", "text": "def find(args, mode); end", "title": "" }, { "docid": "62cbedcc5e4098a292e83198e3a7ada7", "score": "0.5076557", "text": "def search_results(page, per_page)\n return unless valid_target?\n Rails.cache.fetch(cache_key(page, per_page), expires_in: 1.day) do\n search_target(page, per_page)\n end\n end", "title": "" }, { "docid": "5ea6f9e22e0eb2a5fbc022f9c99f6545", "score": "0.5076253", "text": "def find(*args, &block)\n item = __lookup(*args, &block)\n\n item[0] += 1\n\n item[1]\n end", "title": "" }, { "docid": "64b5a330e2249a7f190fa934dcce1a4f", "score": "0.50683755", "text": "def find &block\n # assume not found\n result = nil\n # iterate over each element, evaluate block\n each do |x|\n if yield x # if evaluates true, break and return that object\n result = x\n break\n end\n end\n return result\n end", "title": "" }, { "docid": "5198a46ac7afcb52cd6a30333240693c", "score": "0.5064851", "text": "def find *args, &block\n @finder = [args, block]\n end", "title": "" }, { "docid": "4bc6b97c2d5d22000a93a37c0c7d7ef3", "score": "0.50469995", "text": "def my_find(collection)\n i = 0\n while i < collection.length\n if yield(collection[i])\n return collection[i]\n end\n i += 1\n end\n nil\nend", "title": "" }, { "docid": "9f7bc618d5ff79e2b8250ae639aa5224", "score": "0.5045079", "text": "def another_find\n #use another_each\n end", "title": "" }, { "docid": "33e7191c07e53ebcbfa151143a727457", "score": "0.5044366", "text": "def find_text\n return @find_text\n end", "title": "" }, { "docid": "0bf78934a4e0014217f44b5851b78788", "score": "0.50344646", "text": "def memoize(id)\n memoized[id] ||= yield\n end", "title": "" }, { "docid": "517c43cbd1fcd641f71452afcf774922", "score": "0.5031822", "text": "def find_by_remote_id remote_id\n @lock.synchronize {@cache[remote_id]&.get}\n end", "title": "" }, { "docid": "0fe090ddf93165969fcd0758d820ee7e", "score": "0.5022634", "text": "def find(value)\n to_find(@to_sum, value, 0, @to_sum.length)\n end", "title": "" }, { "docid": "84c84a0f3efefc9170e6ef390083e009", "score": "0.50095737", "text": "def find needle, options = {}\n options[:align] ||= 1\n options[:limit] ||= @find_limit\n\n if needle.is_a?(Fixnum)\n # silently convert to DWORD\n needle = [needle].pack('L')\n end\n\n if options[:align] == 1\n # fastest find?\n processed_bytes = 0\n sections.each do |section|\n next unless section.data # skip empty sections\n pos = section.data.index(needle)\n return section.va+pos if pos\n processed_bytes += section.vsize\n return nil if processed_bytes >= options[:limit]\n end\n end\n nil\n end", "title": "" }, { "docid": "629ca4990939cbc5031eb914a21b9182", "score": "0.5008656", "text": "def search(key, needle)\n # We starts at 0\n i = 0\n # We create our MD5 hasher\n hasher = Digest::MD5.new\n # We loop \n while i+=1\n \t# We concatenate the key and the current value in a single string\n message = [key,i].join\n # We hash it using MD5\n hash = hasher.hexdigest(message)\n # It the hash starts with the needle we return the solution\n return i if hash.to_s.start_with?(needle)\n end\nend", "title": "" }, { "docid": "2c046db09834fa2301e44bcbd8c2b259", "score": "0.5007035", "text": "def find_by!(arg, *args); end", "title": "" }, { "docid": "a0b95c4d22e0579e54dcc1a95e2ffedf", "score": "0.4998533", "text": "def find_by_name(name)\n cache_locally :by_name => name do\n cache_manager.ns(:attributes_by_name).get_or_cache(name, 24.hours) do \n construct_if_found one.find_by_name_ne(name)\n end\n end\n end", "title": "" }, { "docid": "8acfc801257321e7594bf03fcf8be28e", "score": "0.4996514", "text": "def find(value)\r\n @used_length.times do |i|\r\n return i if value==self[i]\r\n end\r\n return nil\r\n end", "title": "" }, { "docid": "82d8fd1c5ff52943760921b4dbc0ce45", "score": "0.49943393", "text": "def _find(term = '', records = 1000, tolerance = 50)\n output = []\n search_space = Dir.entries(@path).reject { |k| k == '.' || k == '..' } rescue []\n search_space.each do |search_space_term|\n if OBFS::Levenshtein.distance(search_space_term, term) <= tolerance && OBFS::WhiteSimilarity.similarity(search_space_term, term) > 0.0\n output << search_space_term\n end\n end\n output.first(records)\n end", "title": "" }, { "docid": "b9a9a086ff8f0e75252d2fe5cee338a7", "score": "0.4975005", "text": "def search_cache_by(attribute, term, options={})\n matcher = instance_variable_get(\"@#{name_for(attribute)}_matcher\") || instance_variable_set(\"@#{name_for(attribute)}_matcher\", Soulmate::Matcher.new(name_for(attribute)))\n matches = matcher.matches_for_term(term, options)\n\n res = []\n matches.each {|m| res << [m['id'].split('_')[-1].to_i, m['data']] }\n\n res\n end", "title": "" }, { "docid": "a3a8fd01dd48bd777f62105a53d95543", "score": "0.49749926", "text": "def find(id)\n @candidates.each_with_index { |cad, index| return @candidates[index] if cad[:id]==id }\n\n return nil\nend", "title": "" }, { "docid": "c9be53ca0a624be6e8004c806b8995af", "score": "0.49746776", "text": "def find_one_with_tiny_cache(id)\n return find_one_without_tiny_cache(id) unless tiny_cache_enabled?\n return find_one_without_tiny_cache(id) unless select_all_column?\n\n id = id.id if ActiveRecord::Base === id\n\n if cachable?\n record = @klass.read_tiny_cache(id)\n if record\n return record if where_values.blank? || where_values_match_cache?(record)\n end\n end\n\n record = find_one_without_tiny_cache(id)\n record.write_tiny_cache\n record\n end", "title": "" }, { "docid": "bccdea65d758cd6a97015dc3c7c570e7", "score": "0.49735233", "text": "def memoize(key, &block)\n if @storage.include? key then\n return @storage[key]\n end\n\n val = block.call()\n store(key => val)\n return val\n end", "title": "" }, { "docid": "3b5a301091818d124c30e92d36e19e46", "score": "0.49712384", "text": "def find_by_path(path)\n path = path.dup\n\n cache_key = path\n\n wiki, time = cache[cache_key]\n if wiki\n puts \"!!! USE CACHE: #{PP.pp(wiki.cache_key, '').strip}: #{wiki.ident}\"\n [wiki, time, true]\n else\n page = repos.find_by_path(path)\n puts \"!!! CREATE CACHE: #{PP.pp(page.cache_key, '').strip}: #{page.ident}\"\n cache.store(cache_key, [page, t = Time.now])\n [page, t, false]\n end\n end", "title": "" }, { "docid": "03834b1aed0f9a2e01434e86d4cfc8fa", "score": "0.49698517", "text": "def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id \n end\n # @candidates.select { |candidate| candidate[:id] == id }\n \nend", "title": "" }, { "docid": "82410346b69ef2438c68380e0b90686e", "score": "0.4962677", "text": "def find(id)\n # @candidates.detect{|candidate| candidate[:id] == id.to_i} \n @candidates.each{|candidate| return candidate if candidate[:id] == id.to_i}\nend", "title": "" }, { "docid": "ec2f6d761204f20de795ede0c52397f4", "score": "0.49610192", "text": "def match(subject)\n return @cache[subject] if (@cache && @cache[subject])\n tokens = subject.split('.')\n @results.clear\n matchAll(@root, tokens)\n # FIXME: This is too low tech, will revisit when needed.\n if @cache\n prune_cache if @cache.size > CACHE_SIZE\n @cache[subject] = Array.new(@results).freeze # Avoid tampering of copy\n end\n @results\n end", "title": "" } ]
6c0a4b2ffcc0e357e0e86dc6e0781c82
zh/00default.rb: TraditionalChinese resources of 00default.rb. header
[ { "docid": "015f0d46dbcca4a44d46b1ee929837b8", "score": "0.0", "text": "def title_tag\n\tr = \"<title>#{CGI::escapeHTML( @html_title )}\"\n\tcase @mode\n\twhen 'day', 'comment'\n\t\tr << \"(#{@date.strftime( '%Y-%m-%d' )})\" if @date\n\twhen 'month'\n\t\tr << \"(#{@date.strftime( '%Y-%m' )})\" if @date\n\twhen 'form'\n\t\tr << '(Append)'\n\twhen 'edit'\n\t\tr << '(Edit)'\n\twhen 'preview'\n\t\tr << '(Preview)'\n\twhen 'showcomment'\n\t\tr << '(TSUKKOMI Status Change Completed)'\n\twhen 'conf'\n\t\tr << '(Preferences)'\n\twhen 'saveconf'\n\t\tr << '(Preferences Changed)'\n\twhen 'nyear'\n\t\tyears = @diaries.keys.map {|ymd| ymd.sub(/^\\d{4}/, \"\")}\n\t\tr << \"(#{years[0].sub( /^(\\d\\d)/, '\\1-')}[#{nyear_diary_label @date, years}])\" if @date\n\tend\n\tr << '</title>'\nend", "title": "" } ]
[ { "docid": "7dde9dad3f258d06da0822e451bd64cb", "score": "0.59846014", "text": "def index\n\t\t@file = YAML.load_file(\"#{RAILS_ROOT}/config/locales/#{I18n.default_locale}.yml\")\n @res = @file[I18n.default_locale.to_s]\n @language = I18n.default_locale.to_s\n\t\ttranslation_options\n\tend", "title": "" }, { "docid": "6fb0d140e749a17e672cee6752e37ced", "score": "0.57731104", "text": "def chinese_s\n CLD.detect_language('这是一个简体中文测')\n end", "title": "" }, { "docid": "2a2adc7e0d587e3ec99e8f8056328ed0", "score": "0.5756033", "text": "def chinese_t\n CLD.detect_language('這是中國傳統的考試')\n end", "title": "" }, { "docid": "335961c358398912a0fb0cb91e9b31b1", "score": "0.5712135", "text": "def translations; end", "title": "" }, { "docid": "4fc524cc38c02a1e8f5650994cd50b8a", "score": "0.5708987", "text": "def set_chinese\n @chinese = Chinese.find(params[:id])\n end", "title": "" }, { "docid": "05f9933f51cb8cb8b8acbcf34a0ca2cb", "score": "0.56342554", "text": "def hello_locales\n {\n \"hello\" => :en,\n \"hi\" => :en,\n \"hey\" => :en,\n \"hola\" => :es\n }\n end", "title": "" }, { "docid": "c5316c393421155dcb3119d6aa255906", "score": "0.55776364", "text": "def apply_locale; end", "title": "" }, { "docid": "3ce8490e95d783d77d8f8f34162ecec0", "score": "0.557117", "text": "def index\n @q = ShopDatabase.ransack(params[:q])\n @shop_databases = @q.result\n #ドロップダウンの選択肢に47都道府県に加えて「全国」を入れるため\n @zenkoku = JpPrefecture::Prefecture.new\n @zenkoku.name = \"全国\"\n end", "title": "" }, { "docid": "0b56ebd5cfc39e5a59cb236280bb7257", "score": "0.55604565", "text": "def index\n @translations = @locale.translations.order(\"raw_key, pluralization_index\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translations }\n end\n end", "title": "" }, { "docid": "96f74e3bd679e9d1ca9ac8e24dad60c2", "score": "0.55453455", "text": "def show\n @chinese_word = ChineseWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chinese_word }\n end\n end", "title": "" }, { "docid": "97196a16bfee9fde73b3fb5413cf90c1", "score": "0.55444163", "text": "def name\n zh_name ? zh_name : jp_name \n end", "title": "" }, { "docid": "f9cc77aaa38958283b5a92fa4a993e70", "score": "0.5530598", "text": "def index\n\t\t@languages = Language.all\n\t\t@title = t(\"translate.title\")\n\t\trespond_with @languages\n\tend", "title": "" }, { "docid": "b21e807474aba72cb5fd6fdaffc55311", "score": "0.5518809", "text": "def hi\n case @language\n when :japanese\n 'やあ世界'\n else\n 'hello world'\n end\n end", "title": "" }, { "docid": "9b6ab19474a2795a52f892524f7e853e", "score": "0.55173767", "text": "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'zh' => '中文'\n }\n end", "title": "" }, { "docid": "d547964d106551234dc6d72111dbbefb", "score": "0.5479234", "text": "def l10n(text, lang = @lang, script = @script)\n if lang == \"zh\" && script == \"Hans\"\n xml = Nokogiri::HTML::DocumentFragment.parse(text)\n xml.traverse do |n|\n next unless n.text?\n\n n.replace(n.text.gsub(/ /, \"\").gsub(/:/, \":\").gsub(/,/, \"、\")\n .gsub(/\\(/, \"(\").gsub(/\\)/, \")\").gsub(/\\[/, \"【\").gsub(/\\]/, \"】\"))\n end\n xml.to_xml.gsub(/<b>/, \"\").gsub(\"</b>\", \"\").gsub(/<\\?[^>]+>/, \"\")\n else text\n end\n end", "title": "" }, { "docid": "2945a28bb96d35168e5517ad9f53994c", "score": "0.5467231", "text": "def index\n\n #if I18n.available_locales.count > 1\n @categories = Category.active.ordered.with_translations(I18n.locale)\n #else\n # @categories = Category.active.alpha\n #end\n @page_title = I18n.t :knowledgebase, default: \"Knowledgebase\"\n @title_tag = \"#{AppSettings['settings.site_name']}: \" + @page_title\n @meta_desc = \"Knowledgebase for #{AppSettings['settings.site_name']}\"\n @keywords = \"Knowledgebase, Knowledge base, support, articles, documentation, how-to, faq, frequently asked questions\"\n add_breadcrumb @page_title, categories_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "012ba100d9da1beefd684665a8cbba94", "score": "0.5452318", "text": "def src_label\n 'ソース'\nend", "title": "" }, { "docid": "a3d516706e1560e6e1f0697a4784a25e", "score": "0.5418321", "text": "def index\n @translations = @locale.translations.find(:all, :order => \"raw_key, pluralization_index\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translations }\n end\n end", "title": "" }, { "docid": "0ef56509ca4a2bffefe567949cb332f9", "score": "0.5414818", "text": "def set_chinese_post\n @chinese_post = ChinesePost.find(params[:id])\n end", "title": "" }, { "docid": "a1ee21d9cbf24b36345737c7029bcf05", "score": "0.53870445", "text": "def translate(filename)\n \n end", "title": "" }, { "docid": "c01cc97882eaf3da7cbbf18e2582e03f", "score": "0.5368176", "text": "def translators_note; end", "title": "" }, { "docid": "189c1d94a7b7298a665a85f8728d1ad3", "score": "0.5337926", "text": "def translator(lc = \"en\")\n if lc == \"en\"\n puts \"Hello World\"\n elsif lc == \"es\"\n puts \"Hola Mundo\"\n elsif lc == \"de\"\n puts \"Hallo Welt\"\n elsif lc == \"ru\"\n puts \"Privet, Mir\"\n elsif lc == \"ja\"\n puts \"Kon'nichiwa sekai\"\n end\n end", "title": "" }, { "docid": "3bf91478590ab02662cd3f4752f4ce9d", "score": "0.5326537", "text": "def hi\n case @language\n when \"english\"\n \"Hello world!\"\n else\n \"¡Hola mundo!\"\n end\n end", "title": "" }, { "docid": "9ee0dcdaa7c68550707122ecbb3c6d83", "score": "0.53204554", "text": "def languages; end", "title": "" }, { "docid": "2269a33ccdd3d19c60644c5cd2acd4d8", "score": "0.53128225", "text": "def current_language; english? ? t(:japanese) : t(:english) end", "title": "" }, { "docid": "46172716669dd7cb25626b50c470c2f5", "score": "0.53107315", "text": "def title_in_russian\n additional_info[:title]\n end", "title": "" }, { "docid": "9238d79d6c316a483d47484322d93163", "score": "0.530566", "text": "def new\n @chinese_word = ChineseWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chinese_word }\n end\n end", "title": "" }, { "docid": "9fee2429714c887fb3d0ae45858c1d79", "score": "0.52791643", "text": "def template_language; end", "title": "" }, { "docid": "a1cb8b4138001b45fb754240eeb97087", "score": "0.52790374", "text": "def to_pinyin(chinese)\n #return Pinyin.t(chinese, '-')\n #return HanziToPinyin.hanzi_to_url(chinese)\n return chinese\n end", "title": "" }, { "docid": "22179d3bca7aa718e144eaf56e5c60aa", "score": "0.5260049", "text": "def content_language; end", "title": "" }, { "docid": "a60ece36bf08d86c3304098e5993e872", "score": "0.52570796", "text": "def language_file( num_cores )\n \"#{File.expand_path( File.dirname(__FILE__) )}/samples/lang-de-#{num_cores.nil? ? 'st' : num_cores}.json\"\n end", "title": "" }, { "docid": "db579f8b80ab820fddf0ec53e3f47453", "score": "0.5247759", "text": "def language(); end", "title": "" }, { "docid": "a0b37b5738588a259e4842f1551f31ce", "score": "0.5242712", "text": "def locales; end", "title": "" }, { "docid": "a0b37b5738588a259e4842f1551f31ce", "score": "0.5242712", "text": "def locales; end", "title": "" }, { "docid": "f5174cb9d036ef06b96cf310c9e0e639", "score": "0.5238121", "text": "def index\n\t\t@words = Word.all\n\t\t# render text: @words.map { |i| \"#{i.russian}: --- #{i.greek} --- #{i.latin} --- #{i.english} --- #{i.french} --- #{i.german} --- #{i.dutch} --- #{i.spanish} --- #{i.italian} --- #{i.hungarian} --- #{i.croatian} \" }.join(\"<br/>\" )\n\tend", "title": "" }, { "docid": "f45cbe0757322d135890ccc994c44e33", "score": "0.5235206", "text": "def index\n respond_to do |format|\n format.json { render :json => \"put locales here. TBD\"}\n end\n end", "title": "" }, { "docid": "6baad5035fa25628b4ef5774fc4b6415", "score": "0.5224717", "text": "def translator; end", "title": "" }, { "docid": "6adff9d92e927066b8496dc0f7ad7116", "score": "0.522121", "text": "def default_locale; end", "title": "" }, { "docid": "86908cd97d99814550c86678ae2f4bbf", "score": "0.52032065", "text": "def base_locale; end", "title": "" }, { "docid": "86908cd97d99814550c86678ae2f4bbf", "score": "0.52032065", "text": "def base_locale; end", "title": "" }, { "docid": "04696dc4038b83fff4c93cd9570e0d08", "score": "0.5187799", "text": "def name_english\n end", "title": "" }, { "docid": "8939f41e196c1da857ce2838f8fb6de4", "score": "0.5186682", "text": "def register_default_translators; end", "title": "" }, { "docid": "51569a1dc49d53a269ebad686819b08f", "score": "0.51836455", "text": "def initialize\n @locales = [ :en ]\n @default_locale = :en\n @enable_themes = false\n end", "title": "" }, { "docid": "c3877eba16879e3ed8ded00d06fa62a9", "score": "0.5182229", "text": "def language; end", "title": "" }, { "docid": "c3877eba16879e3ed8ded00d06fa62a9", "score": "0.5182229", "text": "def language; end", "title": "" }, { "docid": "c3877eba16879e3ed8ded00d06fa62a9", "score": "0.5182229", "text": "def language; end", "title": "" }, { "docid": "c3877eba16879e3ed8ded00d06fa62a9", "score": "0.5182229", "text": "def language; end", "title": "" }, { "docid": "c3877eba16879e3ed8ded00d06fa62a9", "score": "0.5182229", "text": "def language; end", "title": "" }, { "docid": "b8d1d67527bfdcd074cf6454fd3cc28a", "score": "0.51731247", "text": "def index\n @enwords = Word.all\n\t@encategory = Category.all\n\t@ru_categories = Category.find(:all, :conditions => ['lang=?', 'ru'])\n\t@en_categories = Category.find(:all, :conditions => ['lang=?', 'en'])\n\t@fr_categories = Category.find(:all, :conditions => ['lang=?', 'fr'])\n\t@jp_categories = Category.find(:all, :conditions => ['lang=?', 'jp'])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @words }\n end\n end", "title": "" }, { "docid": "bc17bef3a83fc0d8b2231b2fc65472d7", "score": "0.51604384", "text": "def index\n @kai2_tsua7s = Kai2Tsua7.where('漢羅逝!=全羅逝').order(漢羅逝: :desc)\n end", "title": "" }, { "docid": "38057a26f45d1e9d465add2312ca8431", "score": "0.5159689", "text": "def index\n\t @aliases = DnsAlias.find(:all)\n\n\t respond_to do |format|\n\t format.html # index.html.erb\n\t format.xml { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n ::Temple::Utils.escape_html((@locale_direction)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((full_page_title)) \n ::Temple::Utils.escape_html((stylesheet_link_tag 'application')) \n if theme.name != \"default\" and theme.disable_inheritance == false\n \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('style', theme.default)))) \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('rtl', theme.default)) if rtl?)) \n end \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag 'style')) \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag('rtl') if rtl?)) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((stylesheet_link_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js')) \n ::Temple::Utils.escape_html((javascript_tag { ::Temple::Utils.escape_html((theme_image_path('ok.png').html_safe)) \n ::Temple::Utils.escape_html((theme_image_path('warning.png').html_safe)) \n})) \n ::Temple::Utils.escape_html((javascript_include_tag 'application')) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((javascript_include_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_tag {'$.fx.off = true;' if Rails.env.test?})) \n for header in theme.headers do\n \n ::Temple::Utils.escape_html((header =~ /\\.js$/ ? javascript_include_tag(header) : header)) \n end \n ::Temple::Utils.escape_html((csrf_meta_tags)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((link_to t('amahi'), root_url)) \n ::Temple::Utils.escape_html((link_to t('home'), root_path)) \n ::Temple::Utils.escape_html(( _slim_controls1 = form_tag search_path(action: 'hda'), method: 'get', id: 'searchform' do\n \n ::Temple::Utils.escape_html((text_field_tag 'query', @query, :maxlength => 45, :size => 20, :class => \"ip-input\", :id => 'searchinput')) \n ::Temple::Utils.escape_html((submit_tag 'HDA', :class => 'searchbutton', :name => \"button\" , :id => 'hdasearchbutton')) \n ::Temple::Utils.escape_html((submit_tag t('web'), :class => 'searchbutton', :name => \"button\" , :id => 'websearchbutton')) \n end \n ::Temple::Utils.escape_html((_slim_controls1)) \n)) \n _slim_codeattributes1 = root_path; if _slim_codeattributes1; if _slim_codeattributes1 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes1)) \n end; end \n ::Temple::Utils.escape_html((t('home'))) \n if current_user_is_admin?\n \n _slim_codeattributes2 = users_engine.root_path; if _slim_codeattributes2; if _slim_codeattributes2 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes2)) \n end; end \n ::Temple::Utils.escape_html((t('setup'))) \n ::Temple::Utils.escape_html((t('help'))) \n _slim_codeattributes3 = apps_engine.root_path; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t('apps'))) \n else\n \n ::Temple::Utils.escape_html((t('help'))) \n end \n ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( flash.each do |name, msg|\n \n ::Temple::Utils.escape_html((name)) \n ::Temple::Utils.escape_html((msg)) \n end \n)) \n unless @no_tabs\n \n ::Temple::Utils.escape_html(( _temple_html_attributeremover1 = ''; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = \"preftab\"; _temple_html_attributemerger1[1] = ''; _slim_codeattributes1 = nav_class(@tabs); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1.join(\" \")))).to_s); else; _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1))).to_s); end; _temple_html_attributemerger1[1]; _temple_html_attributeremover1 << ((_temple_html_attributemerger1.reject(&:empty?).join(\" \")).to_s); _temple_html_attributeremover1 \n if !_temple_html_attributeremover1.empty? \n _temple_html_attributeremover1 \n end \n @tabs.each do |tab|\n \n _temple_html_attributeremover2 = ''; _slim_codeattributes2 = tab_class(tab); if Array === _slim_codeattributes2; _slim_codeattributes2 = _slim_codeattributes2.flatten; _slim_codeattributes2.map!(&:to_s); _slim_codeattributes2.reject!(&:empty?); _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2.join(\" \")))).to_s); else; _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2))).to_s); end; _temple_html_attributeremover2 \n if !_temple_html_attributeremover2.empty? \n _temple_html_attributeremover2 \n end \n _slim_codeattributes3 = tab.url; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t tab.label)) \n ::Temple::Utils.escape_html((tab.label.downcase)) \n if @advanced\ntab.advanced_subtabs.each do |subtab|\n \n _temple_html_attributeremover3 = ''; _slim_codeattributes4 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes4; _slim_codeattributes4 = _slim_codeattributes4.flatten; _slim_codeattributes4.map!(&:to_s); _slim_codeattributes4.reject!(&:empty?); _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4.join(\" \")))).to_s); else; _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4))).to_s); end; _temple_html_attributeremover3 \n if !_temple_html_attributeremover3.empty? \n _temple_html_attributeremover3 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; else\ntab.basic_subtabs.each do |subtab|\n \n _temple_html_attributeremover4 = ''; _slim_codeattributes5 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes5; _slim_codeattributes5 = _slim_codeattributes5.flatten; _slim_codeattributes5.map!(&:to_s); _slim_codeattributes5.reject!(&:empty?); _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5.join(\" \")))).to_s); else; _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5))).to_s); end; _temple_html_attributeremover4 \n if !_temple_html_attributeremover4.empty? \n _temple_html_attributeremover4 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; end \n end \n)) \n if aliases.size > 0 \nt 'dns_alias' \nt 'ip_address' \n \n\tname = [h(one.alias), @domain].join '.'\n\tname = h($1) if one.alias =~ /(.*)\\.\\z/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /\\A\\d+\\z/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_alias'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"alias_row_\" + uid\n\t\t\tinfo = \"alias_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_alias' \n h(one.alias) \n spinner uid \nt 'delete_alias' \n h one.alias \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'aliases-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_alias', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'delete', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"alias_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'aliases',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_aliases_defined' \n end \n \n button_to \" #{t('new_alias')} &raquo; \", update_page { |page|\n \tpage.hide 'new-alias-to-step1'\n \tpage[:alias_alias].value = \"\"\n \tpage[:alias_address].value = \"\"\n\tpage[:alias_address].disabled = true\n\tpage[:alias_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-alias-step1'\n \tpage[:alias_alias].focus\n }, :id => \"new-alias-to-step1\" \n error_messages_for :alias \n t 'new_dns_alias' \n form_for(newalias) do |f| \n f.error_messages \n f.label :alias \n f.text_field :alias, :size => 18, :maxlength => 32 \nt 'the_alias_name_you_input_will_be_added' \nt 'ip_address' \n f.text_field :address, :size => 18, :maxlength => 32 \nt 'the_ip_address_can_be' \nt 'a_single_number_0_254_to_point_to_a_given_machine' \nt 'an_external_ip_address_to_make_the_alias' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-alias-step1'\n\t\t\t\t\tpage.show 'new-alias-to-step1'\n\t\t\t\t\tpage[:alias_alias].value = \"\"\n\t\t\t\t\tpage[:alias_address].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:alias_address].disabled = true\n\t\t\t\t\tpage[:alias_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_alias\", \" #{t('create_alias')} &raquo; \",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"alias_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"aliases\", :failure => \"create_aliases_error_msgs\" } \n end \n observe_field 'alias_alias', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_alias_check' },\n\t\t\t:with => \"'alias=' + encodeURIComponent(value)\" \n observe_field 'alias_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n \n \n \n else\n \n if aliases.size > 0 \nt 'dns_alias' \nt 'ip_address' \n \n\tname = [h(one.alias), @domain].join '.'\n\tname = h($1) if one.alias =~ /(.*)\\.\\z/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /\\A\\d+\\z/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_alias'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"alias_row_\" + uid\n\t\t\tinfo = \"alias_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_alias' \n h(one.alias) \n spinner uid \nt 'delete_alias' \n h one.alias \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'aliases-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_alias', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'delete', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"alias_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'aliases',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_aliases_defined' \n end \n \n button_to \" #{t('new_alias')} &raquo; \", update_page { |page|\n \tpage.hide 'new-alias-to-step1'\n \tpage[:alias_alias].value = \"\"\n \tpage[:alias_address].value = \"\"\n\tpage[:alias_address].disabled = true\n\tpage[:alias_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-alias-step1'\n \tpage[:alias_alias].focus\n }, :id => \"new-alias-to-step1\" \n error_messages_for :alias \n t 'new_dns_alias' \n form_for(newalias) do |f| \n f.error_messages \n f.label :alias \n f.text_field :alias, :size => 18, :maxlength => 32 \nt 'the_alias_name_you_input_will_be_added' \nt 'ip_address' \n f.text_field :address, :size => 18, :maxlength => 32 \nt 'the_ip_address_can_be' \nt 'a_single_number_0_254_to_point_to_a_given_machine' \nt 'an_external_ip_address_to_make_the_alias' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-alias-step1'\n\t\t\t\t\tpage.show 'new-alias-to-step1'\n\t\t\t\t\tpage[:alias_alias].value = \"\"\n\t\t\t\t\tpage[:alias_address].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:alias_address].disabled = true\n\t\t\t\t\tpage[:alias_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_alias\", \" #{t('create_alias')} &raquo; \",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"alias_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"aliases\", :failure => \"create_aliases_error_msgs\" } \n end \n observe_field 'alias_alias', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_alias_check' },\n\t\t\t:with => \"'alias=' + encodeURIComponent(value)\" \n observe_field 'alias_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n \n \n \n end \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((Date.today.year)) \n ::Temple::Utils.escape_html((link_to \"Amahi\", \"http://www.amahi.org\", :target => \"_blank\")) \n ::Temple::Utils.escape_html((link_to t('your_control_panel'), 'https://www.amahi.org/user', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('feedback'),'https://www.amahi.org/feedback', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('wiki'), 'https://wiki.amahi.org/', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('tracker'), 'https://bugs.amahi.org', :target=>'_blank')) \n if theme.author\n \n ::Temple::Utils.escape_html((t('theme_by'))) \n ::Temple::Utils.escape_html((theme.author_url ? link_to(theme.author, theme.author_url) : \"#{theme.author} \")) \n ::Temple::Utils.escape_html((link_to t('live_help'), 'http://talk.amahi.org', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('forums'), 'https://forums.amahi.org', :target=>'_blank')) \n end; if current_user\n \n ::Temple::Utils.escape_html((link_to (t('logout') + \" \" + current_user.login), logout_path)) \n else\n \n ::Temple::Utils.escape_html((link_to t('log_in'), login_path)) \n end \n)) \n ::Temple::Utils.escape_html((yield :js_templates)) \n\nend\n }\n\t end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n ::Temple::Utils.escape_html((@locale_direction)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((full_page_title)) \n ::Temple::Utils.escape_html((stylesheet_link_tag 'application')) \n if theme.name != \"default\" and theme.disable_inheritance == false\n \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('style', theme.default)))) \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('rtl', theme.default)) if rtl?)) \n end \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag 'style')) \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag('rtl') if rtl?)) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((stylesheet_link_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js')) \n ::Temple::Utils.escape_html((javascript_tag { ::Temple::Utils.escape_html((theme_image_path('ok.png').html_safe)) \n ::Temple::Utils.escape_html((theme_image_path('warning.png').html_safe)) \n})) \n ::Temple::Utils.escape_html((javascript_include_tag 'application')) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((javascript_include_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_tag {'$.fx.off = true;' if Rails.env.test?})) \n for header in theme.headers do\n \n ::Temple::Utils.escape_html((header =~ /\\.js$/ ? javascript_include_tag(header) : header)) \n end \n ::Temple::Utils.escape_html((csrf_meta_tags)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((link_to t('amahi'), root_url)) \n ::Temple::Utils.escape_html((link_to t('home'), root_path)) \n ::Temple::Utils.escape_html(( _slim_controls1 = form_tag search_path(action: 'hda'), method: 'get', id: 'searchform' do\n \n ::Temple::Utils.escape_html((text_field_tag 'query', @query, :maxlength => 45, :size => 20, :class => \"ip-input\", :id => 'searchinput')) \n ::Temple::Utils.escape_html((submit_tag 'HDA', :class => 'searchbutton', :name => \"button\" , :id => 'hdasearchbutton')) \n ::Temple::Utils.escape_html((submit_tag t('web'), :class => 'searchbutton', :name => \"button\" , :id => 'websearchbutton')) \n end \n ::Temple::Utils.escape_html((_slim_controls1)) \n)) \n _slim_codeattributes1 = root_path; if _slim_codeattributes1; if _slim_codeattributes1 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes1)) \n end; end \n ::Temple::Utils.escape_html((t('home'))) \n if current_user_is_admin?\n \n _slim_codeattributes2 = users_engine.root_path; if _slim_codeattributes2; if _slim_codeattributes2 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes2)) \n end; end \n ::Temple::Utils.escape_html((t('setup'))) \n ::Temple::Utils.escape_html((t('help'))) \n _slim_codeattributes3 = apps_engine.root_path; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t('apps'))) \n else\n \n ::Temple::Utils.escape_html((t('help'))) \n end \n ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( flash.each do |name, msg|\n \n ::Temple::Utils.escape_html((name)) \n ::Temple::Utils.escape_html((msg)) \n end \n)) \n unless @no_tabs\n \n ::Temple::Utils.escape_html(( _temple_html_attributeremover1 = ''; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = \"preftab\"; _temple_html_attributemerger1[1] = ''; _slim_codeattributes1 = nav_class(@tabs); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1.join(\" \")))).to_s); else; _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1))).to_s); end; _temple_html_attributemerger1[1]; _temple_html_attributeremover1 << ((_temple_html_attributemerger1.reject(&:empty?).join(\" \")).to_s); _temple_html_attributeremover1 \n if !_temple_html_attributeremover1.empty? \n _temple_html_attributeremover1 \n end \n @tabs.each do |tab|\n \n _temple_html_attributeremover2 = ''; _slim_codeattributes2 = tab_class(tab); if Array === _slim_codeattributes2; _slim_codeattributes2 = _slim_codeattributes2.flatten; _slim_codeattributes2.map!(&:to_s); _slim_codeattributes2.reject!(&:empty?); _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2.join(\" \")))).to_s); else; _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2))).to_s); end; _temple_html_attributeremover2 \n if !_temple_html_attributeremover2.empty? \n _temple_html_attributeremover2 \n end \n _slim_codeattributes3 = tab.url; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t tab.label)) \n ::Temple::Utils.escape_html((tab.label.downcase)) \n if @advanced\ntab.advanced_subtabs.each do |subtab|\n \n _temple_html_attributeremover3 = ''; _slim_codeattributes4 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes4; _slim_codeattributes4 = _slim_codeattributes4.flatten; _slim_codeattributes4.map!(&:to_s); _slim_codeattributes4.reject!(&:empty?); _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4.join(\" \")))).to_s); else; _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4))).to_s); end; _temple_html_attributeremover3 \n if !_temple_html_attributeremover3.empty? \n _temple_html_attributeremover3 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; else\ntab.basic_subtabs.each do |subtab|\n \n _temple_html_attributeremover4 = ''; _slim_codeattributes5 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes5; _slim_codeattributes5 = _slim_codeattributes5.flatten; _slim_codeattributes5.map!(&:to_s); _slim_codeattributes5.reject!(&:empty?); _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5.join(\" \")))).to_s); else; _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5))).to_s); end; _temple_html_attributeremover4 \n if !_temple_html_attributeremover4.empty? \n _temple_html_attributeremover4 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; end \n end \n)) \n if aliases.size > 0 \nt 'dns_alias' \nt 'ip_address' \n \n\tname = [h(one.alias), @domain].join '.'\n\tname = h($1) if one.alias =~ /(.*)\\.\\z/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /\\A\\d+\\z/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_alias'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"alias_row_\" + uid\n\t\t\tinfo = \"alias_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_alias' \n h(one.alias) \n spinner uid \nt 'delete_alias' \n h one.alias \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'aliases-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_alias', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'delete', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"alias_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'aliases',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_aliases_defined' \n end \n \n button_to \" #{t('new_alias')} &raquo; \", update_page { |page|\n \tpage.hide 'new-alias-to-step1'\n \tpage[:alias_alias].value = \"\"\n \tpage[:alias_address].value = \"\"\n\tpage[:alias_address].disabled = true\n\tpage[:alias_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-alias-step1'\n \tpage[:alias_alias].focus\n }, :id => \"new-alias-to-step1\" \n error_messages_for :alias \n t 'new_dns_alias' \n form_for(newalias) do |f| \n f.error_messages \n f.label :alias \n f.text_field :alias, :size => 18, :maxlength => 32 \nt 'the_alias_name_you_input_will_be_added' \nt 'ip_address' \n f.text_field :address, :size => 18, :maxlength => 32 \nt 'the_ip_address_can_be' \nt 'a_single_number_0_254_to_point_to_a_given_machine' \nt 'an_external_ip_address_to_make_the_alias' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-alias-step1'\n\t\t\t\t\tpage.show 'new-alias-to-step1'\n\t\t\t\t\tpage[:alias_alias].value = \"\"\n\t\t\t\t\tpage[:alias_address].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:alias_address].disabled = true\n\t\t\t\t\tpage[:alias_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_alias\", \" #{t('create_alias')} &raquo; \",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"alias_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"aliases\", :failure => \"create_aliases_error_msgs\" } \n end \n observe_field 'alias_alias', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_alias_check' },\n\t\t\t:with => \"'alias=' + encodeURIComponent(value)\" \n observe_field 'alias_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n \n \n \n else\n \n if aliases.size > 0 \nt 'dns_alias' \nt 'ip_address' \n \n\tname = [h(one.alias), @domain].join '.'\n\tname = h($1) if one.alias =~ /(.*)\\.\\z/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /\\A\\d+\\z/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_alias'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"alias_row_\" + uid\n\t\t\tinfo = \"alias_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_alias' \n h(one.alias) \n spinner uid \nt 'delete_alias' \n h one.alias \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'aliases-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_alias', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'delete', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"alias_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'aliases',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_aliases_defined' \n end \n \n button_to \" #{t('new_alias')} &raquo; \", update_page { |page|\n \tpage.hide 'new-alias-to-step1'\n \tpage[:alias_alias].value = \"\"\n \tpage[:alias_address].value = \"\"\n\tpage[:alias_address].disabled = true\n\tpage[:alias_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-alias-step1'\n \tpage[:alias_alias].focus\n }, :id => \"new-alias-to-step1\" \n error_messages_for :alias \n t 'new_dns_alias' \n form_for(newalias) do |f| \n f.error_messages \n f.label :alias \n f.text_field :alias, :size => 18, :maxlength => 32 \nt 'the_alias_name_you_input_will_be_added' \nt 'ip_address' \n f.text_field :address, :size => 18, :maxlength => 32 \nt 'the_ip_address_can_be' \nt 'a_single_number_0_254_to_point_to_a_given_machine' \nt 'an_external_ip_address_to_make_the_alias' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-alias-step1'\n\t\t\t\t\tpage.show 'new-alias-to-step1'\n\t\t\t\t\tpage[:alias_alias].value = \"\"\n\t\t\t\t\tpage[:alias_address].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:alias_address].disabled = true\n\t\t\t\t\tpage[:alias_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_alias\", \" #{t('create_alias')} &raquo; \",\n\t\t\t\t\t:url => { :controller => 'aliases', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"alias_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"aliases\", :failure => \"create_aliases_error_msgs\" } \n end \n observe_field 'alias_alias', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_alias_check' },\n\t\t\t:with => \"'alias=' + encodeURIComponent(value)\" \n observe_field 'alias_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'aliases', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n \n \n \n end \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((Date.today.year)) \n ::Temple::Utils.escape_html((link_to \"Amahi\", \"http://www.amahi.org\", :target => \"_blank\")) \n ::Temple::Utils.escape_html((link_to t('your_control_panel'), 'https://www.amahi.org/user', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('feedback'),'https://www.amahi.org/feedback', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('wiki'), 'https://wiki.amahi.org/', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('tracker'), 'https://bugs.amahi.org', :target=>'_blank')) \n if theme.author\n \n ::Temple::Utils.escape_html((t('theme_by'))) \n ::Temple::Utils.escape_html((theme.author_url ? link_to(theme.author, theme.author_url) : \"#{theme.author} \")) \n ::Temple::Utils.escape_html((link_to t('live_help'), 'http://talk.amahi.org', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('forums'), 'https://forums.amahi.org', :target=>'_blank')) \n end; if current_user\n \n ::Temple::Utils.escape_html((link_to (t('logout') + \" \" + current_user.login), logout_path)) \n else\n \n ::Temple::Utils.escape_html((link_to t('log_in'), login_path)) \n end \n)) \n ::Temple::Utils.escape_html((yield :js_templates)) \n\nend\n\n\tend", "title": "" }, { "docid": "f26f7c2d701bdb8e0a9d1065d0c428af", "score": "0.5155953", "text": "def unicode_names; end", "title": "" }, { "docid": "dd748a46015516f8d43a12c5b68e69c2", "score": "0.5151127", "text": "def translate(*arg)\r\n ArkanisDevelopment::SimpleLocalization::Language.app_without_symbols(self, *arg)\r\n end", "title": "" }, { "docid": "98b0230ff63007b726a9b2f0a9321bc0", "score": "0.51499933", "text": "def index\n @topics = Topic.all\n\t@title = \"Клубная Жизнь\"\n respond_to do |format|\n\t format.html# index.html.erb\n format.json { render :json => @topics }\n end\n end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.51431113", "text": "def i18n_key; end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.51431113", "text": "def i18n_key; end", "title": "" }, { "docid": "cfd3a806301db5c8667e1bdb47cef93f", "score": "0.51431113", "text": "def i18n_key; end", "title": "" }, { "docid": "971810fb5742539f662592997ba4af9a", "score": "0.5122854", "text": "def path(params); \"#{site.path}translate#{query_string(params)}\"; end", "title": "" }, { "docid": "29b90add1d3c272b8b714d61da84b3d5", "score": "0.5121005", "text": "def init_i18n\n I18n.backend = Russian.i18n_backend_class.new\n I18n.default_locale = LOCALE\n I18n.load_path.unshift(*locale_files)\n end", "title": "" }, { "docid": "5ad92d633df240dea807548f1207beb8", "score": "0.5120434", "text": "def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_header\n\t\n\t# rename - zh-tw ==> zh_tw\n\t#\n\tif I18n.locale == :\"zh\" #-tw\" || I18n.locale == :\"zh-TW\"\n \n if env['HTTP_ACCEPT_LANGUAGE'][3] == 84 # 84 == 'T'\n\t\t I18n.locale = :zh_tw\n end\n\tend\n\t\n\t#logger.debug I18n.locale.length\n\t\n logger.debug \"* Locale set to '#{I18n.locale}'\"\n\t\n\t\n end", "title": "" }, { "docid": "e46144eafbd8c9260c0c4d22c4be51ae", "score": "0.5116876", "text": "def translate() abstract end", "title": "" }, { "docid": "e46144eafbd8c9260c0c4d22c4be51ae", "score": "0.5116876", "text": "def translate() abstract end", "title": "" }, { "docid": "f780f1ff42725670ac4c4ddeac0a8729", "score": "0.51152027", "text": "def unicode_names=(_arg0); end", "title": "" }, { "docid": "c2604834dd8501b500e0b043aae13a36", "score": "0.51148546", "text": "def hello_world lang\n case lang\n when \"es\"\n \"Hola Mundo\"\n when \"de\"\n \"Hallo Welt\"\n when \"ru\"\n \"Privetstvuyu, mir\"\n when \"ja\"\n \"Kon'nichiwa sekai\"\n else\n \"Hello World\"\n end\nend", "title": "" }, { "docid": "03b01fe9bf942eee5c7735e666f1b384", "score": "0.51074", "text": "def i18n_to_mycobank_language\n { de: \"Deu\", es: \"Spa\", fr: \"Fra\", pt: \"Por\",\n ar: \"Ara\", fa: \"Far\", nl: \"Nld\", th: \"Tha\", zh: \"Zho\" }\n end", "title": "" }, { "docid": "e4e75a9aff2209868155f27cdbe4da08", "score": "0.5105151", "text": "def get_word_ja()\n @data = Japanese.find(params[:id]);\n @data.word_vietnamese =@data.word_vietnamese.force_encoding(\"UTF-8\")\n @data.word_japanese =@data.word_japanese.force_encoding(\"UTF-8\")\n @arr_translate = @data.word_vietnamese.split(';')\n @example =encode(Example.searchJa(@data.word_japanese))\n @arr = [@data,@arr_translate,@example]\n respond_to do |format|\n format.json { render json: @arr}\n end\n end", "title": "" }, { "docid": "63ca08c170437b5ef5994138b0cbe2e5", "score": "0.51001066", "text": "def translate(file)\n self.heard = file\n \n case file\n when %r:^app/controllers/:\n name = file.sub('_controller.rb', '').sub('app/controllers/', '')\n features = self.controllers[name]\n when %r:^app/models/:\n name = file.sub('.rb', '').sub('app/models/', '')\n features = self.models[name]\n #\n when %r:^app/views/:\n file = file.sub('app/views/', '')\n directory = file.split('/')[0..-2].compact.join('/')\n features = self.controllers[directory]\n when %r:^lib/:\n name = file.sub('.rb', '').sub('lib/', '')\n features = self.models[name]\n when %r:.feature$:\n return [file]\n else\n #\n end\n \n features = [] if !features\n \n return features.collect { |name| \"features/#{name}.feature\" }\n\n end", "title": "" }, { "docid": "8f439ea670827f1cc4dc7b311b585527", "score": "0.509299", "text": "def description_english\n end", "title": "" }, { "docid": "74ec96c60d456a8053cbdb434e54f18d", "score": "0.50912", "text": "def l10n(x, lang = @lang, script = @script)\n if lang == \"zh\" && script == \"Hans\"\n xml = Nokogiri::HTML::DocumentFragment.parse(x)\n xml.traverse do |n|\n next unless n.text?\n n.replace(n.text.gsub(/ /, \"\").gsub(/:/, \":\").gsub(/,/, \"、\").\n gsub(/\\(/, \"(\").gsub(/\\)/, \")\").\n gsub(/\\[/, \"【\").gsub(/\\]/, \"】\"))\n end\n xml.to_xml.gsub(/<b>/, \"\").gsub(\"</b>\", \"\").gsub(/<\\?[^>]+>/, \"\")\n else\n x\n end\n end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "733f290f73e2f4c472823e33ff841354", "score": "0.50910413", "text": "def lang; end", "title": "" }, { "docid": "8f6b3eca6f977d25b547542e9a5cbded", "score": "0.5088679", "text": "def message_in_english\n #hash = @translation_interpolations.clone\n #hash[:locale] = :en\n #puts @translation_interpolations\n #puts hash\n return message 'en' \n end", "title": "" }, { "docid": "d5aca9264ff88458883cb025099d7f82", "score": "0.50866127", "text": "def LangMapping(slocale)\n\t\tlocales = { \n\t\t\t\"en\" => \"English\",\n\t\t\t\"de\" => \"German\",\n\t\t\t\"es\" => \"Spanish\",\n\t\t\t\"fr\" => \"French\",\n\t\t\t\"it\" => \"Italian\",\n\t\t\t\"ja\" => \"Japanese\",\n\t\t\t\"ko\" => \"Korean\",\n\t\t\t\"nl\" => \"Dutch\",\n\t\t\t\"th\" => \"Thai\",\n\t\t\t\"zh\" => \"Simplified Chinese\",\n\t\t\t#{}\"zh\" => \"traditionalchinese\",\n\t\t\t\"ru\" => \"Russian\",\n\t\t\t\"pt\" => \"Portuguese\"\n\t\t}\n\t\t\n\t\tif slocale == \"zh\"\n\t\t\tcountryCode = `adb shell getprop persist.sys.country`\n\t\t\tcountryCode = countryCode.delete \"\\r\\n\"\n\t\t\tif countryCode == \"TW\"\n\t\t\t\tdeviceLang = \"Traditional Chinese\"\n\t\t\telse\n\t\t\t\tdeviceLang = locales.fetch(slocale)\t\n\t\t\tend\n\t\telse \n\t\t\tdeviceLang =locales.fetch(slocale)\t\n\t\tend\n\t\t#@@logger.info(\"GotLanguage from LangMapping() -#{deviceLang}\")\n\t\treturn deviceLang\n\tend", "title": "" }, { "docid": "1576b36f83a6af91199d47ee7b31732e", "score": "0.50860137", "text": "def hello_world language\n language_hash = {\n \"es\" => \"hello world\",\n \"de\" => \"hallo welt\",\n \"ru\" => \"Привет, мир\",\n \"ja\" => \"こんにちは世界\"\n }\n language_hash[language]\nend", "title": "" }, { "docid": "41e3a1d94e54f7c9273a2eb8e9fc924b", "score": "0.50839883", "text": "def set_locale\n if %w{en ja}.include?(params[:hl])\n I18n.locale = params[:hl]\n end\n end", "title": "" }, { "docid": "06a985dd7831c4d326a48d457e752e14", "score": "0.5080697", "text": "def resources; end", "title": "" }, { "docid": "f3466ced5e964113916c3f6225b31b09", "score": "0.5079894", "text": "def italy() new_start(self.class::ITALY) end", "title": "" }, { "docid": "4c18f97bdf9bb4696152521fb4ca1b1c", "score": "0.50798", "text": "def copy_locale \n template \"devise_links.en.yml\", \"config/locales/cream.en.yml\"\n end", "title": "" }, { "docid": "dff60937a06669443ac637da7f3d2ac5", "score": "0.50688165", "text": "def help\n\t\tinfo = \"#{MATCH_CN}指南\"\n\t\tset_page_title(info)\n\t\tset_block_title(info)\n end", "title": "" }, { "docid": "f534d16aebdd5bd47e0ff1277f707d58", "score": "0.5061216", "text": "def translate(locale, key, options = T.unsafe(nil)); end", "title": "" }, { "docid": "9b4f340cc22550b1810a43c1c9f0fcb4", "score": "0.50528413", "text": "def jen\n end", "title": "" }, { "docid": "80fd8607258eb9e5dea2d90458ea6b6e", "score": "0.50505173", "text": "def lang=(_arg0); end", "title": "" }, { "docid": "80fd8607258eb9e5dea2d90458ea6b6e", "score": "0.50505173", "text": "def lang=(_arg0); end", "title": "" }, { "docid": "43695412f70020e1af8f7a745926dcec", "score": "0.50466704", "text": "def languageChange()\n setCaption(trUtf8(\"きっかんじ\"))\n @kanji_label.setText( trUtf8(\"textLabel1\") )\n @toggle_button.setText( trUtf8(\"pushButton1\") )\n @notes_label.setText( trUtf8(\"textLabel2\") )\n end", "title": "" }, { "docid": "f9df59201c0e4f56cdb28f275e6e65cf", "score": "0.5044062", "text": "def hello_world(language)\n if (language == 'es')\n 'Hola Mundo'\n elsif (language == 'de')\n 'Hallo Welt'\n elsif (language == 'swe')\n 'Hej världen'\n else\n 'Hello World'\nend\nend", "title": "" }, { "docid": "4a279da79ed65b55d0c9477c09751678", "score": "0.5042797", "text": "def index\n @chinese_posts = ChinesePost.all\n .includes(:chinese_phrases, :vietnamese_phrases, :user)\n .paginate(page: params[:page], per_page: 8)\n .order(created_at: :desc)\n authorize @chinese_posts\n end", "title": "" }, { "docid": "e0cc3a385202944edd989b40abf5fe8f", "score": "0.5041809", "text": "def common_permalink\n self.soldier_translations.select{|x| x.locale == \"ka\"}.first.permalink\n end", "title": "" }, { "docid": "eca4b2aa8f225dc0fa538a476b59e7a7", "score": "0.5041528", "text": "def translate\n Locale.set('es-CR')\n @view_translations = ViewTranslation.find(:all, \n :conditions => [ 'text IS NULL AND language_id = ?', Locale.language.id ], \n :order => 'tr_key')\n @all_translations = ViewTranslation.find(:all, \n :conditions => ['text IS NOT NULL AND language_id = ?', Locale.language.id],\n :order => 'text')\n end", "title": "" }, { "docid": "bda9be45970807ec0ea2c2c3d8568cf2", "score": "0.5039454", "text": "def index\n @big_concerts = BigConcert.order(\"id DESC\").all\n @title = \"コン一覧\"\n end", "title": "" }, { "docid": "f35e69493b6aa475a168068904c9bb89", "score": "0.50386643", "text": "def locales=(_arg0); end", "title": "" }, { "docid": "3231ad97d433e4288c647a3eefa746e3", "score": "0.5038531", "text": "def to_ru\n to_language :ru\n end", "title": "" }, { "docid": "d693425ea466b1227f7202983f653695", "score": "0.5035739", "text": "def append_model_i18n\n model_locales = 'config/locales/ja/models'\n empty_directory model_locales\n template 'locale_ja.yml', File.join(model_locales, specified.class_path, \"#{specified.file_name}.yml\")\n end", "title": "" }, { "docid": "2fd4e0a47412b43e41c559a4aa747f37", "score": "0.5020908", "text": "def index\n @chineses = Chinese.all\n @microposts = Micropost.all\n\n end", "title": "" }, { "docid": "936649ed36b4e43df46353ee11638d25", "score": "0.5020757", "text": "def create\n @chinese_word = ChineseWord.new(params[:chinese_word])\n\n respond_to do |format|\n if @chinese_word.save\n flash[:notice] = 'ChineseWord was successfully created.'\n format.html { redirect_to(@chinese_word) }\n format.xml { render :xml => @chinese_word, :status => :created, :location => @chinese_word }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @chinese_word.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e20227041e30c60c098a261ca6b53065", "score": "0.50192183", "text": "def hello_world lang = 'en' #set default\n valid_codes = {\n \"en\" => \"Hello, world!\",\n \"es\" => \"Hola, mundo!\",\n \"de\" => \"Hallo, welt!\",\n \"ru\" => \"Privet, mir!\",\n \"ja\" => \"Kon'nichiwa sekai!\"\n }\n valid_codes[lang.downcase] || \"Hello, wherever you are!\" #for un-accounted-for language codes, sends general response\nend", "title": "" }, { "docid": "c4a711570ba9e8bc468018d4101bd78c", "score": "0.5013322", "text": "def localize(ios, src)\n index = 0\n lngs = []\n ios << \"\\ncase ctx.best_language \"\n code = StringIO.new\n while index = src.index(/<[a-z]{2}>/, index)\n lngs << (lng = src[index + 1, 2].to_sym)\n if end_index = src.index(/<\\/#{lng}>/, index += 4)\n code << \"\\nwhen #{lng.inspect} then\"\n compile(code, src[index...end_index])\n index = end_index + 5\n end\n end\n ios << \"#{lngs.inspect.gsub(/ /, '')}#{code.string}\\nend\"\n end", "title": "" }, { "docid": "64627a4b1f68ddd548650ecc1dba49b7", "score": "0.50098777", "text": "def index\n @hr_config_languages = Hr::Config::Language.all\n end", "title": "" } ]
7e8a943e24f71a6e77d2b273770b0b47
Policies that need review
[ { "docid": "0eb38fb35453a3c8479601d899ef2a72", "score": "0.7188583", "text": "def review\n @policies = Policy.where(\"status=? OR status=?\", \"GENERATED\", \"ERRING\")\n end", "title": "" } ]
[ { "docid": "b5ab36b915d8e4191cc5e2703f227c29", "score": "0.7986065", "text": "def policies; end", "title": "" }, { "docid": "fee384cc34a2ee8995d0dcd00feb351f", "score": "0.77429336", "text": "def policies\n end", "title": "" }, { "docid": "ee1e04a5dfc4f69cc08792c48aa924e3", "score": "0.74204355", "text": "def policy; end", "title": "" }, { "docid": "e515d01dcde3def54c632fd9387c8e2c", "score": "0.71833265", "text": "def analyze_policy; end", "title": "" }, { "docid": "aebd4de0c6112170f052cdb0fc1fb4e5", "score": "0.71755767", "text": "def policies\n @pundit_policies ||= {}\n end", "title": "" }, { "docid": "0306aeb02f5595b0087cd57351748f79", "score": "0.71262723", "text": "def policies\n @_pundit_policies ||= {}\n end", "title": "" }, { "docid": "8fadcac2a2371b3803c9ea7e3f042e28", "score": "0.70650625", "text": "def policies\n @_pundit_policies ||= {}\n end", "title": "" }, { "docid": "16bc423906e0d5879360859cea4e0c7a", "score": "0.7058315", "text": "def policies \n Scram::DEFAULT_POLICIES | self.user_policies\n end", "title": "" }, { "docid": "ccafcf34bb854aa19e6720d503f068a3", "score": "0.6988642", "text": "def enforce_policy_use(*); end", "title": "" }, { "docid": "30b8931993dab548ad0331eb55d1caa7", "score": "0.69800687", "text": "def policy_list\n super\n end", "title": "" }, { "docid": "f128b60ffefd4e9d9b455bb5685c1711", "score": "0.69359064", "text": "def auth_policies; end", "title": "" }, { "docid": "d87e53165bde61db1327473eba1b9fb2", "score": "0.6632597", "text": "def check_cv_wo_policy\n # TODO\n end", "title": "" }, { "docid": "057564e411740f962afeab83b754649b", "score": "0.6599635", "text": "def permit_rules\n end", "title": "" }, { "docid": "b7d6d13ec50ddd4df0e2cf94eea2f271", "score": "0.6574784", "text": "def access_policy; end", "title": "" }, { "docid": "dfe04d94f3e273b1cd9c60ce8f46f34a", "score": "0.65686476", "text": "def policy_rules\n policy.try(:policy_rules)\n end", "title": "" }, { "docid": "c18cc765a9a57589ae4dc81025c6d4ba", "score": "0.65644056", "text": "def auth_policies=(_arg0); end", "title": "" }, { "docid": "f67f05547b9f798d5160113512c7cc57", "score": "0.6562888", "text": "def assign_policies(db)\n assert_privileges(params[:pressed])\n session[:pol_db] = db # Remember the DB\n session[:pol_items] = find_records_with_rbac(db, checked_or_params).ids # Set the array of tag items\n @in_a_form = true\n if @explorer\n protect\n @refresh_partial = \"layouts/protect\"\n else\n javascript_redirect(:action => 'protect', :db => db) # redirect to build policy screen\n end\n end", "title": "" }, { "docid": "590e7245e058b61455676a198010490b", "score": "0.6562357", "text": "def policy\n @policy\n end", "title": "" }, { "docid": "6611832855abc11aeb66f8256d76cab2", "score": "0.65297574", "text": "def get_policies\n grantor.get_policies\n end", "title": "" }, { "docid": "036ba981dc545eb5095ce5047174a7d1", "score": "0.65242", "text": "def policies\n @elb.policies\n end", "title": "" }, { "docid": "b590317aaf1d946ece6135d07b73b124", "score": "0.648836", "text": "def permit_rules\n end", "title": "" }, { "docid": "7de13bd618abf49ef5ef579fdf3f18e8", "score": "0.64536136", "text": "def basic_assess\n end", "title": "" }, { "docid": "2fd0a972c199e9af21c25befa8d7b331", "score": "0.6444026", "text": "def before_approve(approval); end", "title": "" }, { "docid": "f5819aa0c250b42c47f683c4181f2b13", "score": "0.64303225", "text": "def approval_process\n if approval_check\n update(status: \"Approved\")\n pets.each { |p| p.update!(adoptable: false) }\n elsif review_complete && rejects_exist\n update(status: \"Rejected\")\n end\n end", "title": "" }, { "docid": "38838e123f9a08d031a106d81a194d3c", "score": "0.64292306", "text": "def accept_policies\n registration_policies.each{ |p| send(\"#{p}=\", '1') }\n end", "title": "" }, { "docid": "29ad010b3702c994366a407313f2caf9", "score": "0.6420549", "text": "def policies\n java_import(org.dspace.authorize.AuthorizeManager)\n\n pols = AuthorizeManager.getPolicies(DSpace.context, @obj)\n\n pols.collect do |p|\n pp = p.getEPerson\n pg = p.getGroup\n hsh = {\n action: p.getAction\n }\n hsh[:person] = pp.getName if pp\n hsh[:group] = pg.getName if pg\n\n hsh\n end\n end", "title": "" }, { "docid": "8997103d7414cbd9ebbd99cbab426740", "score": "0.6403987", "text": "def set_and_authorize_recommendation\n @recommendation = policy_scope(base_object).find(params[:id])\n authorize @recommendation\n end", "title": "" }, { "docid": "2ef5463a07431b7659a35ac5a9b3c005", "score": "0.6392494", "text": "def review\n authorize Event\n end", "title": "" }, { "docid": "65fcdb0be38e64411f0a11cdd397cc60", "score": "0.63881207", "text": "def accessible_policies\n if(self.role.title == \"company_admin\")\n Policy.where(company_id: self.company_id)\n else\n (self.policy_owner + self.policy_reviewer + self.policy_approver ).uniq\n end\n end", "title": "" }, { "docid": "bf6154ec339414f9444c4befaefee103", "score": "0.63562", "text": "def policies\n return @policies\n end", "title": "" }, { "docid": "bf6154ec339414f9444c4befaefee103", "score": "0.63562", "text": "def policies\n return @policies\n end", "title": "" }, { "docid": "bf3735fc5cf5731ce032c25e60be5504", "score": "0.63552636", "text": "def company_policy\n\t\tputs \"Policies Of Company\"\n\tend", "title": "" }, { "docid": "ec3604194382c30c5ececf1b98b5dcab", "score": "0.6350973", "text": "def policy_methods\n []\n end", "title": "" }, { "docid": "d05fe25dc590718d918866fff4ab1f9d", "score": "0.6345038", "text": "def action_allowed?\n case params[:action]\n # If the action is creating a new late policy then verifies the current user has the prvilages to perform the action or not.\n when 'new', 'create', 'index'\n current_user_has_ta_privileges?\n # If the action is to edit/update or destroy a late policy then verifies if the current user has the prvilages to perform the action or not.\n when 'edit', 'update', 'destroy'\n current_user_has_ta_privileges? &&\n current_user.instructor_id == instructor_id\n end\n end", "title": "" }, { "docid": "14c8de159f5e626ad006a9a9772dc1f4", "score": "0.63245726", "text": "def generate_policy\n statements = []\n compile.resources.keys!.each do |r_name|\n r_object = compile.resources[r_name]\n if r_object[\"Policy\"]\n r_object[\"Policy\"].keys!.each do |effect|\n statements.push(\n \"Effect\" => effect.to_s.capitalize,\n \"Action\" => [r_object[\"Policy\"][effect]].flatten.compact.map { |i| \"Update:#{i}\" },\n \"Resource\" => \"LogicalResourceId/#{r_name}\",\n \"Principal\" => \"*\",\n )\n end\n r_object.delete!(\"Policy\")\n end\n end\n statements.push(\n \"Effect\" => \"Allow\",\n \"Action\" => \"Update:*\",\n \"Resource\" => \"*\",\n \"Principal\" => \"*\",\n )\n Smash.new(\"Statement\" => statements)\n end", "title": "" }, { "docid": "5141250f8d4ef4209a5f77e7265e45d0", "score": "0.632386", "text": "def set_policy\n end", "title": "" }, { "docid": "f2b442ea8c50d095c8ec9fd628bcd66b", "score": "0.6294969", "text": "def policy_scopes\n @pundit_policy_scopes ||= {}\n end", "title": "" }, { "docid": "21194eb6f306a86a1a3f3ffcc2048ed4", "score": "0.6286713", "text": "def policies\n @policies ||= load_model('Policies')\n end", "title": "" }, { "docid": "2a8d8f784430e4ff103f6367fbb2c3b8", "score": "0.6280375", "text": "def protect_audit(pp, mode, db, recs)\n msg = \"[#{pp.name}] Policy Profile #{mode} (db:[#{db}]\"\n msg += \", ids:[#{recs.sort_by(&:to_i).join(',')}])\"\n event = \"policyset_\" + mode\n {:event => event, :target_id => pp.id, :target_class => pp.class.base_class.name, :userid => session[:userid], :message => msg}\n end", "title": "" }, { "docid": "9dcccfed359d8eae50ff6e22f96bec41", "score": "0.62641144", "text": "def policy_for(model)\n Pundit.policy!(token, model)\n end", "title": "" }, { "docid": "d3ea409472cd59346b8606b1aff0abe9", "score": "0.6251262", "text": "def policy\n @options[:policy]\n end", "title": "" }, { "docid": "f029b38a287bcde0397fcf6bcdc61af2", "score": "0.6250061", "text": "def policy(record)\n obj = ::PolicyFinder.authorizing_object(record)\n super(obj)\n end", "title": "" }, { "docid": "1ecef99d71507bd7bcc094c5db5f2612", "score": "0.62000936", "text": "def policy_scopes\n @_pundit_policy_scopes ||= {}\n end", "title": "" }, { "docid": "0d7e8dec447bb5ada5fea52f1037ea5f", "score": "0.6198886", "text": "def preferred_auth_policies; end", "title": "" }, { "docid": "328bfb4e6530061f4438891a446771e1", "score": "0.61918694", "text": "def index\n @user = current_user\n @offers = policy_scope(Offer).with_sealed_state\n authorize @offers\n end", "title": "" }, { "docid": "5ede94a19ff052027d8b6fe15997a459", "score": "0.61862224", "text": "def review\n # record a payment exemption if there is one, before submission\n @resource&.identifier&.record_payment\n end", "title": "" }, { "docid": "cdaa3709c7268b0c160a57ce31b742d2", "score": "0.6184431", "text": "def policies()\n return MicrosoftGraph::Identity::ConditionalAccess::Policies::PoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "022d2e17bc3cbf18a200f0b9a1faad7a", "score": "0.61827695", "text": "def policy\n consultation.doctor.consultation_policy\n end", "title": "" }, { "docid": "ba527d763f4813cdae37f01a28ff92af", "score": "0.61827093", "text": "def set_and_authorize_recommendation_measure\n @recommendation_measure = policy_scope(base_object).find(params[:id])\n authorize @recommendation_measure\n end", "title": "" }, { "docid": "891eeefa436993ba4e72d2897e391077", "score": "0.618162", "text": "def authorisation_decision(request, policy)\n # compute the risk\n risk = compute_risk(request, policy)\n\n # get the mitigation strategy for the permission mentioned in the request\n ms = Parameters::SENSITIVITY_TO_STRATEGIES[request[:sensitivity]]\n\n obligation = :none\n decision = false\n fdomain = Parameters::REJECT_DOMAIN\n # check for deny zone and check the user has enough budget for this owner\n # (instant deny conditions)\n if policy[request[:recipient]][0] != :deny &&\n request[:requester].risk_budget[request[:owner]] > 0\n # now check to see which risk domain the computed risk falls into\n risk_domains(request).each do |did, domain| \n if risk >= domain[0] && risk < domain[1] then\n # set the obligation to whatever the mitigation strategy says for this risk domain\n obligation = Parameters::MITIGATION_STRATEGIES[ms][did]\n\n # if there was an obligation, decrease budget and add it to\n # the active list for this agent\n if obligation != :none then\n add_obligation(request[:requester], obligation, request[:owner])\n end\n\n # if we are in the last domain then reject the request,\n # otherwise accept (poss. with obligation)\n if did == Parameters::REJECT_DOMAIN then \n decision = false \n else decision = true \n end\n\n # record this just for logging in the result\n fdomain = did\n end\n end\n end\n\n # return lots of information\n return {\n decision: decision,\n risk: risk,\n obligation: obligation, \n domain: fdomain,\n strategy: ms, \n requester: request[:requester].id,\n recipient: request[:recipient].id,\n source_zone: policy[request[:requester].id][0], \n target_zone: policy[request[:recipient].id][0],\n req_budget: request[:requester].risk_budget[request[:owner]]\n }\n end", "title": "" }, { "docid": "1d682b9a076f9e6ccdbd44154e14a119", "score": "0.61666423", "text": "def policy_scope(*args)\n super\n end", "title": "" }, { "docid": "7e52040c5343580b8033588921af7819", "score": "0.61657155", "text": "def check_policy(company_name, description, restricted_keywords)\n\n # Step 1: Direct positive indicator check\n if restricted_keywords.downcase.scan('open search policy').count != 0\n return [:allowed, \"direct-pos\"]\n\n # Step 2: Strong negagtive indicator check\n elsif check_strong_neg(description + restricted_keywords) != 0\n return [:prohibited, \"strong-neg\"]\n\n # Step 3-A: Implied negagtive indicator check by company name\n elsif restricted_keywords.downcase.scan(company_name.downcase).count != 0\n return [:prohibited, \"implied-neg\"]\n\n # Step 3-B: Implied negagtive indicator check by implied negative phrases\n elsif check_implied_neg(description + restricted_keywords) != 0\n return [:prohibited, \"implied-neg\"]\n\n # Step 4: Interpret as an implied positive if not caught by none of the above\n else\n return [:allowed, \"implied-pos\"]\n end\nend", "title": "" }, { "docid": "c3fd98a0d335ac94b307d6a24c49adb4", "score": "0.61568147", "text": "def privacy_policy\n end", "title": "" }, { "docid": "c3fd98a0d335ac94b307d6a24c49adb4", "score": "0.61568147", "text": "def privacy_policy\n end", "title": "" }, { "docid": "d0f62febacb010b97120ef28c345d057", "score": "0.61487275", "text": "def permissions_policy(&block); end", "title": "" }, { "docid": "7a77af8b235de3342ef8de6302b52495", "score": "0.6148372", "text": "def preferred_auth_policies=(_arg0); end", "title": "" }, { "docid": "1c094b0b74935d33cba6e03ef72826ec", "score": "0.6146764", "text": "def index\n authorize Pass\n @passes = policy_scope Pass\n end", "title": "" }, { "docid": "de1809e96275122ae9090777b27f1237", "score": "0.6146516", "text": "def generate_policy\n {}\n end", "title": "" }, { "docid": "de1809e96275122ae9090777b27f1237", "score": "0.6146516", "text": "def generate_policy\n {}\n end", "title": "" }, { "docid": "19e6d7bb57e25679da0ae19eaf651637", "score": "0.6144551", "text": "def test_general_policy_settings_action_allowed\n # check that no permissions will be used..\n temp = sops(:sop_with_fully_public_policy).policy.use_allowlist\n assert !temp, \"'use_allowlist' flag should be set to 'false' for this test\"\n\n temp = sops(:sop_with_fully_public_policy).policy.use_denylist\n assert !temp, \"'use_denylist' flag should be set to 'false' for this test\"\n\n group_permissions = temp_get_group_permissions(sops(:sop_with_fully_public_policy).policy)\n assert group_permissions.empty?, 'there should be no group permissions for this policy'\n\n person_permissions = temp_get_person_permissions(users(:owner_of_my_first_sop).person, sops(:sop_with_fully_public_policy).policy)\n assert person_permissions.empty?, 'there should be no person permissions for this policy'\n\n # ..all flags are checked to 'false'; only policy settings will be used\n res = Seek::Permissions::Authorization.is_authorized?('edit', sops(:sop_with_fully_public_policy), users(:sysmo_user_who_wants_to_access_different_things))\n assert res, \"test user should have been allowed to 'edit' the SOP - it uses fully public policy\"\n end", "title": "" }, { "docid": "1e71eb2e8c24a212df6a688b9bd9c548", "score": "0.61418736", "text": "def craftPolicy\n\n end", "title": "" }, { "docid": "84c85f4e404df53e6c165bdda56a9f1b", "score": "0.6134455", "text": "def policies=(value)\n @policies = value\n end", "title": "" }, { "docid": "84c85f4e404df53e6c165bdda56a9f1b", "score": "0.6134455", "text": "def policies=(value)\n @policies = value\n end", "title": "" }, { "docid": "8177029b3f24591c8e243b378b0cb91f", "score": "0.61180836", "text": "def policies\n Policy.elem_match(enrollees: { m_id: hbx_member_id })\n end", "title": "" }, { "docid": "8898f2f9ee6c364aa79ccc0039782ab0", "score": "0.61102307", "text": "def test_edit_from_policy(object_pid)\n policy_pid = policy_pid_for(object_pid)\n return false if policy_pid.nil?\n Rails.logger.debug(\"[CANCAN] -policy- Does the POLICY #{policy_pid} provide EDIT permissions for #{current_user.user_key}?\")\n group_intersection = user_groups & edit_groups_from_policy( policy_pid )\n result = !group_intersection.empty? || edit_users_from_policy( policy_pid ).include?(current_user.user_key)\n Rails.logger.debug(\"[CANCAN] -policy- decision: #{result}\")\n result\n end", "title": "" }, { "docid": "0131107ca2debb17b3d02e04e92bb027", "score": "0.61043924", "text": "def get_policies(opts)\n policies = []\n\n if opts[:user].is_a?(User)\n if opts[:query][\"type\"] == 'group'\n policies = opts[:user].group_policies\n else\n policies = opts[:user].policies + opts[:user].group_policies\n end\n end\n\n produce_rest_list(opts[:uri], opts[:rules], opts[:query], policies, \"policies\", [], opts[:user])\nend", "title": "" }, { "docid": "9eaab8bafe5136645b379459b16a87e2", "score": "0.61016047", "text": "def policy_content\n @policy || default_policy\n end", "title": "" }, { "docid": "653df7cf31d9cef1585e6393afdfc7fb", "score": "0.61009926", "text": "def test_edit_from_policy(object_id)\n policy_id = policy_id_for(object_id)\n return false if policy_id.nil?\n Rails.logger.debug(\"[CANCAN] -policy- Does the POLICY #{policy_id} provide EDIT permissions for #{current_user.user_key}?\")\n group_intersection = user_groups & edit_groups_from_policy( policy_id )\n result = !group_intersection.empty? || edit_users_from_policy( policy_id ).include?(current_user.user_key)\n Rails.logger.debug(\"[CANCAN] -policy- decision: #{result}\")\n result\n end", "title": "" }, { "docid": "c9ad3dc421c38020c181ad757ab79932", "score": "0.60948133", "text": "def policy_scopes\n @_pundit_policy_scopes ||= {}\n end", "title": "" }, { "docid": "2ff2593648a561ede0e789d92b00865d", "score": "0.6093619", "text": "def policy(record)\n policies[record] ||= Pundit.policy!(pundit_user, record)\n end", "title": "" }, { "docid": "1b3a08e48b5ee6e6357e631c9f8fbb8d", "score": "0.60715264", "text": "def guest_policy(user)\n can :manage, Message\n can :manage, Profile\n end", "title": "" }, { "docid": "ba9d2bd405d67f0718c6ad5dd5d4a1a8", "score": "0.6067576", "text": "def dc_choices4_site_policies()\n site = dc_get_site()\n site.dc_policies.all.inject([]) { |r, policy| r << [ policy.name, policy.id] if policy.active }\nend", "title": "" }, { "docid": "c520bff0d936c530c58e65887aff6d1c", "score": "0.60627276", "text": "def test_general_policy_settings_action_allowed\n # check that no permissions will be used..\n temp = sops(:sop_with_fully_public_policy).policy.use_whitelist\n assert !temp, \"'use_whitelist' flag should be set to 'false' for this test\"\n \n temp = sops(:sop_with_fully_public_policy).policy.use_blacklist\n assert !temp, \"'use_blacklist' flag should be set to 'false' for this test\"\n \n group_permissions = temp_get_group_permissions(sops(:sop_with_fully_public_policy).policy)\n assert group_permissions.empty?, 'there should be no group permissions for this policy'\n\n person_permissions = temp_get_person_permissions(users(:owner_of_my_first_sop).person, sops(:sop_with_fully_public_policy).policy)\n assert person_permissions.empty?, 'there should be no person permissions for this policy'\n\n # ..all flags are checked to 'false'; only policy settings will be used\n res = Seek::Permissions::Authorization.is_authorized?(\"edit\", nil, sops(:sop_with_fully_public_policy), users(:sysmo_user_who_wants_to_access_different_things))\n assert res, \"test user should have been allowed to 'edit' the SOP - it uses fully public policy\"\n end", "title": "" }, { "docid": "819cfab1d3cd830f98a8c4ee9c80bb5e", "score": "0.60444003", "text": "def patient_policy(user)\n can :manage, Appointment # Opt Off\n can :manage, Documentation # Opt Off\n can [:read, :update], Document, user_holder_id: user.user_holder.id # Only the doctor can create and delete a document.\n can [:read], Medication, user_holder_id: user.user_holder.id # Only the doctor can create, update and delete a medication.\n can :manage, Meeting # Opt Off\n can :manage, Message # Opt Off\n can :manage, Profile # Opt Off\n can [:read], Treatment, user_holder_id: user.user_holder.id # Only the doctor can create, update and delete a treatment.\n can :read, UserActivity, user_holder_id: user.user_holder.id #It is a log from the system - Only systemAdmin can change it.\n can :manage, UserSetting # Opt Off\n can :read, UserHolder, user_holder_id: user.user_holder.id # UserHolder is controlled by the system - Only systemAdmin can change it.\n end", "title": "" }, { "docid": "d5fa835011631d9a4c220725ec5cad1f", "score": "0.6044299", "text": "def has_admin_access(aws,policy_arn)\n policy_detail = aws.iam.get_policy(policy_arn: policy_arn).policy\n\n policy_doc = aws.iam.get_policy_version({\n policy_arn: policy_arn,\n version_id: policy_detail[:default_version_id]\n }).policy_version.document\n\n # policy doc is URI encoded.\n policy_doc = JSON.parse(URI.decode(policy_doc)) if policy_doc.is_a? String\n output = { policy_doc: policy_doc, admin_access: false}\n\n # Policy doc with a single statement can also be written as \n # Statement => {\n # \"Effect\" : xxxxx,\n # \"Action\" : xxxxx,\n # \"Resource\": xxxxx,\n # }\n # instead of\n # Statement => [ {statement1}, {statement2}, etc]\n if policy_doc['Statement'].is_a? Hash\n output[:admin_access] = true if statement_has_admin?(policy_doc['Statement'])\n else\n # For policydoc with multiple statements\n # Statement => [ {statement1}, {statement2}, etc]\n policy_doc['Statement'].each do | statement |\n output[:admin_access] = true if statement_has_admin?(statement)\n end\n end\n\n return output\n\nend", "title": "" }, { "docid": "86d772623d78249a5b69a6260adc18ec", "score": "0.6035946", "text": "def rapprochement\n\n end", "title": "" }, { "docid": "335e5c2edaa5821f4d8982885574aa38", "score": "0.6031923", "text": "def temporary_policy_while_waiting_for_publishing_approval\n return true unless authorization_checks_enabled\n return true if User.current_user.blank?\n if is_published? && !is_a?(Publication) && gatekeeper_required? && !User.current_user.person.is_asset_gatekeeper_of?(self)\n policy.access_type = if new_record?\n Policy::NO_ACCESS\n else\n Policy.find_by_id(policy.id).access_type\n end\n end\n end", "title": "" }, { "docid": "796d10daf105cb06c15c156464e97904", "score": "0.60235614", "text": "def access_restrictions; end", "title": "" }, { "docid": "28f821b190c2378bdaac40f619b36bf5", "score": "0.60224247", "text": "def dc_user_can_view(ctrl, policy_id)\n policy_id = policy_id.policy_id if policy_id and policy_id.respond_to?(:policy_id)\n# Eventualy object without policy_id will be checked. This is to prevent error\n policy_id = nil unless policy_id.class == BSON::ObjectId\n#\n site = ctrl.site\n policies = site.dc_policies\n# permission defined by default policy\n default_policy = Mongoid::QueryCache.cache { policies.find_by(is_default: true) }\n return false, 'Default accsess policy not found for the site!' unless default_policy\n# \n permissions = {}\n default_policy.dc_policy_rules.to_a.each { |v| permissions[v.dc_policy_role_id] = v.permission }\n# update permissions with defined policy \n part_policy = nil\n if policy_id\n part_policy = Mongoid::QueryCache.cache { policies.find(policy_id) }\n return false, 'Access policy not found for part!' unless part_policy\n part_policy.dc_policy_rules.to_a.each { |v| permissions[v.dc_policy_role_id] = v.permission }\n end\n# apply guest role if user has no roles defined\n if ctrl.session[:user_roles].nil?\n role = Mongoid::QueryCache.cache { DcPolicyRole.find_by(system_name: 'guest', active: true) }\n return false, 'System guest role not defined!' unless role\n ctrl.session[:user_roles] = [role.id]\n end\n# Check if user has any role that allows him to view part\n# p h, ctrl.session[:user_roles]\n can_view, msg = false,''\n ctrl.session[:user_roles].each do |role|\n next unless permissions[role] # role not yet defined. Will die in next line.\n if permissions[role] > 0\n can_view = true\n break\n end\n end\n msg = if !can_view\n part_policy ? t(part_policy.message,part_policy.message) : t(default_policy.message,default_policy.message)\n end\n return can_view, msg\nend", "title": "" }, { "docid": "c01d3a86dc5bd2a7806cc270f58a3487", "score": "0.6021909", "text": "def edit\n @recruitments = policy_scope(RecruitmentClass).all\n authorize RecruitmentClass\n end", "title": "" }, { "docid": "c38bd968fb8afeec9dfaf378ed2486c9", "score": "0.60205406", "text": "def doctor_policy(user)\n can :manage, Appointment\n can :manage, Documentation\n can :manage, Document\n can :manage, Medication\n can :manage, Meeting\n can :manage, Message, user_holder_id: user.user_holder.id\n can :manage, Profile\n can :manage, Treatment\n can :read, UserActivity #It is a log from the system - Only systemAdmin can change it.\n can :manage, UserSetting\n can :read, UserHolder # UserHolder is controlled by the system - Only systemAdmin can change it.\n end", "title": "" }, { "docid": "d66973194d34c6fdb268d5782985b156", "score": "0.60181874", "text": "def check_approval_status\n raise \"User can't approve/reject properties\" if @current_user&.role&.name == 'user'\n end", "title": "" }, { "docid": "57a02097284f1a996fe3f9c459d092a5", "score": "0.6010125", "text": "def show\n authorize ReviewStatus\n end", "title": "" }, { "docid": "86cc589ddb6bd0e555019e823462e6fc", "score": "0.6003034", "text": "def password_policies\n request_get('/utils/policies')\n end", "title": "" }, { "docid": "b86e43fb49d65443128d3e1244baf2fc", "score": "0.59952545", "text": "def active_policy\n super\n end", "title": "" }, { "docid": "131cc95ab5243f737fc785bdf52595ad", "score": "0.5992887", "text": "def policy(record)\n policies[record] ||= find_policy!(pundit_user, record)\n end", "title": "" }, { "docid": "d7f2a90c12032dd68556cce4f1ed4373", "score": "0.59888184", "text": "def show\n authorize @evaluation\n end", "title": "" }, { "docid": "efcc5a2dacbb6d7a11ae3c07cb009de6", "score": "0.5978046", "text": "def index\n @elections = policy_scope(Election).order(sort_column.to_s + ' ' + sort_direction.to_s).page(params[:page]).per(params[:limit])\n authorize @elections\n end", "title": "" }, { "docid": "aa0db66c9fb87c7208154a9d1511c651", "score": "0.59754616", "text": "def test_edit_from_policy(object_id)\n policy_ids = active_policy_ids_for(object_id)\n return false if policy_ids.nil?\n Rails.logger.debug(\"[CANCAN] -policy- Do the POLICIES #{policy_ids} provide READ permissions for #{current_user.user_key}?\")\n results = policy_ids.collect do |policy_id|\n group_intersection = user_groups & edit_groups_from_policy( policy_id )\n result = !group_intersection.empty? || edit_users_from_policy( policy_id ).include?(current_user.user_key)\n result\n end\n result = results.any? {|result| !!result}\n Rails.logger.debug(\"[CANCAN] -policy- decision: #{result}\")\n result\n end", "title": "" }, { "docid": "a8f5755f25120be16a76238733676f1e", "score": "0.5963", "text": "def compliance_review_allowed?(_review, user)\n user.admin?\n end", "title": "" }, { "docid": "3e0137aa54982ce3a89ed080b2f1b6ef", "score": "0.5962775", "text": "def policies\n UserPolicyCollection.new(self) \n end", "title": "" }, { "docid": "dabd24b0a986ef5ae8a84294f5b9555f", "score": "0.596001", "text": "def permit?(action)\n # TODO: policies are mixing application and domain concerns (or perhaps\n # they are purely application concerns). need to figure out how to draw\n # the line.\n case action\n when :list_cases\n true\n when :list_queue\n agent? || enroller? || governor?\n when :list_search\n agent? || enroller? || governor?\n when :list_reports\n admin? || enroller?\n when :admin\n agent? && admin?\n else\n false\n end\n end", "title": "" }, { "docid": "c1b6a841333d91da62f6ee9c606b6c11", "score": "0.59586746", "text": "def apply_rules\n self.approval_status = (amount.to_f < user.limit.to_f)\n save\n end", "title": "" }, { "docid": "67b59b9d19c76615e37fa11d6fbf780e", "score": "0.5954729", "text": "def implementation_granted?\n mgmt_approval_status == 'approved' && sec_approval_status == 'approved'\n end", "title": "" }, { "docid": "83c647e591f75cdcb358761ffd55f5d2", "score": "0.59493756", "text": "def guest_policy\n user = users(:guest)\n project = projects(:portfolio)\n ProjectPolicy.new(user, project)\nend", "title": "" }, { "docid": "ac770aa31a4d6ed8d0f24b5d09f5d664", "score": "0.59492", "text": "def putPolicy\n\n end", "title": "" }, { "docid": "1bbfa43597825ca3fb37ea6422068697", "score": "0.5947992", "text": "def needs_review model, urgency, &block\n if policy(model).review?\n # Only get articles which the current user can review\n policy_scope(model).needs_review.each do |record|\n next unless record.ready_for_review? # Skip anything which is reviewable but isn't expecting review yet.\n \n block.call({\n model: model,\n name: record_name(record),\n url: polymorphic_admin_path([:review, :admin, record]),\n message: translate('admin.tags.unapproved_changes'),\n urgency: urgency,\n })\n end\n end\n end", "title": "" }, { "docid": "4afa54b38af565ba1ad971e4d1b85069", "score": "0.5930277", "text": "def index\n authorize_action_for Policy, at: current_store\n @policies = current_store.policies\n end", "title": "" }, { "docid": "d68ebf373d08b60bab97fda374fcd0da", "score": "0.59268486", "text": "def may_approve\n @study and @study.can_be_approved_by current_user\n end", "title": "" }, { "docid": "0f6a321834def7e8d428daca4b0973b7", "score": "0.59235114", "text": "def check_models_wo_policy\n good_req = true\n rps = []\n $abst_states.each do |k, s|\n if s.type == 'model'\n if s.req_policies.count == 0\n good_req = false\n $log.error \"check_models_wo_policy() no policy for #{s.id}\"\n # TODO: add warnings\n $stat_policy_model_na_count += 1\n p = \" # #{s.id}\\n\"\n p += \" '#{s.model}' => {\\n\"\n p += \" is_authenticated: true,\\n\"\n p += \" is_authorized: true,\\n\"\n p += \" level: 5, # Mid \\n\"\n p += \" roles: [\\n\"\n p += \" { role: 'user', action:'CRUD' }\\n\"\n p += \" ]\\n\"\n p += \" },\\n\"\n rps << p\n end\n end\n end\n\n if good_req == false\n # print remidiation\n print \"\\e[31m\" # red\n puts \"Missing base policies\"\n puts \"---\"\n rps.each do |p|\n puts p\n end\n puts \"---\"\n print \"\\e[0m\" # reset\n end\n return good_req\n end", "title": "" } ]
74a6440611140c8e9a7e4105811f5c40
if alias was changed in not new object it's important, because alias can't be change
[ { "docid": "23bc332b684f390de82a021d3fe2888d", "score": "0.6380368", "text": "def check_alias\n self.alias_str = self.alias_str_was\n end", "title": "" } ]
[ { "docid": "9a3cb344c0099778d69d2973a5883587", "score": "0.65068775", "text": "def alias=(_); end", "title": "" }, { "docid": "7396f84692d53e9eca92d22173752a6f", "score": "0.63058", "text": "def is_alias?; end", "title": "" }, { "docid": "5a130828c5b0c2a14f698b9f25d2ba65", "score": "0.6288614", "text": "def type_alias(new, original)\n types[new] = original \n end", "title": "" }, { "docid": "5a130828c5b0c2a14f698b9f25d2ba65", "score": "0.6288614", "text": "def type_alias(new, original)\n types[new] = original \n end", "title": "" }, { "docid": "7814032421a207f1dd530b8af6d15c44", "score": "0.6261105", "text": "def alias(new_key, old_key)\n @jvms[new_key] = @jvms[old_key]\n end", "title": "" }, { "docid": "be994a743f09a473ceee75563df67bb0", "score": "0.6210903", "text": "def type_alias(new, original)\n types[new] = original\n end", "title": "" }, { "docid": "1d6387ef2db60d220778b34ad57e7633", "score": "0.61272293", "text": "def alias_to(the_alias_id)\n self.alias = true\n self.alias_id = the_alias_id\n self.save\n end", "title": "" }, { "docid": "1d072fefeda9147ce7093b012cb595fc", "score": "0.6123474", "text": "def add_alias(new_name, old_name)\r\n sections = old_name.partition('::')\r\n \r\n if sections[1] == ''\r\n target = @cache[old_name].clone\r\n else\r\n vocab = vocabularies[sections[0]]\r\n fail XfOOrthError, \"Vocabulary #{name} does not exist.\" if vocab.nil? \r\n target = vocab[sections[2]].clone\r\n end\r\n\r\n target.name = new_name\r\n @cache[new_name] = @current_vocabulary[new_name] = target\r\n \r\n if @owner.debug\r\n puts \"#{new_name} is an alias of #{old_name}\"\r\n puts\r\n end\r\n end", "title": "" }, { "docid": "920d4c81ce45258c0a70c58748ed0153", "score": "0.60945165", "text": "def uhook_duplicated_object(obj)\n end", "title": "" }, { "docid": "23b5db143d616fb50d8dee1b7ccf1a1c", "score": "0.6074507", "text": "def attribute_alias?(new_name); end", "title": "" }, { "docid": "23b5db143d616fb50d8dee1b7ccf1a1c", "score": "0.6074507", "text": "def attribute_alias?(new_name); end", "title": "" }, { "docid": "e70947c009f5954de8ebb5e61ee0d2d5", "score": "0.60440594", "text": "def alias(alias_name)\n clone.alias! alias_name\n end", "title": "" }, { "docid": "04ea9205a7b0783a1116a20e72015030", "score": "0.6044023", "text": "def alias?; end", "title": "" }, { "docid": "d2cef91a20600a51ae3756251ecbb170", "score": "0.5999963", "text": "def handle_alias(var_name, new_name, old_name, scope = :instance)\n namespace = namespace_for_variable(var_name)\n return if namespace.nil?\n new_meth = new_name.to_sym\n old_meth = old_name.to_sym\n old_obj = namespace.child(:name => old_meth, :scope => scope)\n new_obj = register MethodObject.new(namespace, new_meth, scope) do |o|\n register_visibility(o, visibility)\n register_file_info(o, statement.file, statement.line)\n end\n\n if old_obj\n new_obj.signature = old_obj.signature\n new_obj.source = old_obj.source\n new_obj.docstring = old_obj.docstring\n new_obj.docstring.object = new_obj\n else\n new_obj.signature = \"def #{new_meth}\" # this is all we know.\n end\n\n namespace.aliases[new_obj] = old_meth\n end", "title": "" }, { "docid": "11bc3ad1c5a40958a93089e28221b0a6", "score": "0.59893936", "text": "def or_alias\n object.alias || object\n end", "title": "" }, { "docid": "76adbbd9eab78514d03060f5aa645843", "score": "0.5987505", "text": "def replace_aliases_with_original_keys(hash)\n # DISCUSS: Better way to check for alias presence in `hash`\n return hash unless (hash.keys & @aliases.values).any?\n\n _hash = hash.dup\n\n @aliases.each do |original_key, _alias|\n _hash[original_key] = _hash.delete(_alias) if _hash.key?(_alias)\n end\n\n return _hash\n end", "title": "" }, { "docid": "18cb780e2aa5acd38cbfe586ed7e1e39", "score": "0.5985301", "text": "def alias_attribute(new_name, old_name); end", "title": "" }, { "docid": "a3766247e9da1208a195951598613071", "score": "0.59768397", "text": "def alias_old_subject(context = :default)\n return if last_subject.nil?\n if not self.new_record? # NEED NEW CONDITION (probably) now that last_subject will always be true whether the name has changed or not # this is a rename, not a new topic\n @ta = TopicAlias.create(:coded_subject => last_subject.seoify, :network_id => network.id, :topic_id => self.id, :user_id => self.most_recent_editor.id)\n end\n end", "title": "" }, { "docid": "1ad8e61a972e4fa1579d6658ac0d0bb1", "score": "0.5972188", "text": "def aliases=(aliases)\n super((aliases || []).select { |a| a != name })\n end", "title": "" }, { "docid": "e62c810942847cb329d7093261774f00", "score": "0.5945878", "text": "def orig_object; end", "title": "" }, { "docid": "4e60515c60f6fe097b1dadb225ad9746", "score": "0.59362", "text": "def alias_type(format, new, old); end", "title": "" }, { "docid": "789fed75feea3fa1f1790e8a2c425400", "score": "0.58948696", "text": "def update!(**args)\n @alias = args[:alias] unless args[:alias].nil?\n end", "title": "" }, { "docid": "07aa2d1e6f25ddf024b5725f787d6ccb", "score": "0.58811677", "text": "def alias; end", "title": "" }, { "docid": "7499975a8a097da129ad7ed0c920f337", "score": "0.5874917", "text": "def alias=(_arg0); end", "title": "" }, { "docid": "742d7aecf3a93846d24e53d5a871aa0e", "score": "0.5857434", "text": "def is_alias?\n false\n end", "title": "" }, { "docid": "377aa2aef3b63db75c0b2d41b57dafdd", "score": "0.58551687", "text": "def start_alias(node)\n mark_used(node.old_method)\n end", "title": "" }, { "docid": "beb31a24d35ad6d95c2dfc288988e15b", "score": "0.58365065", "text": "def update!(**args)\n @alias = args[:alias] if args.key?(:alias)\n end", "title": "" }, { "docid": "8a78b69b5fb7eaefb839d03f5373e4b0", "score": "0.583649", "text": "def create_shared_alias(new_name)\n old_name, target = popm(2)\n\n unless target.is_a?(Class)\n error \"F13: The target of .alias: must be a class\"\n end\n\n old_spec = get_old_shared_spec(target, old_name)\n\n target.create_shared_method(new_name,\n get_alias_type(old_spec, new_name),\n old_spec.tags,\n &old_spec.does)\n clear_cast\n end", "title": "" }, { "docid": "f07fea7a1e868f7450cfe9549864f04a", "score": "0.58309644", "text": "def is_alias?\n end", "title": "" }, { "docid": "86a6368bb74f67a6885bceb40df0b662", "score": "0.581608", "text": "def on_alias(left, right); end", "title": "" }, { "docid": "eaee04dfdfd56484e1a3f74d806cc6bf", "score": "0.58005804", "text": "def resolve_names_and_aliases(duplicate)\n final_comments = duplicate.handlers.pluck(:or_final_comment)\n duplicate.alias_check = final_comments.any?{|c| /use name as alias/ =~ c} ? \"Y\" : \"N\"\n name = final_comments.select{|c| /name = / =~ c}\n duplicate.resolved_name = name.empty? ? nil : name.first.gsub(/name = /,\"\")\n duplicate.save\nend", "title": "" }, { "docid": "4f890ac01c8f6dfbdbf8d762070e08b1", "score": "0.5797782", "text": "def resolve_alias\n object['alias']\n end", "title": "" }, { "docid": "b67ce1adc8a972ac7eab980ef42212e5", "score": "0.57846236", "text": "def visit_alias(node)\n node.copy(left: visit(node.left), right: visit(node.right))\n end", "title": "" }, { "docid": "99a59e90e2ba989c7bf68903d02b2922", "score": "0.5749541", "text": "def add_alias(alias_name, original_name, version = nil)\n self[alias_name.to_sym] = [self[original_name.to_sym].first, version]\n end", "title": "" }, { "docid": "4ead49cfc23a5f89d66306b840c737c3", "score": "0.56922185", "text": "def rename(aliases)\n attribute = self.attribute\n renamed = aliases[attribute]\n renamed.equal?(attribute) ? self : self.class.new(renamed)\n end", "title": "" }, { "docid": "409201c98b128eefbca24af20ed4fe29", "score": "0.5682069", "text": "def alias=(a)\n self.aliases = [a]\n end", "title": "" }, { "docid": "8167a4014efa20fd37902b176378fee8", "score": "0.5667514", "text": "def actual\n alias_id ? (self.alias || self) : self\n end", "title": "" }, { "docid": "7ee12659c42a254c5e132947e9d6308f", "score": "0.56518817", "text": "def alias_name; end", "title": "" }, { "docid": "7ee12659c42a254c5e132947e9d6308f", "score": "0.56518817", "text": "def alias_name; end", "title": "" }, { "docid": "a028bd0e9b023d5562f731a72e3ec840", "score": "0.56319225", "text": "def diff=(o); end", "title": "" }, { "docid": "85cc232474168143e36fa442291b2c0f", "score": "0.5630542", "text": "def alias_\n @alias_\n end", "title": "" }, { "docid": "85cc232474168143e36fa442291b2c0f", "score": "0.5630542", "text": "def alias_\n @alias_\n end", "title": "" }, { "docid": "e1e2ac44b5bc6e67014cd7d4b9dd69f8", "score": "0.5625647", "text": "def alias_tracker; end", "title": "" }, { "docid": "3ad4cd5d822c9defd35e1db81a56f3ff", "score": "0.56181365", "text": "def test_not_shared_objects(ctx1, ctx2)\n assert_not_equal(ctx1.referent.object_id, ctx2.referent.object_id)\n assert_not_equal(ctx1.referent.metadata.object_id, ctx2.referent.metadata.object_id)\n\n original_ref_title = ctx1.referent.metadata[\"title\"]\n new_title = \"new test title\"\n # just ensure new uniqueness\n new_title += original_ref_title if original_ref_title\n\n ctx1.referent.set_metadata(\"title\", new_title)\n\n # That better not have changed ctx2\n\n assert_not_equal(new_title, ctx2.referent.metadata[\"title\"])\n\n # Now fix first title back to what it was originally, to have no\n # side-effects\n ctx1.referent.set_metadata(\"title\", original_ref_title)\n end", "title": "" }, { "docid": "06c15b02755ff22a87270560ce506805", "score": "0.56078506", "text": "def alias_method_once(new_name, old_name)\n return self if method_defined?(new_name)\n\n alias_method(new_name, old_name)\n end", "title": "" }, { "docid": "21d7bb2739e14dcb7681a405f870da97", "score": "0.5596322", "text": "def alias_of(alias_name)\n self.setters.find do |name|\n list = [*(self.property_options[name] || {})[:alias]] || []\n list.include?(alias_name.to_sym)\n end\n end", "title": "" }, { "docid": "c2aeefa2e8b4292e26c6e601da2c16dd", "score": "0.5591613", "text": "def obj_alias!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n # - - - - label initialization - - - -\n __ID1__ = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 203:5: {...}? ID\n unless ( ( (KEYS.find { |key| next_word() == key }).nil? ) )\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise FailedPredicate( \"OBJ_ALIAS\", \"(KEYS.find { |key| next_word() == key }).nil? \" )\n end\n __ID1___start_464 = self.character_index\n id!\n __ID1__ = create_token do |t|\n t.input = @input\n t.type = ANTLR3::INVALID_TOKEN_TYPE\n t.channel = ANTLR3::DEFAULT_CHANNEL\n t.start = __ID1___start_464\n t.stop = self.character_index - 1\n end\n # syntactic predicate action gate test\n if @state.backtracking == 1\n # --> action\n\n @last_alias = __ID1__.text\n \n # <-- action\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "title": "" }, { "docid": "0ee33de0b5f432dc63c6ed83a26256f5", "score": "0.55888295", "text": "def has_alias?(name)\r\n end", "title": "" }, { "docid": "3b9de20398f7e4b7568602857df6c25c", "score": "0.55880326", "text": "def alias_type(format, new, old)\n\t\t[:encoder, :decoder].each do |ende|\n\t\t\tenc = @coders_by_name[format][ende][old]\n\t\t\tif enc\n\t\t\t\t@coders_by_name[format][ende][new] = enc\n\t\t\telse\n\t\t\t\t@coders_by_name[format][ende].delete(new)\n\t\t\tend\n\t\tend\n\t\tself\n\tend", "title": "" }, { "docid": "581fed8937b2b0ae0a142eb10a2d9819", "score": "0.5587818", "text": "def modified=(_); end", "title": "" }, { "docid": "da1d50a09b7177a224bfc6f5351b268b", "score": "0.55772924", "text": "def singleton_method_alias( newname, original )\n\t\t\tsingleton_class.__send__( :alias_method, newname, original )\n\t\tend", "title": "" }, { "docid": "da1d50a09b7177a224bfc6f5351b268b", "score": "0.55772924", "text": "def singleton_method_alias( newname, original )\n\t\t\tsingleton_class.__send__( :alias_method, newname, original )\n\t\tend", "title": "" }, { "docid": "da1d50a09b7177a224bfc6f5351b268b", "score": "0.55772924", "text": "def singleton_method_alias( newname, original )\n\t\t\tsingleton_class.__send__( :alias_method, newname, original )\n\t\tend", "title": "" }, { "docid": "da1d50a09b7177a224bfc6f5351b268b", "score": "0.55772924", "text": "def singleton_method_alias( newname, original )\n\t\t\tsingleton_class.__send__( :alias_method, newname, original )\n\t\tend", "title": "" }, { "docid": "da1d50a09b7177a224bfc6f5351b268b", "score": "0.55772924", "text": "def singleton_method_alias( newname, original )\n\t\t\tsingleton_class.__send__( :alias_method, newname, original )\n\t\tend", "title": "" }, { "docid": "dc7ae95186fbe2526f34be9b1eeeef87", "score": "0.5562635", "text": "def test_anchor_alias_bug\n q1 = Quux.new\n q1.one = Blarg.new 1\n q1.two = Blarg.new 2\n # @one and @three are identical, so the YAML should have @one be an\n # anchor and @three should be an alias\n q1.three = q1.one\n\n yaml = YAML.dump q1\n\n # puts yaml\n q2 = YAML.load yaml\n\n # This yaml was generated from MRI, so this test ensures we can read\n # the MRI dump of the above classes.\n yaml =<<EOYAML\n--- !ruby/object:Quux\none: &id001 !ruby/object:Blarg\n foo: 1\nthree: *id001\ntwo: !ruby/object:Blarg\n foo: 2\nEOYAML\n q3= YAML.load(yaml)\n\n assert_equal(q1, q2)\n assert_equal(q1, q3)\n assert_same(q3.one, q3.three)\n end", "title": "" }, { "docid": "58ea8c7915e09d38b22415bbb33f0f85", "score": "0.5554429", "text": "def aliased(alias_name)\n super.with(name: name || alias_name)\n end", "title": "" }, { "docid": "89718d02606cee9a8a35a9eb5486d87e", "score": "0.555304", "text": "def visit_alias(node); end", "title": "" }, { "docid": "9f6348d99904c9015fcbf6fdff9e853a", "score": "0.5546958", "text": "def aliases(other)\n entries.each_with_object({}) { |(key, name), aliases|\n other_name = other[key].name\n if name.field != other_name\n aliases[name.field] = other_name\n end\n }\n end", "title": "" }, { "docid": "150ff6bab112c39e161f19a6ab520eeb", "score": "0.55355734", "text": "def add_command_alias( original, alias_command ) #:nodoc:\n original.syntax << alias_command[:syntax]\n alias_command[:is_public] = original_command.is_public\n alias = self.class.new( alias_command )\n alias.mark_as_alias!\n end\n\n\n def self.store_command( command )\n @@commands ||= { }\n @@commands[command.name] = command\n end\n def self.all\n @@commands\n end\n def help_description\n syntax.map { |syntax| \"#{syntax}\\n\" }.join('') + \" #{command.description}\\n\\n\"\n end\n def short_help_description\n help_description\n end\n protected\n \n def mark_as_alias!\n @is_alias = true\n end\n \n private\n\n def command_name(syntax) #:nodoc:\n syntax = syntax.trim\n if syntax =~ /\\s/\n syntax.sub(/^(\\S+).*/, '\\1')\n else\n syntax\n end\n end\n end", "title": "" }, { "docid": "ddcc30093fec6438486cfae7046e53b2", "score": "0.5535492", "text": "def setup_index_alias(new_index_name)\n\n existing_alias = Tire::index(index.name).aliases.\n find { |a| a.name == index.name }\n\n if existing_alias\n ali = existing_alias\n ali.indices.each { |index_name| ali.indices.delete(index_name) }\n else\n #note:\n # Never used the model name as the name of a real index, used alias only\n Tire::index(index.name).delete #delete the real index that has the name\n ali = Tire::Alias.new(name: index.name)\n end\n\n #clean up all indcies which has the model's name as alias\n ali.indices.add(new_index_name)\n ali.save\n end", "title": "" }, { "docid": "3a36b227532337ffade75b57aa1d2f01", "score": "0.55282944", "text": "def safe_alias\n self.set_alias\n self._alias\n end", "title": "" }, { "docid": "4c7d5cccce82f669b6f503997dca5aaf", "score": "0.55279595", "text": "def attribute_alias?(new_name)\n attribute_aliases.key? new_name.to_s\n end", "title": "" }, { "docid": "3e05fca79c7f379643f5d3fc87efbb82", "score": "0.55243003", "text": "def alias\n super\n end", "title": "" }, { "docid": "f8dab51a49de13cab04482c8bcfe2fc4", "score": "0.5522864", "text": "def alias? \n not @alias.nil?\n end", "title": "" }, { "docid": "197181eda7752658beb12fdbb6c8a64d", "score": "0.5519241", "text": "def _tags_adapt(old_tags)\n\t\to = old_tags.dup\n\t\tif o['crossing_ref']=='tiger' then o.delete('crossing_ref'); o['segregated']='yes' end\n\t\to\n\tend", "title": "" }, { "docid": "4fbb1f977c3b22b0ccb6fd638b9e7774", "score": "0.5518279", "text": "def alias_instance_method(orig_name, new_name = \"_original_#{orig_name}\")\n alias_method new_name.to_sym, orig_name.to_sym unless method_defined?(new_name.to_s)\n end", "title": "" }, { "docid": "c551898bcafb231dd4e97be1073cee9e", "score": "0.55176157", "text": "def chooseAlias \n case @cursrc[0][:STATE]\n\twhen 0\n\t tableAlias = @st.getTable[:ALIAS]\n\t @cursrc[0][:ALIAS] = tableAlias\n\t @cursrc[0][:STATE] = 1\n\twhen 1\n\t tableAlias = @cursrc[0][:ALIAS]\n\twhen 2\n\t tableAlias = @cursrc[0][:ALIAS]\n\t @cursrc.clear\n\t @cursrc[0] = {:STATE => 0}\n\twhen 3\n\t @cursrc.clear\n\t tableAlias = @st.getTable[:ALIAS]\n\t @cursrc[0] = {:STATE => 1, :ALIAS => tableAlias}\n\telse\n\t errorExit(\"@cursrc is in wrong state #{@cursrc[0][:STATE]} in chooseAlias\")\n end\n tableAlias\n end", "title": "" }, { "docid": "9b409b28bf59ae8685685400625ced97", "score": "0.55154896", "text": "def on_var_alias(left, right); end", "title": "" }, { "docid": "5b73c342c2e982e01af95f6d32e3551d", "score": "0.55130535", "text": "def duplicate_with(metadata_overrides = T.unsafe(nil)); end", "title": "" }, { "docid": "ab2230f660ca3084d483b31b360427e8", "score": "0.55086356", "text": "def syncMetadata(oldAlias, newAlias)\n\n @coltab.each do |col, entry|\n entry.each do |key, value|\n # puts \"#{value} - #{newAlias} - #{oldAlias}\"\n @coltab[col][key] = newAlias if value == oldAlias\n end\n end\n\n end", "title": "" }, { "docid": "9025700a58584e56ac0b13ebbd6eb5dc", "score": "0.5501524", "text": "def move_aliases!\n old_tag.consequent_aliases.each do |tag_alias|\n tag_alias.update!(consequent_name: new_tag.name)\n end\n end", "title": "" }, { "docid": "d3014974bcdc78e6e3e9f283a68fb860", "score": "0.54987925", "text": "def oalias(arg)\r\n #\r\n new_method_id, old_method_id = *arg.to_a[0]\r\n #\r\n remove_method(new_method_id) if method_defined?(new_method_id)\r\n #\r\n if old_method_id.to_s[-1] == (?=) then\r\n eval \"def #{new_method_id}(*args); self.#{old_method_id}(*args); end\"\r\n else\r\n eval \"def #{new_method_id}(*args, &block); self.#{old_method_id}(*args, &block); end\"\r\n end\r\nend", "title": "" }, { "docid": "f535081d675fe572de7bfaf0df18e81a", "score": "0.54858375", "text": "def alias_task(new_name, old_name) \n original_task = Rake.application.tasks_hash[old_name.to_s]\n copied_task = original_task.dup\n Rake.application.tasks_hash[new_name.to_s] = copied_task\n Rake.application.tasks_hash[old_name.to_s] = original_task\n copied_task.name = new_name\n copied_task.clone_some_inside_vars\nend", "title": "" }, { "docid": "262931b84d6723e360d5c7dd6a5e0aac", "score": "0.54689807", "text": "def aliased?\n !self.alias.nil?\n end", "title": "" }, { "docid": "63126ed77fef096a63ed4e82cc949009", "score": "0.5467503", "text": "def aliases\n @aliases.dup\n end", "title": "" }, { "docid": "05ee306b4b807ae168a0b123a6603b5c", "score": "0.5459958", "text": "def alias(an_alias)\n { alias: an_alias }\n end", "title": "" }, { "docid": "68cf182d2e8342c1b8d45d8d13e6a16c", "score": "0.5451032", "text": "def make_alias(this)\n _aliased_name = aliased_name\n original_name = name\n\n alias_target(this).class_eval do\n alias_method _aliased_name, original_name\n end\n end", "title": "" }, { "docid": "2864fb0e27b867a354f5a55e8407df4d", "score": "0.54486465", "text": "def set_alias(aliass)\n @alias = aliass\n end", "title": "" }, { "docid": "eaf9697006bf09fb53a46992def9a244", "score": "0.5435398", "text": "def alias_=(value)\n @alias_ = value\n end", "title": "" }, { "docid": "eaf9697006bf09fb53a46992def9a244", "score": "0.5435398", "text": "def alias_=(value)\n @alias_ = value\n end", "title": "" }, { "docid": "a217c9f860235f77ef45392abfd10751", "score": "0.5430728", "text": "def aliased\n if alias?\n self.class.new(to_h.merge({\n \"tag\" => metadata.aliased_tag\n }))\n end\n end", "title": "" }, { "docid": "3df1dd592c2bf873a0f9f158324d26b5", "score": "0.5430602", "text": "def add_alias(key_from, ob_to)\n put(key_for(ob_to.class, key_from), key_for(ob_to))\n end", "title": "" }, { "docid": "9fbbcdddc5a4471c7020f4fa132b535a", "score": "0.54135627", "text": "def duplicable?; end", "title": "" }, { "docid": "9fbbcdddc5a4471c7020f4fa132b535a", "score": "0.54135627", "text": "def duplicable?; end", "title": "" }, { "docid": "24171232a16833267bc773274db56be3", "score": "0.5411409", "text": "def === obj\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "24171232a16833267bc773274db56be3", "score": "0.5411409", "text": "def === obj\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f401e82e50816114bc76a8d2fa5275a3", "score": "0.5396728", "text": "def alias(builder)\n repo = builder.repo\n aliased_repo = builder.aliased_repo || builder.aliased_tag\n msg = Simple::Ansi.green(\"Aliasing #{repo} -> #{aliased_repo}\")\n $stderr.puts msg\n end", "title": "" }, { "docid": "354803a21d33464217149370805922a6", "score": "0.53937644", "text": "def get_alias_type(old_spec, new_name)\n old_type = old_spec.class\n new_type = XfOOrth.name_to_type(new_name, self)\n old_desc, new_desc = old_type.foorth_name, new_type.foorth_name\n\n unless (allowed = ALLOWED_ALIAS_TYPES[old_type])\n error \"F13: A #{old_desc} method may not be aliased.\"\n end\n\n unless allowed.include?(new_type)\n error \"F13: A #{old_desc} method may not be aliased as a #{new_desc}\"\n end\n\n XfOOrth.validate_type(self, new_type, new_name)\n\n new_type\n end", "title": "" }, { "docid": "fa4fe177932376929121201cff572bfc", "score": "0.5386639", "text": "def alias\n read_attr :alias\n end", "title": "" }, { "docid": "3a3eb056001ce1548340b781294a9512", "score": "0.53713876", "text": "def aliases(other)\n entries.each_with_object({}) { |(key, name), aliases|\n field = name.field\n other_name = other.fetch(key).name\n if field != other_name\n aliases[field] = other_name\n end\n }\n end", "title": "" }, { "docid": "264cc83ea1a149106bb006cbbde6d9a6", "score": "0.53688544", "text": "def orig_name=(*) end", "title": "" }, { "docid": "402f9974441c0c26df046bcd85ae720c", "score": "0.53621435", "text": "def run_alias(data, alias_name, real_attribute)\n real = data[real_attribute]\n aliaz = data[alias_name]\n # Only matters if the alias is provided.\n if aliaz\n data[real_attribute] =\n if real\n # Merge the data.\n if block_given?\n yield(aliaz, real)\n elsif aliaz.is_a?(Array) and real.is_a?(Array)\n # Easy to combine Arrays.\n (real + aliaz).uniq\n elsif aliaz.is_a?(Hash) and real.is_a?(Hash)\n # Easy to combine Hashes.\n real.merge(aliaz)\n else\n raise Razor::ValidationFailure.new(\"cannot supply both #{real_attribute} and #{alias_name}\")\n end\n else\n data[alias_name]\n end\n data.delete(alias_name)\n end\n data\n end", "title": "" }, { "docid": "055f5ddef2f2a83f3de33f6b0e6bd3f2", "score": "0.53614813", "text": "def alias_attribute(new_alias,attr)\n\n # get to the base attribute\n while alias_attributes[attr]\n attr = alias_attributes[attr]\n end\n\n raise UndefinedAttribute, \"#{attr} is not a defined attribute so it cannot be aliased\" unless defined_attributes[attr]\n\n alias_attributes[new_alias] = attr\n\n define_method(new_alias) do\n send(attr)\n end\n define_method(\"#{new_alias}?\") do\n send(\"#{attr}?\")\n end\n define_method(\"#{new_alias}=\") do |*args, &block|\n send(\"#{attr}=\",*args, &block)\n end\n end", "title": "" }, { "docid": "d4157512887b402be5ce2ac49e40b6b5", "score": "0.5359042", "text": "def alias_tag\n self.alias_id && self.alias ? self.alias.name : \"\"\n end", "title": "" }, { "docid": "8e2d1a809eefc276eacc7a27958dc13d", "score": "0.5352577", "text": "def aliases; end", "title": "" }, { "docid": "8e2d1a809eefc276eacc7a27958dc13d", "score": "0.5352577", "text": "def aliases; end", "title": "" }, { "docid": "8e2d1a809eefc276eacc7a27958dc13d", "score": "0.5352577", "text": "def aliases; end", "title": "" }, { "docid": "8e2d1a809eefc276eacc7a27958dc13d", "score": "0.5352577", "text": "def aliases; end", "title": "" }, { "docid": "8e2d1a809eefc276eacc7a27958dc13d", "score": "0.5352577", "text": "def aliases; end", "title": "" } ]
6ac945b2630e536f507d6467619875c8
Drops current claim for attached user and removes their current data
[ { "docid": "172da7afec4368bc16509f5af6ce7189", "score": "0.6336432", "text": "def drop_claim(account)\n case self.status\n when STATUS_DE1, STATUS_DE2\n Annotation.destroy_all({document_id: self.id, account_id: account.id})\n Group.destroy_all({document_id: self.id, account_id: account.id})\n newStatus = self.status == STATUS_DE2 ? STATUS_DE1 : STATUS_NEW\n if self.de_one_id == account.id\n self.update({status: newStatus, de_one_id: self.de_two_id, de_two_id: nil, de_one_complete: self.de_two_complete, de_two_complete: nil})\n else\n self.update({status: newStatus, de_two_id: nil})\n end\n when STATUS_IN_QC, STATUS_IN_SUPP_QC\n Group.destroy_all({document_id: self.id, account_id: account.id, iteration: self.iteration})\n self.update({status: self.status - 1, qc_id: nil})\n AnnotationGroup.joins(:group).where({\"groups.document_id\" => self.id, :iteration => self.iteration}).update_all({approved_count: 0})\n when STATUS_IN_QA, STATUS_IN_SUPP_QA\n annotation_notes.where({:document_id => self.id}).destroy_all\n AnnotationGroup.joins(:group).where({\"groups.document_id\" => self.id, :iteration => self.iteration}).update_all({qa_approved_by: nil})\n Group.where({\"groups.document_id\" => self.id, :iteration => self.iteration}).update_all({qa_approved_by: nil})\n self.update({status: self.status - 1, qa_id: nil, qa_note: nil})\n when STATUS_IN_SUPP_DE\n Group.destroy_all({document_id: self.id, iteration: self.iteration})\n AnnotationGroup.joins(:annotation).destroy_all({\"annotations.document_id\" => self.id, :iteration => self.iteration, :created_by => account.id})\n self.annotation_notes.where(:iteration => self.iteration - 1).update_all({:de_ref => nil})\n self.update({status: STATUS_READY_SUPP_DE, de_one_id: nil})\n end\n end", "title": "" } ]
[ { "docid": "f28c128a2084f8043b6642f6cd1bf72d", "score": "0.79410726", "text": "def unclaim\n update(user: nil)\n end", "title": "" }, { "docid": "290e083e7a836caa1db1178595f23c48", "score": "0.67084706", "text": "def delete_current_user\n\t\tcurrent_user = nil\n\tend", "title": "" }, { "docid": "e3b2705399b4fd10f957533d67d83649", "score": "0.66364473", "text": "def unlink\n self.user_id = nil\n self.save\n end", "title": "" }, { "docid": "f7286e8af0ca9d80f255cf7dccd52d4b", "score": "0.662606", "text": "def remove_key\n @user = nil\n end", "title": "" }, { "docid": "423a8cc87b5ceee98dcc3ee68b1bfa12", "score": "0.6588075", "text": "def deauthorized\n user.update_attributes(\n stripe_user_id: nil,\n publishable_key: nil,\n secret_key: nil,\n currency: nil\n )\n end", "title": "" }, { "docid": "0ad5aae5cd472c827224bfcbe40e12e6", "score": "0.6456132", "text": "def update_claim_attributes(token, claim_user)\n self.first_name = claim_user.first_name\n self.last_name = claim_user.last_name\n self.cover_photo = claim_user.cover_photo\n self.avatar = claim_user.avatar\n if claim_user.reels.any?\n self.reels = claim_user.reels\n end\n\n self.save!\n claim_user.destroy\n end", "title": "" }, { "docid": "888047c0c37fe24a3cd0b63c2b683fd2", "score": "0.64529365", "text": "def remove_from_user(item)\n self.items.delete(item)\n item.owner = nil\n end", "title": "" }, { "docid": "0edea72efb21e6948ed7efeb2e2a8943", "score": "0.6395108", "text": "def remove_user\n \n session[:user_id] = nil\n end", "title": "" }, { "docid": "6a69baf65d7ec7b54409862eb5d34b07", "score": "0.63849366", "text": "def unclaim\n timeslot = Timeslot.find(params[:id])\n user = timeslot.user\n if current_user.id == timeslot.user_id || current_user.user_role.can_claim_unclaim\n flash[:notice] =\n \"You have unclaimed the timeslot at #{timeslot.time.strftime('%l:%M %P')}\n for the role #{timeslot.role} #{timeslot.role_number}\"\n\n if timeslot.is_approved\n user.total_approved_hours -= timeslot.duration\n\n case timeslot.role\n when 'Front Desk'\n user.front_office_hours -= timeslot.duration\n when 'Runner'\n user.pantry_runner_hours -= timeslot.duration\n when 'Volunteer'\n user.volunteer_hours -= timeslot.duration\n end\n\n else\n user.total_unapproved_hours -= timeslot.duration\n\n end\n user.save\n timeslot.is_approved = false\n timeslot.user = nil\n timeslot.save\n end\n redirect_to event_path(timeslot.event)\n end", "title": "" }, { "docid": "16e652e3caea55ecf228326d1746d0ae", "score": "0.63784045", "text": "def remove_user(user)\n \tuser.room = nil\n \tuser.save\n end", "title": "" }, { "docid": "3941aeb49f6917386a845ca782076c73", "score": "0.6365885", "text": "def delete_user_profile\n account.delete_cc_details\n account.save!\n end", "title": "" }, { "docid": "ae8503752c64943c8278df5fe63fe018", "score": "0.6353175", "text": "def clear_current_user\n self.current_user = nil\n end", "title": "" }, { "docid": "0e752a5a0702ef28f36be6d93e18171b", "score": "0.632686", "text": "def remove_reader_user email\n remove_access_role_scope_value :reader, :user, email\n end", "title": "" }, { "docid": "f4ada9cb79e0d4d4e1257d611e1a4cba", "score": "0.6308562", "text": "def clear_current_user; end", "title": "" }, { "docid": "e09ffbd99f3b176f541fd94be21f6a48", "score": "0.6298399", "text": "def destroy\n @user_prize.destroy\n end", "title": "" }, { "docid": "77d7fe8c12a840551a65fe6616e1177b", "score": "0.62781394", "text": "def destroy\n @user.destroy\n Auth0ManagementAPI.delete_user current_user.id\n end", "title": "" }, { "docid": "b35fcee7d65ac9cb8a2de45cb1973f19", "score": "0.6275967", "text": "def destroy\n get_user().delete\n end", "title": "" }, { "docid": "a16d3b3cd4db5bdc6825ad53011a1aa8", "score": "0.6249342", "text": "def destroy\n current_user.destroy\n end", "title": "" }, { "docid": "663cdbcb8061ee2b3083c18493735fae", "score": "0.6238585", "text": "def delete\n appctrl_delete( 'User' )\n @user = @record # (historical)\n end", "title": "" }, { "docid": "a1be60e7e2bca887c4ca6f8ae062431f", "score": "0.6220427", "text": "def teardown\n remove_user :login_id => @user.login_id\n end", "title": "" }, { "docid": "182526090016a57eb165bdd5bf7e0e50", "score": "0.6219798", "text": "def delete_asset\n user = User.find(params[:user_id])\n if user == current_user\n asset = user.attached_assets.find(params[:pic])\n asset.asset.clear\n asset.destroy\n user.save(:validate => false)\n sign_in user\n redirect_to edit_user_path(user)\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "6ace70dc557c67b2ed20409d55dedf55", "score": "0.6215791", "text": "def destroy\n @avatar = @user.avatar\n @avatar.purge\n redirect_to user_path(@user)\n end", "title": "" }, { "docid": "4b3555d09ac380018eb04daa19971b62", "score": "0.6201894", "text": "def unSetUser\n client.adelete_user(getUser)\n end", "title": "" }, { "docid": "43f7f2c7f9354ecba36d534d0496ed02", "score": "0.6199408", "text": "def delete\n current_user.university = nil\n current_user.save\n end", "title": "" }, { "docid": "8c2aacd3144a0bcc4eb019266ab44699", "score": "0.6197335", "text": "def delete current_user\n raise RequestError.new(:internal_error, \"Delete: no user specified\") if current_user.nil?\n\n if current_user.id != self.user_id then # if random owner \n # remove all links between this file and the current user\n FileUserAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy!\n # remove all associations where this file is \"inside\" a folder for the current user only\n FileFolderAssociation.all(file_id: self.id).each do |asso|\n asso.destroy! if current_user.x_files.get(asso.parent_id)\n end\n # remove all associations where this file is shared >TO< another user\n SharedToMeAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy!\n\n else # if true owner \n # remove all links between this file and ALL users\n FileUserAssociation.all(x_file_id: self.id).destroy!\n # remove all associations where this file is \"inside\" a folder for ALL users\n FileFolderAssociation.all(file_id: self.id).destroy!\n # remove all associations where this file is shared >BY< the current user\n SharedByMeAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy! \n\n # if a content exist and if the user is the original owner, reduce the user's used space\n current_user.remove_file_size self.content.size if content\n\n # remove the content if and only if the true owner removes the file\n # a hook inside the content.delete method will check it this content is referenced by antoher file.\n self.content.delete if self.content\n\n # now remove the entity\n self.destroy!\n end\n end", "title": "" }, { "docid": "9b9f6a901237257be5f80b276f2c6deb", "score": "0.61827475", "text": "def delete_user\n @_current_user = session[ :current_user_id ] = nil\n reset_session\n end", "title": "" }, { "docid": "ab415885e5c587407874bfade58de29b", "score": "0.6180943", "text": "def discard_profile!\n self.current_profile = nil\n end", "title": "" }, { "docid": "a547b0f3432bf0d2dc8490b91398bf90", "score": "0.6173541", "text": "def destroy\n @robots=\"noindex,nofollow\"\n @user = @account\n respond_to do |format|\n if @user == current_user\n format.json { render :json=>{:error=>[nil, \"You cannot delete yourself\"]}}\n end\n @user.person.user_id=nil if @user.person.present?\n @user.person.save if @user.person.present?\n if !@user.destroy\n format.json { render :json=>report_error(@user)}\n else\n format.json { render :json=>{}}\n end\n end\n end", "title": "" }, { "docid": "dd40bf6c4e0a99843a29a8269c94622f", "score": "0.6158994", "text": "def delete_myself\n @@user.destroy\nend", "title": "" }, { "docid": "2c56281d16166155979e81b19733c55e", "score": "0.6156387", "text": "def destroy_and_child\n self.claims.each do |claim|\n claim.destroy_and_child\n end\n self.destroy\n end", "title": "" }, { "docid": "fc3031fa5894478827cb948e1d17f2e5", "score": "0.6156318", "text": "def delete\r\n for item in Item.items_by_agent(self)\r\n item.delete\r\n end\r\n\r\n for org in Organization.organizations_by_user(self)\r\n org.remove_member(self)\r\n end\r\n self.delete_profile_picture\r\n @@users.delete(self)\r\n end", "title": "" }, { "docid": "54a1e226c981b458c4287fd31f25dff5", "score": "0.61544025", "text": "def dispose_user\n User.current_user = nil\n end", "title": "" }, { "docid": "714115490bb06020cb3fa223ebcdca4f", "score": "0.61528766", "text": "def destroy\n user = User.find_by(authentication_token: request.headers['X-User-Token'])\n user.authentication_token = nil\n user.save\n sign_out(user)\n end", "title": "" }, { "docid": "2788d181594a4151c2811b2e68836ae3", "score": "0.6149119", "text": "def remove_user(user)\n self.user_ids.delete user.id\n self.save\n user.topic_ids.delete self.id\n user.save\n end", "title": "" }, { "docid": "209a65442aa98ed19573dad7958111aa", "score": "0.61401314", "text": "def remove_owner_user email\n remove_access_role_scope_value :owner, :user, email\n end", "title": "" }, { "docid": "29c861ebd111ef297205b9886361ed7c", "score": "0.6137349", "text": "def remove_auth_user(user)\n\n user_id = user.id.to_s\n\n ary = self.get_read_users_a\n ary.delete(user_id)\n self.set_read_users(ary)\n\n ary = self.get_write_users_a\n ary.delete(user_id)\n self.set_write_users(ary)\n end", "title": "" }, { "docid": "2f95d9a20285ea54e04790dff58d411b", "score": "0.6130828", "text": "def delete_avatar\n current_user.avatar=nil\n current_user.save\n redirect_to root_path\n end", "title": "" }, { "docid": "8660bb1a4ebc5b0624cd54dfb52dfe75", "score": "0.6129344", "text": "def destroy\n if !self.insurance_billings.blank?\n # the patient insured record is used within insurance_billings, dont allow deletes\n errors.add :base, \"The patient insured record is used within a cliam, deletions of the insured record are not allowed.\"\n else\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end\n end", "title": "" }, { "docid": "e9be024484349830d54323714f47a60d", "score": "0.6125053", "text": "def destroy\n @profile_claim = ProfileClaim.find(params[:id])\n @profile_claim.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_claims_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e5afd4695bd995351446af697435bb5", "score": "0.61250067", "text": "def remove_owner_iam_member identity\n remove_access_role_scope_value :owner, :iam_member, identity\n end", "title": "" }, { "docid": "0e17e2f94faa8bda7b08890e66e6accc", "score": "0.61078364", "text": "def destroy\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in claims Delete\"\n begin\n @claim.destroy\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : claims Deleted Successfully\"\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} claims_controller destroy method\" }\n end \nend", "title": "" }, { "docid": "91aeb238092ce6a058aeede0b81613b3", "score": "0.61044514", "text": "def remove_avatar\n # When removing other user's avatar, ensure current user is mod or higher.\n if @current_user.id != params[:id] && !@current_user.is_mod_or_higher?\n access_denied\n return\n end\n @user = User.find(params[:id])\n @user.avatar_post_id = nil\n if @user.save\n flash[:notice] = \"Avatar removed\"\n else\n flash[:notice] = \"Failed removing avatar\"\n end\n redirect_to :action => :show, :id => params[:id]\n end", "title": "" }, { "docid": "0e4e3eb4320a6a2c4c37578b13d06574", "score": "0.60998493", "text": "def destroy\n logger.info \"User ID #{ @user.id } #{ @user.name } self-deleted\"\n @user.name = 'Self Deleted'\n @user.email = \"self-deleted-#{@user.id}@example.com\"\n @user.active = false\n @user.approved = false\n @user.city = ''\n @user.state = ''\n @user.country = ''\n @user.time_zone = ''\n @user.remove_photo = true\n @user.speaker_id = 0\n if @user.save\n logger.info \"User #{@user.id} #{ @user.name } self-deleted\"\n # redirect_to logout_path This happens automatically because active and approved were disabled\n else\n logger.error \"Error self-deleting user #{@user.id}: #{ @user.errors.full_messages.join(', ')}\"\n flash[:notice] = \"There was a problem removing your account - please contact an admin.\"\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "a3e5a4d4f62d701a20d5be47c736c017", "score": "0.6092898", "text": "def destroy\n current_user.destroy\n session[:user_id] = nil\n end", "title": "" }, { "docid": "204b5cc47ff559164742e7287fefd9ac", "score": "0.60896176", "text": "def destroy\n user.delete(path)\n end", "title": "" }, { "docid": "ca51bd77c20ac5cde47bb3be1c0e25e9", "score": "0.608795", "text": "def destroy\n @claim_prior_auth.destroy\n respond_to do |format|\n format.html { redirect_to claim_prior_auths_url, notice: 'Claim prior auth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "85467b690c6a167802af7924e55ce3cd", "score": "0.6086257", "text": "def clear_current_registering_user\n self.current_registering_user = nil\n end", "title": "" }, { "docid": "85467b690c6a167802af7924e55ce3cd", "score": "0.6086257", "text": "def clear_current_registering_user\n self.current_registering_user = nil\n end", "title": "" }, { "docid": "6b61029c83f869a2681aa0e28411b0ed", "score": "0.6081754", "text": "def clear_current_user\n set_current_user(nil)\n end", "title": "" }, { "docid": "0850ed2545265114bfd5d19cee571b59", "score": "0.6077612", "text": "def destroy\n\n current_user&.authentication_token = nil\n\n if current_user.save\n head(:ok)\n else\n head(:unauthorized)\n end\n\n end", "title": "" }, { "docid": "78120c15e11bee3cd466a3613af63222", "score": "0.6064337", "text": "def erase\n user&.update!(email: SolidusGdpr.configuration.erased_email.call)\n end", "title": "" }, { "docid": "f6629570d7654e81802813ac08eb8743", "score": "0.60586023", "text": "def destroy\n # Delete the user\n execute(\"ipmitool channel setaccess #{@channel} #{@property_hash[:userid]} callin=off ipmi=off link=off privilege=15\")\n execute(\"ipmitool user disable #{@property_hash[:userid]}\")\n\n # Update the property hash\n @property_hash[:ensure] = :absent\n end", "title": "" }, { "docid": "efb82a9075c3908c724a98aaea53221b", "score": "0.6058521", "text": "def destroy\n if @user.removable\n if @user.email == current_user.email\n log_out\n @user.destroy\n redirect_to root_url, notice: 'User was successfully destroyed.'\n else\n @user.destroy\n redirect_to users_url, notice: 'User was successfully destroyed.'\n end\n end\n end", "title": "" }, { "docid": "f3b3e92c36239c9343b0674388da1cc9", "score": "0.6054792", "text": "def destroy\n general_controller_delete_with_log(current_user.user_holder, @user_holder, @medication, user_holder_medications_path(@user_holder))\n end", "title": "" }, { "docid": "6cbe11669ce2a3a51aed1fabee4aab1c", "score": "0.6053286", "text": "def destroy\n session[:impersonate_id] = nil\n super\n end", "title": "" }, { "docid": "7d2083c8eedcbd3e3bdde13d74338db4", "score": "0.6049528", "text": "def remove_owner(current_user)\n self.owners.delete(current_user.id)\n self.save!\n if self.owners.empty?\n self.destroy! # Exclamation point raises exception on failure\n end\n end", "title": "" }, { "docid": "3d38b944043468f05853fec40d3c208f", "score": "0.6048958", "text": "def RemoveUser(useremail)\n userid = getuserdata(useremail)[\"userid\"]\n RemoveUserData(userid)\n RemoveUserCreds(userid)\n end", "title": "" }, { "docid": "e2c6f69e88ac8226377866e98df54cf6", "score": "0.60484993", "text": "def delete\n super(@user)\n end", "title": "" }, { "docid": "63759c9844d360ace37152675979eef0", "score": "0.60476005", "text": "def remove_user_from_session!\n @active_rbac_user = nil\n reset_session\n end", "title": "" }, { "docid": "0bcd5cf31cece45ae9c3fe7598a5cfe0", "score": "0.6036631", "text": "def destroy\n @user = Relationship.find(params[:id]).accessed\n current_user.unaccess!(@user)\n\tredirect_to @user\n end", "title": "" }, { "docid": "bd0e969adb0d2f6a3bb29dae73e1b345", "score": "0.6030173", "text": "def delete_avatar\n self.avatar = nil\n end", "title": "" }, { "docid": "1f4a2c86ca77653ce4bfcc4c37bf01d5", "score": "0.6028722", "text": "def delete\n Modeles::User.delete @userInTable.id\n @userInTable = nil\n @name = nil\n @groups = nil\n @mail = nil\n @website = nil\n @isAdmin = nil\n @files = nil\n @errors = nil\n end", "title": "" }, { "docid": "84c4c911764ed1f8d710d0d318cc6f75", "score": "0.60121006", "text": "def delete!\n groups.clear\n access_keys.clear\n policies.clear\n mfa_devices.clear\n signing_certificates.clear\n login_profile.delete if login_profile.exists?\n delete\n end", "title": "" }, { "docid": "9603ec2fd99ebdcf03b7dbc3814c4933", "score": "0.6011538", "text": "def remove_current\n if !current_user.avatar.nil?\n current_user.avatar.destroy\n else\n true\n end\n end", "title": "" }, { "docid": "39329847f5012eeccc5345ddc2851b5d", "score": "0.60104644", "text": "def destroy_user\n current_user\n if current_user\n @current_user_id = @currentUser.id\n @currentUser.destroy\n # The following will log user out after destroying the user.\n session[:user_id] = nil\n end\nend", "title": "" }, { "docid": "ab1df8bfe0cea0f8b51ddbab02185cdc", "score": "0.5997276", "text": "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fefa536e53b8b32b241c90b8f7cca6f8", "score": "0.59961444", "text": "def unassign\n self.owner = nil\n save\n end", "title": "" }, { "docid": "a65ac8eac0e73e455282615213e916bd", "score": "0.59916806", "text": "def destroy\n @claim = Claim.find(params[:id])\n @claim.destroy\n\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a65ac8eac0e73e455282615213e916bd", "score": "0.59916806", "text": "def destroy\n @claim = Claim.find(params[:id])\n @claim.destroy\n\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cb5c679a4fcbb6e2e037fff671c0512c", "score": "0.5991522", "text": "def beneficiary_log_out\n\t\tforget_b(beneficiary_current_user)\n\t\tsession.delete(:beneficiary_id)\n\t\t@current_user = nil\n\tend", "title": "" }, { "docid": "88958baf305a75d18962814e5c8e379f", "score": "0.5990101", "text": "def destroy #TODO: SOFT DELETE\n\t\tuser=User.find(params[:id])\n\t\tsign_out user\n\t\tuser.wipe\n\t\tflash[:success]=\"By #{user.name} it was a pleasure to have meet you\"\n\t\tredirect_to root_path\n\tend", "title": "" }, { "docid": "50607728dc094be05b89e3966bdacf65", "score": "0.5988061", "text": "def unlink_impact\n if !self.impact_uid.blank? && !self.uid.include?('_impact')\n linked_tracker = Tracker.find_by(uid: self.impact_uid)\n linked_tracker.update_attributes(original_uid: nil,\n no_original_uid: 'Original was deleted.')\n elsif !self.original_uid.blank? && self.uid.include?('_impact')\n linked_tracker = Tracker.find_by(uid: self.original_uid)\n linked_tracker.update_attribute(:impact_uid, nil)\n end\n end", "title": "" }, { "docid": "5f2795c5df21ba21e570dcf92f536606", "score": "0.59867615", "text": "def destroy\n if !self.insurance_sessions.blank?\n # record is used in an insurance_session, dont allow deletion\n errors.add :base, \"Patient insured record is used within session, deletion is not allowed.\"\n else\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end \n end\n end", "title": "" }, { "docid": "b6285a783253d7746944b3639e33ccc3", "score": "0.5986663", "text": "def remove\n use\n login('root', '')\n Cmd.new(\"devpi user -y --delete '#{new_resource.name}'\")\n logoff\n end", "title": "" }, { "docid": "46e21727e274781ec0d743adb3287156", "score": "0.59853476", "text": "def destroy\n @user.destroy\n # after destroing since destroyed user was logged in , session will lose its id, si its needs to be nullified\n # in order to avoid being logged out on deleting any other user you need to set up session user id to nill \n # !! only in case if that passed @user is the one who is logged in\n session[:user_id] = nil if @user == current_user\n flash[:notice] = \"Account and all associated articles successfully deleted\"\n redirect_to articles_v2s_path\n end", "title": "" }, { "docid": "6e5c9e6c22234e5d6976db155824aa21", "score": "0.5979335", "text": "def remove\n snapby = Snapby.find(params[:snapby_id])\n if current_user.id == snapby.user_id or is_admin\n snapby.update_attributes(removed: true)\n snapbyer = User.find(snapby.user_id)\n snapbyer.update_attributes(snapby_count: snapbyer.snapbies.where(\"removed = 0\").count)\n\n render json: { result: { messages: [\"snapby successfully removed\"] } }, status: 200\n else\n render json: { errors: { internal: [\"The snapby does not belong to the current user\"] } }, :status => 500\n end\n end", "title": "" }, { "docid": "4b59d755c68a9b1f0cccd7945bebe500", "score": "0.59776515", "text": "def destroy\n User.mongo['users'].remove(@attributes)\n end", "title": "" }, { "docid": "9b14255a392f63fa0ceda367a789fa94", "score": "0.59734684", "text": "def teardown\n @user = nil\n end", "title": "" }, { "docid": "8f1ade0b5e8583b25f1e1a5db0e1ad79", "score": "0.59687465", "text": "def forget(user)\n\t\t# call instance method forget to set DB hash-string to nil\n\t\tuser.forget\n\t\t# delete relevant values from cookie\n\t\tcookies.delete(:user_id)\n\t\tcookies.delete(:remember_token)\n\t\t# now call in log_out \n\tend", "title": "" }, { "docid": "569e404bdc68fdd4eeb4c124f2bf8478", "score": "0.59682673", "text": "def remove_user user\n current_user.episodes.each do |episode|\n episode.users -= [user]\n end\n end", "title": "" }, { "docid": "9bbc150daa638b1a70327754da068973", "score": "0.5966973", "text": "def drop\n\t\tif checkAuth(params)\n \t\ta = Activity.find_by(id: params[:ActID])\n\t\t\trelation = a.memberactivities.find_by(user_id: params[:UserID])\n\t\t\trelation.delete\n\t\t\ta.update(member_number: a.member_number - 1)\n\t\t\trtn = {\n\t\t \tstatus: \"201\"\n\t\t }\n\t\trender :json => rtn\n \telse\n \t\trtn = {\n\t\t\t\terrormsg: \"Authentication Denied.\",\n status: \"401\"\n }\n\t render :json => rtn\n \tend\n\tend", "title": "" }, { "docid": "b8422c59104203a0578c435944881ee4", "score": "0.5965524", "text": "def clear(user_id)\n Lacmus.fast_storage.del key(user_id)\n Lacmus.fast_storage.del key(user_id, true)\n end", "title": "" }, { "docid": "1bae892b0b1491ae46242ae4354335bf", "score": "0.59632105", "text": "def destroy\n get_master_context\n @user = User.find(params[:id])\n authorize_muni_admin!(:delete, @user)\n if @user\n @user.destroy\n end\n end", "title": "" }, { "docid": "41a7742459e15b2e2713cd0d8145d7d8", "score": "0.5962574", "text": "def forget(user)\n user.forget\n cookies.delete(user_id_cookie)\n cookies.delete(user_token_cookie)\n end", "title": "" }, { "docid": "deafb6410afe5f0e1b07a543dadb69b5", "score": "0.59557545", "text": "def destroy_resource(object)\n #If user is a group leader thenit will nullify position of the group leader\n @group = Group.where(users_id: object.id) rescue nil\n if @group != nil\n @group.each do |group|\n group.update_attributes(:users_id => nil)\n end\n end\n #If user is not a group leader it will remove him/her from every group he/she belongs to\n @ingroups = InGroup.where(users_id: object.id) rescue nil\n if @ingroups != nil\n @ingroups.destroy_all\n end\n\n #All attendance records made by that user will be nullified and records for the user will be removed\n @attrec = Attendance.where(user_id: object.id) rescue nil\n if @attrec != nil\n @attrec.destroy_all\n end\n @atttrack = Attendance.where(tracker_id: object.id) rescue nil\n if @atttrack != nil\n @atttrack.each do |at|\n at.update_attributes(:tracker_id => nil)\n end\n end\n\n #If user is deleted all messages from messagelist will be removed. If for some magical reason user is being deleted is admin then the message and all \n #message listst will be destroyed\n @msglist = MessageList.where(users_id: object.id) rescue nil\n if @msglist!=nil\n @msglist.destroy_all\n end\n\n @msg = Message.where(users_id: object.id) rescue nil\n if @msglist != nil\n @msg.each do |m|\n @all = MessageList.where(messages_id: m.id)\n @all.destroy_all\n end\n @msg.destroy_all\n end\n \n #Destroy the user\n \n @user = User.find_by_id(object.id).destroy\n if @user.uberadmin != true\n @user.destroy\n else\n end\n end", "title": "" }, { "docid": "8ce62ea661c3b28d8da00f17f0d5de0f", "score": "0.5954727", "text": "def soft_delete!\n User.transaction do\n # set its deleted_at timestamp\n self.deleted_at = Time.now\n save!\n \n # set the visibility of all offers and quests to deleted\n ActiveRecord::AccessControl.as(User.admin) do\n Quest.update_all({ :visibility => \"deleted\" }, :owner_id => self)\n # TODO: Offer.update_all({ :visibility => \"deleted\" }, :owner_id => self)\n end\n\n # remove users social identities \n Identity.oauth_identities.each do |identity_name|\n if (_identity = identity(identity_name))\n _identity.destroy\n end\n end\n \n # adjust the email identity so, that the email address is kept for \n # future references and that the user might re-signup with same email\n # again.\n if (email = identity(:email))\n Identity.update_all({:type => \"Identity::Deleted\"}, :id => email)\n end\n end\n end", "title": "" }, { "docid": "7e9aa56a9905dd2fb5c6de548afbf82e", "score": "0.59545153", "text": "def destroy\n @user.update_attributes(:api_authtoken => nil, :authtoken_expiry => nil)\n render_success_message(200, \"Token cleared\")\n end", "title": "" }, { "docid": "b8648a4a4e191aec195caa178f3f5c89", "score": "0.5951556", "text": "def leave user\n demote user\n self.users.destroy user\n if self.users.size == 0\n self.destroy\n end\n end", "title": "" }, { "docid": "a45ea6c17e51e3fade7c049df595b399", "score": "0.59504855", "text": "def destroy\n @user_profile=UserProfile.find(params[:id])\n if current_user == @user_profile.user\n @user_profile.destroy\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "b5919a1ad267db5aef10b43025ea4a07", "score": "0.5949637", "text": "def forget_b(user)\n user.forget_beneficiary\n cookies.delete(:beneficiary_id)\n cookies.delete(:remember_token)\n end", "title": "" }, { "docid": "bfc1c447eb2a1a5decf1e315ce93fd80", "score": "0.5949279", "text": "def deprovision\n provisioningobject_provisionings_path = user_provisionings_path(@provisioningobject, active: true )\n\n super \n end", "title": "" }, { "docid": "20d4cf954ec8971221f7c54501c0bfd9", "score": "0.5947471", "text": "def destroy\n #Clear out current user session login before delete\n user_to_be_deleted = @user.user_id\n if belongs_to_current_user(user_to_be_deleted)\n session[:user_id] = nil\n end\n @user.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n flash[:notice] = \"#{user_to_be_deleted}\" + \n \"'s account has been terminated\"\n end\n end", "title": "" }, { "docid": "e64195205c075023d26f3a950e74d575", "score": "0.594597", "text": "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:rem_token)\n end", "title": "" }, { "docid": "d3ee1de5c25afb017ad18209a0483ae3", "score": "0.59434646", "text": "def destroy\n # Find the user by ID\n @user = User.find(params[:user_id])\n # Destroys the user's Lock record\n @user.lock.destroy!\n end", "title": "" }, { "docid": "cc7c5e8cb5ae7600c78be3e55aa2d656", "score": "0.59427416", "text": "def destroy\n @user = User.delete(current_user)\n session[:user_id] = nil\n redirect_to root_path\n end", "title": "" }, { "docid": "9fde087aece1745d3bd4a993095b2d23", "score": "0.5941964", "text": "def destroy\n subscription = Recurly::Subscription.find(recurly_account.account_code)\n Recurly::Subscription.delete(recurly_account.account_code)\n\n billing_info = Recurly::BillingInfo.find(recurly_account.account_code)\n billing_info.destroy\n user.update_attribute(:subscription_plan, nil)\n end", "title": "" }, { "docid": "341a8e1aa1c02e41b0d690a53d4a7856", "score": "0.5931527", "text": "def remove_request_info\n @user.bank_value += @pto_request.cost\n @user.save\n\n @calendar.signed_up_agents.delete(@user.name)\n @calendar.signed_up_total >= 1 ? @calendar.signed_up_total -= 1 : @calendar.signed_up_total = 0\n @calendar.save\n UpdatePrice.update_calendar_item(@calendar)\n HumanityAPI.delete_request(@pto_request.humanity_request_id)\n end", "title": "" }, { "docid": "6b50e24b068ea019ab3f382b9e0a0c14", "score": "0.59297055", "text": "def down\n employee = Employee.find_by_phone \"3038153575\"\n Employee.delete employee\n \n admin = User.find_by_email \"julialt@gmail.com\"\n User.delete admin\n end", "title": "" }, { "docid": "d27b8bb632ab2e9d94b3a2127ea21e11", "score": "0.59287065", "text": "def remove_reader_iam_member identity\n remove_access_role_scope_value :reader, :iam_member, identity\n end", "title": "" }, { "docid": "6916d7c09fcf3c00b161a0f6f661970f", "score": "0.59279704", "text": "def sign_out\n self.identity = nil\n end", "title": "" } ]
5d5154a3c6bdbcb239c32df4bd7b6f4e
Returns all the listerners instances.
[ { "docid": "129db1bc26b83c653c947fcaf2c77428", "score": "0.0", "text": "def listeners\n @@listeners ||= @@listener_classes.collect {|listener| listener.instance}\n end", "title": "" } ]
[ { "docid": "82ac743875ef7c5ea890138e736672ec", "score": "0.7007815", "text": "def list_of_instances\n super\n end", "title": "" }, { "docid": "bd684f2ba730a96834785db4dd208ef4", "score": "0.68962485", "text": "def instances()\n return @instances\n end", "title": "" }, { "docid": "6d63e9285dd7ce2c336ba56af1523007", "score": "0.6853371", "text": "def instances\n end", "title": "" }, { "docid": "ecd27c50b197184c8abbc810921e3bda", "score": "0.6773499", "text": "def list\n self.class.list\n end", "title": "" }, { "docid": "d903ed9ea78b6c45a6a27e08d3e412da", "score": "0.67562246", "text": "def instances\n @instances ||= []\n end", "title": "" }, { "docid": "223c1b532fa422700db399b3023ec983", "score": "0.67027146", "text": "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "title": "" }, { "docid": "2ff065dda81a85a2d42ea00e66c241ea", "score": "0.6577454", "text": "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "title": "" }, { "docid": "e135f4f5dc60e11ed382ad3b450c3d48", "score": "0.6548552", "text": "def lists\n Resources::Lists.new(self)\n end", "title": "" }, { "docid": "85719e462fed2496c3068dcc405c32e5", "score": "0.6442946", "text": "def all\n @list\n end", "title": "" }, { "docid": "ad9bb50bd6a1f451d194d70dc15605f9", "score": "0.6420955", "text": "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "title": "" }, { "docid": "6309274a3383738d953706e3bddebb0f", "score": "0.6408007", "text": "def listings\n return @listings ||= build_all_listings\n end", "title": "" }, { "docid": "6309274a3383738d953706e3bddebb0f", "score": "0.6408007", "text": "def listings\n return @listings ||= build_all_listings\n end", "title": "" }, { "docid": "6309274a3383738d953706e3bddebb0f", "score": "0.6408007", "text": "def listings\n return @listings ||= build_all_listings\n end", "title": "" }, { "docid": "adcacc1ac4970dd2c20f913da8f4bb75", "score": "0.6378877", "text": "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "title": "" }, { "docid": "d84a2bba2ea55153811a94fd9855f5c6", "score": "0.63290834", "text": "def list\n @@list\n end", "title": "" }, { "docid": "ac9a39adc1f32e42cd66ac1578a880db", "score": "0.6327013", "text": "def entries\n @list\n end", "title": "" }, { "docid": "f443e093b4e9d5aaa39bb731da741323", "score": "0.6316236", "text": "def list\n @list ||= manager_list\n end", "title": "" }, { "docid": "9f126018ffbfc286b600ac1dfcf943f1", "score": "0.63048947", "text": "def index\n @instances = Instance.all\n end", "title": "" }, { "docid": "9f126018ffbfc286b600ac1dfcf943f1", "score": "0.63048947", "text": "def index\n @instances = Instance.all\n end", "title": "" }, { "docid": "ba3ac26de6d6d3e6e4c667e5801f2539", "score": "0.62776995", "text": "def all\n self.class.all\n end", "title": "" }, { "docid": "205aebc018321c5458cdc4127848f36c", "score": "0.6225954", "text": "def list\n get()\n end", "title": "" }, { "docid": "185d3e6668bbf3efabff1cc54f4c263e", "score": "0.62156576", "text": "def registered_lists\n List.registered(id)\n end", "title": "" }, { "docid": "54a1c3e2073f0a8fa76c6921bc54a860", "score": "0.620732", "text": "def list(&block)\n @driver.list(&block)\n end", "title": "" }, { "docid": "db51936ec3d2401fba56fdc090c7c9a5", "score": "0.6192042", "text": "def list\n return @lists\n end", "title": "" }, { "docid": "f9ae518abf05a4299eb562f4827158cb", "score": "0.61487395", "text": "def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end", "title": "" }, { "docid": "0efaf59cbeaeba3e8abe4ba4a87b9f4e", "score": "0.61349064", "text": "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "title": "" }, { "docid": "841578778c77b5c0ccbbc3d46891a036", "score": "0.613378", "text": "def listings\n self.trips.map{|trip| trip.listing}\n end", "title": "" }, { "docid": "e463976863461b169143d4eb53112fd5", "score": "0.6130217", "text": "def instances; end", "title": "" }, { "docid": "e463976863461b169143d4eb53112fd5", "score": "0.6130217", "text": "def instances; end", "title": "" }, { "docid": "581841af3617a21ea0fb3edca67cd4c7", "score": "0.61286736", "text": "def list\n return @list\n end", "title": "" }, { "docid": "3a4cd154cdf75908560f8aff58e0852c", "score": "0.61176544", "text": "def scrapers\n @@scrapers\n end", "title": "" }, { "docid": "79906fa9bc34f965d35c34a4247477ce", "score": "0.6099784", "text": "def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end", "title": "" }, { "docid": "fe784193cff44c01e6e4a92d93c87fac", "score": "0.60833174", "text": "def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end", "title": "" }, { "docid": "b4d9112f8522c6f8dbb989408181e380", "score": "0.6063139", "text": "def all\n collection.order(:display_name).all.\n map { |fields| Server.new_instance self, fields }\n end", "title": "" }, { "docid": "355dccd96b37946893dad861e606f70f", "score": "0.6059294", "text": "def info\n @listers.collect {|l| [l.name, l.description] }\n end", "title": "" }, { "docid": "55da26d6e611a58e8fe4e03f2dcb699b", "score": "0.6053909", "text": "def lists\n client.get_lists\n end", "title": "" }, { "docid": "b1939e0016e9002639ed9c036fab20d0", "score": "0.60531974", "text": "def list\n @list_helper ||= ListWrapper.new(self)\n end", "title": "" }, { "docid": "4232710a69b01f16af047d48bbd50834", "score": "0.6052767", "text": "def listings\n @listings = trips.select do |trip|\n trip.listings\n end\n end", "title": "" }, { "docid": "93ce013aab7fcac75de5ace85680a259", "score": "0.6041846", "text": "def index\n @truckers = Trucker.all\n end", "title": "" }, { "docid": "51419d18470b76cb24ccb077de7cf709", "score": "0.60400456", "text": "def listings\n Zoopla::CachedListings.new.search(self).sort_by(&:updated_at).reverse!\n end", "title": "" }, { "docid": "6ae6826405c68342353f38766735e6be", "score": "0.6026687", "text": "def index\n @admin_retailers = Admin::Retailer.all\n end", "title": "" }, { "docid": "35080b3c114c2e3ef935cf32c1784f4a", "score": "0.6024953", "text": "def all(instance)\n data = service.list_users(instance).to_h[:items] || []\n load(data)\n end", "title": "" }, { "docid": "e4e53ceb24a56d55a4b5f39bd0f7af94", "score": "0.6020853", "text": "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "title": "" }, { "docid": "d08d9381b4eef4e4524ea3b1b41f07ff", "score": "0.599276", "text": "def get_all()\n raise \"Must be overridden\"\n end", "title": "" }, { "docid": "d3ba98c8348bdf1c468306b30b31258e", "score": "0.5982109", "text": "def list_all\n store_location\n query = create_query(:HerbariumRecord, :all, by: default_sort_order)\n show_selected_herbarium_records(query)\n end", "title": "" }, { "docid": "842dce051551915c970aee4022c7a5d6", "score": "0.5974441", "text": "def list_entries\n model_class.respond_to?(:list) ? model_scope.list : model_scope\n end", "title": "" }, { "docid": "9222a9a685bb6cf7c014c3d623f363e3", "score": "0.5964143", "text": "def index\n @listens = Listen.all\n end", "title": "" }, { "docid": "1bb7e8f537dd6dee8ba88cf77cc67346", "score": "0.59427637", "text": "def index\n @engineer_classes = EngineerClass.all\n end", "title": "" }, { "docid": "d9b211aa4ea78f5b6ac8d25a6bd75674", "score": "0.5933577", "text": "def index\n @instalers = Instaler.all\n end", "title": "" }, { "docid": "310d1aced71e7353b5af83eaaf54895e", "score": "0.59273225", "text": "def index\n @requesters = Requester.all\n end", "title": "" }, { "docid": "1dce4b00efef1b3e5fdd6e71736ec373", "score": "0.59122986", "text": "def index\n @trainers = Trainer.all\n end", "title": "" }, { "docid": "1dce4b00efef1b3e5fdd6e71736ec373", "score": "0.59122986", "text": "def index\n @trainers = Trainer.all\n end", "title": "" }, { "docid": "1dce4b00efef1b3e5fdd6e71736ec373", "score": "0.59122986", "text": "def index\n @trainers = Trainer.all\n end", "title": "" }, { "docid": "fb3ff721da3573cfcd48af85c6d6fa6f", "score": "0.5902736", "text": "def all_instances\n all_instances_de_hijos + tabla.entries.map { |entrada| generar_instancia(entrada) }\n end", "title": "" }, { "docid": "c05f002330460beed0229aefac6d7737", "score": "0.58961487", "text": "def list(scope = list_query)\n model.all(scope)\n end", "title": "" }, { "docid": "f9e0b1e75d449fd8ab8647f0bac0412c", "score": "0.5895646", "text": "def listings\n self.trips.map do |ti|\n ti.listing \n end\n end", "title": "" }, { "docid": "146c7a7f54465945ed1c3a2dcbaadbcf", "score": "0.5889353", "text": "def listings\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\t@listings = Listing.find_all_by_user_id(@current_user)\n\tend", "title": "" }, { "docid": "7be61fdc31a14794f280fa8e37131721", "score": "0.58875656", "text": "def list\n @list ||= []\n end", "title": "" }, { "docid": "7be61fdc31a14794f280fa8e37131721", "score": "0.58875656", "text": "def list\n @list ||= []\n end", "title": "" }, { "docid": "7889424da506369d631adc65363ec2e2", "score": "0.5885549", "text": "def clients\n trainers.map {|trainer| trainer.clients}.flatten\n end", "title": "" }, { "docid": "da8c6a934cb220553389f316065e2426", "score": "0.58836174", "text": "def index\n @reagent_lists = ReagentList.all\n end", "title": "" }, { "docid": "bf06f7ff939ece6512e450534a1ccf0d", "score": "0.58786213", "text": "def index\n @pt_trainers = Pt::Trainer.all\n end", "title": "" }, { "docid": "f4936058e9e7f464d0cf42970d5cd554", "score": "0.5876324", "text": "def index\n @kitchencabinets = Kitchencabinet.all\n end", "title": "" }, { "docid": "b41da0c2cac9d08d28fca2299c91216e", "score": "0.58706224", "text": "def index\n @loners = Loner.all\n end", "title": "" }, { "docid": "9e4447bd4f61a2d3610c2fbb0bd11331", "score": "0.58662087", "text": "def index\n @authers = Auther.all\n end", "title": "" }, { "docid": "9e4447bd4f61a2d3610c2fbb0bd11331", "score": "0.58662087", "text": "def index\n @authers = Auther.all\n end", "title": "" }, { "docid": "0c01389d137de91af0e5b398142d7bbe", "score": "0.5863469", "text": "def fetch_watchers\n watcher_users.to_a\n end", "title": "" }, { "docid": "51313986816566d0d18cb18ddb5657d9", "score": "0.5862725", "text": "def index\n @callers = Caller.all\n end", "title": "" }, { "docid": "a8d39d9a210d105b5e597994c03dcca0", "score": "0.584815", "text": "def index\n @launchers = Launcher.all\n end", "title": "" }, { "docid": "8b769803b00c959f7c9dabe1c4914de8", "score": "0.58363575", "text": "def index\n @lagers = Lager.all\n @datensAll = Daten.all\n end", "title": "" }, { "docid": "82fa0633d348d3f35babf5f1b7b4454e", "score": "0.5829921", "text": "def list\n @list\n end", "title": "" }, { "docid": "4ee4c124eb7333e4945a2173eb559628", "score": "0.5828911", "text": "def list\n\n get_list['list'].collect { |e| ParticipantEntry.new(e) }\n end", "title": "" }, { "docid": "57d30be050f0a4ef7441775bcc59a554", "score": "0.5824388", "text": "def all\n collection.find({}, { :sort=>[[:display_name, Mongo::ASCENDING]] }).\n map { |fields| Server.new_instance self, fields }\n end", "title": "" }, { "docid": "c6e6eda64e6f761e9624129ab08b49a1", "score": "0.5821857", "text": "def get_items\r\n @list\r\n end", "title": "" }, { "docid": "029fdbc040b0d52c233aa8b4aa70c665", "score": "0.58143455", "text": "def index\n @riders = Rider.all\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5811706", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "4f5a44739c55b685f40a2e38fda72fc9", "score": "0.5805632", "text": "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "title": "" }, { "docid": "22c8da1a008edd01d5074438c5355d09", "score": "0.58044934", "text": "def list\n @List\n end", "title": "" }, { "docid": "eaf4ec986fa8d08173858523a6e9a6a2", "score": "0.57904917", "text": "def index\n @blockers = Blocker.all\n end", "title": "" }, { "docid": "f259402b7770a1930cd5e99e3dae23b2", "score": "0.5788052", "text": "def list\n call! :list\n end", "title": "" }, { "docid": "f115317f8623aeed8545ab9b265c1ab5", "score": "0.57877505", "text": "def index\n @remixers = Remixer.all\n end", "title": "" }, { "docid": "efdba5b74f569d47455ac5308bb87ea1", "score": "0.57866234", "text": "def index\n @telfornecedors = Telfornecedor.all\n end", "title": "" }, { "docid": "8cd8a9f2742f1e874f850847b5589e3d", "score": "0.57823837", "text": "def get_all\n @monkeys.dup\n end", "title": "" }, { "docid": "0dc81e89c6c214b31c49e9cc84083e20", "score": "0.578097", "text": "def list klass, names, options, check_remote = false, &block\n ResourceInfo.list klass, self, names, options, check_remote, &block\n end", "title": "" }, { "docid": "7cf95131c3d0ebafb25a08bbce0b987c", "score": "0.5775169", "text": "def index\n @admins_election_results = Admins::ElectionResult.all\n end", "title": "" }, { "docid": "27f807c86d2da0cedf7b446806188bbf", "score": "0.57723606", "text": "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" }, { "docid": "5ce30df5c46a5649e24f081ff110f2fb", "score": "0.5767868", "text": "def list\n super\n end", "title": "" } ]
b9294ba4647d56fa56df2382890b25c4
Builds up the HDS definition of a data element, given a PhEMA definition
[ { "docid": "bfdcd1cde506a2e040d3d90b869d8b65", "score": "0.5643785", "text": "def phema_data_type_to_hds_json element, isSource\n is_subset_function = @hds_translator.is_subset_function(element[\"attrs\"][\"element\"][\"uri\"])\n if is_subset_function\n subset_element = element\n element = get_first_contained_element(subset_element[\"attrs\"][\"phemaObject\"])[1]\n end\n\n value_set = get_value_set_for_element element\n result_range = get_result_attribute_for_element element\n is_age_function = @hds_translator.is_age_function_reference(element[\"attrs\"][\"element\"][\"uri\"])\n\n @hds_translator.data_criteria(\n element[\"attrs\"][\"element\"][\"uri\"],\n value_set,\n build_value_for_element(value_set, (result_range.nil? ? nil : result_range[1])),\n build_attributes_for_element(element),\n nil, # Date range\n false, # Negated?\n false, # Is a variable?\n (isSource ? '' : element[\"hds_name\"]),\n is_age_function ? build_temporal_references_for_age_function(element) : build_temporal_references_for_element(element),\n build_subsets_for_element(subset_element)\n )\n end", "title": "" } ]
[ { "docid": "100354e085b75e8915a9c9a2819a9f0a", "score": "0.58727926", "text": "def content_definition(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_definition_from_essence_type(element, essence_hash['essence_type'])\n else\n element.content_definition_for(essence_hash['name'])\n end\n end", "title": "" }, { "docid": "984d2bb9bc8eabe644918a0f26cbea1e", "score": "0.5578368", "text": "def definition_builder; end", "title": "" }, { "docid": "984d2bb9bc8eabe644918a0f26cbea1e", "score": "0.5578368", "text": "def definition_builder; end", "title": "" }, { "docid": "1e2e46eae0ed1764d9d7c61378541cf9", "score": "0.55206525", "text": "def build(element, essence_hash)\n definition = content_definition(element, essence_hash)\n if definition.blank?\n raise ContentDefinitionError, \"No definition found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: definition['name'], element_id: element.id)\n end\n end", "title": "" }, { "docid": "b8481b6583a6e4bb1b0f684a061ca88b", "score": "0.514289", "text": "def build(element, essence_hash)\n if (description = content_description(element, essence_hash)).blank?\n raise ContentDefinitionError, \"No description found in elements.yml for #{essence_hash.inspect} and #{element.inspect}\"\n else\n new(name: description['name'], element_id: element.id, skip_translate: description['translate'] == false)\n end\n end", "title": "" }, { "docid": "dcc6e2d1261f10ac5f235ca91126b069", "score": "0.51287615", "text": "def to_sdd_xml\n # Take care of a few global configs before generating the xml:\n # generate constructions from library ids\n generate_constructions\n\n # generate SHW references on spaces\n connect_shw\n\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.send(:SDDXML) do\n xml.send(:Proj) do\n self.class.xml_fields.each do |field|\n xml.send(:\"#{field[:xml_field_name]}\", self[field[:db_field_name]]) if self[field[:db_field_name]]\n end\n\n # set some hard coded values which are not fields\n xml.send(:CreateDate, created_at.to_i)\n\n # Don't default these as they raise warnings and will stop the cbecc engine from producing the compliance report\n # xml.send(:ExcptCondFanPress, 'No')\n # xml.send(:ExcptCondWCC, 'No')\n xml.send(:AutoHardSize, 1)\n xml.send(:AutoEffInput, 1)\n\n # TODO: need to include analysis type and software version here too? (required per SDD inputs)\n\n # go through children if they have something to add, call their methods\n kids = self.class.children_models\n unless kids.nil? || kids.empty?\n kids.each do |k|\n if k[:model_name] == 'building'\n unless building.nil?\n building.to_sdd_xml(k, xml)\n end\n else\n models = send(k[:model_name].pluralize)\n models.each do |m|\n m.to_sdd_xml(k, xml)\n end\n end\n end\n end\n end\n end\n end\n builder.to_xml\n end", "title": "" }, { "docid": "75e1242cf2e3f95ada64c5ee6e06f903", "score": "0.51236486", "text": "def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end", "title": "" }, { "docid": "1bd3c794ea0f36028f0b07cc8b045c70", "score": "0.51039314", "text": "def make_emma_record(data, **)\n Search::Record::MetadataRecord.new(data)\n end", "title": "" }, { "docid": "f5f7d7eea95bfea16b9e1ff9ec9b5c92", "score": "0.5075244", "text": "def get_definition(cls, bld, fun)\r\n bld.add(\"//\")\r\n bld.add(\"// Configuration \")\r\n bld.add(\"//\")\r\n\r\n entityClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\r\n configFunName = \"Configure(EntityTypeBuilder<\" + entityClassName + \"> builder)\"\r\n\r\n bld.startFunction(\"public void \" + configFunName)\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end", "title": "" }, { "docid": "113ce3460bb3ca1989835ccf5f9a60be", "score": "0.5066524", "text": "def initialize(xml_contents)\n @doc = @entry = Document.parse(xml_contents)\n details = @doc.at_xpath('measure/measureDetails')\n @id = details.at_xpath('uuid').text.upcase\n @hqmf_set_id = details.at_xpath('guid').text.upcase\n @hqmf_version_number = details.at_xpath('version').text.to_i\n @title = details.at_xpath('title').text\n @description = details.at_xpath('description').text\n @cms_id = \"CMS#{details.at_xpath('emeasureid').text}v#{@hqmf_version_number}\"\n @nqf_id = details.at_xpath('nqfid/@extension').value\n\n @attributes = []\n details.children.reject {|e| e.name == 'text'}.each do |attribute|\n attribute_data = Utilities::MEASURE_ATTRIBUTES_MAP[attribute.name.to_sym]\n if (attribute_data)\n attribute_data['value'] = attribute.at_xpath('@extension').try(:value) || attribute.text\n @attributes << HQMF::Attribute.from_json(attribute_data)\n end\n end\n\n @criteria_map = {}\n @measure_period_map = {\n details.at_xpath('period/@uuid').value => :measure_period,\n details.at_xpath('period/startDate/@uuid').value => :measure_period_start,\n details.at_xpath('period/stopDate/@uuid').value => :measure_period_end\n }\n @measure_period_map.keys.each do |key|\n @criteria_map[key] = OpenStruct.new(id: HQMF::Document::MEASURE_PERIOD_ID, hqmf_id: key)\n end\n \n # Extract the data criteria\n @source_data_criteria = []\n @derived_data_criteria = []\n @attribute_map = {}\n @doc.xpath('measure/elementLookUp/qdm').each do |entry|\n data_type = entry.at_xpath('@datatype').value\n if !['Timing Element', 'attribute'].include? data_type\n criteria = DataCriteria.new(entry)\n @source_data_criteria << criteria\n @criteria_map[criteria.hqmf_id] = criteria\n elsif data_type == 'attribute'\n attribute = Attribute.new(entry.at_xpath('@id').value, entry.at_xpath('@oid').value, entry.at_xpath('@name').value)\n @attribute_map[attribute.id] = attribute\n elsif data_type == 'Timing Element'\n name = entry.at_xpath('@name').value\n if MEASURE_PERIOD_TITLES[name]\n hqmf_id = entry.at_xpath('@uuid').value\n @criteria_map[hqmf_id] = OpenStruct.new(id: HQMF::Document::MEASURE_PERIOD_ID, hqmf_id: hqmf_id)\n @measure_period_map[hqmf_id] = MEASURE_PERIOD_TITLES[name]\n end\n end\n end\n\n # Extract the population criteria and population collections\n @populations = []\n @population_criteria = []\n \n population_defs = @doc.xpath('measure/measureGrouping/group')\n population_defs.each_with_index do |population_def, population_index|\n\n population = {}\n population_def.xpath('clause').each do |criteria_def|\n\n criteria = PopulationCriteria.new(criteria_def, self, population_index)\n @population_criteria << criteria\n population[criteria.type] = criteria.id\n\n end\n\n @doc.xpath('measure/measureObservations').children.reject {|e| e.name == 'text'}.each_with_index do |observ_def, observ_index|\n observ = PopulationCriteria.new(observ_def, self, population_index)\n @population_criteria << observ\n population[observ.type] = observ.id\n raise \"multiple observations... don't know how to tie to populations\" if observ_index > 0\n end\n\n population['id'] = \"Population#{population_index}\"\n population['title'] = \"Population #{population_index}\" if population_defs.length > 1\n @populations << population\n\n end\n\n\n puts \"\\t NEED TO HANDLE STRATIFICATIONS\"\n # stratifier_id_def = population_def.at_xpath('cda:templateId/cda:item[@root=\"'+HQMF::Document::STRATIFIED_POPULATION_TEMPLATE_ID+'\"]/@controlInformationRoot', NAMESPACES)\n # population['stratification'] = stratifier_id_def.value if stratifier_id_def\n\n end", "title": "" }, { "docid": "d59632a42fee765637eab84682def026", "score": "0.5043526", "text": "def parse_definition_list; end", "title": "" }, { "docid": "067a8535ba4f72800d98438bb1ee12cd", "score": "0.50080884", "text": "def createDefinition(csdl = '')\n\t\t\tDataSift::Definition.new(self, csdl, false)\n\t\tend", "title": "" }, { "docid": "4152314ef6c5b4c8af1c865d3133f071", "score": "0.49985462", "text": "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Loads data into a cell in this data set\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function loadCell($cellString, $errorList, $curRowIndex, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.iadd(1, \"if (isset($cellString) && strlen(trim($cellString)) > 0)\");\n outCode.iadd(1, \"{\");\n outCode.iadd(2, \"switch($curCellIndex)\");\n outCode.iadd(2, \"{\");\n \n varNum = 0;\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n \n if XCTEPhp::Utils::isPrimitive(var)\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.iadd(3, \"$cellString; break;\") \n else\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.sameLine(\"new \" << var.vtype << \"($cellString); break;\") \n end \n \n varNum = varNum + 1;\n end\n end\n \n outCode.iadd(3, \"default: break;\");\n \n outCode.iadd(2, \"}\");\n outCode.iadd(1, \"}\");\n \n outCode.add(\"}\");\n outCode.unindent\n end", "title": "" }, { "docid": "06146466f343ade7778ffb144020c995", "score": "0.49945024", "text": "def get_definition(codeClass, cfg)\n eqString = String.new\n seperator = \"\"\n longArrayFound = false\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n eqString << \"/**\\n* Defines the variables in an object\\n*/\\n\"\n eqString << \"void \" << codeClass.name << \" :: zero()\\n\"\n eqString << \"{\\n\"\n\n # if codeClass.hasAnArray\n # eqString << \" unsigned int i;\\n\\n\";\n # end\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray)\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if !var.isStatic # Ignore static variables\n if XCTECpp::Utils::isPrimitive(var)\n eqString << \" \" << var.name << \" = \" << XCTECpp::Utils::getZero(var) << \";\\n\"\n end\n end\n end\n end\n\n eqString << \"}\\n\\n\"\n end", "title": "" }, { "docid": "62139ce60b815d451a559987289114ff", "score": "0.4992737", "text": "def get_definition(cls, bld)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsName = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsIntf = Utils.instance.createVarFor(cls, \"ts_interface\")\r\n\r\n bld.startFunction(\"initData(item: \" + Utils.instance.getStyledClassName(cls.model.name) + \"): void\")\r\n\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.isList()\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = [];\")\r\n else\r\n if Utils.instance.isNumericPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = 0;\")\r\n elsif var.getUType().downcase == \"boolean\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = false;\")\r\n elsif var.getUType().downcase == \"datetime\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = new Date();\")\r\n elsif Utils.instance.isPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = '';\")\r\n else\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) +\r\n \" = {} as \" + Utils.instance.getStyledClassName(var.getUType()) + \";\")\r\n varCls = ClassModelManager.findVarClass(var, \"ts_interface\")\r\n if varCls != nil\r\n vService = Utils.instance.createVarFor(varCls, \"class_angular_data_gen_service\")\r\n\r\n if vService != nil\r\n srcName = \"item.\" + Utils.instance.getStyledVariableName(var)\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(vService) +\r\n \".initData(\" + srcName + \");\")\r\n end\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.endFunction()\r\n end", "title": "" }, { "docid": "3e128dcb517ee361321e594863060841", "score": "0.4983499", "text": "def construct_the_data_structures(element, attrs)\n if @config.include? element\n @data_identifier = true\n @current_parent_element = @config[element]\n @attributes << [attrs]\n end\n\n if @data_identifier\n if @current_parent_element\n if @current_parent_element.include? element\n @attributes << [@current_parent_element[element], attrs]\n end\n end\n end\n end", "title": "" }, { "docid": "52913398c986fe7a93cf92b079d6bf39", "score": "0.49410453", "text": "def cuteddy_def_axparts\n \n axes_parts = {\"names\" => [ \"xprel\", \"yprel\", \"z\", \"time\" ]}\n \n hash_xpr = { \"name\"=> nil, \"atts\"=>nil, \"val\"=>nil}\n \t\t hash_xpr[\"name\"] = \"xprel\"\n \t\t hash_xpr[\"atts\"] = { \"units\"=>\"km\", \\\n \"long_name\"=>\"X distance from pmax (p-grid)\"}\n axes_parts[\"xprel\"] = hash_xpr\n hash_ypr = { \"name\"=> nil, \"atts\"=>nil, \"val\"=>nil}\n \t\t hash_ypr[\"name\"] = \"yprel\"\n \t\t hash_ypr[\"atts\"] = { \"units\"=>\"km\", \\\n \"long_name\"=>\"Y distance from pmax (p-grid)\"}\n axes_parts[\"yprel\"] = hash_ypr\n hash_z = { \"name\"=> nil, \"atts\"=>nil, \"val\"=>nil}\n \t\t hash_z[\"name\"] = \"z\"\n \t\t hash_z[\"atts\"] = { \"units\"=>\"km\", \\\n \"long_name\"=>\"Ocean mid-layer depth axis\"}\n axes_parts[\"z\"] = hash_z\n hash_t = { \"name\"=> nil, \"atts\"=>nil, \"val\"=>nil}\n \t\t hash_t[\"name\"] = \"time\"\n \t\t hash_t[\"atts\"] = { \"units\"=>\"days\", \\\n \"long_name\"=>\"Time Axis\"}\n axes_parts[\"time\"] = hash_t\n \n return axes_parts\n end", "title": "" }, { "docid": "c9b30f55b1ea70b4aa3a3530a9348efd", "score": "0.49296746", "text": "def create_doc_records(proposal)\n\n EdiHelper.transform_log.write \"Transforming Hansa World Enterprise (HWE)..\"\n\n # ---------\n # BH record (heading)\n # ---------\n # Headings are provided by the schema's defaults. No need to set values here.\n rec_set = HierarchicalRecordSet.new({}, 'BH')\n\n # ----------\n # HWE record\n # ----------\n extended_fgs = ExtendedFg.find(:all,\n :select => '\n extended_fgs.extended_fg_code,\n extended_fgs.grade_code,\n extended_fgs.marketing_org_code,\n extended_fgs.old_fg_code,\n extended_fgs.tu_nett_mass,\n extended_fgs.units_per_carton,\n fg_products.carton_pack_product_code,\n fg_products.unit_pack_product_code,\n item_pack_products.actual_count,\n item_pack_products.basic_pack_code,\n item_pack_products.cosmetic_code_name,\n item_pack_products.marketing_variety_code,\n item_pack_products.product_class_code,\n item_pack_products.size_ref,\n carton_pack_styles.description carton_pack_style_description,\n commodities.commodity_description_long,\n marketing_varieties.marketing_variety_description,\n fg_marks.ri_mark_code,\n fg_marks.ru_mark_code,\n fg_marks.tu_mark_code,\n basic_packs.short_code,\n unit_pack_products.nett_mass unit_pack_product_nett_mass,\n unit_pack_product_types.description unit_pack_product_type_description',\n\n :joins => '\n INNER JOIN fg_products ON fg_products.fg_product_code = extended_fgs.fg_code\n INNER JOIN item_pack_products ON (item_pack_products.item_pack_product_code = fg_products.item_pack_product_code\n AND item_pack_products.id = fg_products.item_pack_product_id)\n INNER JOIN carton_pack_products ON (carton_pack_products.carton_pack_product_code = fg_products.carton_pack_product_code\n AND carton_pack_products.id = fg_products.carton_pack_product_id)\n INNER JOIN carton_pack_styles ON (carton_pack_styles.carton_pack_style_code = carton_pack_products.carton_pack_style_code\n AND carton_pack_styles.id = carton_pack_products.carton_pack_style_id)\n INNER JOIN commodities ON commodities.commodity_code = extended_fgs.commodity_code\n INNER JOIN marketing_varieties ON (marketing_varieties.marketing_variety_code = item_pack_products.marketing_variety_code\n AND marketing_varieties.id = item_pack_products.marketing_variety_id)\n INNER JOIN fg_marks ON fg_marks.fg_mark_code = extended_fgs.fg_mark_code\n INNER JOIN basic_packs ON basic_packs.basic_pack_code = item_pack_products.basic_pack_code\n INNER JOIN unit_pack_products ON (unit_pack_products.unit_pack_product_code = fg_products.unit_pack_product_code\n AND unit_pack_products.id = fg_products.unit_pack_product_id)\n INNER JOIN unit_pack_product_types ON (unit_pack_product_types.type_code = unit_pack_products.type_code\n AND unit_pack_product_types.id = unit_pack_products.unit_pack_product_type_id)',\n\n :conditions => ['extended_fgs.created_on > ? or extended_fgs.updated_on > ?', 1.day.ago, 1.day.ago])\n #:conditions => ['extended_fgs.id > ? AND extended_fgs.id < ?', 59,70])\n\n extended_fgs.each do |record|\n\n varsize = record.size_ref == 'NOS' ? record.actual_count : record.size_ref\n unit_pp_nett_mass = record.unit_pack_product_nett_mass.nil? ? '' : record.unit_pack_product_nett_mass << 'Kg'\n\n innerpackdesc = case record.unit_pack_product_type_description\n when 'Tray'\n '(Tray)'\n when 'Bag'\n \"(#{record.units_per_carton}x#{unit_pp_nett_mass}Bag)\"\n else\n ' '\n end\n\n description = [record.commodity_description_long,\n record.marketing_variety_description,\n record.tu_mark_code,\n record.short_code,\n record.carton_pack_style_description,\n varsize,\n record.product_class_code,\n record.grade_code,\n record.cosmetic_code_name,\n innerpackdesc,\n record.tu_nett_mass].join(' ') << ' Kg'\n\n classification = ['FG',\n record.marketing_variety_code,\n record.product_class_code,\n record.grade_code,\n record.actual_count,\n record.basic_pack_code,\n record.cosmetic_code_name,\n record.size_ref,\n record.units_per_carton,\n record.unit_pack_product_code,\n record.carton_pack_product_code,\n record.marketing_org_code,\n record.ri_mark_code,\n record.ru_mark_code,\n record.tu_mark_code].join(',')\n\n hwe_rec = HierarchicalRecordSet.new({\n 'fg_item_description' => description,\n 'fg_item_code' => record.extended_fg_code,\n 'alternate_code' => record.old_fg_code,\n 'classification' => classification\n }, 'HWE')\n\n rec_set.add_child hwe_rec\n\n end\n\n rec_set\n end", "title": "" }, { "docid": "2d16846445c431f3fca7e35301b14c75", "score": "0.49274707", "text": "def to_data_element_creation_payload\n {\n name: data_element.fetch(\"name\"),\n short_name: data_element.fetch(\"short_name\"),\n code: data_element.fetch(\"code\")\n }\n end", "title": "" }, { "docid": "a0b4c5690f29fb66c24bb5915fc46804", "score": "0.49218252", "text": "def createEphem(targetName)\n\n cmd = \"#{$cmdPre}ataephem \" + targetName;\n doCmd(cmd);\n cmd = \"#{$cmdPre}atawrapephem \" + targetName + \".ephem\";\n doCmd(cmd);\n\n return targetName + \".ephem\"\n\nend", "title": "" }, { "docid": "9a05726cfdb9b54cb00e8b411ff419ec", "score": "0.4917915", "text": "def dsm(dataType, varName, varAlias)\r\n dsn = \"decision\".ljust(16)\r\n dpm = \"dpm\".ljust(4)\r\n dt = dataType.ljust(12)\r\n vn = varName.ljust(48)\r\n\r\n out = <<EOF\r\n#{dsn}#{dpm}#{dt}#{vn}\"#{varAlias}\";\r\nEOF\r\n\r\n out # Return generated output\r\n end", "title": "" }, { "docid": "538cc19180fa694cf852a678b0f70f66", "score": "0.49028528", "text": "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Creates an insert statement for this classes data\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function genInsert($cellString, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.add(\" $inserts = \")\n outCode.add('\"INSERT INTO ' << codeClass.name << 'List VALUES (\";')\n # outCode.add(\"'.\\\\n\\\";\")\n \n varNum = 0\n\n# for var in codeClass.variableSection\n# if var.elementId == CodeElem::ELEM_VARIABLE\n# \n# if XCTEPhp::Utils::isPrimitive(var)\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"$cellString; break;\") \n# else\n# conDef << \" case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \"\n# conDef << \"new \" << var.vtype << \"($cellString); break;\") \n# end \n# \n# varNum = varNum + 1;\n# end\n# end\n \n \n outCode.add(\"}\");\n\n return(conDef);\n end", "title": "" }, { "docid": "e930c0d2e6e3f85642a9f6f7e57c1740", "score": "0.48678964", "text": "def get_definition(codeClass, bld)\n end", "title": "" }, { "docid": "dfbb7ab775ed7e7a83164c51d94332d1", "score": "0.48401153", "text": "def load_entries_from_edw\n STDERR.puts \"Loading Camel Criteria Data from EDW for #{mss_name}.\"\n data = []\n SqlServer.create(EDW::SOURCE, EDW::DM_ALCATEL::DATABASE) do |db|\n db.query sql\n # puts db.fields\n data = db.data\n end\n data\n end", "title": "" }, { "docid": "8d8462617500a66ac0a49a4d6e96c7d2", "score": "0.4838988", "text": "def build_id_element_map phenotype\n return unless phenotype[\"children\"]\n\n # Loop through all immediate children\n phenotype[\"children\"].each do |child|\n # Only select PhEMA objects - don't pull out KineticJS elements\n if child[\"className\"] == \"PhemaGroup\" or child[\"className\"] == \"PhemaConnection\"\n @id_element_map[child[\"id\"]] = child\n # Add in the generated name so it's saved and can be reused, but only for datatypes or categories\n if child[\"attrs\"][\"element\"][\"type\"] == \"DataElement\" or \n child[\"attrs\"][\"element\"][\"type\"] == \"Category\" or\n child[\"attrs\"][\"element\"][\"type\"] == \"SubsetOperator\" or\n child[\"attrs\"][\"element\"][\"type\"] == \"FunctionOperator\"\n value_set = get_value_set_for_element child\n @id_element_map[child[\"id\"]][\"hds_name\"] = @hds_translator.generate_entity_name(child[\"attrs\"][\"element\"][\"uri\"], value_set[\"name\"], child[\"id\"])\n end\n end\n\n # Recursively process children\n if child[\"children\"]\n build_id_element_map child\n end\n end\n\n @id_element_map\n end", "title": "" }, { "docid": "5d213e396eb04c306d9f46288ee76b8b", "score": "0.4830814", "text": "def definition_tag(definition); end", "title": "" }, { "docid": "c84a1b9cdd7fe8a1f6be11e905ba2acf", "score": "0.4812786", "text": "def data_for_hyacinth_ds\n # Using Marshal to make a copy so we don't modifiy the in-memory copy, then saving the modified copy to Fedora\n { DigitalObject::DynamicField::DATA_KEY => remove_extra_controlled_term_uri_data_from_dynamic_field_data!(Marshal.load(Marshal.dump(@dynamic_field_data))) }\n end", "title": "" }, { "docid": "941d6e5f71b42d3fda76ee0cc99471cf", "score": "0.48000813", "text": "def create_definition_associations\n # TODO: make sure functionality for extracting word + index is extracted and shared\n # Loop through map of defs to related words and create the association\n @relateds.each do |definition, see_also_records|\n see_also_records.each do |see_also_word|\n headword_data = headword_data see_also_word\n word = headword_data[:word]\n word_index = headword_data[:index]\n\n # Get the definition for the word and word index\n related_def = @word_definitions.dig(word.downcase, word_index)\n unless related_def\n # Missing related definition - report error, skip\n @error_reporter.report_error(definition.word.text, \n \"'see_also' word not found: #{see_also_word}\",\n 'error'\n )\n next\n end\n\n # TODO: Could use 'new' instead of 'create' here and batch save at end\n # Add association to related def and report errors\n relation = DefinitionRelation\n .where(\n definition: definition,\n related_definition: related_def,\n relation_type: 'see_also'\n )\n .first_or_create\n\n if relation.errors.present?\n error_reporter.report_error word,\n \"Error with def relation '#{word.downcase}': #{relation.errors.full_messages}\",\n 'error'\n end\n end\n end\n end", "title": "" }, { "docid": "d048e97419c7e66e590ebb4dea710f81", "score": "0.47871253", "text": "def get_definition(codeClass, cfg)\n readDef = String.new\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n\treadDef << \"\\n\"\n\t\n readDef << \" public function create() {\\n\";\n readDef <<\n\t\t\t\"$serializer = JMS\\Serializer\\SerializerBuilder::create()->build();\n\t\t\t\t\t\"\n\t\t\t\"$data = $serializer->deserialize(file_get_contents('php://input'), '', 'json')\n\t\t\t\n\t\t\tforeach ($data as $varName => varValue)\n\t\t\t{\n\t\t\t}\"\n \n\t\t\t\"{ return($this->\" << varSec.name << \"); };\\n\"\n \n\n for varSec in varArray\n if varSec.elementId == CodeElem::ELEM_VARIABLE && varSec.genSet == \"true\"\n if !varSec.isPointer\n if varSec.arrayElemCount == 0\n readDef << \"( $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name)\n readDef << \")\\t{ $this->\" << varSec.name << \" = $new\" << XCTEPhp::Utils::getCapitalizedFirst(varSec.name) << \"; };\\n\"\n end\n end\n\n elsif varSec.elementId == CodeElem::ELEM_COMMENT\n readDef << \" \" << XCTEPhp::Utils::getComment(varSec)\n elsif varSec.elementId == CodeElem::ELEM_FORMAT\n readDef << varSec.formatText\n end\n end\n\n return(readDef);\n end", "title": "" }, { "docid": "6e235854731b105fa5a2650451196a0e", "score": "0.4756696", "text": "def makeIDDefinitionFile()\n # Build the ID definitions header output file name and include flag\n baseFileName = \"combined_pkt_ids\"\n idDefinesFileName = ccdd.getOutputPath() + baseFileName + \".h\"\n headerIncludeFlag = \"_\" + baseFileName.upcase() + \"_H_\"\n\n # Open the types header output file\n idDefinesFile = ccdd.openOutputFile(idDefinesFileName)\n\n # Check if the types header file successfully opened\n if idDefinesFile != nil\n # Add the build information to the output file\n outputFileCreationInfo(idDefinesFile)\n\n # Add the header include to prevent loading the file more than once\n ccdd.writeToFileLn(idDefinesFile, \"#ifndef \" + headerIncludeFlag)\n ccdd.writeToFileLn(idDefinesFile, \"#define \" + headerIncludeFlag)\n ccdd.writeToFileLn(idDefinesFile, \"\")\n\n # Get the number of rows for the Includes table data\n numIncludeRows = ccdd.getTableNumRows(\"Includes\")\n\n # Check if there are any data to include\n if numIncludeRows > 0\n # Step through each row of Includes data\n for row in 0..numIncludeRows-1\n # Output the Includes table's 'includes' column data\n ccdd.writeToFileLn(idDefinesFile, ccdd.getTableData(\"Includes\", \"includes\", row))\n end\n\n ccdd.writeToFileLn(idDefinesFile, \"\")\n end\n\n minimumLength = 1\n\n # Step through the list of names that are used\n for index in 0..$usedHKNames.length - 1\n # Check if the length exceeds the minimum length found thus far\n if $usedHKNames[index].length > minimumLength\n # Store the new minimum length\n minimumLength = $usedHKNames[index].length\n end\n end\n\n # Step through the list of names that are used\n for index in 0..$usedHKNames.length - 1\n # Output the ID name and ID to the file\n ccdd.writeToFileFormat(idDefinesFile, \"#define %-\" + minimumLength.to_s + \"s (%7s + FC_OFFSET )\\n\", $usedHKNames[index], $usedHKValues[index])\n end\n\n # Finish and close the ID definitions header output file\n ccdd.writeToFileLn(idDefinesFile, \"\")\n ccdd.writeToFileLn(idDefinesFile, \"#endif /* \" + headerIncludeFlag + \" */\")\n\n # Close the output file\n ccdd.closeFile(idDefinesFile)\n # The combined ID file failed to open\n else\n # Display an error dialog\n ccdd.showErrorDialog(\"<html><b>Error opening combined ID output file '</b>\" + idDefinesFileName + \"<b>'\")\n end\nend", "title": "" }, { "docid": "94fe7a5d6833670bd52dad020d13e40a", "score": "0.4730914", "text": "def to_hds(patient)\n # Start with a new HDS record.\n record = Record.new\n\n # Loop over the QDM Patient's data elements, and create the corresponding\n # HDS Record Entry models on the newly created record.\n patient.dataElements.each do |data_element|\n category = data_element.qdmCategory if data_element.fields.include? 'qdmCategory'\n next unless category\n # Handle patient characteristics seperately.\n next if data_element.qdmCategory == 'patient_characteristic'\n\n # Grab the QDM datatype name of this data element.\n qdm_model_name = data_element.class.name.demodulize\n\n # Handle mismatched HDS names for QDM things.\n category = Utils.qdm_to_hds_class_type(category)\n\n # Grab the corresponding HDS model we will cast this QDM model into.\n hds_model = category.camelize.constantize\n\n # Start with a new HDS entry.\n hds_entry = hds_model.new\n\n # Populate codes.\n hds_entry.codes = Utils.qdm_codes_to_hds_codes(data_element.dataElementCodes)\n\n # Populate OID.\n hds_entry.oid = data_element.hqmfOid\n\n # Populate description.\n hds_entry.description = data_element.description\n\n # Set type.\n hds_entry.set(_type: hds_model.to_s)\n\n # Set status_code.\n status = data_element.fields.include?('qdmStatus') ? data_element[:qdmStatus] : nil\n status = 'ordered' if status == 'order'\n hds_entry.status_code = { 'HL7 ActStatus': [status] }\n\n # Grab the QDM attribute mappings for this data element, and construct the\n # corresponding HDS attributes.\n hds_attrs = {}\n @qdm_to_hds_mappings[qdm_model_name].each do |qdm_attr, hds_attr|\n next if data_element[qdm_attr].nil?\n\n extracted_value = extractor(data_element[qdm_attr].as_json)\n if hds_attr.is_a?(Hash) && hds_attr[:low]\n # Handle something that has multiple parts.\n hds_attrs[hds_attr[:low]] = extracted_value.first\n hds_attrs[hds_attr[:high]] = extracted_value.last if hds_attr[:high]\n elsif extracted_value.is_a?(Array) && extracted_value.any? && extracted_value.first.is_a?(Hash) && extracted_value.first[:code] && hds_attr != 'facility' && hds_attr != 'components'\n # Handle a result that is returning multiple codes.\n hds_attrs[hds_attr] = [CodedResultValue.new(codes: Utils.qdm_codes_to_hds_codes(extracted_value), description: extracted_value.first[:title])]\n elsif extracted_value.is_a?(Array)\n # Handle simple Arrays.\n hds_attrs[hds_attr] = { values: extracted_value } if extracted_value.any?\n elsif hds_attr == 'values' && extracted_value.key?(:scalar)\n # Handle a Quantity.\n hds_attrs[hds_attr] = [PhysicalQuantityResultValue.new(extracted_value)]\n elsif hds_attr == 'values' && extracted_value.key?(:code)\n # Handle a Code result.\n hds_attrs[hds_attr] = [CodedResultValue.new(codes: Utils.qdm_codes_to_hds_codes([extracted_value]), description: extracted_value[:title])]\n elsif hds_attr == 'dose'\n # Handle a dosage.\n hds_attrs[hds_attr] = dose_extractor(extracted_value)\n else\n # Nothing special.\n hds_attrs[hds_attr] = extracted_value\n end\n end\n\n # If there is an actual negationReason, set negationInd to true.\n if hds_attrs.key?('negationReason') && !hds_attrs['negationReason'].nil?\n hds_attrs['negationInd'] = true\n end\n\n # Unpack references.\n unpack_references(hds_attrs)\n\n # Unpack facility.\n unpack_facility(hds_attrs)\n\n # Unpack diagnosis.\n unpack_diagnosis(hds_attrs)\n\n # Unpack components.\n unpack_components(hds_attrs)\n\n # Communication entries need direction, which we can get from the QDM model name.\n if hds_entry._type == 'Communication'\n hds_attrs['direction'] = qdm_model_name.underscore\n end\n\n # Ignore infinity dates.\n Utils.fix_infinity_dates(hds_attrs)\n\n # Apply the attributes to the entry.\n hds_entry.set(hds_attrs)\n\n # Add entry to HDS record, make sure to handle tricky plural types.\n plural_category = ['medical_equipment'].include?(category) ? category : category.pluralize\n record.send(plural_category) << hds_entry unless hds_entry.codes.empty?\n end\n\n # Unpack patient characteristics.\n unpack_patient_characteristics(patient, record)\n\n # Unpack extended_data.\n unpack_extended_data(patient, record)\n\n record['measure_ids'] = patient['measure_ids'] if patient['measure_ids']\n\n record\n end", "title": "" }, { "docid": "1cdd2826c0b3110617ee3ffd7a139190", "score": "0.47205654", "text": "def addMissingDWHR(elements)\n locationText = \"HouseFile/House/Components/HotWater/Primary\"\n elements[locationText].add_element(\"DrainWaterHeatRecovery\")\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery\"\n elements[locationText].attributes[\"showerLength\"] = \"5.0\"\n elements[locationText].attributes[\"dailyShowers\"] = \"2\"\n elements[locationText].attributes[\"preheatShowerTank\"] = \"false\"\n elements[locationText].attributes[\"effectivenessAt9.5\"] = \"50.0\"\n elements[locationText].add_element(\"Efficiency\", {\"code\"=>\"2\"})\n elements[locationText].add_element(\"EquipmentInformation\")\n elements[locationText].add_element(\"ShowerTemperature\", {\"code\"=>\"1\"})\n elements[locationText].add_element(\"ShowerHead\", {\"code\"=>\"0\"})\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation\"\n elements[locationText].add_element(\"Manufacturer\")\n elements[locationText].add_element(\"Model\")\n\n # ASF 05-10-2016: Added default values for manufacturer, model so hthat user can spec \"NA\" in choice file.\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation/Manufacturer\"\n elements[locationText].text = \"Generic\"\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation/Model\"\n elements[locationText].text = \"2-Medium Efficiency\"\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/ShowerTemperature\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/ShowerHead\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\nend", "title": "" }, { "docid": "7ddd08a2e9575285187386c9fe1b5833", "score": "0.47136658", "text": "def get_definition\n\n end", "title": "" }, { "docid": "0c02b50d93407b434ee3e79f58a6c68d", "score": "0.47117403", "text": "def generate_metadata_rules_hash(params)\n rules = {\n required_entity_type_ids: [],\n show_stopper_entity_type_ids: [],\n boosted_entity_type_ids: [],\n entity_type_ordered_list: [],\n parts_of_speech: {}\n }\n\n params.each do |k,v|\n if k.to_s.starts_with?('required_entity_')\n rules[:required_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('show_stopper_entity_')\n rules[:show_stopper_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('boosted_entity_')\n rules[:boosted_entity_type_ids] << v.to_i\n end\n\n if k.to_s.starts_with?('pos_')\n key = ::Epiphany::Analyzers::PartsOfSpeech::SUPPORTED_FIELDS.find do |field|\n field == k.split('pos_').last\n end\n\n val = ::Epiphany::Analyzers::PartsOfSpeech::VALUE_OPTIONS.find do |opt|\n opt == v.strip\n end\n\n # parts of speech fields / vals are enforced in the above constants\n next unless key && val\n rules[:parts_of_speech][key] = val\n end\n\n if k == 'entity_type_ordered_list' && v.present?\n rules[:entity_type_ordered_list] = v.split(',').map{|val| val.strip }\n end\n end\n\n rules\n end", "title": "" }, { "docid": "54282fd841415c8d3efb818b88d48b4a", "score": "0.47044414", "text": "def build_metadata\n raise StandardError, 'Record not found' if record.nil?\n raise StandardError, \"Missing required elements, missing element(s) are: #{importerexporter.parser.missing_elements(keys_without_numbers(record.keys)).join(', ')}\" unless importerexporter.parser.required_elements?(keys_without_numbers(record.keys))\n \n self.parsed_metadata = {}\n self.parsed_metadata[work_identifier] = [record[source_identifier]]\n add_work_type\n add_standard_metadata\n add_file\n add_visibility\n add_rights_statement\n add_admin_set_id\n add_collections\n add_local\n self.parsed_metadata\n end", "title": "" }, { "docid": "810fbe2a2a553e6438fa5688a58cd699", "score": "0.47001123", "text": "def create_measure_period_v1_data_criteria(doc,measure_period,v1_data_criteria_by_id)\n\n attributes = doc[:attributes]\n attributes.keys.each {|key| attributes[key.to_s] = attributes[key]}\n \n measure_period_key = attributes['MEASUREMENT_PERIOD'][:id]\n measure_start_key = attributes['MEASUREMENT_START_DATE'][:id]\n measure_end_key = attributes['MEASUREMENT_END_DATE'][:id]\n \n @measure_period_v1_keys = {measure_start: measure_start_key, measure_end: measure_end_key, measure_period: measure_period_key}\n \n type = 'variable'\n code_list_id,negation_code_list_id,property,status,field_values,effective_time,inline_code_list,children_criteria,derivation_operator,temporal_references,subset_operators=nil\n \n #####\n ##\n ######### SET MEASURE PERIOD\n ##\n #####\n \n measure_period_id = HQMF::Document::MEASURE_PERIOD_ID\n value = measure_period\n measure_criteria = HQMF::DataCriteria.new(measure_period_id,measure_period_id,nil,measure_period_id,code_list_id,children_criteria,derivation_operator,measure_period_id,status,\n value,field_values,effective_time,inline_code_list, false, nil, temporal_references,subset_operators,nil,nil)\n \n # set the measure period data criteria for all measure period keys\n v1_data_criteria_by_id[measure_period_key] = measure_criteria\n v1_data_criteria_by_id[measure_start_key] = measure_criteria\n v1_data_criteria_by_id[measure_end_key] = measure_criteria\n @measure_period_criteria = measure_criteria\n \n end", "title": "" }, { "docid": "b104b477148f25614e619ff46450c5d6", "score": "0.46944657", "text": "def createHRV( elements )\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList\"\n elements[locationText].add_element(\"Hrv\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv\"\n elements[locationText].attributes[\"supplyFlowrate\"] = \"60\"\n elements[locationText].attributes[\"exhaustFlowrate\"] = \"60\"\n elements[locationText].attributes[\"fanPower1\"] = \"123.7\"\n elements[locationText].attributes[\"isDefaultFanpower\"] = \"true\"\n elements[locationText].attributes[\"isEnergyStar\"] = \"false\"\n elements[locationText].attributes[\"isHomeVentilatingInstituteCertified\"] = \"false\"\n elements[locationText].attributes[\"isSupplemental\"] = \"false\"\n elements[locationText].attributes[\"temperatureCondition1\"] = \"0\"\n elements[locationText].attributes[\"temperatureCondition2\"] = \"-25\"\n elements[locationText].attributes[\"fanPower2\"] = \"145.6\"\n elements[locationText].attributes[\"efficiency1\"] = \"64\"\n elements[locationText].attributes[\"efficiency2\"] = \"64\"\n elements[locationText].attributes[\"preheaterCapacity\"] = \"0\"\n elements[locationText].attributes[\"lowTempVentReduction\"] = \"0\"\n elements[locationText].attributes[\"coolingEfficiency\"] = \"25\"\n elements[locationText].add_element(\"EquipmentInformation\")\n elements[locationText].add_element(\"VentilatorType\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/VentilatorType\"\n elements[locationText].attributes[\"code\"] = \"1\" # HRV\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv\"\n elements[locationText].add_element(\"ColdAirDucts\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts\"\n elements[locationText].add_element(\"Supply\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].attributes[\"length\"] = \"1.5\"\n elements[locationText].attributes[\"diameter\"] = \"152.4\"\n elements[locationText].attributes[\"insulation\"] = \"0.7\"\n elements[locationText].add_element(\"Location\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Location\"\n elements[locationText].attributes[\"code\"] = \"4\" # Main Floor\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].add_element(\"Type\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Type\"\n elements[locationText].attributes[\"code\"] = \"1\" # Flexible\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].add_element(\"Sealing\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Sealing\"\n elements[locationText].attributes[\"code\"] = \"2\" # Sealed\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts\"\n elements[locationText].add_element(\"Exhaust\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].attributes[\"length\"] = \"1.5\"\n elements[locationText].attributes[\"diameter\"] = \"152.4\"\n elements[locationText].attributes[\"insulation\"] = \"0.7\"\n elements[locationText].add_element(\"Location\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Location\"\n elements[locationText].attributes[\"code\"] = \"4\" # Main Floor\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].add_element(\"Type\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Type\"\n elements[locationText].attributes[\"code\"] = \"1\" # Flexible\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].add_element(\"Sealing\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Sealing\"\n elements[locationText].attributes[\"code\"] = \"2\" # Sealed\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\nend", "title": "" }, { "docid": "1527daa3810396cb7ae1a0dd9a2b4359", "score": "0.46903506", "text": "def parse_source_file_definition(data, defs={})\n return if defs.empty?\n defs.each do |_def|\n data[_def.url] = { 'title' => '', 'config' => {} } if data[_def.url].nil?\n record = { 'url' => _def.url, 'title' => _def.get_props[\"@title\"], 'content' => '' }\n if _def.get_props['@params'] then\n record['params'] = []\n _def.get_props['@params'].each_pair do |k,v|\n record['params'] << [k,v]\n end\n end\n record['content'] = _def.get_props['@content'].gsub(/\\n/,'<br/>') if _def.get_props['@content']\n if _def.get_props['@description'] then\n data[_def.url]['title'] = _def.get_props['@description']\n end\n data[_def.url]['config'][_def.method] = record\n end\n data\n end", "title": "" }, { "docid": "9a75e303ddeefa207665bf1d1f113260", "score": "0.46775648", "text": "def to_eeml\n return EEML::Data.new(power, :id => key)\n end", "title": "" }, { "docid": "02fcec7851c734f06dfe7e9ceb7fc647", "score": "0.4659321", "text": "def belBuilder(pObj)\n documentString = \"\"\n documentString << 'SET DOCUMENT Name = \"BEL document generated for parsing purposes by bel2csv\"'\n breakln(documentString)\n documentString << 'SET DOCUMENT Description = \"Note: This is an automatically created BEL document with dummy definitions. It\\'s not intended for usage outside of bel2csv conversion.\"'\n \n emptyln(documentString)\n \n begin\n nameSpaces = File.open(\"namespaces\")\n rescue Errno::ENOENT\n puts \"Error: Namespace listing file 'namespaces' required for tabulated file conversion but missing.\"\n abort\n end\n nameSpaces.each do |ns|\n documentString << \"#{DF} #{ns.chomp!} #{URL}\"\n breakln(documentString)\n end\n emptyln(documentString)\n pObj.belArray.each do |bel|\n if bel\n documentString << bel\n breakln(documentString)\n end\n end\n return documentString\nend", "title": "" }, { "docid": "6c86abeb3c2b1ce00b56d68cdd30ee27", "score": "0.46547872", "text": "def get_definition(fun, cfg)\n eDef = String.new\n\n indent = String.new(\" \")\n\n # Skeleton of comment block\n eDef << indent << \"#\\n\"\n eDef << indent << \"#\\n\"\n\n for param in fun.parameters\n eDef << indent << \"# \" << param.name << \":: \\n\"\n end\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \"# \\n\" << indent << \"# return:: \\n\"\n end\n\n eDef << indent << \"def \"\n\n # Function body framework\n if fun.isStatic\n eDef << \"self.\"\n end\n\n eDef << fun.name << \"(\"\n\n for param in (0..(fun.parameters.size - 1))\n if param != 0\n eDef << \", \"\n end\n\n eDef << XCTERuby::Utils::getParamDec(fun.parameters[param])\n end\n\n eDef << \")\"\n\n eDef << \"\\n\"\n\n eDef << indent << \" \\n\"\n\n if fun.returnValue.vtype != \"void\"\n eDef << indent << \" return \\n\"\n end\n\n eDef << indent << \"end # \" << fun.name << \"\\n\\n\"\n\n return eDef\n end", "title": "" }, { "docid": "f7978f5a2f142223ead6e2756bdb6063", "score": "0.46350056", "text": "def new_definition(sax, author_id)\n Definition.new.tap do |definition|\n definition.author_id = author_id\n definition.text = sax.text\n definition.source = sax.source\n definition.uri = sax.uri\n end\nend", "title": "" }, { "docid": "7f5304903e22745abbd25cfe1ddcfbbb", "score": "0.4628008", "text": "def setup_derived_entry_elements(id_generator)\n @hqmf_id = attr_val('./*/cda:id/@root') || attr_val('./*/cda:typeId/@extension')\n @title = attr_val('./*/cda:code/cda:displayName/@value').try(:titleize)\n @type = attr_val('./*/cda:code/@code')\n @comments = @entry.xpath('./*/cda:text/cda:xml/cda:qdmUserComments/cda:item/text()', HQMF2::Document::NAMESPACES)\n .map(&:content)\n handle_preconditions(id_generator)\n obs_test = attr_val('./cda:measureObservationDefinition/@classCode')\n # If there are no measure observations, or there is a title, then there are no aggregations to extract\n return unless !@title && obs_test.to_s == 'OBS'\n @title = attr_val('../cda:code/cda:displayName/@value')\n @aggregator = attr_val('./cda:measureObservationDefinition/cda:methodCode/cda:item/@code')\n end", "title": "" }, { "docid": "7c65237618cba153176a81eef6f29c3d", "score": "0.46274084", "text": "def createH2KSysType1( elements, sysType1Name )\n locationText = \"HouseFile/House/HeatingCooling/Type1\"\n\n elements[locationText].add_element(sysType1Name)\n if ( sysType1Name == \"Baseboards\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/EquipmentInformation\"\n elements[locationText].attributes[\"numberOfElectronicThermostats\"] = \"0\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"100\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Furnace\" )\n\n\n stream_out (\"ADDING FURNACE ....\\n\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Furnace with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Boiler\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Boiler with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"ComboHeatDhw\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # ComboHeatDhw with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"25.3\"\n elements[locationText].attributes[\"flueDiameter\"] = \"152.4\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"ComboTankAndPump\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump/TankCapacity\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].attributes[\"value\"] = \"151.4\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"EnergyFactor\")\n elements[locationText].attributes[\"useDefaults\"] = \"true\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankLocation\")\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"CirculationPump\")\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].attributes[\"hasEnergyEfficientMotor\"] = \"false\"\n\n elsif ( sysType1Name == \"P9\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].attributes[\"id\"] = \"0\"\n elements[locationText].attributes[\"numberOfSystems\"] = \"1\"\n elements[locationText].attributes[\"thermalPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"annualElectricity\"] = \"1800\"\n elements[locationText].attributes[\"spaceHeatingCapacity\"] = \"23900\"\n elements[locationText].attributes[\"spaceHeatingEfficiency\"] = \"90\"\n elements[locationText].attributes[\"waterHeatingPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"burnerInput\"] = \"0\"\n elements[locationText].attributes[\"recoveryEfficiency\"] = \"0\"\n elements[locationText].attributes[\"isUserSpecified\"] = \"true\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation\"\n elements[locationText].add_element(\"Manufacturer\")\n elements[locationText].add_element(\"Model\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Manufacturer\"\n elements[locationText].text = \"Generic\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Model\"\n elements[locationText].text = \"Generic\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].add_element(\"TestData\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].attributes[\"controlsPower\"] = \"10\"\n elements[locationText].attributes[\"circulationPower\"] = \"130\"\n elements[locationText].attributes[\"dailyUse\"] = \"0.2\"\n elements[locationText].attributes[\"standbyLossWithFan\"] = \"0\"\n elements[locationText].attributes[\"standbyLossWithoutFan\"] = \"0\"\n elements[locationText].attributes[\"oneHourRatingHotWater\"] = \"1000\"\n elements[locationText].attributes[\"oneHourRatingConcurrent\"] = \"1000\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"NetEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/NetEfficiency\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"80\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"ElectricalUse\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/ElectricalUse\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"100\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"200\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"300\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"BlowerPower\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/BlowerPower\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"300\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"500\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"800\"\n end\nend", "title": "" }, { "docid": "5c3535409a7fc9da0bb5da52e07d8d98", "score": "0.4624027", "text": "def createH2KSysType2( elements, sysType2Name )\n\n locationText = \"HouseFile/House/HeatingCooling/Type2\"\n elements[locationText].add_element(sysType2Name)\n elements[locationText].attributes[\"shadingInF280Cooling\"] = \"AccountedFor\"\n\n if ( sysType2Name == \"AirHeatPump\" )\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"60\"\n elements[locationText].add_element(\"Type\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment/Type\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment\"\n elements[locationText].add_element(\"Function\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n # I think these can be commented out if we default to 'calculated'\n #elements[locationText].attributes[\"value\"] = \"\"\n #elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n elements[locationText].add_element(\"CoolingEfficiency\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"2\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Specifications/CoolingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"2\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature\"\n elements[locationText].add_element(\"CutoffType\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature/CutoffType\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n\n # CHECK this - should be 8.3 ?\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].attributes[\"value\"] = \"-5.0\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump\"\n elements[locationText].add_element(\"CoolingParameters\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n\n elements[locationText].add_element(\"FansAndPump\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump\"\n # Do we need to set this? what should we set it to?\n elements[locationText].attributes[\"flowRate\"] = \"700\"\n\n elements[locationText].add_element(\"Mode\")\n elements[locationText].add_element(\"Power\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirHeatPump/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n\n elsif ( sysType2Name == \"WaterHeatPump\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"canCsaC448\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"0\"\n elements[locationText].add_element(\"Function\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"21.5\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature\"\n elements[locationText].add_element(\"CutOffType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature/CutOffType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].attributes[\"value\"] = \"8.3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump\"\n elements[locationText].add_element(\"SourceTemperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/SourceTemperature\"\n elements[locationText].attributes[\"depth\"] = \"1.5\"\n elements[locationText].add_element(\"Use\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/WaterHeatPump/SourceTemperature/Use\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType2Name == \"GroundHeatPump\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/EquipmentInformation\"\n elements[locationText].attributes[\"canCsaC448\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"0\"\n elements[locationText].add_element(\"Function\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Equipment/Function\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"21.5\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"HeatingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/HeatingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications\"\n elements[locationText].add_element(\"CoolingEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Specifications/CoolingEfficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"Temperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature\"\n elements[locationText].add_element(\"CutoffType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature/CutoffType\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature\"\n elements[locationText].add_element(\"RatingType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/Temperature/RatingType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].attributes[\"value\"] = \"8.3\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"SourceTemperature\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/SourceTemperature\"\n elements[locationText].attributes[\"depth\"] = \"1.5\"\n elements[locationText].add_element(\"Use\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/SourceTemperature/Use\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump\"\n elements[locationText].add_element(\"CoolingParameters\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n\n elements[locationText].add_element(\"FansAndPump\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump\"\n # Do we need to set this? what should we set it to?\n elements[locationText].attributes[\"flowRate\"] = \"360\"\n\n elements[locationText].add_element(\"Mode\")\n elements[locationText].add_element(\"Power\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/GroundHeatPump/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n\n elsif ( sysType2Name == \"AirConditioning\" )\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Equipment\"\n elements[locationText].attributes[\"crankcaseHeater\"] = \"60\"\n elements[locationText].add_element(\"CentralType\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Equipment/CentralType\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1\"\n elements[locationText].add_element(\"RatedCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications/RatedCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications\"\n elements[locationText].add_element(\"Efficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/Specifications/Efficiency\"\n elements[locationText].attributes[\"isCop\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"3\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning\"\n elements[locationText].add_element(\"CoolingParameters\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters\"\n elements[locationText].attributes[\"sensibleHeatRatio\"] = \"0.76\"\n elements[locationText].attributes[\"openableWindowArea\"] = \"20\"\n elements[locationText].add_element(\"FansAndPump\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump\"\n elements[locationText].attributes[\"flowRate\"] = \"0\"\n elements[locationText].add_element(\"Mode\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump/Mode\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump\"\n elements[locationText].add_element(\"Power\")\n locationText = \"HouseFile/House/HeatingCooling/Type2/AirConditioning/CoolingParameters/FansAndPump/Power\"\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n end\nend", "title": "" }, { "docid": "9352bb35e458347ccb55f36661fd0961", "score": "0.462282", "text": "def dpm(dataType, varName, varAlias)\r\n lead = \" \".ljust(16)\r\n dpm = \"dpm\".ljust(4)\r\n dt = dataType.ljust(12)\r\n vn = varName.ljust(48)\r\n\r\n out = <<EOF\r\n#{lead}#{dpm}#{dt}#{vn}\"#{varAlias}\";\r\nEOF\r\n\r\n out # Return generated output\r\n end", "title": "" }, { "docid": "b37ef7d2fc34fac331bb39a97ca8b485", "score": "0.46226", "text": "def create_definition(style); end", "title": "" }, { "docid": "3d67bed9e7be1769f674b2f407548852", "score": "0.4622289", "text": "def build_attributes_for_element element\n return nil unless element[\"attrs\"] and element[\"attrs\"][\"phemaObject\"] and element[\"attrs\"][\"phemaObject\"][\"attributes\"]\n attr_hash = Hash.new\n attributes = element[\"attrs\"][\"phemaObject\"][\"attributes\"]\n attributes.each do |key, value|\n # We need to handle result as a special entry, and so it's excluded from general attribute processing.\n # Result will be used when we define the value of the data element.\n if value and key != 'Result'\n attribute_symbol = key.underscore.to_sym\n if value.is_a?(Array)\n if value.length > 0\n attr_hash[attribute_symbol] = {:type => \"CD\", :code => value[0][\"id\"], :title => value[0][\"name\"]} if value[0][\"type\"] == \"ValueSet\"\n end\n elsif value[\"type\"]\n if value[\"type\"] == \"present\"\n attr_hash[attribute_symbol] = {:type => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n attr_hash[attribute_symbol] = build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n end\n attr_hash\n end", "title": "" }, { "docid": "b3067461b8b934e75a5bb318e4d12920", "score": "0.46216437", "text": "def definition\n @definition ||= []\n end", "title": "" }, { "docid": "0572b48f40cdcde6aa68cd2dd90e9b84", "score": "0.461972", "text": "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "title": "" }, { "docid": "0572b48f40cdcde6aa68cd2dd90e9b84", "score": "0.461972", "text": "def mini_definition\n {\n '@type': schema_type,\n '@id': identifier,\n 'name': sanitize(title)\n }\n end", "title": "" }, { "docid": "4c146e8d1557f0ed352e2b015aebbbb9", "score": "0.46168378", "text": "def definition_root\n Rails.root.join('data', 'HCA_metadata', self.version)\n end", "title": "" }, { "docid": "2435dba153dcbb18d6d6a3ec473e8d43", "score": "0.46065634", "text": "def definition_for_nil_entry\n reference = @entry.at_xpath('./*/cda:outboundRelationship/cda:criteriaReference', HQMF2::Document::NAMESPACES)\n ref_id = nil\n unless reference.nil?\n ref_id = \"#{HQMF2::Utilities.attr_val(reference, 'cda:id/@extension')}_#{HQMF2::Utilities.attr_val(reference, 'cda:id/@root')}\"\n end\n reference_criteria = @data_criteria_references[strip_tokens(ref_id)] unless ref_id.nil?\n if reference_criteria\n # we only want to copy the reference criteria definition, status, and code_list_id if this is this is not a grouping criteria (i.e., there are no children)\n if @children_criteria.blank?\n @definition = reference_criteria.definition\n @status = reference_criteria.status\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n @code_list_id = reference_criteria.code_list_id\n end\n else\n # if this is a grouping data criteria (has children) mark it as derived and only pull title and description from the reference criteria\n @definition = 'derived'\n if @specific_occurrence\n @title = reference_criteria.title\n @description = reference_criteria.description\n end\n end\n else\n puts \"MISSING_DC_REF: #{ref_id}\" unless @variable\n @definition = 'variable'\n end\n end", "title": "" }, { "docid": "e127c222a177b15553a3ed98b7f58884", "score": "0.46053895", "text": "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "title": "" }, { "docid": "e127c222a177b15553a3ed98b7f58884", "score": "0.46053895", "text": "def create_from_scratch(element, essence_hash)\n essence_hash.stringify_keys!\n if content = build(element, essence_hash)\n content.create_essence!(essence_hash['essence_type'])\n end\n content\n end", "title": "" }, { "docid": "f4c1ef95ec6719cd96f3f6099adb781d", "score": "0.4605173", "text": "def build_data(event, type, value)\n data = EventData.new\n data.name = event.name\n data.tags = @tags.merge(event.tags.merge(type: type))\n data.fields = value.is_a?(Hash) ? value : { value: value }\n data.timestamp = calc_timestamp(event)\n data\n end", "title": "" }, { "docid": "18f5fe20d001a9a7d5bc6e2ffa49770b", "score": "0.45987654", "text": "def create_daily_data\n data = {\n sign: @sign_name.to_s,\n duration: 'daily',\n horoscope_text: get_daily_horoscope,\n }\n @horoscope = Horoscope.new(data)\n if @horoscope.save\n intensity = @theastrologer_content.css(\"div.row.daily-meta div[1] p[1]\").text.split(':').last.gsub(' ', '').to_s\n keywords = @theastrologer_content.css(\"div.row.daily-meta div[2] p[1]\").text.split(':').last.gsub(' ', '')\n mood = @theastrologer_content.css(\"div.row.daily-meta div[1] p[2]\").text.split(':').last.gsub(' ', '')\n @horoscope.other_details.create(\n [\n {\n detail_type: \"intensity\",\n detail: intensity\n },\n {\n detail_type: \"keywords\",\n detail: keywords\n },\n {\n detail_type: \"mood\",\n detail: mood\n }\n ]\n )\n end\n end", "title": "" }, { "docid": "28db623e26872389d1805f9fbdb8c9f6", "score": "0.45955154", "text": "def expand_rule_definition definition\r\n\t\t@rules.reverse_each do |r|\r\n definition = definition.gsub \"[:#{r.type.to_s}]\", \"(#{r.definition})\"\r\n\t\tend\r\n\t\tdefinition\r\n\tend", "title": "" }, { "docid": "88589481d2cd00f40cf2e8ab418b37b7", "score": "0.4581842", "text": "def data(data, opts = {})\n definition = opts[:definition] || opts[:def]\n records = new_collection(opts[:hamster])\n\n data.lines do |line|\n records = add_to_collection(records, record(line, def: definition))\n end\n\n return records\n end", "title": "" }, { "docid": "2aba5061fec0183f4defcf0908dae47d", "score": "0.45813772", "text": "def generate_definition\n # return if not @type # ToDo: remove?\n @type.to_s + ' ' + code_name + \";\\n\"\n end", "title": "" }, { "docid": "85d569b46e5e9f7f57a7b9dc0b6a4e28", "score": "0.45774314", "text": "def build(data)\n raise Sawyer::Error, \"No schema for this relation: #{inspect}\" unless @schema\n @schema.build data\n end", "title": "" }, { "docid": "9de5869c7cc7d77cede1eda3b4982805", "score": "0.45722106", "text": "def data\n hash = default_data\n components.each do |component|\n hash[component.property] = component.data\n end\n if has_element_class?\n hash['elements'] = []\n elements.each do |element|\n hash['elements'] << element.data\n end\n end\n hash\n end", "title": "" }, { "docid": "dd4514c2d0d770d183c6e066b9ef67b3", "score": "0.4566544", "text": "def generate_itemdef_data(type,name)\n generate_itemdef_line(type,name,true,false)\n end", "title": "" }, { "docid": "0851cf7caedd69462d0ec1cdd0f890b6", "score": "0.45547557", "text": "def expand_definition(definition)\n return definition if definition.is_a? Hash\n definition.each_with_object({}) do |key, result|\n if key.is_a? String\n result[key] = :default\n elsif key.is_a? Hash\n result.merge!(expand_sub_definitions(key))\n end\n end\n end", "title": "" }, { "docid": "fc3f92c009fbcfeb90c55df9611d073c", "score": "0.45499942", "text": "def build_ast(tag, properties_or_children_or_text = nil, children_or_text = nil)\n definition = {\n type: :ELEMENT,\n tag: tag\n }\n if properties_or_children_or_text && children_or_text\n if children_or_text.is_a?(Array)\n unless properties_or_children_or_text.is_a?(Hash)\n fail Error, 'when `children` are defined as second argument, first argument must be a `properties` Hash'\n end\n\n definition.merge(properties: properties_or_children_or_text,\n children: children_or_text)\n elsif children_or_text.is_a?(String)\n unless properties_or_children_or_text.is_a?(Hash)\n fail Error, 'when `text` is defined as second argument, first argument must be a `properties` Hash'\n end\n\n definition.merge(properties: properties_or_children_or_text,\n children: [{\n type: :TEXT,\n value: children_or_text\n }])\n else\n # rubocop:disable Layout/LineLength\n fail Error, 'when first argument is a `properties` Hash, second argument must be either `Array` of `children` or a `String`'\n # rubocop:enable Layout/LineLength\n end\n elsif properties_or_children_or_text.is_a?(Hash)\n definition.merge(properties: properties_or_children_or_text)\n elsif properties_or_children_or_text.is_a?(Array)\n definition.merge(children: properties_or_children_or_text)\n elsif properties_or_children_or_text.is_a?(String)\n definition.merge(children: [{\n type: :TEXT,\n value: properties_or_children_or_text\n }])\n elsif properties_or_children_or_text.nil?\n definition\n else\n fail Error, 'first argument must be a `properties` Hash, `children` Array, text `String`, or empty'\n end\n end", "title": "" }, { "docid": "8a7867f3910f3ac58c0798bb70f64492", "score": "0.4541416", "text": "def getDcMetadataDefinition(metadata, meetingStartTime, meetingEndTime)\n dc_metadata_definition = []\n dc_metadata_definition.push( { :symbol => :title,\n :fullName => \"opencast-dc-title\",\n :fallback => metadata['meetingname']})\n dc_metadata_definition.push( { :symbol => :identifier,\n :fullName => \"opencast-dc-identifier\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :creator,\n :fullName => \"opencast-dc-creator\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :isPartOf,\n :fullName => \"opencast-dc-ispartof\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :contributor,\n :fullName => \"opencast-dc-contributor\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :subject,\n :fullName => \"opencast-dc-subject\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :language,\n :fullName => \"opencast-dc-language\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :description,\n :fullName => \"opencast-dc-description\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :spatial,\n :fullName => \"opencast-dc-spatial\",\n :fallback => \"BigBlueButton\"})\n dc_metadata_definition.push( { :symbol => :created,\n :fullName => \"opencast-dc-created\",\n :fallback => meetingStartTime})\n dc_metadata_definition.push( { :symbol => :rightsHolder,\n :fullName => \"opencast-dc-rightsholder\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :license,\n :fullName => \"opencast-dc-license\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :publisher,\n :fullName => \"opencast-dc-publisher\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :temporal,\n :fullName => \"opencast-dc-temporal\",\n :fallback => \"start=#{Time.at(meetingStartTime / 1000).to_datetime};\n end=#{Time.at(meetingEndTime / 1000).to_datetime};\n scheme=W3C-DTF\"})\n dc_metadata_definition.push( { :symbol => :source,\n :fullName => \"opencast-dc-source\",\n :fallback => $passIdentifierAsDcSource ?\n metadata[\"opencast-dc-identifier\"] : nil })\n return dc_metadata_definition\nend", "title": "" }, { "docid": "68d0106a7ece8b1f30dba60571c431da", "score": "0.45297587", "text": "def create_protonym_from_hol reference, name, author, journal, hol_taxon\n\n end", "title": "" }, { "docid": "3692e8e07e52aba2d809847ef986f4ee", "score": "0.45263162", "text": "def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end", "title": "" }, { "docid": "9b4b13e168452e93aba3ae6d932af094", "score": "0.45156106", "text": "def build_hash(ts)\n result = @data.map { |key, dps| { key => dps[ts] } if dps.key?(ts) }\n return if result.include?(nil)\n\n @parameters[ts] = result.reduce do |formula_map, parameter|\n formula_map.merge(parameter)\n end\n end", "title": "" }, { "docid": "dc520c224cb9b1fa881d8eca365eee96", "score": "0.45131588", "text": "def build\n Automaton.new(@name, @dimensions, @type, @width, @rule)\n end", "title": "" }, { "docid": "c9d8268697f1d1a29b32f1617777db61", "score": "0.45115775", "text": "def generate_column_def_table()\r\n table_def_name = \"column_definitions\"\r\n # If the table doesn't already exist, create it\r\n puts \"Creating column definition table (#{table_def_name}) if it doesn't exist.\" if @enable_debug_logging\r\n db_column_size_limits = @db_column_size_limits\r\n @db.transaction(:retry_on => [Sequel::SerializationFailure]) do\r\n @db.create_table?(table_def_name.to_sym) do\r\n String :tableName, :size => db_column_size_limits[:tableName]\r\n String :kappSlug, :size => db_column_size_limits[:kappSlug]\r\n String :formSlug, :size => db_column_size_limits[:formSlug]\r\n String :fieldName, :text => true\r\n String :fieldKey, :size => db_column_size_limits[:fieldKey]\r\n String :columnName, :size => db_column_size_limits[:columnName]\r\n primary_key [:tableName, :columnName]\r\n end\r\n end\r\n end", "title": "" }, { "docid": "f08e539ab013cdd1ef3aff9feebdc582", "score": "0.45059803", "text": "def build_embedded_models(data)\n return false unless relations.include? :embed_one\n\n relations[:embed_one].each do |name, relation|\n value = if data.key? relation[:alias] then data[relation[:alias]]\n elsif data.key? name then data[name]\n else nil\n end\n\n @embedded_models[name] = ::Mandrake::EmbeddedModel.new(relation[:model], value)\n end\n end", "title": "" }, { "docid": "f17d8670ce3387b807fbf023336f10f7", "score": "0.45025912", "text": "def save_definition(word_id, definition)\n MinWords::DB[:defines].insert definition_text: definition, word_id: word_id\n end", "title": "" }, { "docid": "fbb05073160928c06e3248ecd7562940", "score": "0.45024318", "text": "def make_hl7_from_text(text)\n hl7 = HL7::Message.new\n msh = hl7.standard_msh\n msh.sending_facility = {:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n if ENV['RAILS_ENV'] == 'development'\n pro_id = 'D'\n else\n pro_id = 'P'\n end\n msh.processing_id = {:processing_id=>pro_id}\n hl7 << msh\n p = User.find_by_wedgetail(wedgetail,:order=>\"created_at DESC\")\n hl7 << p.make_pid\n obr = HL7::Obr.new\n obr[0] = \"OBR\"\n obr.set_id = 1\n obr.filler_order_number= {:entity_identifier=>\"%X\" % self.id,:namespace_id=>Pref.namespace_id,:universal_id=>Pref.hostname,:universal_id_type=>\"DNS\"}\n author = User.find_by_wedgetail(created_by,:order=>\"created_at DESC\")\n obr.principal_result_interpreter = {:name=>{:family_name=>author.family_name.upcase,:given_name=>author.given_names.upcase,:id_number=>author.id}}\n obr.observation_time = created_at\n usi = {:name_of_coding_system=>\"LN\"} # LOINC\n message_type = {:message_code=>'REF',:trigger_event=>'I12'}\n case narrative_type_id\n when 1 # Health Summary\n usi[:identifier] = \"34133-9\"\n usi[:text] = \"Summarization of episode note\"\n when 2 # Medication Chart\n usi[:identifier] = \"19009-0\"\n usi[:text] = \"Medication.current\"\n when 3 # Discharge Summary\n usi[:identifier] = \"28574-2\"\n usi[:text] = \"Discharge note\"\n when 4 # Progress Note\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 5 # Allergies\n usi[:identifier] = \"11488-4\" # no good loinc code\n usi[:text] = \"Consultation Note\"\n when 6 # Scrapbook\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n when 7 # Result\n usi[:identifier] = \"11526-1\"\n usi[:text] = \"Study report\"\n message_type = {:message_code=>'ORU',:trigger_event=>'R01'}\n when 8 # Letter\n usi[:identifier] = \"34140-4\"\n usi[:text] = \"Transfer of care referral note\"\n when 9 # Immunisations\n usi[:identifier] = \"11369-6\"\n usi[:text] = \"History of immunization\"\n else\n usi[:identifier] = \"11488-4\"\n usi[:text] = \"Consultation Note\"\n end\n obr.universal_service_identifier = usi\n msh.message_type = message_type\n hl7 << obr\n obx = HL7::Obx.new\n obx[0] = \"OBX\"\n obx.set_id = 1\n obx.value_type = \"FT\"\n obx.identifier = usi\n obx.value = text\n obx.result_status = \"F\"\n hl7 << obx\n hl7\n end", "title": "" }, { "docid": "cd26449e931e349947c66c4a57e218d2", "score": "0.4497852", "text": "def get_definition()\n html_def = @noko.css(\"li.g:first-of-type\")\n local_word_info = Hash.new\n local_word_info[:title] = html_def.css(\"h3 span\")[0].text\n\n if local_word_info[:title].ascii_only?\n local_word_info[:title] = local_word_info[:title].upcase\n else\n local_word_info[:title] = make_readable(local_word_info[:title]).upcase\n end\n\n local_word_info[:types_definitions] = []\n html_def.css(\"tr\").each do |e|\n # puts e\n if e.to_s =~ /<div/\n definitions = Hash.new\n definitions[:type] = e.css(\"div\")[0].text.upcase\n definitions[:definitions] = []\n e.css(\"li\").each do |li|\n definitions[:definitions] << li.text\n end\n local_word_info[:types_definitions] << definitions\n end\n end\n\n return local_word_info\n end", "title": "" }, { "docid": "59101da551ec7a30fdf15a93086934b7", "score": "0.44855788", "text": "def build_xml(builder)\n super(builder)\n object_data.each do |d|\n builder.Attribute do |b|\n d.build_xml(b)\n end\n end\n builder.DefaultUnitType { |b| default_eng_unit_type.build_xml(b) }\n end", "title": "" }, { "docid": "d962bb99bd8699683a154d5d3c5f7876", "score": "0.44803363", "text": "def get_definition(codeClass, cfg)\n conDef = String.new\n indent = \" \"\n\n conDef << indent << \"# Constructor\\n\"\n\n conDef << indent << \"def initialize()\\n\"\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n if var.defaultValue != nil\n conDef << indent << \" @\" << var.name << \" = \"\n\n if var.vtype == \"String\"\n conDef << \"\\\"\" << var.defaultValue << \"\\\"\"\n else\n conDef << var.defaultValue << \"\"\n end\n\n if var.comment != nil\n conDef << \"\\t# \" << var.comment\n end\n\n conDef << \"\\n\"\n end\n end\n end\n\n conDef << indent << \"end # initialize\\n\\n\";\n\n return(conDef);\n end", "title": "" }, { "docid": "84086881ec2f60d609d1a5a15b06cf68", "score": "0.44739637", "text": "def parseDcMetadata(metadata, dc_metadata_definition)\n dc_data = {}\n\n dc_metadata_definition.each do |definition|\n dc_data[definition[:symbol]] = parseMetadataFieldOrFallback(metadata, definition[:fullName], definition[:fallback])\n end\n\n return dc_data\nend", "title": "" }, { "docid": "09407bb0163ef8628935afbb17002970", "score": "0.44675913", "text": "def parse (pdef)\n\n tree = case pdef\n when Array then pdef\n when String then parse_string(pdef)\n when Class then pdef.do_make\n when ProcessDefinition then pdef.do_make\n when SimpleExpRepresentation then pdef.do_make # legacy...\n else\n raise \"cannot handle pdefinition of class #{pdef.class.name}\"\n end\n\n tree = [ 'define', { 'name' => 'NoName', 'revision' => '0' }, [ tree ] ] \\\n unless get_expression_map.is_definition?(tree.first)\n #\n # making sure the first expression in the tree is a DefineExpression\n # (an alias for 'process-definition')\n\n tree\n end", "title": "" }, { "docid": "3207472336d687726ebfd07a8071d0ba", "score": "0.44653186", "text": "def createProgramXMLSection( houseElements )\n loc = \"HouseFile\"\n houseElements[loc].add_element(\"Program\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].attributes[\"class\"] = \"ca.nrcan.gc.OEE.ERS.ErsProgram\"\n houseElements[loc].add_element(\"Labels\")\n\n loc = \"HouseFile/Program/Labels\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"EnerGuide Rating System\")\n loc = \"HouseFile/Program/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"Système de cote ÉnerGuide\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Version\")\n loc = \"HouseFile/Program/Version\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].attributes[\"major\"] = \"15\"\n houseElements[loc].attributes[\"minor\"] = \"1\"\n houseElements[loc].attributes[\"build\"] = \"19\"\n houseElements[loc].add_element(\"Labels\")\n loc = \"HouseFile/Program/Version/Labels\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"v15.1b19\")\n loc = \"HouseFile/Program/Version/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"v15.1b19\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"SdkVersion\")\n loc = \"HouseFile/Program/SdkVersion\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].attributes[\"major\"] = \"1\"\n houseElements[loc].attributes[\"minor\"] = \"11\"\n houseElements[loc].add_element(\"Labels\")\n loc = \"HouseFile/Program/SdkVersion/Labels\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"v1.11\")\n loc = \"HouseFile/Program/SdkVersion/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"v1.11\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Options\")\n loc = \"HouseFile/Program/Options\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"Main\")\n loc = \"HouseFile/Program/Options/Main\"\n houseElements[loc].attributes[\"applyHouseholdOperatingConditions\"] = \"false\"\n houseElements[loc].attributes[\"applyReducedOperatingConditions\"] = \"false\"\n houseElements[loc].attributes[\"atypicalElectricalLoads\"] = \"false\"\n houseElements[loc].attributes[\"waterConservation\"] = \"false\"\n houseElements[loc].attributes[\"referenceHouse\"] = \"false\"\n houseElements[loc].add_element(\"Vermiculite\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite\"\n houseElements[loc].attributes[\"code\"] = \"1\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite/English\"\n houseElements[loc].add_text(\"Unknown\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite/French\"\n houseElements[loc].add_text(\"Inconnu\")\n loc = \"HouseFile/Program/Options\"\n houseElements[loc].add_element(\"RURComments\")\n loc = \"HouseFile/Program/Options/RURComments\"\n houseElements[loc].attributes[\"xml:space\"] = \"preserve\"\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Results\")\n loc = \"HouseFile/Program/Results\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"Tsv\")\n houseElements[loc].add_element(\"Ers\")\n houseElements[loc].add_element(\"RefHse\")\n\nend", "title": "" }, { "docid": "941752b90186831c3dbb4a03e1ab9566", "score": "0.44644633", "text": "def to_definition\n DynamicModel::AttributeDefinition.new({\n :class_type => self.class_type,\n :name => self.name,\n :type => self.type,\n :length => self.length,\n :required => self.required,\n :default => self.default\n })\n end", "title": "" }, { "docid": "633a2e8c2522fd26a7d6176d548c0f63", "score": "0.44625127", "text": "def data_for_hyacinth_ds\n data = super\n data[DIGITAL_OBJECT_DATA_KEY] = Marshal.load(Marshal.dump(@publish_target_data))\n data\n end", "title": "" }, { "docid": "6e61bcc05d86f26b0f2e25fdbfa75e7d", "score": "0.44585738", "text": "def hdf_descriptions(config_rule)\n [\n {\n label: 'check',\n data: check_text(config_rule)\n },\n ]\n end", "title": "" }, { "docid": "4b6834b832121a3489dc94c5ef71818f", "score": "0.44528913", "text": "def definition(definition_name)\n @definition_name = definition_name\n end", "title": "" }, { "docid": "39d5a154fc0db8eab37e429e1a143267", "score": "0.44512132", "text": "def getSeriesDcMetadataDefinition(metadata)\n dc_metadata_definition = []\n dc_metadata_definition.push( { :symbol => :title,\n :fullName => \"opencast-series-dc-title\",\n :fallback => metadata['meetingname']})\n dc_metadata_definition.push( { :symbol => :identifier,\n :fullName => \"opencast-dc-isPartOf\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :creator,\n :fullName => \"opencast-series-dc-creator\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :contributor,\n :fullName => \"opencast-series-dc-contributor\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :subject,\n :fullName => \"opencast-series-dc-subject\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :language,\n :fullName => \"opencast-series-dc-language\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :description,\n :fullName => \"opencast-series-dc-description\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :rightsHolder,\n :fullName => \"opencast-series-dc-rightsholder\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :license,\n :fullName => \"opencast-series-dc-license\",\n :fallback => nil})\n dc_metadata_definition.push( { :symbol => :publisher,\n :fullName => \"opencast-series-dc-publisher\",\n :fallback => nil})\n return dc_metadata_definition\n end", "title": "" }, { "docid": "d903f3b3ab244ff1bf3a8e3fba2b3676", "score": "0.44485223", "text": "def build_everything\n @defs.keys.each { |k| self[k] }\n end", "title": "" }, { "docid": "1a09ead6bae6e552068876c28275d732", "score": "0.44447076", "text": "def create_weekly_data\n number = @slide_number.to_i + 1\n data_content = Nokogiri::HTML(\n open(\n \"#{ENV['API_DOMAIN_2']}#{ENV['API_DOMAIN_2_WEEKLY']}\"\n )\n ).css(\"div.shareable-section-wrapper\")\n return {} if data_content.blank?\n\n data = {\n sign: @sign_name.to_s,\n duration: \"weekly\",\n horoscope_text: data_content.css(\"div[#{number}]\").text.split(' ')[1..-1].join(' ')\n } if data_content\n Horoscope.create(data) if data_content and data\n end", "title": "" }, { "docid": "c6d0dff7ff721881b3ecc03866d77da2", "score": "0.44423845", "text": "def content_description(element, essence_hash)\n essence_hash.stringify_keys!\n # No name given. We build the content from essence type.\n if essence_hash['name'].blank? && essence_hash['essence_type'].present?\n content_description_from_essence_type(element, essence_hash['essence_type'])\n else\n content_description_from_element(element, essence_hash['name'])\n end\n end", "title": "" }, { "docid": "7fa68133eff7967dd7066c81b49d3c2f", "score": "0.443917", "text": "def build(hsh)\n hsh.each do |k, v|\n k = Utils.camelize k.to_s if k.is_a? Symbol\n @parameters[k] = v.is_a?(Array) ? v.join(',') : v.to_s\n end\n\n self\n end", "title": "" }, { "docid": "7af2053cebacdb1f15f7d1c18165b487", "score": "0.44386533", "text": "def extract_definition_from_type\n # If we have a specific occurrence of a variable, pull attributes from the reference.\n # IDEA set this up to be called from dc_specific_and_source_extract, the number of\n # fields changed by handle_specific_variable_ref may pose an issue.\n extract_information_for_specific_variable if @variable && @specific_occurrence\n\n if @entry.at_xpath('./cda:grouperCriteria')\n @definition ||= 'derived'\n return\n end\n # See if we can find a match for the entry definition value and status.\n entry_type = attr_val('./*/cda:definition/*/cda:id/@extension')\n handle_entry_type(entry_type)\n end", "title": "" }, { "docid": "8a5a41cbb3afdb444e06e9acd20c0ca0", "score": "0.4435626", "text": "def structure\n # create a hash and return it\n h = {\n name: @name,\n required: @required,\n expression: @expression,\n data_type: @data_type,\n field_type: @field_type\n }\n h[:properties] = @properties if @properties.keys.count > 0\n h\n end", "title": "" }, { "docid": "d54ba3b4e5c6d75ca7f2def3a41a84c6", "score": "0.44249865", "text": "def GenElementHeader(tx, ty, tdir)\n tscale = GetCnt('refdessize')\n desc = AskStr('desc')\n if (name = AskStr('name')) == ''\n name = $ElementName\n end\n PcbElementHeader(\"\", desc, name, \"\", 0, 0, tx, ty, tdir, tscale, \"\")\nend", "title": "" }, { "docid": "587562b39bde37abbe1b1bbb68082ce5", "score": "0.44222257", "text": "def definition\n if element.blank?\n log_warning \"Content with id #{id} is missing its Element.\"\n return {}\n end\n element.content_definition_for(name) || {}\n end", "title": "" }, { "docid": "62bb8b1b79c515ed6108b299ad5cb27f", "score": "0.44191825", "text": "def amee_item_definition\n @amee_item_definition||=amee_data_category.item_definition\n end", "title": "" }, { "docid": "537515ea5b371a14209bccf9306e79d5", "score": "0.44151285", "text": "def initOML()\n\t\tlayouthash = Hash.new\t\t\t\t\t# use the layout hash to describe the database structure \t\t\t\t\t\n\t\tlayouthash[\"nodeid\"] = \"int32\"\t\t\t# column1: nodeid to identify which usrp inserted this row\n\t\tlayouthash[\"freq\"] = \"int32\" \t\t\t# column2: the RF freuquency of USRP (in case of sweeping mode, it is the frequency of the first block)\n\t\t\n\t\t# define the rest of the column names and the @oml_inject_str (contains ruby command to insert data) according to the number of channels and the mode \n\t\tif @mode == 'COR'\t\n\t\t\t@oml_inject_str=\"MPStatDynamic.inject(line.split(',')[1],#{(@freq/1000000).to_i},\"\n\t\t\tfor i in 1..@numofchannel\n\t\t\t\tlayouthash[\"cor#{i}\"]= \"double\"\n\t\t\t\t@oml_inject_str=@oml_inject_str+\"line.split(',')[#{i+1}].delete('\\\\n').to_f,\"\n\t\t\tend\t\t\t\t\t\n\t\telse\n\t\t\t@oml_inject_str=\"MPStatDynamic.inject(line.split(',')[1],#{(@freqbegin/1000000).to_i},\"\n\t\t\tfor i in 1..@numofchannel\n\t\t\t\tlayouthash[\"psd#{i}\"]= \"double\"\n\t\t\t\t@oml_inject_str=@oml_inject_str+\"line.split(',')[#{i+1}].delete('\\\\n').to_f,\"\n\t\t\tend\n\t\tend \n\t\t\n\t\t# create the measurement class\n\t\tclassname = \"#{@standard}_#{@mode}\".downcase \n\t\tMPBaseClassFactory.create_class(\"MPStatDynamic\", classname, layouthash)\n\t\tif MPBaseClassFactory.class_exists?(\"MPStatDynamic\")\n\t\t\tprintinfo \"measurement class #{classname} created ! \"\n\t\telse\n\t\t\tprinterr \"measurement class #{classname} creation failed ! \"\n\t\t\texit 1 \n\t\tend \n\t\t\n\t\t# complete the @oml_inject_str \n\t\t@oml_inject_str = @oml_inject_str[0..-2] + ')'\n\t\t\n\t\tif @expid.nil? or @expid.include?(\" \")\n\t\t\tprinterr \"invalid omf experiment ID, please specify with --expid option\"\n\t\t\texit 1\n\t\tend \n \t# call the OML library to initialize\n \tOML4R::init(nil, { :appName => \"usrpse\", :collect => \"tcp:am.wilab2.ilabt.iminds.be:3004\", :domain => @expid} )# use oml server\n \n\tend", "title": "" }, { "docid": "6f73f778ddf4eb37af1895826bc2a811", "score": "0.4414787", "text": "def load_entries_from_edw\n STDERR.puts \"Loading PrefixFence data from EDW for #{mss_name}.\"\n data = []\n SqlServer.create(EDW::SOURCE, EDW::DM_ALCATEL::DATABASE) do |db|\n db.query sql\n # puts db.fields\n data = db.data\n end\n data\n end", "title": "" }, { "docid": "15433a6763a7c2194f7c697e53f44694", "score": "0.4411935", "text": "def to_geoMetadataDS(isoXml, fcXml, purl)\n fail ArgumentError, 'generate-geo-metadata: PURL is required' if purl.nil?\n fail ArgumentError, 'generate-geo-metadata: ISO 19139 is required' if isoXml.nil? || isoXml.root.nil?\n\n Nokogiri::XML(\"\n <rdf:RDF xmlns:rdf=\\\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\\\">\n <rdf:Description rdf:about=\\\"#{purl}\\\">\n #{isoXml.root}\n </rdf:Description>\n <rdf:Description rdf:about=\\\"#{purl}\\\">\n #{fcXml.nil? ? '' : fcXml.root.to_s}\n </rdf:Description>\n </rdf:RDF>\"\n )\n end", "title": "" }, { "docid": "d3fbb4686b2c9cc09887f5b6eb2ac567", "score": "0.44076794", "text": "def report_definition\n\t\treport_def = {\n\t\t\tname: {difficulty: 40, approximator: \"none\", field_name:\"name\", max_datum:nil},\n\t\t\tdescription: {difficulty: 40, approximator:\"none\", field_name:\"description\", max_datum:nil},\n\t\t\tis_church: {difficulty: 40, approximiator:\"none\", field_name:\"is_church\", max_datum:nil},\n\t\t\tis_kingdom: {difficulty: 40, approximiator:\"none\", field_name:\"is_kingdom\", max_datum:nil},\n\t\t\tleader: {difficulty: 60, approximator:\"none\", field_name:\"leader_name\", max_datum:nil},\n\t\t\tsuzerain: {difficulty: 60, approximator:\"none\", field_name:\"suzerain_name\", max_datum:nil}\n\t\t}\t\t\t\n\tend", "title": "" }, { "docid": "8fcab4af61bf81ad6eef3475a989f5af", "score": "0.44075075", "text": "def outputMnemonicDefinition(row)\n # Get the variable data type\n dataType = ccdd.getStructureDataType(row)\n\n # Get the single character ITOS encoded form of the data type\n itosEncode = ccdd.getITOSEncodedDataType(dataType, \"SINGLE_CHAR\")\n\n # Check if this data type is a recognized base type, and not a structure\n if itosEncode != nil && itosEncode != dataType\n # Check if the encoding is 'raw' (unrecognized)\n if itosEncode == \"R\"\n # Default to \"unsigned\"\n itosEncode = \"U\"\n end\n\n # Get the variable name and array size\n variableName = ccdd.getStructureVariableName(row)\n arraySize = ccdd.getStructureArraySize(row)\n\n # Check if the variable is not an array definition\n isVar = isVariable(variableName, arraySize)\n\n # Check if the variable is a string\n isString = itosEncode == \"S\" && arraySize\n\n # Set the output flag if this is a non-string variable\n isOutputMnemonic = isVar && !isString\n\n # Check if this is a string definition\n if isString && !isVar\n # Set the flag if the string is not telemetered (if the first\n # member has no non-blank rate)\n isOutputMnemonic = !isTelemetry(row + 1)\n end\n\n # Only output non-array variables or array members (i.e., skip array\n # definitions)\n if isOutputMnemonic\n structurePath = ccdd.getFullVariableName(row, \".\")\n\n # Get the full variable name for this variable, which includes all\n # of the variable names in its structure path\n fullVariableName = ccdd.getFullVariableName(row)\n\n enumeration = nil\n\n # Get the enumeration(s)\n enumerations = ccdd.getStructureEnumerations(row)\n\n # Check if any enumeration exists\n if enumerations != nil && enumerations.length != 0\n # Store the first enumeration\n enumeration = enumerations[0]\n end\n\n # Get the polynomial conversion and limit sets columns (if extant)\n polynomial = ccdd.getStructureTableData(\"polynomial coefficients\", row)\n limitSet = ccdd.getStructureTableData(\"limit sets\", row)\n\n # Step through each flight computer\n for fcIndex in 0..$numFlightComputers - 1\n # Output the mnemonic\n ccdd.writeToFile($tlmFile, itosEncode + \" \" + $fcNames[fcIndex] + fullVariableName + \" {sourceFields = {\" + $fcNames[fcIndex] + structurePath + \"}\")\n\n isConversion = false\n isMultiple = false\n\n # Check if the parameter includes an enumeration\n if enumeration != nil && !enumeration.empty?\n isConversion = true\n isMultiple = false\n end\n\n # Check if this parameter includes a discrete or polynomial\n # conversion\n if polynomial != nil && !polynomial.empty?\n isConversion = true\n isMultiple = polynomial.split(\"\\\\;\").length > 1\n end\n\n # Check if there is an enumeration or polynomial conversion\n if isConversion\n # Check if there are conversions specific to each flight\n # computer\n if isMultiple\n # Output the flight computer-specific conversion\n # reference\n ccdd.writeToFile($tlmFile, \" conversion = \" + $fcNames[fcIndex] + fullVariableName + \"_CONVERSION\")\n # There is only a single conversion\n else\n # Output the conversion reference\n ccdd.writeToFile($tlmFile, \" conversion = \" + fullVariableName + \"_CONVERSION\")\n end\n end\n\n # Check if this parameter includes a limit or limit set\n if limitSet != nil && !limitSet.empty?\n # Output the limit reference\n ccdd.writeToFile($tlmFile, \" limits = \" + fullVariableName + \"_LIMIT\")\n end\n\n ccdd.writeToFileLn($tlmFile, \"}\")\n end\n end\n end\nend", "title": "" }, { "docid": "1c39a463ba7df943563d2f1210c78bbe", "score": "0.44054", "text": "def to_eeml(version = nil)\n if version.nil? || version == 5\n # Check that we have some data items\n if size < 1\n raise EEML::NoData.new('EEML requires at least one data item')\n end\n # Create EEML\n eeml = Builder::XmlMarkup.new\n eeml.instruct!\n eeml_options = {:xmlns => \"http://www.eeml.org/xsd/005\",\n :'xmlns:xsi' => \"http://www.w3.org/2001/XMLSchema-instance\",\n :'xsi:schemaLocation' => \"http://www.eeml.org/xsd/005 http://www.eeml.org/xsd/005/005.xsd\"}\n eeml_options[:version] = version if version\n eeml.eeml(eeml_options) do\n env_options = {}\n env_options[:updated] = @updated_at.xmlschema if @updated_at\n env_options[:creator] = @creator if @creator\n env_options[:id] = @id if @id\n eeml.environment(env_options) do |env|\n env.title @title if @title\n env.feed @feed if @feed\n env.status @status.to_s if @status\n env.description @description if @description\n env.icon @icon if @icon\n env.website @website if @website\n env.email @email if @email\n if @location\n loc_options = {}\n loc_options[:domain] = @location.domain\n loc_options[:exposure] = @location.exposure if @location.exposure\n loc_options[:disposition] = @location.disposition if @location.disposition\n env.location(loc_options) do |loc|\n loc.name @location.name if @location.name\n loc.lat @location.lat if @location.lat\n loc.lon @location.lon if @location.lon\n loc.ele @location.ele if @location.ele\n end\n end\n @data_items.each_index do |i|\n env.data(:id => @data_items[i].id || i) do |data|\n @data_items[i].tags.each do |tag|\n data.tag tag\n end\n value_options = {}\n value_options[:maxValue] = @data_items[i].max_value if @data_items[i].max_value\n value_options[:minValue] = @data_items[i].min_value if @data_items[i].min_value\n data.value @data_items[i].value, value_options\n if @data_items[i].unit\n unit_options = {}\n unit_options[:symbol] = @data_items[i].unit.symbol if @data_items[i].unit.symbol\n unit_options[:type] = @data_items[i].unit.type if @data_items[i].unit.type\n data.unit @data_items[i].unit.name, unit_options\n end\n end\n end\n end\n end\n end\n end", "title": "" } ]
b9a74eae1cc2f47d36db45edc371db92
signed_in employer required PATCH/PUT /jobs/1 PATCH/PUT /jobs/1.json
[ { "docid": "bdefdbf0c321879dea235f5ece35435c", "score": "0.0", "text": "def update\n authorize(@job)\n job_function = JobFunction.find(job_params[:job_function_id])\n respond_to do |format|\n if @job.update(job_params.merge(archetype_low: job_function.low,\n archetype_high: job_function.high,\n job_function_id: job_function.id))\n format.html { redirect_to employer_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "10b65d6ef9ec329e2779c302326a8b0e", "score": "0.72704774", "text": "def update\n if user_signed_in? and current_user.id == @job.user_id\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was unsuccessfully updated. You don\\'t have the permission to update it.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "83bb5bad3674f3fbd93695dfa37c786b", "score": "0.7058356", "text": "def update\n if current_user\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n #TO-DO: add fail cases for creation! \n end\n else\n flash[:notice] = 'You must be logged in to do this'\n redirect_to '/jobs'\n end\n end", "title": "" }, { "docid": "7d253fc9e30368e61ac33413c85b8d50", "score": "0.703124", "text": "def update\n @job = Job.find(params[:id])\n if @job.user_id.eql? current_user.id\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { render :action => \"edit\", :notice => 'Job 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 => @job.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n else\n not_authenticated\n end\n end", "title": "" }, { "docid": "8b7cbbf01c819e2f02767538d4786d93", "score": "0.70126885", "text": "def update\n #generate_companies_list\n #@companies.each {|idx, name| if name == job_params[:company] then @job.company_id = idx end}\n if current_role == :recruiter and !current_user.company_id.nil?\n @job.company_id = current_user.company_id\n @company = Company.find(current_user.company_id)\n end\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66a5043e03a031838b94ae3a9bb91b01", "score": "0.70024943", "text": "def update\n params[:job][:supervisors_override] = params[:supervisors]\n params[:job][:employees_override] = params[:students]\n @job = Job.find(params[:id])\n authorize! :update, @job\n @projects = SponsoredProject.current\n\n respond_to do |format|\n if @job.present?\n format.html { redirect_to(jobs_path, :notice => notice_msg || 'Job was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "dd47739e5108f5561b4a5a410450957b", "score": "0.6860672", "text": "def update\n\t if @job.update_attributes(job_params)\n\t redirect_to controller: 'employers', action: 'show', id: current_user.company.id\n\t else\n\t render 'edit'\n\t end\n\tend", "title": "" }, { "docid": "74b6e9c9648283170eadfde5784ec568", "score": "0.68507075", "text": "def update\n\n @job = current_company.jobs.find(params[:id])\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e02f7b74cdd50027063030e59f1f0b3", "score": "0.67928034", "text": "def update\n # authorize @job\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "426f10a7423698e34063b5e3597f0e3b", "score": "0.6725865", "text": "def update\n authorize! :update, @job\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc5942167ee5096b7c6030cecbd05725", "score": "0.66806287", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to employeer_job_path(@job), notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33f414b9e8699eb7b290f05cc7d45e83", "score": "0.6675793", "text": "def update\n @job = Job.find(params[:id])\n approved_by = nil\n if params[:job] and params[:job][:approved] then\n approved_by = session[:user_id]\n end\n\n respond_to do |format|\n # We only allow the approval to be updated on jobs\n if @job.update_attribute(:approved_by, approved_by)\n format.html { redirect_to(\"/jobs/#{@job.id}\", :notice => 'Job was successfully created.') }\n format.json { render :json => @job, :status => :ok }\n format.xml { render :xml => @job, :status => :ok }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "e88ff36bb65ae9aacc506fb48fdc89d4", "score": "0.66681105", "text": "def update\n @job = Job.find(params[:id])\n \n if @job.user_id = current_user.id\n (@job.update(job_params))\n redirect_to @job\n else \n render 'edit'\n end\n end", "title": "" }, { "docid": "6c1e928769f28097c55228a5251173fd", "score": "0.661623", "text": "def set_job\n @job = Job.includes(:employee).find(params[:id])\n @employee = @job.employee\n authorize @job\n end", "title": "" }, { "docid": "f87d5096ad04b7a50c685576cbf97e4e", "score": "0.66121334", "text": "def update\n\n #params[:author] = current_user.user_id\n @job= Job.find(params[:id])\n \n respond_to do |format|\n if @job.update_attributes(params[:job])\n\tformat.html { redirect_to api_path(@job.title_slug), notice: 'Api was successfully updated.' }\n\tformat.json { head :ok }\n else\n\tformat.html { render action: \"edit\" }\n\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "033065a22ae838f9ae196976827fb77e", "score": "0.6593497", "text": "def update\n authorize @job\n @job.update(job_params)\n head :no_content\n end", "title": "" }, { "docid": "d974d09ba849dee970199e9708a610e5", "score": "0.6573531", "text": "def update\n @job = Job.find(params[:id])\n if remember_token[0] != @job.user_id\n redirect_to(user_profile_path(remember_token[0]))\n end\n @title = 'Edit Job'\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to(@job, :notice => 'Job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72b32e8f2b406133714eb9000459fa63", "score": "0.6567657", "text": "def update\n return not_authorised_redirect unless current_user.can_update?(@job)\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd5acb16447956ddfbd452fe8b1490d2", "score": "0.6566266", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37a21b630308c8d762847367f5264338", "score": "0.6537101", "text": "def update\n respond_to do |format|\n if @user_job.update(user_job_params)\n format.html { redirect_to @user_job, notice: 'User job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b072f96ef03b104c9ffd83856a79848c", "score": "0.6510155", "text": "def update\n respond_to do |format|\n if @user_job.update(user_job_params)\n format.html { redirect_to @user_job, notice: 'User job was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_job }\n else\n format.html { render :edit }\n format.json { render json: @user_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "880c1bd650fc90fdc8d33e4514dd3d69", "score": "0.6504956", "text": "def update\n respond_to do |format|\n if @employee_job.update(employee_job_params)\n format.html { redirect_to @employee_job, notice: 'Employee job was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_job }\n else\n format.html { render :edit }\n format.json { render json: @employee_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29b8b9886a48df10320d10a103f8e44e", "score": "0.6501919", "text": "def update\n flash[:alert] = \"Manually updating jobs has been disabled\"\n return redirect_to :root\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6311540820a656580a50a5713a13fde", "score": "0.64525735", "text": "def update\n if user_signed_in? && policy(@work).can_be_edited_by(current_user)\n respond_to do |format|\n if @work.update(work_params) \n WorkJob.perform_later(current_user.email) #send email about new work has been created\n format.html { redirect_to @work, notice: \"Work was successfully updated.\" }\n format.json { render status: 200, json: { work: show_like_json(@work), notice: \"Work was successfully updated.\" } }\n else\n format.html { render :edit; flash[:notice] = \"Work was not updated.\" }\n format.json { render status: 422, json: { work: show_like_json(@work), notice: \"Work was not updated.\" } }\n end\n end\n else\n unauthorized\n end\n end", "title": "" }, { "docid": "28278f93027076fc5793a79890a011d1", "score": "0.6444164", "text": "def employment_edit\n @job = Job.find params[:id]\n end", "title": "" }, { "docid": "2eebd62c6abe403d6dbddffede8b122a", "score": "0.6417961", "text": "def edit\n authorize @job\n end", "title": "" }, { "docid": "d90a2c469f8d5e59b9d798c461261c3d", "score": "0.6408871", "text": "def update\n if((@jobseeker.email==\"jobs.direwolf.eeker@gmail.com\"))\n @custom_error = \"Action Not Allowed ! This is a SYSTEM DEFINED Jobseeker. Please create sample Jobseeker and perform this action\"\n render \"layouts/error\"\n return\n end\n respond_to do |format|\n if @jobseeker.update(jobseeker_params)\n format.html { redirect_to @jobseeker, notice: 'Jobseeker was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobseeker }\n else\n format.html { render :edit }\n format.json { render json: @jobseeker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "876c7088619802fc13cf30f9a76f46f0", "score": "0.6397768", "text": "def employment_update\n @job = Job.find params[:id]\n if @job.update job_params\n redirect_to applications_employment_path, notice: 'Employment updated'\n else\n render :employment_edit\n end\n end", "title": "" }, { "docid": "8407da5614abfb1ff79b119f97e5f2b4", "score": "0.63816494", "text": "def update\n respond_to do |format|\n if @req.update(req_params.except(:employer_id))\n format.html { redirect_to @req.employer, notice: 'Req was successfully updated.' }\n format.json { render :show, status: :ok, location: @req }\n else\n format.html { render :edit }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ada24996c9316898d621aed731ea8b5", "score": "0.6378989", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb42bbfa6eacbf8deda8be25725d2bbb", "score": "0.6376618", "text": "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc25e43a5e76bcec3ca60a3c69299d7d", "score": "0.6364333", "text": "def update\n @jobseeker = Jobseeker.find(params[:id])\n\n respond_to do |format|\n if @jobseeker.update_attributes(params[:jobseeker])\n format.html { redirect_to @jobseeker, notice: 'Jobseeker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobseeker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af0c586bb90cb76af46fd9151876a6c8", "score": "0.6361375", "text": "def update\n respond_to do |format|\n if @jobseeker.update(jobseeker_params)\n format.html { redirect_to @jobseeker, notice: 'Jobseeker was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobseeker }\n else\n format.html { render :edit }\n format.json { render json: @jobseeker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "333cbadce3aa7dfa2bb56b6e97592ed2", "score": "0.63589346", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_root_path, notice: 'The job opportunity was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "3fd05713ab6b96f2500094f1afb440ae", "score": "0.6354955", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42abac917e422e39dbd959f7b65f5402", "score": "0.63506037", "text": "def update\n respond_to do |format|\n if @employer.update(employer_params)\n sign_out(current_employer)\n sign_in(@employer, :bypass => true)\n format.html { redirect_to @employer, notice: 'Profile successfully updated.' }\n format.json { render :show, status: :ok, location: @employer }\n else\n format.html { render :edit }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17019b20eecedd78aca18f1dd3dd1b5d", "score": "0.63488215", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job_app, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0911500b5fd579bb0708c31c854d8fcf", "score": "0.63482094", "text": "def set_job\n @job = Job.includes(:employee, :order).find(params[:id])\n @order = @job.order\n @company = @job.company\n authorize @job\n\n end", "title": "" }, { "docid": "0ad14596f8d6e01ac8e6a9c190e56b49", "score": "0.63338", "text": "def update\n authorize @job\n respond_to do |format|\n if @job.update(job_params)\n\n mentioned_admins = @job.mentioned_admins if @job.mentioned_admins\n\n mentioned_admins.each do |mentioned_admin|\n current_user.events.create(action: \"mentioned\", eventable: mentioned_admin)\n end\n format.html { redirect_to admin_jobs_path(anchor: \"mod_#{@job.id}\"), notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7966b085e78c5bf6a4bd763f3be74aaa", "score": "0.6323326", "text": "def update\n return unless representsCompany?\n\n @job = Job.find(params[:id])\n return unless canEdit?(@job)\n @job.category = Category.find_by_name(params[:category])\n @job.location = Location.find_by_name(params[:location])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4738ab3c82b78a6b81b02616cb1d66f9", "score": "0.63155055", "text": "def update\n @jobs = Job.all\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d535b0f68db553461096f94e4221676", "score": "0.63144755", "text": "def update\n @empr_job = EmprJob.find(params[:id])\n\n respond_to do |format|\n if @empr_job.update_attributes(params[:empr_job])\n format.html { redirect_to @empr_job, notice: 'Empr job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @empr_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ab070a57419d2e2dba376187476898f", "score": "0.63139397", "text": "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c25f3b440317702e87f57e71a099c59", "score": "0.63125026", "text": "def update\n \n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa0d12ae4177654006772fd857051419", "score": "0.6295074", "text": "def update\n respond_to do |format|\n if @employer.update!(employer_params)\n @employer.user.complete!\n format.html { redirect_to edit_employer_path, notice: 'Employer was successfully updated.' }\n format.json { render :show, status: :ok, location: @employer }\n else\n format.html { render :edit }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4715eb0a17999f8f1537b7be055560bb", "score": "0.6294913", "text": "def update\n @job = Job.find(params[:id])\n \n # todo:\n # add permission checking here\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n flash[:notice] = 'Job was successfully updated.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b99379b9c9cc4c9aac50c90667e28359", "score": "0.6294238", "text": "def update\n #job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbdc8090730a776279da68b94dfeb6cf", "score": "0.6293428", "text": "def update\n @job = Job.find(params[:id])\n if @job.accepted == false\n Job.where(:id => @job).update_all(:acceptor_id => current_user.id)\n Job.where(:id => @job).update_all(:accepted => true)\n flash[:alert] = \"Congratulation job #{@job.title.capitalize} has been successfully accepted and added to your profile\"\n elsif @job.accepted == true\n Job.where(:id => @job).update_all(:completed => true)\n flash[:alert] = \"Congratulation job #{@job.title.capitalize} has been successfully marked completed and updated on your profile\"\n end\n redirect_to root_path\n # respond_to do |format|\n # if @job.update(job_params)\n # format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n # format.json { render :show, status: :ok, location: @job }\n # else\n # format.html { render :edit }\n # format.json { render json: @job.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "5d4ff01423a5fb53dc46c5590d2fe1db", "score": "0.62860215", "text": "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to jobs_url, :notice => 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ea081d03ce0018e9c55da33e5d44e3d", "score": "0.6284867", "text": "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to dashboard_url, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "140353d8623d6a9affa9742f26ea3f26", "score": "0.6278093", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: ' job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77a55e86ca99375421fb747171803921", "score": "0.62692606", "text": "def edit\n @job = Job.find(params[:id])\n authorize @job\n end", "title": "" }, { "docid": "5430f1a2db27d4a66bfae13cec9b73ed", "score": "0.626583", "text": "def update\n authorize @job\n \n respond_to do |format|\n if @job.update(job_params)\n\n mentioned_admins = @job.mentioned_admins if @job.mentioned_admins\n\n mentioned_admins.each do |mentioned_admin|\n current_admin.events.create(action: \"mentioned\", eventable: mentioned_admin)\n end\n format.html { redirect_to admin_job_path(@job), notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6265047", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6264826", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "533eaa793bec179661a839bbdb463ed3", "score": "0.6264707", "text": "def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, :notice => 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4959111df42613611738729ba7b98246", "score": "0.6263813", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b088b33528868d4b31ec89ae095a49d", "score": "0.6262534", "text": "def update\r\n respond_to do |format|\r\n if @job.update_attributes(params[:job])\r\n format.html { redirect_to @job, notice: 'Job 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: @job.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aba8f397a54eaeb64625b9b6c6815e5", "score": "0.62591124", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b42d42c43d0a88cf60eabce44078c8bb", "score": "0.6259059", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.json { render :show, status: :ok, location: @job }\n else\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68483c5e0e0f0bb5df1a4807e22738c8", "score": "0.62588817", "text": "def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
6e0542d3bf1fea1c6b14aca390ec86bd
Public: Checks if the given username / realm combination exists username the username to check realm the realm to check Examples digest_file.has_entry?("myuser", "myrealm") => true Returns true or false if the username/realm combination is found.
[ { "docid": "cb77e980f55fd84a536c8c829c3b00b7", "score": "0.7991423", "text": "def has_entry?(username, realm)\n test_entry = DigestEntry.new(username, realm)\n @entries.has_key?(test_entry.key)\n end", "title": "" } ]
[ { "docid": "78b38feb4feb7884b129e805938b6c36", "score": "0.66091895", "text": "def has_entry?(username)\n test_entry = PasswdEntry.new(username)\n @entries.has_key?(test_entry.key)\n end", "title": "" }, { "docid": "78b38feb4feb7884b129e805938b6c36", "score": "0.66091895", "text": "def has_entry?(username)\n test_entry = PasswdEntry.new(username)\n @entries.has_key?(test_entry.key)\n end", "title": "" }, { "docid": "3c36b499dad0ce05bc8d1381bc055fe3", "score": "0.5962358", "text": "def entry_exists?(entry)\n File.exist?(entry)\n end", "title": "" }, { "docid": "1bb2f7a881db2066816b82053d7abf16", "score": "0.5908403", "text": "def auth(username,pwd)\n File.open(File.expand_path(PWD_FILE), 'rb').each(sep='\\n') do |line|\n u,p = line.chop.split(':')\n if u == username\n if Digest::MD5.hexdigest(pwd) == p\n return true\n end\n end\n end\n return false\nend", "title": "" }, { "docid": "cd68181956d04dc457dd9bc29e75bf86", "score": "0.59027195", "text": "def user_file_exist?(file)\n File.exist? user_file_path(file)\n end", "title": "" }, { "docid": "d0f2768aebe7d8c12acbbaaf01a34041", "score": "0.5839052", "text": "def checkFileAccess(userName, fToAccess, fAccess)\n\n #return false if fAccess.end_with?(\".access\")\n if File.exist?(fAccess) && userExists(userName)\n\n fileProps = YAML.load_file(fAccess)\n fileUsers = fileProps[\"users\"]\n fileGroups = fileProps[\"groups\"]\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n\n if userName == nil\n return false\n end\n\n user = loadUser(userName)\n groups = Array.new\n groupFound = true\n groupAt = 0\n while groupFound\n\n if user.key?(\"group#{groupAt}\")\n groupTmp = user[\"group#{groupAt}\"]\n groups << groupTmp\n groupAt = groupAt.next\n else\n groupFound = false\n end\n end\n\n if(fileUsers.index(\";#{userName};\") != nil || fileUsers.index(\";guest;\") != nil)\n return true\n end\n if fileGroups.index(\";guests;\") != nil\n return true\n end\n for i in 0..groups.size\n\n if(fileGroups.index(\";#{groups[i]};\") != nil)\n return true\n end\n end\n return false\n end\n return false\n end", "title": "" }, { "docid": "b99aa2ef4886d69f8d8914db117ed563", "score": "0.5816934", "text": "def add(username, realm, password)\n raise DigestFileError, \"Unable to add already existing user #{username} in realm #{realm}\" if has_entry?(username, realm)\n\n new_entry = DigestEntry.new(username, realm, password)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end", "title": "" }, { "docid": "e1f56d90f7683bd801990c136dfda282", "score": "0.5704897", "text": "def exists?(username)\n File.open(FTPUSERS_PATH, 'r') do |f|\n f.each_line do |line|\n existing_user = line.split(':').first\n if username.eql?(existing_user)\n return true\n end\n end\n end\n\n return false\n end", "title": "" }, { "docid": "36c9c299252572ef3109d40f0d27986a", "score": "0.5703042", "text": "def exist?(digest)\n ppg_cache(digest) and directory_cache(digest)\n end", "title": "" }, { "docid": "1259d65e4e9707b1944bed71978afc13", "score": "0.5655897", "text": "def credentials? uri, challenges\n challenges.any? do |challenge|\n credentials_for uri, challenge.realm_name\n end\n end", "title": "" }, { "docid": "514f158878ca40dd96694182b08cd44a", "score": "0.5648755", "text": "def user_exists? env, username\n return false if config.nil? || config.empty?\n return true if config[env].has_key? username\n end", "title": "" }, { "docid": "2da38d63a05f8f60961475a104c14f2d", "score": "0.5582491", "text": "def has_user_credential?(username)\n self.credentials.map { |credential| credential.username }.include?(username)\n end", "title": "" }, { "docid": "106e0357691e9d54094ec67cd9f77725", "score": "0.5580393", "text": "def user_exists?(name)\n Etc.getpwnam(name).name == name\n rescue ArgumentError\n false\n end", "title": "" }, { "docid": "41097cec2b476c7a3f227155e12ecc8b", "score": "0.5565227", "text": "def has_users?\n username.present? || user_file.present? || userpass_file.present? || !additional_publics.empty?\n end", "title": "" }, { "docid": "2af004b0d335707d658e0dcbc7dc11f2", "score": "0.552027", "text": "def exist?(*args)\n get(*args)\n true\n rescue Veil::GroupNotFound, Veil::CredentialNotFound\n false\n end", "title": "" }, { "docid": "7c76a4ee8738cf92f23b8ff770dd8ff7", "score": "0.5472632", "text": "def namecheck(name)\n # puts(\"looking for name\")\n if @users.has_key?(name) == true\n return true\n else\n # puts(\"name not found?\")\n return false\n end\n end", "title": "" }, { "docid": "37878ad061e1eb78bcfacf73546f74b1", "score": "0.5466408", "text": "def valid_signin?(credentials)\n account_data = File.readlines(ROOT + \"/users.txt\")\n\n valid_credentials = account_data.map do |account|\n name, password = account.strip.split(\": \")\n [name, password]\n end.to_h\n\n valid_credentials.each do |(name, password)|\n return true if credentials[:username] == name && BCrypt::Password.new(password) == credentials[:password]\n end\n\n false\nend", "title": "" }, { "docid": "c7d0841bd3dbca27fe3d4357bd69aec5", "score": "0.54502606", "text": "def is_used_username? username\n hash = JSON.load File.new 'user_information/user_data.json'\n hash.each_key do |u|\n return true if u == username\n end\n false\nend", "title": "" }, { "docid": "3c259fda71fe64616269a3ea54b5f98a", "score": "0.54290885", "text": "def exists?(name)\n find_user(name)&.size != 0\n end", "title": "" }, { "docid": "737a4f1cae779064f67071759f48bbf5", "score": "0.5426296", "text": "def exists?\n if self.legacy?\n password_on_disk = SaltedSHA1.create_from_shadowhash_file self.generateduid[0]\n return false unless password_on_disk\n return false unless password_on_disk.password.eql? @password.password\n end\n super\n end", "title": "" }, { "docid": "c88e56863fc7be4ae876bad1458ad3b6", "score": "0.5411426", "text": "def check_hash(file, hash)\n if !hash.nil? && File.file?(file)\n computed_h = Digest::SHA256.file(file)\n true if hash.casecmp(computed_h.hexdigest).zero?\n else\n false\n end\n end", "title": "" }, { "docid": "a0b83cd170fdbf351ed604b0782be171", "score": "0.5408532", "text": "def is_entry?(line)\n begin\n is_entry!(line)\n return true\n rescue InvalidDigestEntry\n return false\n end\n end", "title": "" }, { "docid": "45b75ddd85946bbd6c6db184791cc680", "score": "0.5406018", "text": "def exists?\n username && api_key\n end", "title": "" }, { "docid": "612460d5a0532a5326044f7e21eb39a9", "score": "0.5404544", "text": "def exists?\n Puppet.debug \"check if installed: #{@resource[:path]}\"\n return false if self.to_bool(@resource[:replace]) && @resource[:ensure] != :absent\n if File.exists?(@resource[:path])\n return true if @resource[:md5] == nil\n Puppet.debug \"checking against md5 #{@resource[:md5]}\"\n path_md5 = self.getfile_md5(@resource[:path])\n Puppet.debug \"md5 for installed file is #{path_md5}\"\n return true if @resource[:md5] == path_md5\n end \n Puppet.debug \"file not installed #{@resource[:path]}\"\n return false\n end", "title": "" }, { "docid": "e3fd9d3e85bdac7c861231de37dc9542", "score": "0.54034287", "text": "def within_realm? uri\n uri = URI.parse(uri.to_s)\n realm = URI.parse(self.realm)\n return false unless uri.absolute?\n return false unless uri.path[0, realm.path.size] == realm.path\n return false unless uri.host == realm.host or realm.host[/^\\*\\./]\n # for wildcard support, is awkward with URI limitations\n realm_match = Regexp.escape(realm.host).\n sub(/^\\*\\./,\"^#{URI::REGEXP::PATTERN::URIC_NO_SLASH}+.\")+'$'\n return false unless uri.host.match(realm_match)\n return true\n end", "title": "" }, { "docid": "f79125fd65b1134ba0bb3e00ea0a6522", "score": "0.5402118", "text": "def is_entry!(line)\n raise InvalidDigestEntry, \"line commented out\" if line =~ /\\A#/\n parts = line.strip.split(\":\")\n raise InvalidDigestEntry, \"line must be of the format username:realm:md5checksum\" if parts.size != 3\n raise InvalidDigestEntry, \"md5 checksum is not 32 characters long\" if parts.last.size != 32\n raise InvalidDigestEntry, \"md5 checksum has invalid characters\" if parts.last !~ /\\A[[:xdigit:]]{32}\\Z/\n return parts\n end", "title": "" }, { "docid": "e03050d9c29025ae77b6fe51ec0cbec1", "score": "0.53925186", "text": "def auth_info_has_any_name?(info)\n [info['full_name'], info['first_name'], info['last_name']].any?\n end", "title": "" }, { "docid": "aed8442d64622b616b31215082053552", "score": "0.53852296", "text": "def User?(_Id, _Pwd)\r\n _Flag = 0\r\n _Users = YAML.load(File.read(\"_User_Info.yml\"))\r\n #puts \"_Users: #{_Users}\"\r\n if !(_Users)\r\n else\r\n\r\n _Users.each do |user|\r\n if user.has_value?(_Id.to_i) && user.has_value?(_Pwd)\r\n _Flag = 1 #existing user with matching password\r\n puts \"Welcome back #{user[:Name]}!!\"\r\n end\r\n end\r\n end\r\n return _Flag\r\nend", "title": "" }, { "docid": "8bb4425f0d5fc98ccc8c22c4c7baf840", "score": "0.5369883", "text": "def already_digested?(name)\n return name =~ /-([0-9a-zA-Z]{7,128})\\.digested/\n end", "title": "" }, { "docid": "4bc6f95164969fe48a605470d899f00f", "score": "0.53639877", "text": "def user_exists?(username)\n !!Etc.getpwnam(username) rescue false\nend", "title": "" }, { "docid": "db00710351d4e0f5df2640f96913a16f", "score": "0.5357757", "text": "def username_present?(username)\n @hashers.key?(username) && @passwords.key?(username)\n end", "title": "" }, { "docid": "fcbe2d149b34b9da17c13f0377d2ab8d", "score": "0.53403914", "text": "def is_entry?(line)\n begin\n is_entry!(line)\n return true\n rescue InvalidPasswdEntry\n return false\n end\n end", "title": "" }, { "docid": "795c746ce53322bd76cb280b441158a7", "score": "0.52909625", "text": "def ftp_account_exists?(username)\n ftp_account = ::Proftpd::FtpAccount.find_by_username(username)\n !ftp_account.nil?\n end", "title": "" }, { "docid": "622b1007daf1424deea20f912e759e5b", "score": "0.5261518", "text": "def has_uid_or_gid_action\n validate :uid, /^[0-9]+$/\n uid = request[:uid].to_i\n\n uids = IO.readlines(\"/etc/passwd\").map{ |line| line.split(\":\")[2].to_i }\n gids = IO.readlines(\"/etc/group\").map{ |line| line.split(\":\")[2].to_i }\n\n if uids.include?(uid) || gids.include?(uid)\n reply[:output] = true\n else\n reply[:output] = false\n end\n reply[:exitcode] = 0\n end", "title": "" }, { "docid": "6d34c702ed18803bc313f5930865400f", "score": "0.5229257", "text": "def exists?\n users(should_user, should_vhost)\n end", "title": "" }, { "docid": "ef8e09526b7cac23af25a2c7b36b31e7", "score": "0.52154094", "text": "def permissionsExist(file)\n\n fAccess = File.absolute_path(file)+\".access\"\n return !File.exist?(fAccess)\n end", "title": "" }, { "docid": "5555cb5e4bad5b1dbe6175765cbf229d", "score": "0.52153397", "text": "def cdb_has_key?(name)\n Chef::CouchDB.new.has_key?(\"webui_user\", name)\n end", "title": "" }, { "docid": "a7fb63931b51707ca2bfb9ea8663adba", "score": "0.5212226", "text": "def does_user_with_pass_exist(name, password)\n\n begin\n\n db = SQLite3::Database.open \"PicDB.db\" \n row_count = 0\n db.execute \"SELECT * FROM User where Name = '\" + name + \"' and Password ='\" + password + \"'\" do |row|\n row_count = row_count + 1\n end\n if row_count > 0\n return true\n else\n return false\n end \n rescue SQLite3::Exception => e\n puts \"Exception Ocurred\"\n puts e\n ensure\n db.close if db\n end\n end", "title": "" }, { "docid": "3c0fb74df32deec3033b4a0a7bdf4c36", "score": "0.5208896", "text": "def username_exists?(usernames, username)\n !usernames[username].nil?\nend", "title": "" }, { "docid": "c642c7e0b0614ac2ef5ac598ca0ce7c6", "score": "0.5206814", "text": "def check_email_existense\n @email_account_without_domain = normalized_email.split('@').first\n @home = `grep ^#{username} /etc/passwd | cut -d \\: -f6`.chomp\n @email_account_search = `grep -w #{@email_account_without_domain} #{@home}/etc/#{domain}/passwd 2>/dev/null`\n if @email_account_search.empty?\n puts \"E-mail account #{normalized_email} doesn't exist\"\n else\n true\n end\n end", "title": "" }, { "docid": "f2267ecd13deeec6fa62962be9ffa316", "score": "0.51925236", "text": "def user_exists?(username)\n users(username: username).present?\n end", "title": "" }, { "docid": "ed25c60782266c8fd71d16ab022a7fa7", "score": "0.5183897", "text": "def exists?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :exists\n end\n false\n end", "title": "" }, { "docid": "228bb7a5ce2828c3d14230c4a6a3d26d", "score": "0.518285", "text": "def existence_check_fn(criteria, against)\n File.basename(against).starts_with?(criteria[:prefix])\n end", "title": "" }, { "docid": "6b8f681af6e04dce8b7fafe1fa31d78c", "score": "0.5157826", "text": "def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n \n # read credentials from file\n credentials = open(\"credentials.txt\").read.split(\"\\n\").map{|c| c !~ /^#/ ? c : nil}.compact\n \n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == credentials\n end", "title": "" }, { "docid": "69dc0e838a935a64050018ff23a2dea3", "score": "0.5128415", "text": "def exists? jid\n\t\tuser = @users.read ['id'], ['jid', jid]\n\t\tuser.count > 0 ? true : false\n\tend", "title": "" }, { "docid": "a8d7ff07425c41cbb76b0ff384c9e142", "score": "0.5125483", "text": "def local_user_exists(handle: nil, **kwargs)\n users = _get_local_users(handle)\n users.each do |user|\n if user.check_prop_match(**kwargs)\n return true, user\n end\n end\n return false, nil\nend", "title": "" }, { "docid": "ce94d48cb023224a8e4517bdad05d341", "score": "0.5123939", "text": "def has_access_to_file(file_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n \n owner_id = $db.execute(\"SELECT owner_id FROM files WHERE file_id = ?\", file_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n end\n\n shared_users = $db.execute(\"SELECT user_id FROM shared_files WHERE file_id = ?\", file_id)\n shared_users.each do |user|\n if user[\"user_id\"] == user_id\n return true\n end\n end\n return false\nend", "title": "" }, { "docid": "8e06c00894b054833ad20081319477d0", "score": "0.51146895", "text": "def lockfile_exists?\n File.exist?(lockfile_name)\n end", "title": "" }, { "docid": "411a6544c0cbd9091ea0f2a409e025dd", "score": "0.51105285", "text": "def private_key_exists?\n full_key_path.exist?\n end", "title": "" }, { "docid": "bafbc4283dc67937572e3b137e7b3bdd", "score": "0.5108876", "text": "def exists?\n return false if resource[:force].eql? true\n\n authorizable_keystore = client(resource).authorizable_keystore(resource[:intermediate_path], resource[:authorizable_id])\n result = authorizable_keystore.exists\n\n result.data\n end", "title": "" }, { "docid": "3de59a324dd707d592332b04b8d4d0ca", "score": "0.509741", "text": "def exist?\n !entries.empty?\n end", "title": "" }, { "docid": "89d077aaeb7e04e46caf7f2db9069a63", "score": "0.50924695", "text": "def exists?(username)\n perform_request({:action => 'client-checkexists', :username => username})\n end", "title": "" }, { "docid": "4bdcb515a5cc9760558d063582927b90", "score": "0.5089809", "text": "def valid?\n return false unless ::File.exist?(@tmpfile)\n ::File.open(@tmpfile, &:readlines).map! do |line|\n return true if line.match(@secret)\n end\n false\n end", "title": "" }, { "docid": "b52ef81f96ac1330b0d9d1007b59e6ce", "score": "0.5087567", "text": "def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end", "title": "" }, { "docid": "1e04f03a8ad1b970568e3c4e5671165f", "score": "0.50864947", "text": "def does_exist(username)\n @user_manager.exists?(username)\n end", "title": "" }, { "docid": "aed6bcb8337c5717ce679eba397f67ab", "score": "0.5079215", "text": "def exists?(filename)\n @catalog.file_entries.find { |f| filename == f.name.strip }\n end", "title": "" }, { "docid": "b70aab3551eb02777028ecac8449d26c", "score": "0.50645304", "text": "def hasuser? username\n\t\t@cf.usermanager.user? username\t\t\n\tend", "title": "" }, { "docid": "24f0056b9fb5eb79973338aabe669d0e", "score": "0.5060383", "text": "def checksum_valid?\n Digest::SHA256.file(path).hexdigest == sha256sum\n end", "title": "" }, { "docid": "017c95389dbb6a4432341b4bc56f4ba7", "score": "0.5058061", "text": "def challenge_exists?(challenge_name)\n YAML.load_file(\"config.yaml\")[:challenges].each do |challenge|\n return true if challenge[:name] == challenge_name\n end\n false\n end", "title": "" }, { "docid": "9cb7f36f3e3fe89f59cd75eefe87312e", "score": "0.503207", "text": "def exists?(name, options = nil)\n options ||= {}\n name = expanded_key name\n\n instrument(:exists?, name) do\n !read_entry(name, options).nil?\n end\n end", "title": "" }, { "docid": "1b33d70b7f0539a06edf6dbfb4ae9d1c", "score": "0.5030985", "text": "def is_existing_user(db, username)\n username_arr = db.execute(\"SELECT username FROM users\")\n username_arr.each do |user|\n if user[0] == username\n return true\n end\n end\n return false\nend", "title": "" }, { "docid": "f72fa864300cc1660962cc105b478e98", "score": "0.5027291", "text": "def check\n prefix = File.basename(@file)\n if File.exist?(@file)\n @message = \"#{prefix} : Expected file exists\"\n true\n else\n @message = \"#{prefix} : Expected file not found.\"\n false\n end\n end", "title": "" }, { "docid": "8abfbcd168eb831af405a15304be4c62", "score": "0.5027215", "text": "def check_login(username, password)\n hashed_password = Digest::SHA2.hexdigest(password)\n\n @login_database.each_with_index do |data, index|\n return true if (data.include? username + \" || \" + hashed_password)\n end\n return false\nend", "title": "" }, { "docid": "b9315e1ff810d3ae3e29338a00807216", "score": "0.5026029", "text": "def exist?(hs)\n debug(\"Checking if Encrypted Attribute exists here: #{hs.inspect}\")\n result = EncryptedMash.exist?(hs)\n debug(\"Encrypted Attribute #{result ? '' : 'not '}found.\")\n result\n end", "title": "" }, { "docid": "c01be3173bae91027d4558ac59aaf2e5", "score": "0.5024426", "text": "def user_exists?(name)\n @users.member?(name)\n end", "title": "" }, { "docid": "d88ceab30be65c41160ebae99d29315f", "score": "0.5019481", "text": "def setting_exists? \n\t\tuser_ids = Setting.pluck :user_id\n\t\terrors.add(:user_id, \"user has a settings file already\") if user_ids.include? self.user_id\n\tend", "title": "" }, { "docid": "07e1cbb8b964230daf827407f3278db2", "score": "0.50191134", "text": "def does_user_exist(user_name)\n user = Account.find_by(:user_name => user_name)\n if user\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "07e1cbb8b964230daf827407f3278db2", "score": "0.50191134", "text": "def does_user_exist(user_name)\n user = Account.find_by(:user_name => user_name)\n if user\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "fe1768d3331cfaa0045197e230093751", "score": "0.5015086", "text": "def validate(file)\n Kernel::load file\n ENDPOINT.each_key do |k|\n auth = ENDPOINT[k][:oneauth]\n name = auth.split(\":\",2).first\n if name != ENV[\"USER\"]\n $Logger.error \"User attempting to upload invalid config.rb with user name of #{name} instead of #{ENV[\"USER\"]} for this service\"\n return false\n end\n end\n\n return true\n end", "title": "" }, { "docid": "ec5fdc96b1f9ee3432ecbe853fc784c8", "score": "0.50139654", "text": "def does_user_exist (username)\n user = Account.find_by(:user_name=> username)\n if user\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "a84c7043f35531daac1fcc64e307fad4", "score": "0.5009385", "text": "def user_exists?(public_key)\n User.all(public_key: public_key).count > 0\n end", "title": "" }, { "docid": "a705b73c4a569ff0241dcee5d0d402ff", "score": "0.49965468", "text": "def exists?( arg )\n begin\n super( arg )\n rescue PermissionFailure\n return true;\n end\n end", "title": "" }, { "docid": "a7bb7413b43388245e0e76b040222bbc", "score": "0.49932337", "text": "def check_account_holder_exists\n valid = false\n if account.present?\n account.users.each do |user|\n if (user.roles.map(&:title) & ['account_holder']).present?\n valid = true\n end\n end\n unless valid\n errors.add(:roles, 'cannot delete the only account holder')\n end\n end\n end", "title": "" }, { "docid": "bfa3e00b4c53ba97cf0eecf85ef85646", "score": "0.4990921", "text": "def add_or_update(username, realm, password)\n if has_entry?(username, realm) then\n update(username, realm, password)\n else\n add(username, realm, password)\n end\n end", "title": "" }, { "docid": "bfa3e00b4c53ba97cf0eecf85ef85646", "score": "0.4990921", "text": "def add_or_update(username, realm, password)\n if has_entry?(username, realm) then\n update(username, realm, password)\n else\n add(username, realm, password)\n end\n end", "title": "" }, { "docid": "edf9cdd5a88cdb07258e0d6b00084345", "score": "0.49897295", "text": "def valid_credentials?\n cred = load_credentials if File.file?(credentials_file)\n cred && cred.has_key?(:uuid) && cred.has_key?(:token)\n end", "title": "" }, { "docid": "6b23defdc2a58f6c023bcdcb8cba370a", "score": "0.49861857", "text": "def does_user_exist(username)\n user = Account.find_by(:user_name => username)\n if user\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "3a0d8d76dbb9b4c44a7a74ed7ce30c6a", "score": "0.49752542", "text": "def already_exists?(irc_authname)\n Player.filter(:irc_authname => irc_authname).select(:irc_authname).any?\n end", "title": "" }, { "docid": "3a0d8d76dbb9b4c44a7a74ed7ce30c6a", "score": "0.49752542", "text": "def already_exists?(irc_authname)\n Player.filter(:irc_authname => irc_authname).select(:irc_authname).any?\n end", "title": "" }, { "docid": "042969277e89f498f2e0acaf25f2436a", "score": "0.49724388", "text": "def file_exists?(file)\n File.exists?(file)\n end", "title": "" }, { "docid": "5a36ce293ad290f7c20f71aedb90bc33", "score": "0.4966489", "text": "def user_present(name)\n user_exists = false\n execute(\"dscacheutil -q user -a name #{name}\") do |result|\n user_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if user_exists\n\n uid = uid_next\n gid = gid_next\n create_cmd = \"dscl . create /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} NFSHomeDirectory /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} UserShell /bin/bash\"\n create_cmd << \" && dscl . create /Users/#{name} UniqueID #{uid}\"\n create_cmd << \" && dscl . create /Users/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end", "title": "" }, { "docid": "a71e32c47819f646b85645b25e951d31", "score": "0.4960173", "text": "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end", "title": "" }, { "docid": "c024c2faba1c556488b0f041c217ae05", "score": "0.49556676", "text": "def already_there(target, full_target)\n File.exists?(full_target) and (!CHECKSUMS.key?(target) or Digest::MD5.file(full_target).hexdigest == CHECKSUMS[target])\n end", "title": "" }, { "docid": "fa7f546df30b2fe3841c6f7962982ead", "score": "0.49552554", "text": "def new_user?\n while File.exist?(\"models/userDetails/#{@username}.txt\") == true\n puts \"Sorry #{@first_name}, the username '#{@username}' is taken. Please try another.\"\n @username = gets.chomp.downcase\n end\n\tend", "title": "" }, { "docid": "e43e0ab6f3a971d6a2ccc5916700f721", "score": "0.49525732", "text": "def check_file(bucket, file)\n bucket = get_bucket(bucket)\n response = bucket.object(file).exists?\n if response\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "83354f2c22d63ac3193a1b141d286aea", "score": "0.49479532", "text": "def can_access(u)\n if $config.options['debug']\n puts(\"ident: #{@ident} vs. #{u.ident}\")\n puts(\" host: #{@host} vs. #{u.rhost}\")\n puts(\" cert: #{@certfp} vs. #{u.certfp}\")\n puts(\" acct: #{@account} vs. #{u.su}\")\n puts(\"matc1: #{Match.match(@ident, u.ident, true)}\")\n puts(\"matc2: #{Match.match(@host, u.rhost, true)}\")\n puts(\" cert: #{(u.certfp && @certfp && u.certfp == @certfp)}\")\n puts(\" acct: #{u.su && @account && u.su == @account}\")\n end\n #identmatch = match(@ident, u.ident, true)\n #hostmatch = match(@host, u.rhost, true)\n #certfpmatch = u.certfp && @certfp && u.certfp\n Match.match(@ident, u.ident, true) && (Match.match(@host, u.rhost, true) ||\n Match.match(@host, u.ip, true))\n ((u.certfp && @certfp && u.certfp == @certfp) ||\n (u.su && @account && u.su == @account)) &&\n # Invalid O:line\n !(!@account && !@certfp)\n end", "title": "" }, { "docid": "b04c1d59dc600eeb2b7aa0ad4d78a086", "score": "0.4946887", "text": "def entry_exists?(clear_error_message = true)\n self.clear_error_message if clear_error_message\n\n pn = PartNumber.get_part_number(self)\n exists = pn != nil && pn.board_design_entry != nil\n self.set_error_message('The entry already exists') if exists\n exists\n end", "title": "" }, { "docid": "83ae70d9181ec3a951b59ac48277a619", "score": "0.49417302", "text": "def owned?(file)\n wide_file = string_check(file).wincode\n\n return_value = false\n size_needed_ptr = FFI::MemoryPointer.new(:ulong)\n\n # First pass, get the size needed\n bool = GetFileSecurityW(\n wide_file,\n OWNER_SECURITY_INFORMATION,\n nil,\n 0,\n size_needed_ptr\n )\n\n size_needed = size_needed_ptr.read_ulong\n\n security_ptr = FFI::MemoryPointer.new(size_needed)\n\n # Second pass, this time with the appropriately sized security pointer\n bool = GetFileSecurityW(\n wide_file,\n OWNER_SECURITY_INFORMATION,\n security_ptr,\n security_ptr.size,\n size_needed_ptr\n )\n\n raise SystemCallError.new(\"GetFileSecurity\", FFI.errno) unless bool\n\n sid_ptr = FFI::MemoryPointer.new(:pointer)\n defaulted = FFI::MemoryPointer.new(:int)\n\n unless GetSecurityDescriptorOwner(security_ptr, sid_ptr, defaulted)\n raise SystemCallError.new(\"GetFileSecurity\", FFI.errno)\n end\n\n sid = sid_ptr.read_pointer\n\n token = FFI::MemoryPointer.new(:uintptr_t)\n\n begin\n # Get the current process sid\n unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)\n raise SystemCallError, FFI.errno, \"OpenProcessToken\"\n end\n\n token = token.read_pointer.to_i\n rlength = FFI::MemoryPointer.new(:pointer)\n tuser = 0.chr * 512\n\n bool = GetTokenInformation(\n token,\n TokenUser,\n tuser,\n tuser.size,\n rlength\n )\n\n unless bool\n raise SystemCallError, FFI.errno, \"GetTokenInformation\"\n end\n\n string_sid = tuser[FFI.type_size(:pointer)*2, (rlength.read_ulong - FFI.type_size(:pointer)*2)]\n\n # Now compare the sid strings\n if string_sid == sid.read_string(string_sid.size)\n return_value = true\n end\n ensure\n CloseHandle(token)\n end\n\n return_value\n end", "title": "" }, { "docid": "68d8e9b1512db269e188ab36e81ede30", "score": "0.49400115", "text": "def exist?\n File.exist? fullpath\n end", "title": "" }, { "docid": "e086e50e1851ca139a5d99db916c18d3", "score": "0.49362227", "text": "def check_user_access(user, file, flag)\n if inspec.os.linux? == true\n # use sh on linux\n perm_cmd = \"su -s /bin/sh -c \\\"test -#{flag} #{file}\\\" #{user}\"\n elsif inspec.os[:family] == 'freebsd'\n # use sudo on freebsd\n perm_cmd = \"sudo -u #{user} test -#{flag} #{file}\"\n end\n\n if !perm_cmd.nil?\n cmd = inspec.command(perm_cmd)\n cmd.exit_status == 0 ? true : false\n else\n return skip_resource 'The `file` resource does not support `by_user` on your OS.'\n end\n end", "title": "" }, { "docid": "11fdccf88a15f894bf3fad271f9568b4", "score": "0.4932921", "text": "def folder_exists?\n empty_name?\n\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\") || File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\")\n print \"Directory `#{@name}` exists in #{LOCAL_PATH}. Pass a new name: \"\n elsif File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n print \"Directory `#{@name}.git` exists in #{REMOTE_PATH}. Pass a new name: \"\n end\n\n @name = gets.chomp\n folder_exists?\n end\n\n false\n end", "title": "" }, { "docid": "f7cf5fe3328c97a717ffe61e997ca52c", "score": "0.49270424", "text": "def validate_digest_response(request, realm, &password_procedure)\n credentials = decode_credentials_header(request)\n valid_nonce = validate_nonce(request, credentials[:nonce])\n\n if valid_nonce && realm == credentials[:realm] && opaque == credentials[:opaque]\n password = password_procedure.call(credentials[:username])\n method = request.env['rack.methodoverride.original_method'] || request.env['REQUEST_METHOD']\n\n [true, false].any? do |password_is_ha1|\n expected = expected_response(method, request.env['REQUEST_URI'], credentials, password, password_is_ha1)\n expected == credentials[:response]\n end\n end\n end", "title": "" }, { "docid": "e1ec0f9d1447b10ba9961ac2584ceeac", "score": "0.49210536", "text": "def file_exists?(file_name)\n test(\"[ -f #{file_name} ]\")\n end", "title": "" }, { "docid": "adc00b8ae4d5ae6636ed012bfd9d0ea5", "score": "0.4918069", "text": "def plist_key_exists?(key, file, opts={})\n plist_read(key, file, opts) != nil\n end", "title": "" }, { "docid": "d65eb700b30ee5d93778b036d7377e16", "score": "0.49176732", "text": "def checkUserFileAccess(userName, filePath)\n return false if filePath.end_with?(\".access\")\n if(userExists(userName))\n\n fAccess = filePath+\".access\"\n if File.exist?(fAccess)\n return checkFileAccess(userName, filePath, fAccess)\n else\n return checkUserDirectoryAccess(userName,filePath[0..filePath.rindex(@FS)])\n end\n end\n return false\n\n end", "title": "" }, { "docid": "5fe5c08e2995df2b8e4c022a2383d40c", "score": "0.49128827", "text": "def file_name_exist(file_name, owner_id)\n if $db.execute(\"SELECT file_name FROM files WHERE file_name = ? AND owner_id = ?\", file_name, owner_id) == []\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "dad61ea62245900ecd0fd9d43ddad56f", "score": "0.49117166", "text": "def existing_username\n valid = true\n existing_username = DATABASE.execute(\"SELECT * FROM members WHERE username = '#{username}';\")\n \n if !existing_username.empty?\n valid = false\n end\n return valid\n end", "title": "" }, { "docid": "759777ad196ae88643b487037cdaa2cf", "score": "0.49113217", "text": "def has_key? (fei)\n\n File.exist?(compute_file_path(fei))\n end", "title": "" }, { "docid": "1d41ef3494a47e68c5123b64fca65c28", "score": "0.49104038", "text": "def exists?\n File.exists?(@resource[:name])\n end", "title": "" } ]
64e13fb529bde2f7529c383f3a0ac248
Returns the full title on a perpage basis
[ { "docid": "a471d19325c733e2e3bb5e21253333fd", "score": "0.0", "text": "def full_title(page_title = '')\n base_title = 'DSDA'\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" } ]
[ { "docid": "8043c004aaf0669f8680ed8029a7fcae", "score": "0.8028669", "text": "def page_title\n title.page\n end", "title": "" }, { "docid": "d5574881411ca267fc1fd9a436ce6844", "score": "0.7777239", "text": "def full_title(page_title)\n base_title = \"Surpass the Limit\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "b41f193c810218f957840f243bb50657", "score": "0.7755148", "text": "def full_title(page_title)\n base_title = company.title\n base_title = \"#{page_title} | #{base_title}\" if !page_title.empty?\n base_title\n end", "title": "" }, { "docid": "71b7563707cda6a176ca450cae748436", "score": "0.76646644", "text": "def full_title(page_title)\n base_title = \"408textbooks \"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "1f37de37e4048415bd4f5f1925ce994f", "score": "0.76504254", "text": "def full_title(page_title)\n base_title = \"Oppcis\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "026d0fabd98c1979f5fd84e040776204", "score": "0.76276714", "text": "def full_title(page_title)\n base_title = \"NiPaNiPa\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "47db026aa5e0f1c089d3a01ea9c0bc4c", "score": "0.76205224", "text": "def full_title(page_title)\n return BASE_TITLE if page_title.nil? || page_title.empty?\n \"#{BASE_TITLE} | #{page_title}\"\n end", "title": "" }, { "docid": "c85262ee25ef79567fbea8fbfa828e18", "score": "0.7619339", "text": "def full_title(page_title)\n\t\tbase_title = title()\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse \n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend", "title": "" }, { "docid": "aad0f887bf5bb23f53a11761de6cc090", "score": "0.7617115", "text": "def full_title(page_title)\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" }, { "docid": "c9199da26ad0b05e16095cc6164161bf", "score": "0.76109666", "text": "def full_title(page_title = '')\n base_title = \"100 jaar HTS\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" }, { "docid": "2a90c2e273a0465d83ad96d074d2dee0", "score": "0.7602118", "text": "def page_title\n @page.title\n end", "title": "" }, { "docid": "56836c1381e0d71757ddbb6a727d1ab6", "score": "0.75975204", "text": "def full_title(page_title)\n base_title = \"UC Berkeley Alpha Kappa Psi\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "f52da89f0e6129dccb0b9396887774ef", "score": "0.7591144", "text": "def full_title(page_title)\n base_title = \"Time and it's Cost\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "62062d822b926e468c61e71bb0f243c8", "score": "0.7587074", "text": "def full_title(page_title)\n base_title = \"FloatingLegs performing the Extra-Ordinary\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "3fe0c8d5613133e58f7af48001f2ff12", "score": "0.75824946", "text": "def full_title(page_title)\n base_title = \"Suministro\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "aa7e79c4cb25c769eddee85f5d076b82", "score": "0.7573478", "text": "def full_title(page_title = \"\")\n base_title = \"Team Impact MMA Ennis\"\n page_title.empty? ? base_title : base_title + \" | \" + page_title\n end", "title": "" }, { "docid": "bdcda686ab3844fd3044fc8109150e68", "score": "0.75706226", "text": "def full_title(page_title)\n base_title = \"GZSpex\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "405d1072916bdba871d3d4ea3590c149", "score": "0.75679535", "text": "def full_title(page_title)\n base_title = \"Jespers Torvekøkken\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "f56a28a5a604cf999ca49af8b76de4ad", "score": "0.75566804", "text": "def full_title(page_title)\n base_title = \"SociaRoR\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "6846e1237e14fbbf8b3698b418edd663", "score": "0.7555473", "text": "def full_title(page_title)\n base_title = \"CPObaby\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "fcf9b2522c7aeb4d19958079357b4b37", "score": "0.75507075", "text": "def full_title(page_title = '')\n base_title = \"2055 Project\"\n if page_title.empty?\n base_title\n else\n \"#{page_title}\"\n end\n end", "title": "" }, { "docid": "86196d8e5ce0ab8241cdda45d83e89d5", "score": "0.75382197", "text": "def full_title(page_title = '')\n base_title = \"Blackwood PInes\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "fc38c92db07725a00af30b61824c17f6", "score": "0.7535386", "text": "def full_title(page_title = nil)\n if page_title.nil? || page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "b1afa740ab8b053c3198305f86f95f74", "score": "0.7533318", "text": "def full_title(page_title)\n base_title=\"StemLoops\"\n if page_title.empty?\n base_title\n else\n base_title+\" | \"+page_title\n end\n end", "title": "" }, { "docid": "2a475e8403651f81f093da5d2e2c6d23", "score": "0.75277835", "text": "def full_title(page_title)\n base_title = \"Gavin Ching's Story\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "50a8e99728e0fc70bf5864e5f38065b4", "score": "0.7524734", "text": "def fullTitle(page_title)\n base_title = \"LogAJog\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "c0fa9cf9147fd59a9168b7c2f72895a7", "score": "0.75236386", "text": "def full_title(page_title)\n base_title = \"Mesmeride\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "ca415800cddad629d141c082f18ac61d", "score": "0.7523478", "text": "def full_title(page_title)\n base_title = \"dutra\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "3a6882c30c11b2ec916e6d9c64421248", "score": "0.7522619", "text": "def full_title(page_title)\n base_title = \"Tromsø Dannede Gourmet Selskab\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "17dabaeba6bf41591537b7728b8863b7", "score": "0.75208306", "text": "def full_title page_title\n base_title = \"SPOT\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "269123e602f29e4dd6c42b75c15e34b5", "score": "0.75206137", "text": "def page_title\n ''\n end", "title": "" }, { "docid": "83b86c75283ffe578e2d632d2deeae8a", "score": "0.7515265", "text": "def full_title(page_title)\n base_title = \"Claseteca\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "915e6f945edf2bb5640513e1033e8817", "score": "0.7514578", "text": "def full_title(page_title)\n base_title = \"Sisdun\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "dc9a0aa60fb4783997e7a7efe93c8190", "score": "0.75097436", "text": "def page_title(title, options = {})\n if options[:full]\n @full_page_title = title\n else\n @page_title = title\n end\n end", "title": "" }, { "docid": "72d5a963f220ac19d51f3cce8bcceff4", "score": "0.75081086", "text": "def full_title(page_title = '')\n basis_title = \"Vinlotteri\"\n if page_title.empty?\n basis_title\n else\n page_title + \" | \" + basis_title\n end\n end", "title": "" }, { "docid": "29f3175b4f75566031f4d61550063185", "score": "0.75055814", "text": "def full_title(page_title)\n base_title = \"Hamco Internet Solutions\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "582da30d42fc73d2107b011098c71173", "score": "0.75013185", "text": "def full_title(page_title = '')\n base_title = \"Mulder WMS\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "63ff7537392f2864361f2499b0b7dceb", "score": "0.7498602", "text": "def full_title(page_title)\n site_name if page_title.empty?\n end", "title": "" }, { "docid": "63ff7537392f2864361f2499b0b7dceb", "score": "0.7498602", "text": "def full_title(page_title)\n site_name if page_title.empty?\n end", "title": "" }, { "docid": "f2b78f0c69781994a59b9f77a1377335", "score": "0.7493749", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else \n \"#{page_title} | #{site_name}\"\n end \n \n end", "title": "" }, { "docid": "cd01a9b65890fefa1f4407ac3b3016be", "score": "0.7492458", "text": "def full_title(page_title)\n base_title = \"Integrated Marketing, Branding, Social, Digital | Louisville, KY\"\n if page_title.empty?\n base_title\n else\n page_title\n end\n end", "title": "" }, { "docid": "b21f279bec90dedb31bf0798ac6bfadb", "score": "0.74766773", "text": "def full_title(page_title = '')\n base_title = \"TeamThrive\"\n if page_title.empty? \n base_title \n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "1b07272d859676cf61706132ce75703c", "score": "0.74764484", "text": "def full_title(page_title)\n base_title = \"아이엠박스\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "68b28541214e96f376560b7e7ced59c0", "score": "0.74689525", "text": "def full_title(page_title)\n base_title = \"ePick One\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "69f01d863d823bf2bd8fc69dcde3205b", "score": "0.7466737", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "3a628206f63f9fb090afcd7f12b1495a", "score": "0.74650055", "text": "def full_title(page_title)\r\n base_title = \"Concord University List of Courses\"\r\n if page_title.empty?\r\n base_title\r\n else\r\n \"#{base_title} | #{page_title}\"\r\n end\r\n end", "title": "" }, { "docid": "d785218898c2d52336f918c93c53cb4b", "score": "0.7464311", "text": "def full_title(page_title)\n base_title = \"Poc Station\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "18843498b764213ca87a665ba5f8023f", "score": "0.746416", "text": "def full_title(page_title)\n base_title = \"Fighting Game League\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "0f9c74b6252ccf9e4663424e11e50bb2", "score": "0.74634725", "text": "def full_title(page_title = '')\n base_title = DEFAULT_TITLE\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "5a4b0016e7f734a8adba007b3109e041", "score": "0.746175", "text": "def full_title(page_title)\n base_title = \"Real-Time Productivity\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" }, { "docid": "90f98763a4949211f3ab1338cbeb1986", "score": "0.7458291", "text": "def full_title(page_title = '')\n base_title = \"Grajnamaxa.pl - Gry Online, Darmowe Gry, Super Gry!\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" }, { "docid": "dd57103a3c9e5faed5dbaa30bdbdeaa9", "score": "0.74565923", "text": "def full_title(page_title = '')\n base_title = \"OwnYourData\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "dd57103a3c9e5faed5dbaa30bdbdeaa9", "score": "0.74565923", "text": "def full_title(page_title = '')\n base_title = \"OwnYourData\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "fbfa70fc71d74b7e674c35ac8582a0f4", "score": "0.7449984", "text": "def full_title(page_title)\n base_title = \"Model United Nations at UCSD\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "a6c6176a03e40bedc045925c6ec5acd1", "score": "0.74463224", "text": "def full_title(page_title)\n base_title = \"TPNA Membership\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "f0956f81c0c7916bfd972ab5e92945e0", "score": "0.7444474", "text": "def title\n page_title\n end", "title": "" }, { "docid": "dea723af6c9ebd7cced7c8f2a55fa577", "score": "0.7439866", "text": "def full_title(page_title = '')\n base_title = \"Stepní Vlk\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "ac596f984f7856467f6cbfdcb4baf48f", "score": "0.7439015", "text": "def full_title(page_title = '')\n\t\tbase_title = \"Camron Khan\"\n\t\tif page_title.blank?\n\t\t base_title\n\t\telse\n\t\t page_title + \" | \" + base_title\n\t\tend\n\tend", "title": "" }, { "docid": "d559730af36b4b76f5be94a332bc4a23", "score": "0.74356586", "text": "def full_title(page_title = '')\n base_title = 'Memento'\n if page_title.empty?\n base_title\n else\n \"#{page_title} - #{base_title}\"\n end\n end", "title": "" }, { "docid": "d05e6a2d664c545523576a1ab129e267", "score": "0.7431243", "text": "def full_title(page_title)\n base_title = \"Foods Watch\"\n if page_title.empty?\n base_title\n else\n \"#{page_title}-#{base_title}\"\n end\n end", "title": "" }, { "docid": "7764a537f771594aa7f823a6e039a4b6", "score": "0.743096", "text": "def full_title(page_title)\n\t\tbase_title = \"KnowMyDrive\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend", "title": "" }, { "docid": "71e68afb42eba9a79088683a4e9b00af", "score": "0.7424293", "text": "def full_title(page_title = '')\n base_title = \"Book of Faces\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "5304a934a78d0b7edc1827932b610922", "score": "0.74219173", "text": "def page_title\n @page_title\n end", "title": "" }, { "docid": "5304a934a78d0b7edc1827932b610922", "score": "0.74219173", "text": "def page_title\n @page_title\n end", "title": "" }, { "docid": "d0b7bc540b72ac467c7a73544e649c64", "score": "0.74216485", "text": "def full_title(page_title = '')\n base_title = \"HouHealth\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.7421082", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "69e7a2d626fa763bdf44667c9414366a", "score": "0.74210167", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "54553184d1459307ad19ab1f62ee7406", "score": "0.74183375", "text": "def full_title(page_title)\n base_title = \"Research and alerts for public documents published by cities and towns\"\n if page_title.empty?\n base_title\n else\n \"#{page_title}\".html_safe\n end\n end", "title": "" }, { "docid": "ee8f9a72f3e153d21647ec6465f381ae", "score": "0.7416703", "text": "def full_title page_title\n base_title = \"Writup\"\n if page_title.empty?\n base_title\n else\n \"#{base_title}::#{page_title}\"\n end\nend", "title": "" }, { "docid": "9a5828847d20870adbed6737b7d7074c", "score": "0.74161303", "text": "def full_title(page_title = '')\n base_title = \"ChatNoir, Best place to buy vintage art\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "ea036872f066ee06ef074a821080ba37", "score": "0.7415809", "text": "def full_title (page_title)\n base_title = \"SSO Manager\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "fb32e8f409886bf27cc9ebaedd16c638", "score": "0.7415275", "text": "def title\n page.title\n end", "title": "" }, { "docid": "c9ab5c933236efdc1aa2a3cee6dbfd9a", "score": "0.74140286", "text": "def full_title(page_title = '')\n base_title = 'The Jolly Advisor'\n\n if page_title.empty?\n base_title\n else\n \"#{page_title}|#{base_title}\"\n end\n end", "title": "" }, { "docid": "088bfe3b9ed0881765747dac4872a420", "score": "0.741275", "text": "def full_title(page_title = '')\n page_title.empty? ? BASE_TITLE : \"#{BASE_TITLE} | #{page_title}\"\n end", "title": "" }, { "docid": "bff81b784d4b3b304fdd7e3645e3353c", "score": "0.74062973", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "a94bb5ae13ff71398bfbb1bdb2b81c91", "score": "0.7405537", "text": "def full_title (page_title)\n base_title = \"Encuestador\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "cdfc3076d3a7ee202cc321c77bb2bfe1", "score": "0.7404392", "text": "def full_title(page_title)\n\tbase_title = \"The Blog of the Future\"\n\tif page_title.empty?\n\t\tbase_title\n\telse\n\t\t\"#{base_title} | #{page_title}\"\n \tend\n end", "title": "" }, { "docid": "eab78a2144f0999bf1f78c5cb2431405", "score": "0.7403199", "text": "def full_title(page_title)\n base_title = \"Bynet Small Cloud Tool\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "5a438354de2d541ca29e76c614c6ea16", "score": "0.7403101", "text": "def full_title(page_title = '')\n base_title = \"Math Affirm\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "5ca4964991c3ded9c0b2b7d327fcb9e9", "score": "0.73985606", "text": "def full_title(page_title = '')\n base_title = \"OHIP Covered Telemedicine Visits\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "6ca7100fefeebbe0f3bf38b3dc7b2255", "score": "0.73921025", "text": "def title_for(page)\n if page && page.data.page_title\n return \"#{page.data.page_title} - Serf by HashiCorp\"\n end\n\n \"Serf by HashiCorp\"\n end", "title": "" }, { "docid": "59e2133a66213af5e0e821a5f5391ddf", "score": "0.7382831", "text": "def full_title(page_title)\n base_title = \"Twelve Notes\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "59e2133a66213af5e0e821a5f5391ddf", "score": "0.7382831", "text": "def full_title(page_title)\n base_title = \"Twelve Notes\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "9f4a2346d4ac6878b9a88533802cbd4c", "score": "0.73741823", "text": "def get_page_title\n @page_title ? @page_title : prefix(nil)\n end", "title": "" }, { "docid": "14648436fab3c8e18c034c67dd422764", "score": "0.73680633", "text": "def full_title(page_title)\n page_title.empty? ? 'Nfuse' : ('Nfuse ' << page_title)\n end", "title": "" }, { "docid": "605f41df5b3d9688233489c3761686cd", "score": "0.73653394", "text": "def full_title(page_title = '')\n base_title = \"Oshie\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "63af4b3918295488a474f46b54c2e348", "score": "0.73583657", "text": "def full_title(page_title)\n base_title = \"CrowdCourse\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "8dc1189ba5f2d20047298ec994b7fa8f", "score": "0.73576206", "text": "def page_title(title = nil)\n @title = title unless title.nil?\n @title\n end", "title": "" }, { "docid": "bc7ad008e384f2cad49a4fcc696e8539", "score": "0.7356985", "text": "def full_title(page_title = '')\n base_title = \"Helpolos.com\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" }, { "docid": "f0ce528bc47b3beb2bf482ebc033297c", "score": "0.7355546", "text": "def full_title(page_title)\n base_title = \"CUFCQ\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "title": "" }, { "docid": "78c73dc29aef8991bcf8f1f0d1017f97", "score": "0.73551697", "text": "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "title": "" }, { "docid": "5481d7edc6c7dacb3f7fbcdda847044d", "score": "0.73546284", "text": "def full_title(page_title = '') \n base_title = \"Stack Overflow\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "title": "" } ]
c9e410f93dd40bdcf28d55f6dd7af34c
I worked on this challenge with Kennedy 1. Pseudocode What is the input? => The group method takes an input names which => is an array of strings. What is the output? => The method outputs 3 different sets of groups, => each with 4 or 5 people. What are the steps needed to solve the problem? => CREATE method group, takes an array as parameter => SET empty array named units => CREATE times loop to make 3 sets of groups => SET names variable to shuffled group => SET empty array named remainder => SET count variable to the remainder of names / 4 => SHIFT names variable into remainder array => SET groupsArray variable to names array sliced into groups of 4 => SHIFT remainder variable into arrays inside groupsArray => RETURN units
[ { "docid": "a122d28953ce7deb89453f20b309b259", "score": "0.8297913", "text": "def group(names)\n\tunits = []\n\t3.times do\n\t\tnames = names.shuffle\n\t\tremainder = []\n\t\tcount = names.length % 4\n\t\tcount.times do\n\t\t\tremainder << names.shift\n\t\tend\n\t\tgroupsArray = names.each_slice(4).to_a\n\t\twhile count != 0\n\t\t\tgroupsArray[count-1] << remainder.shift\n\t\t\tcount -= 1\n\t\tend\n\t\tunits << groupsArray\n\tend\n\treturn units\nend", "title": "" } ]
[ { "docid": "e37c869dc3bf560dd463c8a5b824c459", "score": "0.81615883", "text": "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "title": "" }, { "docid": "efa4e933b5bdf3ad2761cbcc3345fe52", "score": "0.7812525", "text": "def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend", "title": "" }, { "docid": "fb48fafcd0b640f2d3651abb3762d446", "score": "0.771167", "text": "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "title": "" }, { "docid": "27a0a1ff068fc4ee069bd0de1fe6b47e", "score": "0.76492274", "text": "def grouper(array)\n array = array.shuffle\n p num_groups = array.length / 4\n p remainder = array.length % 4\n groups = Array.new\n array.each_slice(4) {|slice| groups.push(slice)}\n if array.length == 6\n groups[1].push(groups[0][3])\n groups[0].pop\n\n elsif remainder == 0\n return groups\n elsif remainder == 1\n groups[0].push(groups[-1][0])\n groups.pop\n elsif remainder == 2\n groups[0].push(groups[-1][0])\n groups[1].push(groups[-1][1])\n groups.pop\n end\np groups\nend", "title": "" }, { "docid": "d821eda30a06eb9ff4387f6db29f94e9", "score": "0.7596136", "text": "def create_group(array)\nunit1=array.shuffle!.each_slice(4).to_a\nunit2=array.shuffle!.each_slice(4).to_a\nunit3=array.shuffle!.each_slice(4).to_a\nputs \"Unit1: #{unit1.to_s} Unit2: #{unit2.to_s} Unit3: #{unit3.to_s}\"\nend", "title": "" }, { "docid": "b5e5d99a7e1e136545221faec492c07d", "score": "0.7593769", "text": "def group_gen_array(list,people=5)# list and number of people per group\n list = Array.new(list) #makes it so that it doesn't change original list\n x = list.length # gets a workable non changing length of list\n num = (x-(x % people))/people\n # ^ creates base number of groups subtract remainder as to not end up with small group\n acc_group = Array.new(num){[]} # create an array to store groups\n group_num = 0\n while x != 1\n x = list.length #changing list number\n y = rand(0...x) #random number\n case group_num\n when num #when exceed group number reset\n group_num = 0\n end\n acc_group[group_num] << list[y] #append random name\n list.delete_at(y) #remove name from list to prevent duplicates\n group_num += 1 if acc_group[group_num].length >= people#when group hits/is max people go to next group\n\n end\n return acc_group\nend", "title": "" }, { "docid": "d10d333fa73e9c4537c5277a413a3e28", "score": "0.7570671", "text": "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "title": "" }, { "docid": "6f59052a79bcfae5db58ca86f091ec22", "score": "0.75587684", "text": "def make_groups(list_of_names)\n result = []\n num_people = list_of_names.length\n cur_group = []\n list_of_names.each do |name|\n cur_group.push(name)\n if cur_group.length == 4 || (cur_group.length == 3 && num_people == 3)\n result.push(cur_group)\n cur_group=[]\n end\n end\n # Right now the solution doesn't gracefully handle 6 people.\n # I should write a find_available function to find an open group to stick someone\n # in.\n if cur_group.length == 2\n name = cur_group.pop\n result[1].push(name)\n end\n if cur_group.length == 1\n name = cur_group.pop\n result[0].push(name)\n end\n return result\nend", "title": "" }, { "docid": "8ab741f26a018a95a47868e5262a1b94", "score": "0.75134164", "text": "def make_groups(all_students)\n\n #calculate how many groups of 5, with one group of leftovers\n num_full_groups = all_students.size / 5\n leftovers = all_students.size % 5\n group_avg = all_students.size.to_f / num_full_groups\n\n #each entry in group_sizes represents one group - put 5 in each full one\n group_sizes = Array.new\n for i in 0...num_full_groups\n group_sizes[i] = 5\n end\n\n #if there's a leftover group- while its size is (1 or more) students less than average, move students into it from other groups one by one\n if leftovers != 0\n i = 0\n while ((group_avg - leftovers) >= 1)\n group_sizes[i] -= 1\n leftovers += 1\n if i.next == num_full_groups\n i = 0\n else\n i = i.next\n end\n end\n group_sizes << leftovers #add leftovers group to group_sizes list\n end\n\n #now we have an array of group sizes, ex: [4,4,5,5,4]\n #populate new groups_names array with arrays of student names of those sizes\n\n groups_names = Array.new\n groupcount=0\n group_sizes.cycle(1) do |i|\n groups_names[groupcount] = Array.new\n for j in 0...i\n groups_names[groupcount][j] = all_students.shift\n end\n groupcount += 1\n end\n\n groups_names\n\nend", "title": "" }, { "docid": "202f4b7ba746871c708e5338b6c4d63a", "score": "0.74079067", "text": "def acct_groups(namelist)\n\tfull_size = namelist.size\n\tsize_of_group = 4 #because I counted the full list and counted 88 members... not sure how you'd go about it without having that number available\n\tnumber_of_groups = full_size / size_of_group #In this case 88/4 = 22\n\trandom_order = namelist.shuffle\n\tgroups = Array.new(number_of_groups) {[]}\n\t\tuntil random_order.empty?\n\t\t\tgroups.each do |group| \n\t\t\tgroup << (random_order.pop)\n\t\t\tend\n\t\tend\n\t\nreturn groups\nend", "title": "" }, { "docid": "336af80aae5b3d50df30b239fce62304", "score": "0.7381235", "text": "def fidder_crabs(names)\n\n # Create empty container for everyone in the group\n everybody = Hash.new\n # Create a counter for group number, defalt to 1\n counter = 1\n\n names.shuffle\n #Mix it up.!!!!!\n\n #while the list is longer than 8 people, put 5 each in a group.\n while names.length >= 8 do\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter +=1\n names = names.drop(5)\n end\n\n #if the remainder is 5, have the last group with 5 people\n if names.length == 5\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(5)\n\n #if the remaiinder group is 7, then we need to split the group into 4 and 3\n elsif names.length == 7\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n #creating the last group\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if the remainder is 6, we can have 2 groups of 3's\n elsif names.length == 6\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n #creating last group of 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if there is a remainder of 4 then create 1 group\n elsif names.length == 4\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n\n #if the remainder is 3, then create the last group with 3\n elsif names.length == 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n else\n names.length < 3\n names_in_group = names[0..1]\n everybody[counter] = names_in_group\n names = names.drop(3)\n end\n\n # since we filter by 8, the highest remainder is 7 and the lowest is 3, only 7 and 6 need to be split into 2 groups, while 3 and 4 could be in 1 group by themselfs.\n everybody\n #Return the hash of everybody in their group number with their names.\nend", "title": "" }, { "docid": "e26b9ceee50888434ce682e65e26577f", "score": "0.7293058", "text": "def accountability_groups(name_array, min_members)\n name_array = name_array.clone\n num_groups = name_array.length/min_members\n group_counter = 0\n group_array = Array.new(num_groups) { [] }\n\n while name_array.length > 0\n\ngroup_array[group_counter].push(name_array.delete_at(rand(0...name_array.length)))\n if group_counter == num_groups - 1\n group_counter = 0\n else\n group_counter += 1\n end\n end\n\n return group_array\n\nend", "title": "" }, { "docid": "eb0bf9aaadd19931938a4821eda9b666", "score": "0.725264", "text": "def method_people(names, number)\n names_array = names.shuffle.map\n teams = (names.length.to_f / number).ceil\n new_array = Array.new(teams) { Array.new }\n count = 0\n names_array.map do |name|\n new_array[count] << name\n count == (teams - 1) ? (count = 0) : (count += 1)\n end\n new_array\n end", "title": "" }, { "docid": "bbbcf82c3a1d37e1fe1ce2130ae07a12", "score": "0.7232833", "text": "def new_groups(array)\n new_group = []\n array.shuffle.each_slice(4){|acc| new_group << acc}\n if new_group.length > 1 && new_group.last.length <= 2\n (new_group.last.length).times do |i|\n new_group[i].push(new_group.last.pop)\n new_group.pop\n end\n end\n new_group\nend", "title": "" }, { "docid": "36ede43259afea1e5db4de6cb422164e", "score": "0.7193119", "text": "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "title": "" }, { "docid": "b74049a0517b441327348cc0e6f8ad2d", "score": "0.71479285", "text": "def accountability_groups(students)\n\nthrowaway = []\nunit = []\ngroups = []\n\n3.times do\n\tthrowaway = students.dup\n\ti = 0\n\n\twhile(throwaway.size > 0) do\n\n\t\tunit << throwaway.sample(4) if throwaway.size % 4 == 0 \n\t\tunit << throwaway.sample(5) if throwaway.size % 4 != 0\n\t\tunit[i].each { |student| throwaway.delete(student) }\n\t\ti += 1\n\tend\n\n\tgroups << unit.dup\n\tunit.clear\nend\ngroups\nend", "title": "" }, { "docid": "3e4c98b71fc08081f2afe04708944527", "score": "0.7143007", "text": "def group_creator(name_list)\n\n\taccountability_groups = []\n\trandomized_names = name_list.shuffle #Used non-destructive shuffle so that I can call on list again for unit 2/3\n\n\twhile (randomized_names.length > 4)\n\t\taccountability_groups << randomized_names.pop(4)\t\n\tend\n\n\tcounter = 0\n\tuntil (randomized_names.length == 0)\n\t\taccountability_groups[counter] << randomized_names.pop\n\t\tcounter\t+= 1\n\tend\n\t\t\n\tcounter = 0\n\tuntil accountability_groups[counter] == nil\n\t\tputs \"Group \" + (counter + 1).to_s + \":\" ; puts accountability_groups[counter]\n\t\tputs\n\t\tcounter += 1 \n\tend\nend", "title": "" }, { "docid": "6753185a1e992ca7330dd0257090d855", "score": "0.70911974", "text": "def create_groups(list, shuffle = false)\n list.shuffle! if shuffle == true\n no_of_groups = list.size < 12 ? list.size/3 : list.size/4\n new_array = Array.new(no_of_groups) {[]}\n new_array.each_with_index {|x, i| new_array[i] << list.pop; break if list.size==0} until list.size == 0\n new_array\nend", "title": "" }, { "docid": "9c28f1bdac7727ed231a24a36a6a91dc", "score": "0.7087796", "text": "def acct_groups(names)\r\n\r\n\tnum_groups = names.size / 4\r\n\r\n\tgroups_ary = Array.new(num_groups) { Array.new }\r\n\r\n\tnames.each_with_index do |name, index|\r\n\t\tgroups_ary[index % num_groups] << name\r\n\tend\r\n\r\n\tgroups_hash = Hash.new\r\n\tgroups_ary.each_with_index do |group_ary, index|\r\n\t\tgroups_hash[\"Accountability Group \" + (index+1).to_s] = group_ary\r\n\tend\r\n\r\n\treturn groups_hash\r\n\r\nend", "title": "" }, { "docid": "0221d8197cceeace3a0e139def35610f", "score": "0.70846987", "text": "def assign_groups(team_list)\n # Set group size to 5 people in each group\n if team_list.length % 5 != 0\n num_groups = team_list.length/5 + 1\n end\n\n #Randomize the number of people in each group\n team = team_list.shuffle\n teams = Array.new(num_groups) { [] }\n\n #Put 5 people in each group\n teams.each do |index|\n 5.times do\n index << team.pop\n end\n end\n return teams\nend", "title": "" }, { "docid": "731981380712553a2fe74eab2635f7c4", "score": "0.7052198", "text": "def make_groups(array)\n groups=Hash.new\n counter = 1\n while array.length > 3\n selection = array.sample(4)\n groups[counter] = selection\n selection.each {|x| array.delete(x)}\n counter += 1\n end\n while array.length != 0\n counter -= 1\n groups[counter] << array.pop\n end\n groups\nend", "title": "" }, { "docid": "d2ecb6eefc2149eb0fcccf29c94918c3", "score": "0.7030361", "text": "def acct_groups(array)\n if array.length % 5 != 0\n num_groups = array.length/5 + 1\n end\n \n cohort = array.shuffle\n groups = Array.new(num_groups) {[]}\n \n groups.each do |group|\n 5.times do \n group << cohort.pop\n end\n end\n \n return groups\nend", "title": "" }, { "docid": "4631dc15f8b528917160fca713cc33d1", "score": "0.69842154", "text": "def group\n students = (1...59).to_a\n students.shuffle.each_slice(5).to_a\nend", "title": "" }, { "docid": "7f8c62a6d331e399a375415b234560a2", "score": "0.6978485", "text": "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "title": "" }, { "docid": "7f8c62a6d331e399a375415b234560a2", "score": "0.6978485", "text": "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "title": "" }, { "docid": "e2e1722fad1119058c1017ce22d249f0", "score": "0.69406843", "text": "def accountability_group(dbcCohort_array)\n array_output = dbcCohort_array.shuffle.each_slice(4).to_a\n if array_output.length % 4 == 0 \n return array_output \n else \n remainder_people = array_output.pop \n for i in 0...array_output.length \n array_output[i].push(remainder_people[i])\n end\n return array_output\n end \nend", "title": "" }, { "docid": "8c939435fd963cc93d19fa83dae7f6b8", "score": "0.6891633", "text": "def group_maker(array)\n group_hash = {}\n arrays = array.each_slice(5).to_a\n arrays.each do |item|\n if item.length == 2\n arrays[0].push(item[0])\n arrays[1].push(item[1])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n \n elsif item.length == 1\n arrays[0].push(item[0])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n else\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n end\n end\n return group_hash\nend", "title": "" }, { "docid": "f6cf4b45c1ef912c90be009762d95dd3", "score": "0.6868903", "text": "def create_group(list) \n if list.length > 5 \n group = []\n group = list.shuffle.each_slice(5).to_a\n p group\n else\t\n p list\n end\nend", "title": "" }, { "docid": "b44345adc7074603dd74286aa2fb4358", "score": "0.6852387", "text": "def groupCreator(array)\n\t3.times do\n\t\tarray.shuffle!\n\t\t\tnewArray=array.each_slice(4).to_a\n\t\t\tnewArray.each do |x|\n\t\t\t\tif(x.length<4)\n\t\t\t\t\ti=0\n\t\t\t\t\tuntil x.length<=0\t\n\t\t\t\t\t\tnewArray[i]<<x.pop\n\t\t\t\t\t\ti+=1\n\t\t\t\t\tend\n\t\t\t\t\tnewArray.pop\n\t\t\t\tend\n\t\t\tend\n\t\t\tp newArray\n\tend\nend", "title": "" }, { "docid": "3ad51ee6ce6fe6899eb2f2504ea5c25d", "score": "0.67478985", "text": "def groupSlice(fireflies)\n \n unit_one = fireflies.shuffle.each_slice(4).to_a\n unit_one[0] << unit_one.pop\n unit_one[0].flatten!\n\n unit_two = fireflies.shuffle.each_slice(4).to_a\n unit_two[0] << unit_two.pop\n unit_two[0].flatten!\n \n unit_three = fireflies.shuffle.each_slice(4).to_a\n unit_three[0] << unit_three.pop\n unit_three[0].flatten!\nend", "title": "" }, { "docid": "9e74dba4153fec8eb2b1be7b2a466680", "score": "0.67306125", "text": "def generate_groups(list)\n\n # decides how many accountability groups to make\n no_of_groups = (list.length/5.0).ceil\n sets = []\n\n # loops once per accountability group to assign cohortians\n no_of_groups.times do\n\n set = []\n while set.length < 5 && list.length > 0\n selected = rand(list.length)\n set << list[selected] unless set.include?(list[selected])\n list.delete_at(selected)\n end\n\n sets << set\n end\n\n # pulls two cohortians from other groups if the last group is smaller than 3\n if sets[-1].length < 3\n sets[-1] << sets[-2][0]\n sets[-2].delete_at(0)\n sets[-1] << sets[-3][0]\n sets[-3].delete_at(0)\n end\n\n n = 1\n sets.each { |set| puts \"Group #{n} is #{set}.\"; n += 1}\nend", "title": "" }, { "docid": "424186c31858625852d3b3737e0bc172", "score": "0.672559", "text": "def acct_groups(cohort)\n\tgroups_array = []\n\tcohort_array = cohort.split(\", \").shuffle!\n\theadcount = cohort_array.size\n\t\tif headcount < 6\n\t\t\tputs \"Too few students to sort!\"\n\t\telsif headcount == 6 || headcount == 9\n\t\t\tcohort_array.each_slice(3) { |three_person|\tgroups_array.push(three_person) }\n\t\telsif headcount <= 8 || headcount % 4 == 0\n \t\t\tcohort_array.each_slice(4) { |four_person| groups_array.push(four_person) }\n\t\telsif headcount % 5 == 0 || headcount >= 11\n \t\t\tcohort_array.each_slice(5) { |five_person| groups_array.push(five_person) }\t\t\n\t\twhile groups_array.last.size < 3\n\t\t\tgroups_array.last.push(groups_array[0][0]); groups_array[0].shift\n\t\t\tgroups_array.last.push(groups_array[1][0]); groups_array[1].shift\n\t\tend\n\t\tend\n\tgroups_hash = Hash.new\n\tnum = 0\n\tgroups_array.each { |team| groups_hash[num += 1] = team }\n\treturn groups_hash\nend", "title": "" }, { "docid": "79d441bbceec51deb0b4bd60414a45f5", "score": "0.6706686", "text": "def name_array(array)\n group_size = 2\n # number_of_elements = array.length\n # number_of_arrays = number_of_elements / group_size.to_i\n shuffled = array.shuffle\n sliced = shuffled.each_slice(group_size).to_a\n if shuffled.length % 2 == 1\n sliced[-2] << sliced[-1][0]\n sliced.delete_at(-1)\n else\n sliced\n end\n sliced\nend", "title": "" }, { "docid": "bec0c2e9fbb54fc5e71f53ebab25036d", "score": "0.6705351", "text": "def accountability_groups(students)\nnum_of_groups = (1..15).to_a #turns number of groups needed into an array\n\nstudent_groups = Array.new #array of arrays of 4 or 5 students \nacct_groups = Hash.new #keys[num_of_groups], value(student_groups)\n\nstudents.each_slice(4) { |s| student_groups << s } #returns array of 14 groups of 4, 1 group of 1\n\nleftover = student_groups.pop #assigns variable name to the group of 1 student\n\nstudent_groups[-1].push leftover #pushes 1 leftover student into the 14th group \n\nnum_of_groups.each_with_index { |i, j| acct_groups[i]=student_groups[j] } #assigns number of groups needed (15 groups) as the hash keys and assigns each student group to a key's value.\n\np acct_groups\n\nend", "title": "" }, { "docid": "1c682246fd6d0664c37c1544cb0c110c", "score": "0.67046785", "text": "def assign_to_groups(number_of_students)\n if not ((number_of_students % 5) == 1 || (number_of_students % 5) == 2)\n group_size = 5\n easy = true\n else\n group_size = 4\n stragglers = number_of_students % group_size\n if stragglers == (0||3)\n easy = true\n else\n easy = false\n end\n end\n my_student_array = (1..number_of_students).to_a.shuffle\n group_assignments = Hash.new\n if easy == true\n assign(my_student_array, 0, group_assignments)\n else #easy = false\n assign(my_student_array, stragglers, group_assignments)\n while my_student_array.length > 0\n group_number -=1\n x = my_student_array.shift\n group_assignments[x] = group_number\n end\n end\n return group_assignments\nend", "title": "" }, { "docid": "f888016970c2c3eadee260b62ff01234", "score": "0.6672543", "text": "def group(list)\n\tfinalArray = Array.new(0)\n\tsubArray = Array.new(0)\n\tmemCounter = 0\n\tgroupMemCounter = 0\n\tgroupCounter = 0\n\tlist.length.times do\n\t\tsubArray.push(list[memCounter])\n\t\tmemCounter += 1\n\t\tgroupMemCounter += 1\n\t\tif groupMemCounter > 4\n\t\t\tfinalArray.push(subArray)\n\t\t\tgroupCounter += 1\n\t\t\tgroupMemCounter = 0\n\t\t\tsubArray = []\n\t\t\tif memCounter == (list.length) and subArray.empty? != true\n\t\t\t\tfinalArray.push(subArray)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tif subArray.length < 3 and subArray.length != 0\n\t\tpreviousGroup = finalArray[groupCounter-1]\n\t\tfinalArray.pop\n\n\t\tsubArray.push(previousGroup[(previousGroup.length-1)])\n\t\tpreviousGroup.pop\n\t\tsubArray.push(previousGroup[(previousGroup.length-1)])\n\t\tpreviousGroup.pop\n\n\t\tfinalArray.push(previousGroup)\n\t\tgroupCounter += 1\n\tend\n\tif subArray.empty? != true\n\t\tfinalArray.push(subArray)\n\tend\n\tprint finalArray\nend", "title": "" }, { "docid": "289f0f21aa778a80a098d1a0a4641139", "score": "0.667024", "text": "def create_groups(list)\n list_copy = []\n list.each {|item| list_copy.push(item)}\n all_groups = []\n list_copy.shuffle!\n while list_copy.size >= 4\n group = list_copy.pop(4)\n all_groups << group\n end\n if list_copy.size > 0\n list_copy.each_with_index do |person, index|\n person = list_copy.pop\n all_groups[index].push(person)\n end\n end\n hash = {}\n all_groups.each_with_index do |group, index|\n hash[\"Accountability Group #{index}\"] = group\n end\n p hash\nend", "title": "" }, { "docid": "8f205db36ed5021153f728840a37dfb3", "score": "0.664471", "text": "def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend", "title": "" }, { "docid": "2569b9fa03e72ed25b02d219e2c52ddd", "score": "0.65897477", "text": "def acct_groups(students)\nnum_students = students.length\n\n#driver code\n# p num_students\n\nif num_students <= 5\n p students\nelsif num_students % 5 == 0 || num_students % 5 >= 3\n p students.each_slice(5).to_a\nelsif num_students % 4 == 0 || num_students % 4 >= 3\n p students.each_slice(4).to_a {|group| p group}\nelsif num_students % 3 == 0\n p students.each_slice(3).to_a {|group| p group}\nelse\n p students.shift(3)\n p students.each_slice(5).to_a\nend\nend", "title": "" }, { "docid": "c4b6c3d56d4514d0a4fc5935e0f1e2f7", "score": "0.658969", "text": "def acct_groups(arr)\n\n num = arr.length\n if num % 5 == 0\n arr.each_slice(5) {|a| p a}\n elsif num % 4 == 0\n arr.each_slice(4) {|a| p a}\n elsif num % 3 == 0\n arr.each_slice(3) {|a| p a}\n elsif (num - 1) % 3 == 0\n arr.each_slice(3) {|a| p a}\n elsif (num + 1) % 3 == 0\n p arr.pop(5)\n arr.each_slice(3) {|a| p a}\n elsif (num - 1) % 4 == 0 || (num + 1) % 4 == 0\n arr.each_slice(4) {|a| p a}\n else\n arr.each_slice(5) {|a| p a}\n end\nend", "title": "" }, { "docid": "0bcb34f1557e574a438de527c0891cc8", "score": "0.6541139", "text": "def assign(group)\n\tif group.length % 5 == 0\n\t\treturn group.shuffle.each_slice(5).to_a\n\telsif group.length % 5 == 1\n\t\treturn group.shuffle.each_slice(4).to_a\n\telsif group.length % 5 == 2\n\t\treturn group.shuffle.each_slice(4).to_a\n\telsif group.length % 5 == 3\n return group.shuffle.each_slice(5).to_a\n\telsif group.length % 5 == 4\n return group.shuffle.each_slice(5).to_a\n\tend\nend", "title": "" }, { "docid": "125fa378ecb9da733dfa81db4013fb1d", "score": "0.6520265", "text": "def group\n students = (1...59).to_a\n students.each_slice(5).to_a\n\nend", "title": "" }, { "docid": "990cfa4bda1ef1733fe8a903b1bcee5e", "score": "0.65159994", "text": "def create_groups(cohort)\n if cohort.length % 5 == 0\n hash = {} \t\n \tcounter = 1\n group_count = cohort.length / 5\n remainder = cohort.length % 5 \t\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..4)\n counter += 1\n end\n else\n \thash = {}\n counter = 1 \n group_count = cohort.length / 4\n remainder = cohort.length % 4\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..3)\n counter += 1\n end\n end\n # Add remainders\n counter = 1\n cohort.each do |string|\n hash[counter] << string\n counter += 1\n end\nreturn hash\nend", "title": "" }, { "docid": "ec625a63d3c9f8fdb2ea4a5aa23c86bf", "score": "0.6507677", "text": "def groups (student_arr)\n num_of_arrays = student_arr.size/5\n if student_arr.size%5 != 0\n num_of_arrays += 1\n end\n\n i = 0\n j = 0\n answer = Array.new(num_of_arrays) {Array.new}\n while j < student_arr.size\n while i < num_of_arrays\n answer[i] << student_arr[j]\n i += 1\n j += 1\n end\n i = 0\n\n end\n p answer\nend", "title": "" }, { "docid": "c9144f84bd69fc54f377c149a0875dfe", "score": "0.64856786", "text": "def print_groups(groups)\n\tx = 0\n\t3.times do\n\tputs \"Unit #{x + 1} Groups\"\n\tgroups[x].each { |group| puts \"#{group} \\n\" }\n\tx += 1\nend\nend", "title": "" }, { "docid": "bb46ac6187018b3db05d7d482153b079", "score": "0.6455576", "text": "def sort_groups_initial(array)\n\t#Set number of groups (one if there are less than four people)\n\tgroup_num = array.length / 4\n\tgroup_num = 1 if array.length < 4\n\n\tcounter = 1\n\n\t#Create a new hash with a default value of an empty array for any key\n\tgroup_hash = Hash.new { |k,v| k[v] = [ ] }\n\n\tarray.each do |i|\n\t\t#Add name to group number\n\t\tgroup_hash[counter] << i\n\n\t\t#Increase group number, or loop back to first group\n\t\tif counter == group_num\n\t\t\tcounter = 1\n\t\telse\n\t\t\tcounter += 1\n\t\tend\n\tend\n\n\treturn group_hash\nend", "title": "" }, { "docid": "d4d507bf6ddd6a5436f3cf6415d000ef", "score": "0.6444203", "text": "def make_acct_groups\n\tputs \"Type in the number of students you have: \"\n\tnumber_students = gets.chomp.to_i\n\n\t# Construct the array with the numbers 1 ... number_stdnts\n\tstudent_id = Array.new(number_students) {|i| i+1 }\n\t#print student_id\n\n\tshuffle_id = student_id.shuffle.to_a\n\t#print shuffle_id\nmod4 = number_students % 4\n\n\tif (number_students == 6)\n\t\tnumber_groups = 2\n\telsif (mod4 ==3)\n\t\tnumber_groups = (number_students / 4) + 1\n\telse\n\t\tnumber_groups = (number_students / 4)\n\tend\n\n\tacct_groups = {} \t\n\tif (number_students == 6)\n\t\tfor i in 1..2\n\t\t\tif (i == 1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[0], shuffle_id[1], shuffle_id[2]]\n\t\t\telse\t\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[3], shuffle_id[4], shuffle_id[5]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 3)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= number_groups -1\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 2)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-2)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telsif (i == (number_groups -1))\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i], shuffle_id[4*i+1]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 1)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 0)\n\t\tfor i in 1..number_groups\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\tend\n\tend\n\treturn acct_groups\nend", "title": "" }, { "docid": "36b7eed8e535319edf351a4570794c22", "score": "0.6429616", "text": "def number_of_groups(list_of_students)\n\tif list_of_students.length % 5 == 0\n\t\tnumber_of_groups = (list_of_students.length / 5) \n\telse\n\t\tnumber_of_groups = (list_of_students.length / 5) + 1\n\tend\nend", "title": "" }, { "docid": "a8cdb88911d6e9a42be6fb1cf2f2d4fb", "score": "0.6429278", "text": "def acct_groups(array)\n group_1 = []\n group_2 = []\n group_3 = []\n group_4 = []\n group_5 = []\n group_6 = []\n group_7 = []\n group_8 = []\n group_9 = []\n group_10 = []\n prime_group = []\n\n i = 0\n while i < array.length\n if (i % 3 == 0) && !(i % 4 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_1 << array[i]\n elsif (i % 4 == 0) && !(i % 5 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_2 << array[i]\n elsif (i % 5 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_3 << array[i]\n elsif (i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_4 << array[i]\n elsif (i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_5 << array[i]\n elsif i % 11 == 0\n group_6 << array[i]\n elsif i % 13 == 0\n group_7 << array[i]\n else\n prime_group << array[i]\n end\n i += 1\n end\n x = 0\n while x < prime_group.length\n if (x % 2 == 0) && !(x % 3 == 0)\n group_8 << prime_group[x]\n elsif x % 3 == 0\n group_9 << prime_group[x]\n else\n group_10 << prime_group[x]\n end\n x += 1\n end\n\n\n\n puts group_1\n puts group_1.length\n puts group_2\n puts group_2.length\n puts group_3\n puts group_3.length\n puts group_4\n puts group_4.length\n puts group_5\n puts group_5.length\n puts group_6\n puts group_6.length\n puts group_7\n puts group_7.length\n #puts prime_group\n #puts prime_group.length\n puts group_8\n puts group_8.length\n puts group_9\n puts group_9.length\n puts group_10\n puts group_10.length\n puts array.length\nend", "title": "" }, { "docid": "e50359148c5b9a7d7d785914e4600665", "score": "0.6351271", "text": "def generate_one_grouping(size)\n\tstudents_array = self.students.to_a\n\tstudents_array.shuffle!\n \tgroup_sizes_array = determine_group_sizes(size)\n \tgroups = []\n \tgroup_sizes_array.each do |size|\n \t\tgroup = []\n\t\twhile group.length < size\n\t\t\tgroup << students_array.slice!(0)\n\t\tend\n\t\t\tgroups << group\n \tend\n \tgroups\n end", "title": "" }, { "docid": "7a603bfc810645f6712a108687ea049e", "score": "0.63478655", "text": "def accounts(group)\n if group.length % 5 == 0\n return group.shuffle.each_slice(5).to_a\n end\nend", "title": "" }, { "docid": "2440116763f65c355568b604ef24cccc", "score": "0.6307953", "text": "def make_groups(name_master_list, group_size, min_group_size, shuffle_first = false)\n\tgroups = {}\n\t# Set initial group number\n\tgroup_num = 1\n\tname_master_list.shuffle! if shuffle_first\n\t\n\tname_master_list.each_with_index do |name, index|\n\t\t# Set the value as an empty array if it doesn't already exist\n\t\tgroups[\"Group #{group_num}\"] ||= [] \n\t\tgroups[\"Group #{group_num}\"] << name\n\t\t# Test whether we have either reached the group size already\n\t\t# Or if we have reached the final name (The item at the next index is nil)\n\t\tif (index + 1) % group_size == 0 && name_master_list[index + 1] != nil\n\t\t\t# Time to make a new group with a new group number\n\t\t\tgroup_num += 1\n\t\tend\n\tend\n\n\t# The last group will be the one with the current group_num value\n\tlast_group = groups[\"Group #{group_num}\"]\n\t# Test if the last group is too small; if so, add its members to the other groups\n\tif last_group.length < min_group_size\n\t\t# Make the second-to-last group the new group for the first member\n\t\tnew_group_num = group_num - 1\n\t\tlast_group.each do |name|\n\t\t\t# Put the member into its new group\n\t\t\tgroups[\"Group #{new_group_num}\"] << name\n\t\t\t# Set a different new group for the next member\n\t\t\tnew_group_num -= 1\n\t\tend\n\t\t# Get rid of the group that was too small, now that its members have new groups\n\t\tgroups.delete(\"Group #{group_num}\")\n\tend\n\n\treturn groups\nend", "title": "" }, { "docid": "292f4ff1638052f0522590762a299f01", "score": "0.62794423", "text": "def groups\n @students.sort_by(&:fullname).each_slice((@students.count / 2.0).round).to_a\n end", "title": "" }, { "docid": "c44330b101a04b86c2f787dd2d0bf66d", "score": "0.61968637", "text": "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "title": "" }, { "docid": "10dccf5af7aa0188d805e506f2a2cffa", "score": "0.6195282", "text": "def town_names(i)\n starts = [\"Bed\", \"Brunn\", \"Dun\", \"Far\", \"Glen\", \"Tarn\"]\n middles = [\"ding\", \"fing\", \"ly\", \"ston\"]\n ends = [\"borough\", \"burg\", \"ditch\", \"hall\", \"pool\", \"ville\", \"way\", \"worth\"]\n\n if i==nil then i = 3\n end\n i.times{\n name1 = starts.sample(1)\n name2 = middles.sample(1)\n name3 = ends.sample(1)\n townArr = []\n townArr.push(name1, name2, name3)\n townName = townArr.each_slice(1).map{|a|a.join ''}.join ''\n p townName\n }\nend", "title": "" }, { "docid": "2ad41f9384d575442acde64166bb3506", "score": "0.6168052", "text": "def town_names(i=3)\nstarts = Array['Bed','Brunn','Dun','Far','Glen','Tarn']\nmiddles = Array['ding','fling','ly','ston']\nends = Array['bourough','burg','ditch','hall','pool','ville','way','worth']\n\nfinished_town_names = []\n\n\n (0...i).each do |element|\n finished_town_names[element] = starts.sample + middles.sample + ends.sample\n end\n\n return finished_town_names\n\nend", "title": "" }, { "docid": "2076356544285527c354ceea75eb9b0d", "score": "0.6126385", "text": "def create_teams(names_array, num_people_per_team)\n @newArray = []\n while names_array.length > 0\n @newArray << random(names_array)\n end\n @twoArray =[]\n\n (0...@newArray.length).step(num_people_per_team).each do |index|\n arr=[]\n for i in 0...num_people_per_team\n arr << @newArray[index + i]\n end\n @twoArray << arr\n end\n return @twoArray\nend", "title": "" }, { "docid": "4b8be6e9213361c4a280b8e1f3ea744b", "score": "0.6016605", "text": "def output_groups(students, size_of_group)\n group_id = 1\n until students.size == 0 do\n puts \"Group \" + group_id.to_s\n puts \"=================\"\n students.shift(size_of_group).each { |student| puts student.name }\n puts\n group_id += 1\n end\nend", "title": "" }, { "docid": "0d903172bb490fba29e0da409c258426", "score": "0.5993188", "text": "def randomizer(names)\r\n shuffled = names.shuffle\r\n sliced = shuffled.each_slice(2).to_a\r\n if shuffled.length % 2 == 1\r\n sliced[-2] << sliced[-1][0]\r\n sliced.delete_at(-1)\r\n sliced\r\n else\r\n sliced\r\n end\r\nend", "title": "" }, { "docid": "f50705a2cf38f0cc7b9d31076d4d8569", "score": "0.5918842", "text": "def groups\n\nroster = [ \"Caroline Artz\", \"Syema Ailia\", \"Alan Alcesto\", \"Daniel Andersen\", \"James Artz\", \"Darius Atmar\", \"Brian Bensch\", \"Nicola Beuscher\", \"Kris Bies\", \"Logan Bresnahan\", \"William Brinkert\", \"Laura C.\", \"Scott Chou\", \"Bernice Anne W Chua\", \"Abraham Clark\", \"Jon Clayton\", \"Kevin Corso\", \"Jacob Crofts\", \"John D.\", \"Katy D.\", \"Emmanuel Kaunitz\", \"Amaar Fazlani\", \"Solomon Fernandez\", \"Edward Gemson\", \"Jamar Gibbs\", \"Chris Gomes\", \"Will Granger\", \"Christopher M. Guard\", \"Adell H.\", \"James Hwang\", \"Matt H.\", \"Michael H.\", \"Peter H.\", \"Ryan Ho\", \"Igor Kazimirov\", \"Walter Kerr\", \"Karla King\", \"Becky Lehmann\", \"Malia Lehrer\", \"Carolina Medellin\", \"Timothy Meixell\", \"Lorena Mesa\", \"Chris Miklius\", \"Joshua Monzon\", \"Shea Munion\", \"Bryan Munroe\", \"Neal Peters\", \"Trevor Newcomb\", \"Aleksandra Nowak\", \"Morgan O.\", \"Fatma Ocal\", \"Van Phan\", \"Luis Fernando Plaz\", \"Nalie Polen\", \"Alicia Quezada\", \"Celeen R.\", \"Jessie Richardson\", \"Gary S.\", \"Iulia S.\", \"Nimi Samocha\", \"Zach Schatz\", \"Schwartz\", \"Pratik Shah\", \"Josh Shin\", \"Shawn Spears\", \"Sasha ilor\", \"Nil Thacker\", \"Nasha Thapliyal\", \"Sabrina Unrein\", \"Brian Wagner\", \"Clinton Weber\", \"Gregory Wehmeier\", \"Michael Whelpley\", \"Alexander Williams\", \"Peter N Wood\", \"Caitlyn Y.\", \"Ryan Zell\",\"random name\"]\n#initial solution\n\n=begin\n group_arrays = []\n i = 0\n while i < roster.length\n group_arrays << roster[i..i+3]\n i += 4\n end\n\n extra = []\n i = 0\n group_arrays.each { |group|\n if group.length < 3\n extra = group #take contents of group and add it to a different group\n if group_arrays[i].length == 5\n i += 1\n end\n group_arrays[i].concat(extra)\n group.pop\n end\n }\n puts group_arrays.to_s\nend\n\n=end\n\n# If I run this program 3 times, it will return the exact same groups\n#The program could be set up to store past groups, but I'd have to make some updates\n#no groups would be impacted by 1 person leaving, once 2 people left I could run the code again though.\n#biggest issue is I can empty the last array, but it doesn't delete the brackets. so that's a thing.\n\n#refactored solution:\n\n group_arrays = []\n while roster.length > 0\n group_arrays << roster.slice!(0..3)\n end\n\n left_overs = group_arrays[-1]\n\n i = 0\n group_arrays.each { |array|\n if left_overs.length < 3 && left_overs.length > 0\n group_arrays[i].push(left_overs[0])\n left_overs.shift\n if group_arrays[i].length == 5\n i += 1\n end\n elsif array.length > 5\n left_overs.push(array[-1])\n array.pop\n end\n }\n puts group_arrays.to_s\nend", "title": "" }, { "docid": "27a39039584469341f1a01e0477902cd", "score": "0.5918161", "text": "def regroup(groups)\n return if groups.empty?\n\n index = groups.count - 2\n while true\n break if index < 0\n if groups[index + 1] && groups[index].char == groups[index + 1].char\n groups[index].count += groups[index + 1].count\n groups.delete_at(index + 1)\n end\n if groups[index].count > 2\n groups.delete_at(index)\n end\n index -= 1\n end\n\n if groups[0] && groups[0].count > 2\n groups.detele_at(0)\n end\nend", "title": "" }, { "docid": "8847c5c3bc1e59b3a37183f082f043e0", "score": "0.5864098", "text": "def groups\n @students.each_slice((@students.count / 2.0).round).to_a\n end", "title": "" }, { "docid": "c78248478e430db4e9b21a8773cc5ccb", "score": "0.58454037", "text": "def acct_group(list)\n groups=[]\n if list.length<=5 \n groups = list \n else\n i=0\n while i <=list.length-3\n groups = groups << list[i..i+2]\n i+=3\n end \n groups[0] = groups[0]+list[i..list.length-1] \n end\n p groups\nend", "title": "" }, { "docid": "a8671b57d104eb8f9c3fed74b3eeb2d0", "score": "0.581848", "text": "def order_per_team(input_array, per_team)\n array = input_array.dup\n # Creates the bulk of teams\n output = (0...(array.length / per_team)).map do\n (0...per_team).map {array.delete_at(rand(array.length))}\n end\n # Corral any stragglers into last array element\n stragglers = []\n stragglers = (0...array.length).map { array.delete_at(rand(array.length)) }\n # binding.pry\n if stragglers.length < per_team -1\n output[0].concat(stragglers)\n else\n output << stragglers\n end\n raise \"order_per_team failed to add all elements to the outputs\" if array.length > 0\n output\nend", "title": "" }, { "docid": "e920d2d756bee9251a3e946efffc11c8", "score": "0.58174884", "text": "def count_SE_groups(a)\n return 1 if a.length == 1\n record = Hash.new\n len_elem = a[0].length\n if len_elem > 1\n a.length.times do |i|\n atemp = Array.new(2,\"\")\n len_elem.times do |j|\n atemp[j % 2] += a[i][j]\n end\n atemp = atemp[0].chars.sort!*\"\" + atemp[1].chars.sort!*\"\"\n a[i] = atemp\n end\n end\n p a.sort!\n count_of_groups = 0\n a.length.times do |i|\n count_of_groups += 1 if a[i + 1] != a[i]\n end\n count_of_groups\nend", "title": "" }, { "docid": "5e235dda477cd7dda9665b5cf375ec69", "score": "0.581567", "text": "def group(array)\n\t\tif (array.length%2) == 0 \n\t\t\tarray2=array[0..(array.length-1)/2]\n\t\t\tarray=array[(array.length)/2..array.length]\n\t\t\treturn array.zip(array2)\n\t\telse\n\t\t\todd_man = array[-1]\n\t\t\tarray = array[0..array.length-2]\n\t\t\tgrouped = group(array)\n\t\t\tgrouped[-1] = grouped[-1].push(odd_man)\n\t\t\tgrouped\n\t\tend\nend", "title": "" }, { "docid": "c4305633dde8bd419e5406f647a5de0f", "score": "0.58144385", "text": "def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend", "title": "" }, { "docid": "4f3e628360c3eda48f05cd4f85b65727", "score": "0.56966394", "text": "def generate_groups(groups, type)\r\n [].tap do |results|\r\n groups.each do |n, obj|\r\n group = {}\r\n group[\"name\"] = obj['name']\r\n group[\"code\"] = n\r\n group[\"risk_category\"] = \"AUTO\"\r\n group[type] = obj[type]\r\n results << group\r\n end\r\n end\r\nend", "title": "" }, { "docid": "448dcfc1c765b624be60006c727db97b", "score": "0.5689836", "text": "def group_names\r\n\t\tnames = []\r\n\t\tgroup.each do |mem|\r\n\t\t\tnames << mem.name\r\n\t\tend\r\n\t\tnames\r\n\tend", "title": "" }, { "docid": "0d71fde32474874984ca7569c4411321", "score": "0.5687358", "text": "def in_groups(number, fill_with = nil)\n # size.div number gives minor group size;\n # size % number gives how many objects need extra accommodation;\n # each group hold either division or division + 1 items.\n division = size.div number\n modulo = size % number\n\n # create a new array avoiding dup\n groups = []\n start = 0\n\n number.times do |index|\n length = division + (modulo > 0 && modulo > index ? 1 : 0)\n groups << last_group = slice(start, length)\n last_group << fill_with if fill_with != false &&\n modulo > 0 && length == division\n start += length\n end\n\n if block_given?\n groups.each { |g| yield(g) }\n else\n groups\n end\n end", "title": "" }, { "docid": "ca034cea187f1875441c5485a1ff6ce3", "score": "0.56747025", "text": "def groups(*groups); end", "title": "" }, { "docid": "ca034cea187f1875441c5485a1ff6ce3", "score": "0.56747025", "text": "def groups(*groups); end", "title": "" }, { "docid": "eae4402b47292b1f18cc24a00323dde3", "score": "0.5664541", "text": "def group_creator\n group = Random.new.rand(1..3)\n return group\nend", "title": "" }, { "docid": "0edcf7b9bdf59d1c2c47d9d941e189b8", "score": "0.566052", "text": "def group_students\n\n\n # retrieve the student\n students = @students.values\n students.sort! { |a,b| a.get_percent_correct <=> b.get_percent_correct }\n\n students_size = students.size \n n = students_size / 3\n\n\n @group_low = divide_students_to_group(0, n-1, students)\n @group_mid = divide_students_to_group(n, n*2-1, students)\n @group_high = divide_students_to_group(n*2, students_size-1, students)\n\n\n end", "title": "" }, { "docid": "da5ad605d542408734b997da50908970", "score": "0.56511414", "text": "def account_group(cohort)\n group_of_3 = cohort.sample(3)\n cohort -= group_of_3\n puts \"Accountability Group(3 people): \"\n group_of_3.each do |index|\n puts index\n end\n group_of_4 = cohort.sample(4)\n cohort -= group_of_4\n puts \"Accountability Group(4 people): \"\n group_of_4.each do |index|\n puts index\n end\nuntil cohort.empty?\n group_of_5 = cohort.sample(5)\n cohort -= group_of_5\n puts \"Accountability Group: \"\n group_of_5.each do |index|\n puts index\n end\nend\nend", "title": "" }, { "docid": "5d71f5b50d2b792c0d7d91daffa7329f", "score": "0.56359977", "text": "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tgroupMaker(array).any? {|x| x.length > 4} ? false : true\nend", "title": "" }, { "docid": "b7f880f1384aaf14d73f4dfd6c404179", "score": "0.56325483", "text": "def in_groups_of(item, number, fill_with = nil)\n if fill_with == false\n collection = item\n else\n padding = (number - item.size % number) % number\n collection = item.dup.concat([fill_with] * padding)\n end\n\n if block_given?\n collection.each_slice(number) { |slice| yield(slice) }\n else\n returning [] do |groups|\n collection.each_slice(number) { |group| groups << group }\n end\n end\n end", "title": "" }, { "docid": "96d49de44442958dda7008bd536759c1", "score": "0.56061405", "text": "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", "title": "" }, { "docid": "2a99c92c578881060df85be40e657876", "score": "0.5604119", "text": "def create_example_groups(groups_count = 100)\n # FIXME: What if Example organization is not found?\n organization = Organization.where(:name => 'Example').first\n \n # Get example students\n users = User.where(:firstname => 'Student', :organization_id => organization.id).all\n user_counter = 0\n \n # Create groups and submissions\n for i in (1..groups_count)\n # Create group\n group = Group.new(:course_instance_id => self.id, :name => \"Group #{i}\", :max_size => 3)\n group.save(:validate => false)\n\n # Add users to group\n students_count = rand(3) # self.groupsizemin + rand(self.groupsizemax - self.groupsizemin + 1)\n for j in (0..students_count)\n user = users[user_counter]\n group.add_member(user) if user\n user_counter += 1\n end\n\n break if user_counter >= users.size\n end\n end", "title": "" }, { "docid": "5b283552da134cb430c0a6e7bb8042fc", "score": "0.55902916", "text": "def groups_of(num)\n collection.each_slice(num).to_a\n end", "title": "" }, { "docid": "23dcfbe05fdfa1afd833578f6fa3db2c", "score": "0.5569989", "text": "def names_thingy\n arr = %w(John, KB, Oliver, Cory, Matthew, Christopher)\n arr.shuffle!\n for name in arr\n puts name\n end\n arr.reject { |elem| elem.length <= 5 }\nend", "title": "" }, { "docid": "0cdd75b29253b63bcc855994153e61a9", "score": "0.55637085", "text": "def step_one(input)\r\n\tletters = input.upcase.gsub(/[^a-zA-Z]/, \"\").split(\"\").compact\r\n\tgroups = letters.join(\"\").scan(/.{1, 5}/)\r\n\tx_group = groups.pop\r\n\tif x_group.length < 5 \r\n\t\tuntil x_group.length == 5\r\n\t\t\tx_group += \"X\"\r\n\t\tend\r\n\tend\r\n\tgroups = groups.push(x_group)\r\nend", "title": "" }, { "docid": "97f04eb32e3e6a480d57db50cac7f222", "score": "0.5563112", "text": "def town_names amt=5, near_water=false\n starts = ['Bed', 'Brunn', 'Dun', 'Far', 'Glen', 'Tarn']\n middles = ['ding', 'fing', 'ly', 'ston']\n ends = ['borough', 'burg', 'ditch', 'hall', 'pool', 'ville', 'way', 'worth']\n waters = ['-on-sea', ' Falls']\n random_names = []\n i = 0\n while i < amt\n name = \"#{starts.sample}#{middles.sample}#{ends.sample}\"\n if near_water == 'near_water'\n name += waters.sample\n end\n random_names.push(name)\n i += 1\n end\n return random_names\nend", "title": "" }, { "docid": "18cfaed22f80e26bde1d40cfc1c0147e", "score": "0.55600524", "text": "def generate_n_sets(array, number_of_sets)\n\nend", "title": "" }, { "docid": "c5f63a6c622b662a3ee69dfc89351e4d", "score": "0.5538325", "text": "def prepare_group_sort(players)\n # We put the players in buckets by their groups\n buckets = players.group_by { |p| p.group }.values.sort_by { |a| -a.length }\n\n # And then we collect them across the buckets\n bucket = buckets.shift\n bucket.zip(*buckets).flatten.compact\n end", "title": "" }, { "docid": "498fb5452d613bed60a4a4a97ba8f3c3", "score": "0.553802", "text": "def test5(array)\n\tputs \"Test5: Groups should be created randomly ->\"\n\tgroupMaker(array) != groupMaker(array) ? true : false\nend", "title": "" }, { "docid": "d4d31a457fa3e225eaa4782fba0f3091", "score": "0.55216914", "text": "def randomize(names_array)\n\tnames_array.shuffle!\nend", "title": "" }, { "docid": "e0f08bf35a868e1a840076519549d1e0", "score": "0.55057764", "text": "def populate_groups_for_round i=@round\r\n temp_groups = []\r\n (1..@number_of_groups).each_entry do |x|\r\n temp_group = Group.new(:position => i, :day => x, :schedule_dataset => self)\r\n temp_groups.push(temp_group)\r\n end\r\n\r\n # Add seminarians who need to be assigned to a single day\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups)\r\n sem.add_to_group(possible_grps.first) if possible_grps.count == 1 && !possible_grps.first.full?\r\n end\r\n\r\n # Add seminarians with too many duplicates to a group with least number of seminarians\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups).sort_by{|g| g.seminarians.count}\r\n sem.add_to_group(possible_grps.first) if sem.duplicate_days >= @duplicate_days_allowed && !possible_grps.first.full?\r\n end\r\n\r\n # Add at least one seminarian to each group\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups).shuffle\r\n sem.add_to_group(possible_grps.first) if possible_grps.count < @number_of_groups && possible_grps.first.seminarians.count == 0\r\n end\r\n\r\n seminarians_left = seminarians_for_round(i)\r\n \r\n while seminarians_left.any? do\r\n\r\n #Find the smallest groups\r\n smallest_number = temp_groups.sort_by{|g| g.seminarians.count}.first.seminarians.count\r\n small_groups = temp_groups.select{|tg| tg.seminarians.count == smallest_number}\r\n\r\n best_match = nil\r\n best_score = 9000\r\n\r\n small_groups.shuffle.each do |group|\r\n seminarians_left.shuffle.each do |sem|\r\n \r\n #Find the best match of seminarians and small groups\r\n if sem.score_for_group(group) < best_score\r\n best_match = [sem, group]\r\n best_score = sem.score_for_group(group)\r\n end\r\n end\r\n end\r\n \r\n best_match.first.add_to_group(best_match.second) if best_match\r\n seminarians_left = seminarians_for_round(i)\r\n end\r\n \r\n temp_groups.each{|g| @groups.push(g)}\r\n end", "title": "" }, { "docid": "03a1a005d053f480ed3a6331498ff443", "score": "0.54422826", "text": "def group_in_fours(i, b)\n b.push(i)\n if b.size() == 4 then\n puts b.to_s\n b.clear\n end\nend", "title": "" }, { "docid": "5906900553835b583902e5e2afaafc09", "score": "0.54337996", "text": "def random_name_generator\n letter_array = (\"A\" .. \"Z\").to_a\n three_letters = letter_array.shuffle.pop(3).join(\"\")\n three_numbers = (1..9).to_a.shuffle.pop(3).join(\"\")\n result = three_letters + three_numbers\n end", "title": "" }, { "docid": "d2e877aea8c392beed0a96e60efda2ae", "score": "0.5412592", "text": "def find_smallest_group(length)\n remainder = length % 5\n if remainder == 0\n return [5, 0]\n elsif remainder == (3 || 4)\n return [remainder, 0]\n else\n diff = 3 - remainder\n return [3, diff]\n end\nend", "title": "" }, { "docid": "39649b54c582b7d889c53ae29e71aaf1", "score": "0.5401928", "text": "def tests_in_groups(tests, num_groups, options={})\n tests = find_tests(tests, options)\n\n case options[:group_by]\n when :found\n tests.map! { |t| [t, 1] }\n when :filesize\n sort_by_filesize(tests)\n when nil\n sort_by_filesize(tests)\n else\n raise ArgumentError, \"Unsupported option #{options[:group_by]}\"\n end\n\n Grouper.in_even_groups_by_size(tests, num_groups, options)\n end", "title": "" }, { "docid": "bb40959e5940b55e901d24d556a5b346", "score": "0.5394995", "text": "def mix_names(girls_array, boys_array)\n b_i = 0 \n boys_array.length.times do \n girls_array << boys_array[b_i]\n b_i += 1 \n end \n output = girls_array\n return output\nend", "title": "" }, { "docid": "3870abc73973fb94b6df21e8f646c87f", "score": "0.538973", "text": "def form_groups\n # allows for the user to sort randomly, by section, by major, by section major, and asks users for desired number of students per group\n puts \"Enter how you would like groups to sorted, then choose the number of students in each group\"\n puts \"1-sort groups randomly\"\n puts \"2-sort groups by section\"\n puts \"3-sort groups by major\"\n puts \"4-sort groups by section and major\"\n user_selection = gets.chomp\n case user_selection\n when \"1\"\n puts \"Groups will be formed randomly and the student list will be permanantly sorted.\"\n puts \"Enter the number of students per group: \"\n num_students = gets.chomp.to_i\n # uses ruby's .shuffle method to randomly place students in @student_array\n @student_array = @student_array.shuffle\n # the code below takes the num_students and splits the elements (students) in @student_array into @group_array with num_students each nested array (the groups)\n # essentially, @student_array is 'chunked' into smaller pieces which become @group_array\n @group_array = @student_array.each_slice(num_students).to_a\n puts \"There are #{@group_array.length} groups\"\n puts \"Press 'enter' to return to menu\"\n temp = gets.chomp\n user_menu\n when \"2\"\n puts \"Groups will be formed by section and the student list will be permanantly sorted.\"\n puts \"Enter the number of students per group: \"\n num_students = gets.chomp.to_i\n # calls the bubble_sort_section method on @student_array, and then splits it into properly sized groups\n @student_array = bubble_sort_section(@student_array)\n @group_array = @student_array.each_slice(num_students).to_a\n puts \"There are #{@group_array.length} groups\"\n puts \"Press 'enter' to return to menu\"\n temp = gets.chomp\n user_menu\n when \"3\"\n puts \"Groups will be formed by major and the student list will be permanantly sorted.\"\n puts \"Enter the number of students per group: \"\n num_students = gets.chomp.to_i\n # calls the bubble_sort_major method on @student_array, and then splits it into properly sized groups\n @student_array = bubble_sort_major(@student_array)\n @group_array = @student_array.each_slice(num_students).to_a\n puts \"There are #{@group_array.length} groups\"\n puts \"Press 'enter' to return to menu\"\n temp = gets.chomp\n user_menu\n when \"4\"\n puts \"Groups will be formed by major and the student list will be permanantly sorted.\"\n puts \"Enter the number of students per group: \"\n num_students = gets.chomp.to_i\n # calls the bubble_sort_section method on @student_array, then the bubble_sort_major method and then splits it into properly sized groups\n # this sorts the @student_array by section, then major, so when groups are made the groups are sorted by section and major\n @student_array = bubble_sort_section(@student_array)\n @student_array = bubble_sort_major(@student_array)\n @group_array = @student_array.each_slice(num_students).to_a\n puts \"There are #{@group_array.length} groups\"\n puts \"Press 'enter' to return to menu\"\n temp = gets.chomp\n user_menu\n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end", "title": "" }, { "docid": "aeac79cd75a8e497d333fa12824483f6", "score": "0.5386046", "text": "def part1 groups\n return groups.map { | g |\n g.gsub(/[^a-z]/,\"\").chars.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "title": "" }, { "docid": "b1890fc708389ba2f305b5d422a64c54", "score": "0.5376492", "text": "def team(p, num)\n z = []\n num.times {z << []}\n i = 0\n while i < p.count\n z[ i%num ] << p[i]\n i+=1\n end\n puts z.inspect\nend", "title": "" }, { "docid": "26fc58d304d1ea93edcfcd5bc7a60496", "score": "0.53713644", "text": "def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend", "title": "" }, { "docid": "21212a4f0d38c65e40f7e8a68f4affb1", "score": "0.5365511", "text": "def assign_group(group_size, students)\n\nend", "title": "" }, { "docid": "2f79b3d24f007ea05a978facbd0d1988", "score": "0.53538024", "text": "def split_teams\n @split_teams ||= shuffled_teams.each_slice(team_count/2).to_a\n end", "title": "" }, { "docid": "a341b418ec00acd601e1052cc8038421", "score": "0.5338102", "text": "def name(names)\n names.sample\nend", "title": "" } ]
74dc4dcf50a72ed1e1bcee4e56447cd0
button callbacks navigationController() is automatically set whenever we add a view controller to a navigation stack, which we did with initWithRootView
[ { "docid": "66fff109d6b8b37e5471b5c3f71e90f5", "score": "0.0", "text": "def tap_red\n controller = ColorDetailController.alloc.initWithColor(UIColor.redColor)\n self.navigationController.pushViewController(controller, animated: true)\n end", "title": "" } ]
[ { "docid": "ddecfe029e8d56b5201223283d08ca14", "score": "0.6450134", "text": "def create_back_button_callback\n\t\tlambda do\n\t\t\t@main.current_menu = @parent\n\t\tend\n\tend", "title": "" }, { "docid": "cc2202307a43e367d2854f4ef55d2190", "score": "0.63294715", "text": "def navigation_controller\n @navigation_controller ||= UINavigationController.alloc.\n initWithRootViewController(main_view_controller)\n end", "title": "" }, { "docid": "496fddf4511001a552383d379320c1c2", "score": "0.62117773", "text": "def main_controller\n has_navigation? ? navigation_controller : self\n end", "title": "" }, { "docid": "af68d8593b0c217a5fdac1d2bb1ad240", "score": "0.61716753", "text": "def navigation_controller\n @navigation_controller ||= UINavigationController.alloc.\n initWithRootViewController(UIViewController.alloc.init)\n end", "title": "" }, { "docid": "88b1829aced670833bfd9acb186e3ae0", "score": "0.59297717", "text": "def on_load\n\t\tset_nav_bar_button :left, title: \"Home\", action: :go_to_welcome_screen\n\tend", "title": "" }, { "docid": "74997ccdf714b24d58e4892d747dfe1d", "score": "0.5828118", "text": "def set_current_nav\n end", "title": "" }, { "docid": "2ae179cee1f3b9d810ecb66c0e39ee6a", "score": "0.58190936", "text": "def on_load\n\t\tset_nav_bar_button :left, title: \"Back\", action: :close_about_us_screen\n\tend", "title": "" }, { "docid": "8dd0d71eb045cb6ba9056fef0430adac", "score": "0.58111316", "text": "def setCurrentController(index)\n if index == 0 then\n @firstContainer = UINavigationController.alloc.initWithRootViewController(FirstViewController.alloc.init) if @firstContainer == nil\n @contentViewController = @firstContainer\n else\n @secondContainer = UINavigationController.alloc.initWithRootViewController(SecondViewController.alloc.init) if @secondContainer == nil\n @contentViewController = @secondContainer\n end\n end", "title": "" }, { "docid": "0d14e7f97764533b421bc38c8d5ea331", "score": "0.58106667", "text": "def on_load\n set_nav_bar_button :left, title: \"Back\", action: :close_screen\n end", "title": "" }, { "docid": "ada5d7b1e53d0ad1cb818f2c81fd3510", "score": "0.57604456", "text": "def on_load\n set_nav_bar_button :left, title: \"Back\", action: :close_visited_screen\n end", "title": "" }, { "docid": "dbefa04a51e18f680a8aec43e17681d2", "score": "0.5739965", "text": "def on_load\n\t\t # set_nav_bar_button :left, title: \"D3 View\", action: :open_help_screen\n\t\t # set_nav_bar_button :right, title: \"Responses\", action: :zaggstar_feed\n\t\tset_nav_bar_button :left, title: \"Cancel\", action: :close_screen\n \t# self.view.backgroundColor = UIColor.whiteColor\n\tend", "title": "" }, { "docid": "b220bacdfac707757de9338d8c8f2629", "score": "0.56769437", "text": "def on_load\n set_nav_bar_button :right, title: \"Done\", action: :close_help_screen\n # self.view.backgroundColor = UIColor.whiteColor\n end", "title": "" }, { "docid": "80b77b98cc168de7eefd72d7a074e016", "score": "0.56211466", "text": "def navigation_location\n location = controller.send :navigation_location if\n controller.respond_to? :navigation_location\n location || super\n end", "title": "" }, { "docid": "7906a048867d40fb40192d5499f8a2ea", "score": "0.5528845", "text": "def splitViewController(svc, willHideViewController:vc, withBarButtonItem:barButtonItem, forPopoverController:pc)\n @masterViewController = vc\n # We ignore withBarButtonItem and forPopoverController to better control the display\n navigationItem.leftBarButtonItem = @button \n end", "title": "" }, { "docid": "49812ea49749f28c2da4d04f6a41e857", "score": "0.55203384", "text": "def on_load\n puts 'in on_load'\n set_nav_bar_button(:left, title: 'Help', action: :open_help_screen)\n end", "title": "" }, { "docid": "def3bf3269b111f7d404ac9dbca5cadb", "score": "0.54980344", "text": "def interaction_add_button_navigation(view, page = 1, pages = 1, offset = 1000000000)\n interaction_add_navigation(\n view,\n labels: [\"❙❮\", \"❮\", \"#{page} / #{pages}\", \"❯\", \"❯❙\"],\n disabled: [page == 1, page == 1, true, page == pages, page == pages],\n ids: [\"button:nav:#{-offset}\", \"button:nav:-1\", \"button:nav:page\", \"button:nav:1\", \"button:nav:#{offset}\"]\n )\nend", "title": "" }, { "docid": "cef9b4c27af2aad510064d184b198f1c", "score": "0.5487022", "text": "def willMoveToParentViewController(controller)\n end", "title": "" }, { "docid": "f02b32fa236181e53df0129680ffd4f6", "score": "0.5413989", "text": "def coder_config_nav\n coder_nav_button.click\n end", "title": "" }, { "docid": "7de62e9aea026af893428a83a4716f2a", "score": "0.53960997", "text": "def set_nav\n url_params = Rails.application.routes.recognize_path(request.referer)\n puts \"Url params: #{url_params}\"\n ctrl = url_params[:controller]\n if ctrl != 'events' || (ctrl == 'events' && url_params[:action] != 'show')\n case ctrl\n when 'calendar'\n session[:nav_to] = calendar_path\n when 'daily'\n session[:nav_to] = daily_p_path(params[:date] || url_params[:date])\n when 'events'\n session[:nav_to] = events_path\n end\n end\n end", "title": "" }, { "docid": "2fe9eefbae6fce8e9900df680632b2fd", "score": "0.5379734", "text": "def navigation_buttons_enabled?\n end", "title": "" }, { "docid": "a7a8da632515b14d492b7b80e8235e00", "score": "0.5359289", "text": "def add_breadcrumb_for_controller; end", "title": "" }, { "docid": "7a7c01c28fac32dffb3f5bbdae324b88", "score": "0.53523505", "text": "def nav\n @nav = { I18n.t('models.network_new_customer_application.actions.index_page.title') => new_customers_url }\n if @application\n if @application.new_record?\n @nav[I18n.t('models.network_new_customer_application.actions.new')] = create_new_customer_url\n else\n @nav[\"განცხადება ##{@application.effective_number}\"] = new_customer_url(id: @application.id)\n end\n end\n end", "title": "" }, { "docid": "90cc81b80ddc0fe393e60b703a6824f1", "score": "0.533824", "text": "def redirect_callbacks\n super\n end", "title": "" }, { "docid": "55219ed000af5991c4281226bc046689", "score": "0.53209895", "text": "def add_to_navigation(&block)\n @navigation_hook = block\n end", "title": "" }, { "docid": "cedd3e196fc372b53701be2fd937475d", "score": "0.5320189", "text": "def libriController(controller, didSelectLibro:libro)\n \n riga_controller = RigaFormController.alloc.initWithAppunto(@appunto, andLibro:libro)\n controller.navigationController.pushViewController(riga_controller, animated:true)\n\n end", "title": "" }, { "docid": "fafcbf85c03946be0743b0cc09053d7a", "score": "0.5306082", "text": "def displayManageBankAccounts\n bank_account_controller = BankAccountController.new\n bank_account_controller.profile = profile\n bank_account_controller.account_controller = self\n self.navigationController.pushViewController(bank_account_controller, animated: true)\n end", "title": "" }, { "docid": "faebedc184858da29c25c31a76f9aedb", "score": "0.52898425", "text": "def start_menu\n MainControllerContracts.invariant(self)\n initialize(440, 533)\n @currentCtrl = @controllers[:menu]\n MainControllerContracts.invariant(self)\n end", "title": "" }, { "docid": "9efdbfcbdcf8d3ab054152888c513d96", "score": "0.52880085", "text": "def assign_back_button_url\n @back_button_url = request.referer || root_path\n end", "title": "" }, { "docid": "9efdbfcbdcf8d3ab054152888c513d96", "score": "0.52880085", "text": "def assign_back_button_url\n @back_button_url = request.referer || root_path\n end", "title": "" }, { "docid": "9efdbfcbdcf8d3ab054152888c513d96", "score": "0.52880085", "text": "def assign_back_button_url\n @back_button_url = request.referer || root_path\n end", "title": "" }, { "docid": "a4d53b0ba6d08c1d2d4f6795844f0ab7", "score": "0.525995", "text": "def navigation_buttons_enabled=(nav_buttons)\n end", "title": "" }, { "docid": "b61325c8d8703c4add8db29d2c8b27ad", "score": "0.52327734", "text": "def before_breadcrumb_callbacks=(_arg0); end", "title": "" }, { "docid": "2d739fe545c5c5b61a672de1a7793d86", "score": "0.51954436", "text": "def splitViewController(svc, willHideViewController:vc, withBarButtonItem:barButtonItem, forPopoverController:pc)\n barButtonItem.title = \"Menu\"\n self.navigationItem.setLeftBarButtonItem(barButtonItem)\n self.popoverViewController = pc\n end", "title": "" }, { "docid": "9b0f6883bbd09afb89ddfcfea7202394", "score": "0.51898503", "text": "def controller\n rotate_device to: :portrait, button: :bottom\n @screen ||= MainScreen.new\n @screen.will_appear\n @screen.navigation_controller\n end", "title": "" }, { "docid": "8cd82943396e90046be4ee8efaefa698", "score": "0.51871765", "text": "def navigation_location; end", "title": "" }, { "docid": "8cd82943396e90046be4ee8efaefa698", "score": "0.51871765", "text": "def navigation_location; end", "title": "" }, { "docid": "e7d0ac42ee660860f25bcbe35530ad57", "score": "0.5181243", "text": "def create_controls_button_callback(controls_button)\n\t\tlambda do\n\t\t\tcontrols_button.controls_menu.player_name = @name.text\n\t\t\t@main.current_menu = controls_button.controls_menu\n\t\tend\n\tend", "title": "" }, { "docid": "fbd975fe9cb70a4a40f903d4b9c6ad80", "score": "0.51752955", "text": "def controller\n @controller ||= TableScreenSearchable.new(nav_bar: true)\n @controller.on_load\n @controller.navigation_controller\n end", "title": "" }, { "docid": "02403990a84823c78c07a0e25402194f", "score": "0.51628995", "text": "def before_breadcrumb_callbacks; end", "title": "" }, { "docid": "2658079ffac788400d163b9c6d6f4410", "score": "0.5152362", "text": "def base_navigation\n nav_links = [\n { icon: 'mdi-folder-open-outline', name: 'Projects', link: projects_path },\n { icon: 'mdi-stamper', name: 'Released Components', link: components_path },\n { icon: 'mdi-folder', name: 'STIGs', link: stigs_path },\n { icon: 'mdi-folder', name: 'SRGs', link: srgs_path }\n ]\n\n if current_user&.admin? || Settings.project.create_permission_enabled\n nav_links.insert(1, { icon: 'mdi-timer-sand', name: 'Start New Project', link: new_project_path })\n end\n\n nav_links\n end", "title": "" }, { "docid": "f88ea4b456626f44cf530ecf7a6b4ac4", "score": "0.5137615", "text": "def on_breadcrumb_callbacks; end", "title": "" }, { "docid": "3a79f5954648ebd0d28d87fc3d181ebf", "score": "0.51322824", "text": "def default_controller; end", "title": "" }, { "docid": "e1dad563b35fe7467e5b4ad3d92acaac", "score": "0.5115708", "text": "def set_navigation\n @navigation = Navigation.find(params[:id])\n end", "title": "" }, { "docid": "e1dad563b35fe7467e5b4ad3d92acaac", "score": "0.5115708", "text": "def set_navigation\n @navigation = Navigation.find(params[:id])\n end", "title": "" }, { "docid": "0919638bd4edcfc8970405a451e6f3f9", "score": "0.5108803", "text": "def home_nav_class\n return 'active' if home_controller?\n end", "title": "" }, { "docid": "2cf6c4f68096ec4d40c4d830d5a12ab7", "score": "0.51075786", "text": "def viewDidLoad\n super\n\n self.navigationController.navigationBarHidden = true\n\n login_button.layer.cornerRadius = 15.0\n end", "title": "" }, { "docid": "378b38328d4912b3ea8670d9d7f8f1b3", "score": "0.50841725", "text": "def setup_nav_bar\n frame = CGRectMake(0, 0, @parentmenu.frame.size.width, NavbarHeight * @parentmenu.frame.size.height)\n @navbar = SmartphoneNavbarView.alloc.init_with_frame(frame, titleText: \"Alle Spiele\", delegate: WeakRef.new(self))\n @parentmenu.addSubview(@navbar)\n end", "title": "" }, { "docid": "71b0d7a6c97df371e59cd4fd3f1bdf70", "score": "0.5036303", "text": "def active_navigation_item\n controller_name\n end", "title": "" }, { "docid": "71b0d7a6c97df371e59cd4fd3f1bdf70", "score": "0.5036303", "text": "def active_navigation_item\n controller_name\n end", "title": "" }, { "docid": "91b7fc2f6c5f86bc80b23ccc78969587", "score": "0.5030007", "text": "def set_cms_navigation_bar\n @cms_navigation_bar = CmsNavigationBar.find(params[:id])\n end", "title": "" }, { "docid": "2622edcf89e63f5183a5c4ac3abcafee", "score": "0.50237244", "text": "def tabletNavbarView(view, buttonPressed: button)\n button_id = button.tag\n\n if (button_id == 0)\n @shop_view.hide\n @menu_view.hidden = false\n @navbar.hide_back_button\n @navbar.set_title_text(\"Alle Stories\")\n @navbar.set_last_selected_button_inactive\n elsif (button_id == 1)\n StartScreen.next_screen= :kids_menu\n StartScreen.last_screen = :parent_menu\n rmq.screen.open_root_screen(StartScreen)\n elsif (button_id == 2)\n if(@shop_view.hidden?)\n @navbar.set_title_text(\"Shop\")\n @shop_view.show\n @menu_view.hidden = true\n @navbar.show_back_button\n @options_view.hide\n end\n elsif (button_id == 3)\n if @options_view.hidden?\n @options_view.show\n else\n @options_view.hide\n end\n @shop_view.hide\n @menu_view.hidden = false\n @navbar.hide_back_button\n @navbar.set_title_text(\"Alle Stories\")\n end\n end", "title": "" }, { "docid": "21348cea6d525f0f331c593c9faadab2", "score": "0.50223523", "text": "def show_in_navigation?\n true\n end", "title": "" }, { "docid": "f5cc2d586d79b2dc8af01f76c806f93a", "score": "0.50107473", "text": "def back\n main_menu()\n end", "title": "" }, { "docid": "5713edb344274dc7304d5d488c66d819", "score": "0.5005541", "text": "def wizard_nav\n activator = nil\n if not @act_name.nil? and Activator.exists?(@act_name)\n activator = Activator.load_existing(@act_name)\n else\n return\n end\n\n if not params[:cancel_activation].nil?\n redirect_to :action => 'cancel', :act_name => @act_name\n return\n elsif not params[:previous_step].nil?\n activator.previous_step\n activator.save\n \n redirect_to :action => \"step#{activator.step}\", :act_name => @act_name\n return\n end\n end", "title": "" }, { "docid": "73af98c711be2507cb6ebb100688e1fe", "score": "0.49962813", "text": "def viewWillAppear( animated )\n super\n\n # for asthetic reasons (the background is black), make the nav bar black for this particular page\n self.navigationController.navigationBar.tintColor = UIColor.blackColor\n self.navigationController.toolbar.tintColor = UIColor.blackColor\n\n # show the toolbar, we're going to need it\n self.navigationController.setToolbarHidden( false )\n end", "title": "" }, { "docid": "62abe20ae56bcdd3b8ee938a7776bc8d", "score": "0.49949083", "text": "def navigation_started(nav)\n self.is_nav_started = true\n end", "title": "" }, { "docid": "25551eb01234608e3a589a8821c6b7f8", "score": "0.49887222", "text": "def action_a_nav\n @ui.key_index = 0\n @base_ui.mode = 1\n end", "title": "" }, { "docid": "94be6c0ffe93fb7f843430419dd250a9", "score": "0.49863738", "text": "def set_nav\n if !root_of.nil?\n self.nav = root_of\n elsif parent.nil?\n self.nav = Trim::Nav.get_default\n self.parent = Trim::Nav.get_default.nav_item\n else\n self.nav = root.nav\n end\n end", "title": "" }, { "docid": "d0b924f24a51ea21c18b734c0e9803b8", "score": "0.49842393", "text": "def init_back_button\n\t\tmessages = @window.user_messages\n\t\tback = Button.new(@window, \n\t\t\t\t\t\t messages.message(:back), \n\t\t\t\t\t\t Constants::TEXT_HEIGHT, \n\t\t\t\t\t\t Constants::FONT_NAME)\n\n\t\tback.x = 100\n\t\tback.y = 650\n\t\tback.add_callback(:release, create_back_button_callback)\n\n\t\tadd_component(back)\n\tend", "title": "" }, { "docid": "0a901fa8dec741f8a12bb38380e9d8fe", "score": "0.497956", "text": "def set_navigation\n @navigation = Navigation.find_by(id: params[:id],site_id: @site.id)\n redirect_to admin_errors_url(error_template: '403') unless @navigation\n end", "title": "" }, { "docid": "c8a5141c36b4af787a07765ae756ba4f", "score": "0.49625292", "text": "def init_breadcrumbs\n @list_of_breadcrumbs = [[ 'base', base_path ], [ controller_name, nil ], [ nil, action_name ]]\n set_breadcrumb_path( self.send( controller_name + '_path' ))\n rescue NoMethodError\n end", "title": "" }, { "docid": "c99f6a4ace4682a2aa1c36f06e4e0df3", "score": "0.49523363", "text": "def authorize\n super(parent[:controller], :back)\n end", "title": "" }, { "docid": "c99f6a4ace4682a2aa1c36f06e4e0df3", "score": "0.49523363", "text": "def authorize\n super(parent[:controller], :back)\n end", "title": "" }, { "docid": "c99f6a4ace4682a2aa1c36f06e4e0df3", "score": "0.49523363", "text": "def authorize\n super(parent[:controller], :back)\n end", "title": "" }, { "docid": "21bf99e9b99535804ed376192cfcc2b0", "score": "0.49510998", "text": "def handle_explicit_navigation\n if SimpleNavigation.explicit_navigation_args\n begin\n level, navigation = parse_explicit_navigation_args\n self.controller.instance_variable_set(:\"@sn_current_navigation_#{level}\", navigation)\n rescue\n #we do nothing here\n #TODO: check if this is the right way to handle wrong explicit navigation\n end\n end\n end", "title": "" }, { "docid": "0e4680a9f3cc17070dff98fd86d9a37d", "score": "0.49402526", "text": "def controller; @context.registers[:controller] end", "title": "" }, { "docid": "08640dbbc14efb6393e76b9b4bd8254d", "score": "0.49338782", "text": "def return_to_main\r\n params[:controller] = params[:parent_controller] unless params[:parent_controller].nil?\r\n redirect_to params_for(:action => \"index\")\r\n end", "title": "" }, { "docid": "60c9c2036dbf48e2c5ce44e3617bb029", "score": "0.4927696", "text": "def current_navigation_for(level)\n self.controller.instance_variable_get(:\"@sn_current_navigation_#{level}\")\n end", "title": "" }, { "docid": "982881aeff653ce16f186a207e0ebdcc", "score": "0.49202254", "text": "def navigation(options={})\n options = {\n :root => nil,\n :current => @page,\n :class => 'nav', \n :id => '',\n :include_root => false,\n :link_current => false,\n :depth => 2\n }.with_indifferent_access.merge(options)\n\n current_user = nil unless defined?(current_user)\n \n if options[:root].is_a?(NilClass)\n root_page = Page.published_or_hidden.viewable_by(current_user).root_only.first\n elsif options[:root].is_a?(Page)\n root_page = options[:root]\n elsif options[:root].is_a?(String)\n root_page = Page.published_or_hidden.viewable_by(current_user).where('pages.url = :root or pages.permalink = :root', :root => options[:root]).first\n elsif options[:root].is_a?(Hash)\n options[:root].stringify_keys!\n root_page = Page.published_or_hidden.viewable_by(current_user).where(:controller => options[:root][:controller], :action => options[:root][:action]).first\n else\n return \"<p><em>Error:</em> Root must be a page, a permalink, a url or a hash containing the controller and action, got: #{root.class.to_s}.</p>\".html_safe\n end\n \n return \"<p><em>Error:</em> Root page not found: #{options[:root]}</p>\".html_safe unless root_page\n\n grouped_pages = root_page.self_and_descendants.viewable_by(current_user).shown_in_menu.published.for_nav.group_by(&:parent_id)\n\n render 'pages/navigation', :options => options, :root_page => root_page, :grouped_pages => grouped_pages, :level => 1\n end", "title": "" }, { "docid": "c05ea79690132bbc8d135b639e4bed34", "score": "0.49167404", "text": "def initialize_controller\n return unless @controller.nil?\n @controller = Controller.instance\n end", "title": "" }, { "docid": "40cefbb6005d8e622bf0f9a9d139fe91", "score": "0.49137244", "text": "def discountClub\n c = SettingsDiscountClubController.new\n c.profile = self.profile\n self.navigationController.pushViewController(c, animated: true)\n end", "title": "" }, { "docid": "23f729fc95951605ddc6ac772bf9bc7c", "score": "0.49120885", "text": "def initialize controller_or_root = nil\n super\n controller_or_root.is_a?(String) ? @root = controller_or_root : @controller = controller_or_root\n end", "title": "" }, { "docid": "9cb9aa4d8e5e921906493b24f1fb72d7", "score": "0.49097073", "text": "def head_buttons\n end", "title": "" }, { "docid": "9cb9aa4d8e5e921906493b24f1fb72d7", "score": "0.49097073", "text": "def head_buttons\n end", "title": "" }, { "docid": "f3e355f130f6b7e9fcefe71949cd1065", "score": "0.49020895", "text": "def set_nav_menu_to_true\n self.nav_menu = true \n end", "title": "" }, { "docid": "fdea4992e03c5e447ee4ac8e9cfbf143", "score": "0.489822", "text": "def didPressAddButton\n puts \"pressed the add button\"\n #add_controller = AddController.alloc.init\n #self.presentViewController(add_controller, animated:true, completion:nil)\n end", "title": "" }, { "docid": "683a11efa26f134d8830a52717044dc9", "score": "0.48961923", "text": "def navbar_active\n # reset in controller for active navbar menu item\n @navbar_active = :overview\n end", "title": "" }, { "docid": "34b94829efd6ca3de6db1b5ad5f5d068", "score": "0.48823577", "text": "def create_components\n\t\tinit_control_components\n\t\tinit_back_button\n\tend", "title": "" }, { "docid": "b8b9853e8b115038e6bc683394b0367b", "score": "0.48813865", "text": "def interaction_add_level_navigation(view, name)\n interaction_add_navigation(\n view,\n labels: [\"❮❮\", \"❮\", name, \"❯\", \"❯❯\"],\n disabled: [false, false, true, false, false],\n ids: [\"button:id:-2\", \"button:id:-1\", \"button:id:page\", \"button:id:1\", \"button:id:2\"]\n )\nend", "title": "" }, { "docid": "ba5cd2715c35bf08e4f0d2378c6070de", "score": "0.48793525", "text": "def base_navigation\n [\n { icon: 'mdi-folder-open-outline', name: 'Projects', link: projects_path },\n { icon: 'mdi-timer-sand', name: 'Start New Project', link: new_project_path }\n ]\n end", "title": "" }, { "docid": "4f01c8faf4dfec507c74f220a5232f9f", "score": "0.4865985", "text": "def initialize_breadcrumbs\n end", "title": "" }, { "docid": "acd04f2fb61c4ed40e2734a5e73443ee", "score": "0.48549303", "text": "def <<(view_controller)\n push view_controller\n end", "title": "" }, { "docid": "1410237c54d0ac0fc84d1172866b2c26", "score": "0.48473406", "text": "def breadcrumbNavigator\n\t@breadcrumbNavigator ||=BreadcrumbNavigator.new\nend", "title": "" }, { "docid": "86b48d97c6cf16163bb4a95522064f17", "score": "0.4844211", "text": "def on_button_push\n\t\t@command.call if @command\n\tend", "title": "" }, { "docid": "ea7459891a6f2203259c38cac578c6d5", "score": "0.48374227", "text": "def new_stack\n\t\t\t\t\t#session[:back] ||= []\n\t\t\t\t\t#session[:back].push({:controller => , :action => })\n\t\t\t\t\t\n\t\t\t\t\t@object = crud_model.new\n\t\t\t\t\trender(:template => \"metacrud/new\")\n\t\t\t\tend", "title": "" }, { "docid": "35e4c54aa25384fec90bc17db678c92b", "score": "0.48365664", "text": "def initialize\n @command_map = {}\n @view = nil\n initialize_controller\n end", "title": "" }, { "docid": "3fa7c40adf59a3dafcd85b8c1c79ad35", "score": "0.48363656", "text": "def controller=(controller); end", "title": "" }, { "docid": "954e6ca9e7782a168040e63bbc0a5b5b", "score": "0.4833579", "text": "def init\n add_breadcrumb I18n.t('form.forms'), :controller => \"forms\", :action => \"index\"\n end", "title": "" }, { "docid": "4fea4451a2dea26a6aaa9ead5ba67637", "score": "0.48306492", "text": "def top_view(root)\nend", "title": "" }, { "docid": "8f582605f703e1fc9d2b8ca1c7c9da8b", "score": "0.48240325", "text": "def on_button_push\n @command.call if @command\n end", "title": "" }, { "docid": "77c80309c9604e96c8868ed9ff3be3f0", "score": "0.48130554", "text": "def controller(controller); end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.4810407", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "6d472570c0393bd850f3fc3cff3c4eb1", "score": "0.4806936", "text": "def cms_nav_url(resource)\n \"/#{resource.to_s.sub(\"::\", \"/\").sub(/Controller$/, \"\").underscore}/\"\n end", "title": "" }, { "docid": "ac3061e08b69c8190a8ff47741412257", "score": "0.4803866", "text": "def set_new_nav\n session[:new_nav] = true if params[:nav_neu] == '1'\n session.delete(:new_nav) if params[:nav_neu] == '0'\n end", "title": "" }, { "docid": "bcdfeb5cbc881fdb473df66cf869d4b4", "score": "0.48035637", "text": "def safe_navigation?; end", "title": "" }, { "docid": "bcdfeb5cbc881fdb473df66cf869d4b4", "score": "0.48035637", "text": "def safe_navigation?; end", "title": "" }, { "docid": "a01a186b444ff7cde997a0e91117411f", "score": "0.4794536", "text": "def reports\n controller = ReportsController.new\n controller.profile = profile\n self.navigationController.pushViewController(controller, animated: true) \n end", "title": "" }, { "docid": "14bbf4943e080808eb214f6dee97ef90", "score": "0.47874516", "text": "def add_navigate(&block)\n @navigate_method = block\n end", "title": "" }, { "docid": "7cea5464baa6e06a0907ec3b75dde25c", "score": "0.47839704", "text": "def controller\n rotate_device to: :portrait, button: :bottom\n @webscreen ||= TestWebScreen.new(nav_bar: true)\n @webscreen.navigation_controller\n end", "title": "" }, { "docid": "cd56cbff9214ed151c0a5216dd8c5ca7", "score": "0.4783094", "text": "def new\n @navigation = current_cms.navigations.new(:position => current_cms.navigations.size + 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @navigation }\n end\n end", "title": "" }, { "docid": "8b93cdad6d73e5d40d3060c8326c7abf", "score": "0.4778135", "text": "def on_button_push\n @command.call if @command\n end", "title": "" } ]
3bc22d1137dfbbe9401f4ed8cdb1199b
Returns the last segment of the JSON Pointer
[ { "docid": "a551497a2b276eb6cbfe9aff95b4a832", "score": "0.6373268", "text": "def last; @last; end", "title": "" } ]
[ { "docid": "09db565158e353484c07ca2eb90d6071", "score": "0.7125985", "text": "def last\n @data[-1][-1]\n end", "title": "" }, { "docid": "d86115fef1a6cf212563ac6f5e0f9f79", "score": "0.7011931", "text": "def get_last\n return tail.data if tail\n return nil\n end", "title": "" }, { "docid": "907e4a7f4f9db324b5248329cf28d8e5", "score": "0.7006672", "text": "def last\n object_from_address(@base[:last])\n end", "title": "" }, { "docid": "bc2affb93aa8cc00f281be054a5a2c43", "score": "0.6835282", "text": "def last\n get(-1)\n end", "title": "" }, { "docid": "9212be72bfc55f9a340f35dacb423589", "score": "0.68203044", "text": "def last\n tail.data\n end", "title": "" }, { "docid": "6cc062055c1c94cf21ece16032472610", "score": "0.67527735", "text": "def last\n return @tail.item\n end", "title": "" }, { "docid": "ff51f57329fa9f6b8e22bed02eb4433e", "score": "0.673382", "text": "def last_path_element\n path_element(-1)\n end", "title": "" }, { "docid": "ea0b0dfb29a017c214cf350360dfd11e", "score": "0.66974354", "text": "def last\n @tail\n end", "title": "" }, { "docid": "57bc590aa81c29f1ebe2a3f60becb995", "score": "0.6687231", "text": "def last\n length = self.length\n self[length - 1, length]\n end", "title": "" }, { "docid": "9f04390d992a73faa9c28b0a3ca1af01", "score": "0.667761", "text": "def get_last\n last_node = self.get_last_node\n return last_node.data if last_node\n return nil\n end", "title": "" }, { "docid": "86bb7b5c0a38a335bb1b7d51e053b035", "score": "0.66685975", "text": "def last\n @head.prev.datum\n end", "title": "" }, { "docid": "95c093ed0153be9eb68d2395fe3549e9", "score": "0.6664579", "text": "def last\n @tail\n end", "title": "" }, { "docid": "81b7c8e0e74d15717f24fca2a7328930", "score": "0.6663684", "text": "def get_last\r\n return nil if @head == nil\r\n current = @head\r\n current = get_last_node(current)\r\n return current.data\r\n end", "title": "" }, { "docid": "35be48ea93db5a51519e45706bdd85e6", "score": "0.66386044", "text": "def last\n self[length - 1]\n end", "title": "" }, { "docid": "1e4efef70c93d4eb5bd26bc2af365f7b", "score": "0.6621667", "text": "def last\n to_ary[-1]\n end", "title": "" }, { "docid": "36e0c3363c5ff802b3773ef944f7d183", "score": "0.66210586", "text": "def getLast\n if @lastNode.nil?\n @firstNode.value\n else\n @lastNode.value\n end\n end", "title": "" }, { "docid": "a5195ee4b32b7ebef3b2f16eb7be2905", "score": "0.66151214", "text": "def get_last\n length = self.length\n\n i = 0\n current_node = @head\n until i == length - 1\n current_node = current_node.next\n i += 1\n end\n return current_node.data\n end", "title": "" }, { "docid": "5f3caf103e5e50829f806d0baed3c62c", "score": "0.66112673", "text": "def last\n @tail.prev_node.value\n end", "title": "" }, { "docid": "9bbeef7822208bdcf75b1d1abc5f530f", "score": "0.6604553", "text": "def last\n @tail.value\n end", "title": "" }, { "docid": "6357b3be633929ef335e739be7aa90b7", "score": "0.659353", "text": "def last\n @tail && @tail.data\n end", "title": "" }, { "docid": "da1e925b4c12ce3624aa33b1e7fffac1", "score": "0.65910125", "text": "def getLastNode() getNode(size-1); end", "title": "" }, { "docid": "8f9b834d7536f909e24e5623f2ea57da", "score": "0.65895206", "text": "def last_element_index() = to_s.split('/').size - 1", "title": "" }, { "docid": "4ad1d1f06b46daf39ca388c0fd0f2f80", "score": "0.6587599", "text": "def last_element\n if has_attributes? then\n @path[-2]\n else\n @path[-1]\n end\n end", "title": "" }, { "docid": "912d7f494c0d6958bc8fe5bd942af47d", "score": "0.6585236", "text": "def last_line\n line = buffer[end_line]\n line[0, end_pos] \n end", "title": "" }, { "docid": "3f41334fb5a179b647e60d81036f7543", "score": "0.6583513", "text": "def lastpoint\n return self.pointlist()[-1]\n end", "title": "" }, { "docid": "3f41334fb5a179b647e60d81036f7543", "score": "0.6583513", "text": "def lastpoint\n return self.pointlist()[-1]\n end", "title": "" }, { "docid": "9dc502c4c7b5e3b3570756ec444db124", "score": "0.656236", "text": "def last\n tail(1)\n end", "title": "" }, { "docid": "6449fe811e576e3aec536073f325efad", "score": "0.6560518", "text": "def last\n self[(self.length-1)..(self.length-1)]\n end", "title": "" }, { "docid": "c335b70baecfe2077ebc47ccb4be1a55", "score": "0.6557152", "text": "def last\n root.as(:entity).limit(1).reverse.one\n end", "title": "" }, { "docid": "372d9816c3db4ecfd08c8d57845f501b", "score": "0.65532637", "text": "def last\n @container[@container.length - 1]\n end", "title": "" }, { "docid": "a9acf3b091faa162ba2a25acad249774", "score": "0.65517306", "text": "def get_last\n return get_at_index(length)\n end", "title": "" }, { "docid": "62a46fb34519de7365918d7e97c0cc4f", "score": "0.65374994", "text": "def last\n object_from_address(@base.last)\n end", "title": "" }, { "docid": "b17bff81bec4915152e89b20c5df1431", "score": "0.65272665", "text": "def last\n if @last_node.nil?\n nil\n else\n @last_node.payload\n end\n end", "title": "" }, { "docid": "ea681b348392aadd885b3513510de366", "score": "0.6519822", "text": "def get_last\n current = @head\n current = current.next until !current.next\n return current.data\n end", "title": "" }, { "docid": "491e560d62cce21fe050611d9fb90440", "score": "0.65194136", "text": "def last\n self[-1]\n end", "title": "" }, { "docid": "bbf1edab92c7766fa3162d052067b1da", "score": "0.6514958", "text": "def get_last\r\n return nil if !@head\r\n\r\n cur = @head\r\n\r\n while(cur.next)\r\n cur = cur.next\r\n end\r\n \r\n return cur.data\r\n \r\n end", "title": "" }, { "docid": "2a47509d9324252fb09a8e8bbed3cca9", "score": "0.6514682", "text": "def getLastNode() getNodeByIndex(size-1); end", "title": "" }, { "docid": "2ed1ff45710cfa992728c95bb533cd74", "score": "0.65072", "text": "def last\n return @last_obj\n end", "title": "" }, { "docid": "d67729be8bc9675e8f80671f9367aa52", "score": "0.65063477", "text": "def get_last\r\n if @head.nil?\r\n return nil\r\n end\r\n\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n end\r\n\r\n return current.data\r\n end", "title": "" }, { "docid": "cbaad2d72b9356cc4332b85f226e6bc7", "score": "0.64954495", "text": "def get_last\n cur = @head\n while cur.next != nil\n cur = cur.next\n end\n return cur.data\n end", "title": "" }, { "docid": "25e6de0fa6647d58253b14c50bc16663", "score": "0.6495246", "text": "def last\n self[-1]\n end", "title": "" }, { "docid": "33a91837c7d364600b2fd0ff29eee533", "score": "0.6495081", "text": "def get_last\n current = @head\n\n until current.next == nil\n current = current.next\n end\n\n return current.data\n end", "title": "" }, { "docid": "64df23c2dc67baa7981f32b8a6d1869e", "score": "0.649269", "text": "def get_last\n current = @head\n until current.next == nil\n current = current.next\n end\n\n return current.data\n end", "title": "" }, { "docid": "1f108d2488db85803c71972cbeb5958e", "score": "0.6477142", "text": "def last\n\t\t\tif @tail == nil\n\t\t\t\t@head\n\t\t\telse \n\t\t\t\t@tail.last\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c38edd36bad92f1a2c3972967eab147e", "score": "0.64695245", "text": "def last\n self[-1]\n end", "title": "" }, { "docid": "a026c747867babbc8448cae5b2e384d7", "score": "0.6465916", "text": "def last\n self.slice(self.size - 1)\n end", "title": "" }, { "docid": "c665973f391ce0740b572f7a33d36277", "score": "0.64623225", "text": "def last\n return @last\n end", "title": "" }, { "docid": "312f4c95c7804c31e1d55ec8b5486a16", "score": "0.64594805", "text": "def get_last\n if @head.nil?\n return nil\n else\n current = @head\n until current.next.nil?\n current = current.next\n end\n return current.data\n end\n end", "title": "" }, { "docid": "57e9b46b90bd9d805e7dbeffd143b29b", "score": "0.6458444", "text": "def last\n return @nodes[-1]\n end", "title": "" }, { "docid": "6507c46b152aaf5a43030317c45c0f6f", "score": "0.64543635", "text": "def last\n self.size > 0 ? self[size - 1] : nil\n end", "title": "" }, { "docid": "8951690d0c8182e718e248d3291afebe", "score": "0.6444018", "text": "def get_last\n if @head.nil?\n return nil\n else \n current = @head\n until current.next.nil?\n current = current.next\n end\n end\n return current.data\n end", "title": "" }, { "docid": "30b5814f0dc2c53237e5736c8dc617ec", "score": "0.644113", "text": "def get_last\n current = @head\n\n while current.next != nil\n current = current.next\n end\n\n return current.data\n end", "title": "" }, { "docid": "81a19d2b2818ab5bfb30fcb3a90f38d0", "score": "0.64397115", "text": "def last\n return fetch(:last)\n end", "title": "" }, { "docid": "a58af408f23715e619bf8459190e7d0f", "score": "0.6439066", "text": "def last_controller_segment\n #segments.select{ |seg| seg.is_a?(ActionController::Routing::StaticSegment) && seg.value != \"new\"}.last\n segments.select{ |seg| seg.second == :static && seg.first != :new }.last\n end", "title": "" }, { "docid": "43e2c5f027166d6dc897b053b9237590", "score": "0.6430894", "text": "def getEndPoint()\n shape().lastPoint() ;\n end", "title": "" }, { "docid": "bb7bf2b108b12e8438a5b838fbe900bc", "score": "0.64292806", "text": "def get_last\n return nil if @head.nil?\n \n current = @head\n \n until current.next.nil?\n current = current.next\n end\n \n return current.data\n end", "title": "" }, { "docid": "726da45317cc47ce584e955b823e45a7", "score": "0.6428147", "text": "def get_last\n if @head.nil?\n return nil\n end\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n return current.data\n end", "title": "" }, { "docid": "b5a37ebe328bfbed438f3d0637cecab0", "score": "0.6425668", "text": "def last(n = 1)\n self.parse.last n\n end", "title": "" }, { "docid": "91c65c0a002585b4995dc5eb165f6b16", "score": "0.64206475", "text": "def last\n @last\n end", "title": "" }, { "docid": "3cfa53b5f66397f446c8aeaca8b60498", "score": "0.6418929", "text": "def get_last\n last = @head\n \n while last.next != nil\n last = last.next\n end\n return last.data\n end", "title": "" }, { "docid": "0617839b9ed8c2c182a0bfe8b61bc336", "score": "0.64087087", "text": "def get_last\n curr = @head\n until curr.next.nil? do\n curr = curr.next\n end\n return curr.data\n end", "title": "" }, { "docid": "3c1188f11a4fea3078b2cc31b46fa918", "score": "0.6405535", "text": "def last\n @data.last\n end", "title": "" }, { "docid": "393651bd3d30c5c0e52a8d26f25aa74e", "score": "0.64012116", "text": "def last\n tail.nil? ? nil : tail.value\n end", "title": "" }, { "docid": "c7f29d4a9dcc0c2e1e2854a3a76f8909", "score": "0.63955516", "text": "def last\n at(-1)\n end", "title": "" }, { "docid": "c7f29d4a9dcc0c2e1e2854a3a76f8909", "score": "0.63955516", "text": "def last\n at(-1)\n end", "title": "" }, { "docid": "c7f29d4a9dcc0c2e1e2854a3a76f8909", "score": "0.63955516", "text": "def last\n at(-1)\n end", "title": "" }, { "docid": "a92707be11041953077f6ba6ab6bf92e", "score": "0.6386104", "text": "def last; self[size-1]; end", "title": "" }, { "docid": "a92707be11041953077f6ba6ab6bf92e", "score": "0.6386104", "text": "def last; self[size-1]; end", "title": "" }, { "docid": "1dc649a514875935b606763efc64104b", "score": "0.638223", "text": "def last()\n return self[-1]\n end", "title": "" }, { "docid": "789ab0c2b6c410c572dd22af17a56a74", "score": "0.63813126", "text": "def last\n @data.last\n end", "title": "" }, { "docid": "b9a800737c858fc9a1135e2e19dc1667", "score": "0.6378574", "text": "def last\n at(-1)\n end", "title": "" }, { "docid": "c6da18c4e598222d8c10cedd08a23574", "score": "0.6371822", "text": "def get_last\n return nil if @head.nil?\n\n current = @head \n\n until current.next.nil? \n current = current.next\n end \n\n return current.data\n end", "title": "" }, { "docid": "c94e1f6d3eb13995667cb033d20a02d6", "score": "0.6363045", "text": "def last_line\n @lines[-1]\n end", "title": "" }, { "docid": "c94e1f6d3eb13995667cb033d20a02d6", "score": "0.6363045", "text": "def last_line\n @lines[-1]\n end", "title": "" }, { "docid": "035e4dba95439866316c63945368348d", "score": "0.6361441", "text": "def last\n entry(-1, Array, false)\n end", "title": "" }, { "docid": "99c5627a0becc39e3c7aec84cad3a2fd", "score": "0.6356901", "text": "def get_last\n return nil if @head.nil?\n\n current = @head\n while !current.next.nil?\n current = current.next\n end\n\n return current.data\n end", "title": "" }, { "docid": "2f8e96b871cc7af79cace681cde60c39", "score": "0.6356688", "text": "def get_last\r\n return nil if @head.nil?\r\n \r\n curr = @head\r\n until curr.next.nil?\r\n curr = curr.next\r\n end\r\n\r\n return curr.data\r\n end", "title": "" }, { "docid": "1ff675b3ce4c7f6814fb6850a8e46755", "score": "0.6351311", "text": "def get_fragment(json_pointer)\n json_pointer = Pointer.new(json_pointer)\n return self if json_pointer.empty?\n\n dig *json_pointer.to_a\n end", "title": "" }, { "docid": "6915487ed6152394d55df026352d7e88", "score": "0.634934", "text": "def get_last\n current_node = @head\n\n until current_node.next == nil\n current_node = current_node.next\n end\n\n return current_node.data\n\n end", "title": "" }, { "docid": "7c4ff6eeff8272ca71e53242e26f8122", "score": "0.6349153", "text": "def getLast\n return @store[-1]\n end", "title": "" }, { "docid": "1c0478d5e4182a6d6f90117be0dc4ee6", "score": "0.6328533", "text": "def last_part(key)\n last_slash = key.rindex('/', -2)\n drop = key.end_with?('/') ? 1 : 0\n if last_slash then\n key.slice(last_slash + 1, key.length - last_slash - 1 - drop)\n else\n key.slice(0, key.length - drop)\n end\nend", "title": "" }, { "docid": "0474459c7fe8785b99386a0360e1ac8b", "score": "0.6326063", "text": "def get_last\n # we can just return 0 for an empty list\n if @head.nil?\n return nil\n else\n # we need to find the last node\n # we start at the head\n current = @head\n\n # if we go all the way to nil, we can't attach get the data from the last non-nil node\n # ESPECIALLY since this is a singly, not doubly, linekd list\n # so, we need to set current to the node WITH node.next = nil\n while !current.next.nil?\n current = current.next\n end\n\n return current.data # retrieve data at what should be the last node\n end\n end", "title": "" }, { "docid": "fec7a091605a642898e709854eae1864", "score": "0.6323445", "text": "def get_last\n if @head == nil\n return nil\n end\n \n current = @head\n \n while current.next != nil\n current = current.next\n end\n \n return current.data\n end", "title": "" }, { "docid": "3084a00297339e191f9a0e024a27951c", "score": "0.6317547", "text": "def getLast()\n unless @next.nil?\n @previous\n\t\telse\n\t\t\t@first\n\t\tend\n end", "title": "" }, { "docid": "4b163910b25777a36365b6b7ddc87e79", "score": "0.63152844", "text": "def last\n Document.traverse self, 'lastChild', nil, false\n end", "title": "" }, { "docid": "652ad93893bbdb7d5fe6359ac79de02a", "score": "0.63133645", "text": "def last\n self.get_geometry_n(self.num_geometries - 1) if self.num_geometries > 0\n end", "title": "" }, { "docid": "104211a6ea91cd82d28cc72cfa6d04bb", "score": "0.63086873", "text": "def last\n to_a.last\n end", "title": "" }, { "docid": "104211a6ea91cd82d28cc72cfa6d04bb", "score": "0.63086873", "text": "def last\n to_a.last\n end", "title": "" }, { "docid": "f172746dc9be855bcddac7a6371c4d73", "score": "0.63016933", "text": "def last\n @raw_responses[@raw_responses.length - 1]\n end", "title": "" }, { "docid": "f03776c90ab79c4e3ab111c7ff759600", "score": "0.62910724", "text": "def last(count = nil)\n `if (count == nil) {\n if (self.length == 0) return nil;\n return self[self.length - 1];\n } else {\n if (count > self.length) count = self.length;\n return self.slice(self.length - count, self.length);\n }`\n end", "title": "" }, { "docid": "e072e5a000edd7f6cf3f2e4e522c7787", "score": "0.6286077", "text": "def last_offset\n\t\tOffset.new(@ida, @segment.endEA - 1)\n\tend", "title": "" }, { "docid": "8502f59efb4ed4b07641b9bb4571ab0c", "score": "0.6281964", "text": "def get_last\n return nil if @head.nil?\n current_node = @head\n \n while (current_node.next)\n current_node = current_node.next\n end\n\n return current.data\n\n end", "title": "" }, { "docid": "2bb841315939b23cf8ab3f18c03acdc3", "score": "0.6277628", "text": "def last\n last_key.get\n end", "title": "" }, { "docid": "f92ca5ebb5c3f9fb83278615fad80421", "score": "0.6273334", "text": "def last_line\n IO.readlines(path)[-1]\n end", "title": "" }, { "docid": "92c77d803b23f0fdb18da72406ee0078", "score": "0.626652", "text": "def last\n to_a.last\n end", "title": "" }, { "docid": "8088716f7ef387b2f6b452ff67535319", "score": "0.6265927", "text": "def get_last\n if @head.nil?\n return nil\n else \n current = @head\n l = self.length-1 \n puts l \n \n if l >0 \n l.times do\n puts current.data\n current=current.next\n end \n end\n\n return current.data\n end\n end", "title": "" }, { "docid": "ac8abff211a0c78d2f036f65d7d42e9a", "score": "0.6263861", "text": "def last\n @nodes.last\n end", "title": "" }, { "docid": "f0e13f5055773fe59d9210edddd6d7c0", "score": "0.6254731", "text": "def last\n lambda do |_rec, acc|\n acc.slice!(0, acc.length - 1)\n end\n end", "title": "" }, { "docid": "8e159826c85efa45577efda7b4500c3d", "score": "0.62519443", "text": "def last\n @last ||= get_limited_arg(:last)\n end", "title": "" }, { "docid": "58b949215ec0197f569155efb6fce4bc", "score": "0.62505746", "text": "def get_last\n curr = @head\n if @head == nil\n return nil\n else\n until curr.next == nil\n curr = curr.next\n end\n return curr.data\n end\n end", "title": "" } ]
7aee0ce80c466faa656fca2ca9c751b4
Blocking commands inside transaction behave like nonblocking. It shouldn't be done though. source://redis//lib/redis/pipeline.rb68
[ { "docid": "725ba65442b0a398afc594da1456c7dc", "score": "0.6380437", "text": "def send_blocking_command(command, _timeout, &block); end", "title": "" } ]
[ { "docid": "00c5e4ac764091a88c958cd4891ba822", "score": "0.63775706", "text": "def transaction(&block); end", "title": "" }, { "docid": "0d4efea218f2ecbba5a3ff05f9731744", "score": "0.62570935", "text": "def transaction(&blk)\n tap(&blk)\n end", "title": "" }, { "docid": "9ad287eae6e8f78203a455b72f027e82", "score": "0.62416536", "text": "def do\n execute flush\n end", "title": "" }, { "docid": "b4660ee164b5db9d7f39e6f38fa48e1b", "score": "0.62371993", "text": "def transaction(&block)\n yield\n end", "title": "" }, { "docid": "b4660ee164b5db9d7f39e6f38fa48e1b", "score": "0.62371993", "text": "def transaction(&block)\n yield\n end", "title": "" }, { "docid": "f370e8096e12d961487441c514011dfc", "score": "0.61821127", "text": "def transaction(&block)\n @@semaphore.synchronize{\n block.call\n }\n end", "title": "" }, { "docid": "c08c00886ecb2d8a142b4eef42af1837", "score": "0.607986", "text": "def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n result = yield(conn)\n conn.execute(SQL_COMMIT)\n result\n rescue => e\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n @transactions.delete(Thread.current)\n end\n end\n end", "title": "" }, { "docid": "39180c387303b4c3643bade153141af8", "score": "0.6065896", "text": "def transaction(&block)\n block.call\n end", "title": "" }, { "docid": "725a5d0366cae8342bb41222b0bc2a76", "score": "0.6050758", "text": "def begin\n db.transaction do\n yield\n end\n end", "title": "" }, { "docid": "0d6371e860a778c10a0a77c214750cf6", "score": "0.6046994", "text": "def transaction(&block)\n yield\n commit\n end", "title": "" }, { "docid": "7236a434fc41866feadbbf165e280b40", "score": "0.60368085", "text": "def transaction\n use do |connection|\n connection.transaction do |conn|\n begin\n yield conn\n rescue Rollback\n return\n end\n end\n end\n end", "title": "" }, { "docid": "7569924e4ff0e0d7b2577cc89166ea0d", "score": "0.603452", "text": "def locked_transaction(&block)\n unless connection.open_transactions.zero?\n raise \"locked_transaction cannot be called from within another transaction!\"\n end\n unsafe_locked_transaction do\n yield if block_given?\n end\n end", "title": "" }, { "docid": "c0083144ad23781ca5c8239d7a996f2b", "score": "0.5961096", "text": "def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end", "title": "" }, { "docid": "988c10e2c587145a7498992cb088168e", "score": "0.5961031", "text": "def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end", "title": "" }, { "docid": "1add8bf3225c1cf864fbd86b7a73e83e", "score": "0.5929478", "text": "def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n log_info(SQL_BEGIN)\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n yield(conn)\n rescue Exception => e\n log_info(SQL_ROLLBACK)\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n unless e\n log_info(SQL_COMMIT)\n conn.execute(SQL_COMMIT)\n end\n @transactions.delete(Thread.current)\n end\n end\n end", "title": "" }, { "docid": "e6a65a29d8ccf234be6a4cb7677c651f", "score": "0.592307", "text": "def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "title": "" }, { "docid": "514ae3d2fd4d66dc5c9b47fa3de7f14b", "score": "0.5870001", "text": "def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end", "title": "" }, { "docid": "833b0ef6d90bdb3fb7f708fec73fdd63", "score": "0.58549124", "text": "def run_transaction(conn, op)\n retries = 0\n max_retries = 3\n while true\n retries += 1\n if retries == max_retries\n err = \"Transaction did not succeed after #{retries} retries\"\n raise err\n end\n\n begin\n op.call(conn)\n\n # If we reach this point, we were able to commit, so we break\n # from the retry loop.\n break\n\n rescue PG::TRSerializationFailure\n # This is a retry error, so we roll back the current\n # transaction and sleep for a bit before retrying. The\n # sleep time increases for each failed transaction.\n # conn.rollback\n puts \"EXECUTE SERIALIZATION_FAILURE BRANCH\"\n sleep_secs = (2**retries).floor\n puts \"Sleeping for #{sleep_secs} seconds\"\n sleep(sleep_secs)\n next\n end\n end\nend", "title": "" }, { "docid": "e3cc0cb6e7209c646e1e65cf0b9cc9cb", "score": "0.58514094", "text": "def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end", "title": "" }, { "docid": "7e7a4ed68cbe9cd2cb9a990fd794b87f", "score": "0.58354014", "text": "def send_blocking_command(command, _timeout, &block)\n send_command(command, &block)\n end", "title": "" }, { "docid": "a36b5c0d5ccfcf45fa39525335df4e78", "score": "0.58122337", "text": "def execute(&block)\n\tblock\nend", "title": "" }, { "docid": "a36b5c0d5ccfcf45fa39525335df4e78", "score": "0.58122337", "text": "def execute(&block)\n\tblock\nend", "title": "" }, { "docid": "80b9e4933d042fc1e0554f66ed47b897", "score": "0.5798067", "text": "def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end", "title": "" }, { "docid": "80b9e4933d042fc1e0554f66ed47b897", "score": "0.5798067", "text": "def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end", "title": "" }, { "docid": "b4e61f1757f14cdd8bfacdd96cb038fd", "score": "0.5783751", "text": "def enqueue\n redis.multi do\n enqueue_non_atomically\n end\n end", "title": "" }, { "docid": "f8d8cbbb599559531f1d9f350ec18a53", "score": "0.5779308", "text": "def commit_stream(shutdown=false)\n @queue = get_queue\n @queue.run # Notify other workers that the commit queue is open for business again\n # No point in continuing if we're not ready\n return :wait unless commit_ready? or shutdown\n # Convert commit_delay to ms\n lock_ttl = @commit_delay * 1000\n lock_ttl = @lock_timeout if lock_ttl < @lock_timeout\n commit_lock = false\n # Acquire a lock to prevent other workers from executing this function.\n @semaphore.lock(commit_lock_key) do |locked|\n return :wait unless locked\n # Hopefully, redlock-rb will accept our pull request so we don't need this rescue block anymore\n begin\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl)\n rescue Redis::BaseConnectionError\n return :wait\n end\n # We'll be locking API later on\n api_lock = false\n return :wait unless commit_lock\n\n begin\n # Block everybody from uploading now\n @queue.commit_status = :running\n # Keep hanging on to the commit lock until we can commit.\n while commit_lock\n # Don't commit unless we're ready or shutting down Logstash\n # Grab the lock again if we managed to lose it while sleeping\n unless commit_lock\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl)\n end\n break unless commit_lock\n # Clear out the queue\n send_to_domo(shutdown, true) until @queue.processed?(shutdown)\n # Acquire a lock on the key used for the non-commit API calls so nobody goes and creates a new Stream Execution in the middle of this.\n api_lock = @commit_lock_manager.lock(lock_key, @lock_timeout)\n break unless api_lock and commit_lock\n # Make sure the API lock and commit lock will last for at least the same amount of time.\n if commit_lock[:validity] <= api_lock[:validity]\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl, extend: commit_lock, extend_only_if_locked: true)\n end\n\n # Validate the active Stream Execution\n unless @queue.execution_id\n @queue.commit_status = :open\n break\n end\n # Do one last validation on the Stream Execution and abort if there are irregularities.\n begin\n stream_execution = @domo_client.stream_client.getExecution(@stream_id, @queue.execution_id)\n rescue Java::ComDomoSdkRequest::RequestException => e\n status_code = Domo::Client.request_error_status_code(e)\n if status_code.nil? or status_code == -1\n @logger.debug(\"We got a status code of -1 somehow. Let's look at the exception.\",\n :exception => e,\n :status_code => status_code,\n :message => e.to_s)\n end\n # The Execution no longer exists.\n if status_code == 404 or status_code == -1\n @queue.commit_status = :open\n @commit_lock_manager.unlock(api_lock) if api_lock\n @commit_lock_manager.unlock(commit_lock) if commit_lock\n return :open\n else\n @commit_lock_manager.unlock(api_lock) if api_lock\n @commit_lock_manager.unlock(commit_lock) if commit_lock\n raise e\n end\n end\n # Abort errored out streams\n if stream_execution.currentState == \"ERROR\" or stream_execution.currentState == \"FAILED\"\n @domo_client.stream_client.abortExecution(@stream_id, stream_execution.getId)\n @logger.error(\"Execution ID for #{stream_execution.getId} for Stream ID #{@stream_id} was aborted due to an error.\",\n :stream_id => @stream_id,\n :dataset_id => @dataset_id,\n :execution_id => stream_execution.getId,\n :execution_state => stream_execution.currentState,\n :execution => stream_execution.to_s)\n @queue.commit_status = :failed\n # Commit!\n elsif stream_execution.currentState == \"ACTIVE\"\n execution_id = stream_execution.getId\n # Block everybody from uploading again\n @queue.commit_status = :running\n sleep(0.5) # Race conditions are a PITA\n # Start the commit\n @logger.info(\"Beginning commit of Stream Execution #{execution_id} for Stream ID #{@stream_id}.\",\n :stream_id => @stream_id,\n :pipeline_id => pipeline_id,\n :dataset_id => @dataset_id,\n :execution_id => execution_id,\n :commit_rows => @queue.commit_rows,\n :execution => stream_execution.to_s)\n stream_execution = Concurrent::Future.execute { @domo_client.stream_client.commitExecution(@stream_id, execution_id) }\n until stream_execution.complete?\n sleep(0.5)\n # Keep the locks active\n if commit_lock[:validity] <= 1000 or api_lock[:validity] <= 1000\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl, extend: commit_lock, extend_only_if_locked: true)\n api_lock = @commit_lock_manager.lock(lock_key, @lock_timeout, extend: api_lock, extend_only_if_locked: true)\n end\n end\n\n stream_execution = stream_execution.value\n # Wait until the commit is actually done processing\n while stream_execution&.currentState == \"ACTIVE\"\n sleep(0.5)\n # Attempt to grab the lock again if we lost it\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl) unless commit_lock\n # Give up if we still can't get it\n return :wait unless commit_lock\n # Keep the locks active\n commit_lock = @commit_lock_manager.lock(commit_lock_key, lock_ttl, extend: commit_lock, extend_only_if_locked: true) if commit_lock[:validity] <= 1000\n api_lock = @commit_lock_manager.lock(lock_key, @lock_timeout, extend: api_lock, extend_only_if_locked: true) if api_lock and api_lock[:validity] <= 1000\n # Update the StreamExecution from the API.\n begin\n stream_execution = @domo_client.stream_client.getExecution(@stream_id, execution_id)\n rescue Java::ComDomoSdkRequest::RequestException => e\n # Almost every exception means we're done.\n status_code = Domo::Client.request_error_status_code(e)\n if status_code.nil? or status_code == -1\n @logger.debug(\"We got a status code of -1 somehow. Let's look at the exception.\",\n :exception => e,\n :status_code => status_code,\n :message => e.to_s)\n end\n if status_code == 404 or status_code < 400 or status_code >= 500\n break\n else\n raise e\n end\n end\n end\n # Mark the queue as successfully committed.\n commit_rows = @queue.commit_rows\n @queue.commit\n @logger.info(\"Committed Execution ID for #{execution_id} for Stream ID #{@stream_id}.\",\n :stream_id => @stream_id,\n :pipeline_id => pipeline_id,\n :dataset_id => @dataset_id,\n :execution_id => execution_id,\n :commit_rows => commit_rows,\n :execution => stream_execution.to_s)\n else\n @logger.warn(\"Stream Execution ID #{stream_execution.getId} for Stream ID #{@stream_id} could not be committed or aborted because its state is #{stream_execution.currentState}\",\n :stream_id => @stream_id,\n :pipeline_id => pipeline_id,\n :dataset_id => @dataset_id,\n :commit_rows => @queue.commit_rows,\n :execution_id => stream_execution.getId,\n :execution_state => stream_execution.currentState,\n :execution => stream_execution.to_s)\n @queue.commit_status = :failed\n end\n break\n end\n # Make sure to unlock all the locks\n ensure\n @commit_lock_manager.unlock(api_lock) if api_lock\n @commit_lock_manager.unlock(commit_lock) if commit_lock\n # Open the queue back up if the execution failed\n @queue.commit_status = :open if @queue.commit_status == :running\n end\n end\n # Return the status of the commit.\n @queue.commit_status\n end", "title": "" }, { "docid": "106f0a6da7a73a5d16639fc4fb45137d", "score": "0.57674384", "text": "def with_transaction\n ActiveRecord::Base.transaction { yield }\n end", "title": "" }, { "docid": "57c81bd8ea0444bdf0513fdb3fb847e7", "score": "0.5760035", "text": "def make_command_waiting\r\n self.class.send :alias_method, :command, :command_and_wait\r\n yield\r\n self.class.send :alias_method, :command, :command_verbatim \r\n end", "title": "" }, { "docid": "b9ebdc8eac569c0ce6c438786c7c5fa5", "score": "0.5759646", "text": "def flush\n return nil if @queries.empty?\n \n @args[:db].transaction do\n @queries.shift(1000).each do |str|\n STDOUT.print \"Executing via buffer: #{str}\\n\" if @debug\n @args[:db].q(str)\n end\n end\n \n return nil\n end", "title": "" }, { "docid": "57f93a8f3740619f1ea30a57588c50bc", "score": "0.57542634", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "57f93a8f3740619f1ea30a57588c50bc", "score": "0.57542634", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "de481a8295ec53a3c4427e30381659b3", "score": "0.5753667", "text": "def transaction\n transaction_not_started = true\n while transaction_not_started do\n begin\n @lock.synchronize do\n @cache.begin_transaction\n # If we get to this point, the transaction was successfully\n # started. We can exit the loop.\n transaction_not_started = false\n end\n rescue TransactionInOtherThread\n # sleep up to 50ms\n sleep(rand(50) / 1000.0)\n end\n end\n\n begin\n yield if block_given?\n rescue => e\n @lock.synchronize { @cache.abort_transaction }\n raise e\n end\n @lock.synchronize { @cache.end_transaction }\n end", "title": "" }, { "docid": "f999ba19f3ca4dbc47043736c85b389c", "score": "0.57434237", "text": "def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "e93b215928af8d9cc1fae2751ea3d47d", "score": "0.5741833", "text": "def execute(&block)\n block\nend", "title": "" }, { "docid": "257b4eb6e7b020943a4a81907ffbd18a", "score": "0.57252157", "text": "def execute(async)\n f = Fiber.current\n begin\n conn = acquire(f)\n conn.acquired_for_connection_pool += 1\n yield conn\n ensure\n conn.acquired_for_connection_pool -= 1\n conn.run_postponed_queries if conn.acquired_for_connection_pool == 0\n release(f) if !async && conn.acquired_for_connection_pool == 0\n end\n end", "title": "" }, { "docid": "656f111e171be53cb2b36c516f69f059", "score": "0.5723477", "text": "def call(*, &block)\n lock_instance.execute(&block)\n end", "title": "" }, { "docid": "dde63befec05fc46d09293740fdd1ad7", "score": "0.5721771", "text": "def smart_transaction\n result = nil\n ensure_in_transaction do\n begin\n handle = connection.lo_open(oid)\n result = yield handle\n connection.lo_close(handle)\n end\n end\n result\n end", "title": "" }, { "docid": "ddec7827e2c5d00950961e2cfe298d0c", "score": "0.57187927", "text": "def perform_atomic_update(&block)\n Edition.connection.execute \"set transaction isolation level serializable\"\n Edition.connection.transaction do\n yield\n end\n end", "title": "" }, { "docid": "e55dd37358a7c6d378736c16c723a641", "score": "0.5717988", "text": "def in_transaction(opts = {})\n yield\n end", "title": "" }, { "docid": "1746cf93eb525a64f9f20c1b5a74344d", "score": "0.5714453", "text": "def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end", "title": "" }, { "docid": "2b009ffce527314c098f0c88f1ec987e", "score": "0.5709333", "text": "def outside_transaction\n # ActiveRecord manages connections per-thread, so the only way to\n # convince it to open another connection is to start another thread.\n thread = Thread.new do\n begin\n yield\n end\n end\n thread.value\n end", "title": "" }, { "docid": "5b164d3de88f1aabdbb73490ea8da751", "score": "0.57060283", "text": "def runMbxTransaction(hpk, op = '')\n limit = Rails.configuration.x.relay.mailbox_retry\n count, complete, res = 0, false, nil\n while count < limit and not complete\n rds.watch(\"mbx_#{hpk}\") do\n rds.multi\n yield\n res = rds.exec\n complete = ! res.nil?\n unless complete\n count += 1\n sleep 0.1 + rand() * 0.1 # let other mbx writes complete\n logger.warn \"#{INFO_NEG} mailbox #{dumpHex hpk}, retry #{op}/#{count}\"\n end\n end\n end\n if count >= limit and not complete\n raise TransactionError.new(self,hpk),\n \"#{op} in mailbox #{dumpHex hpk} transaction failure\"\n end\n return complete ? res : nil\n end", "title": "" }, { "docid": "4990e9cc3b75f60fb6eb233d09eba77d", "score": "0.5698632", "text": "def execute(&block)\r\n block\r\nend", "title": "" }, { "docid": "34a032a825a59eca8043280f705267f2", "score": "0.5687848", "text": "def transaction\n raise ArgumentError, 'No block was given' unless block_given?\n\n with_client do |client|\n begin\n client.query('BEGIN')\n yield client\n client.query('COMMIT')\n rescue StandardError => e\n client.query('ROLLBACK')\n raise e\n end\n end\n end", "title": "" }, { "docid": "65072e29d18dfae81452a5526a827b19", "score": "0.5684931", "text": "def perform(options = {}, &block)\n @record.transaction do\n @record.class.lock('FOR UPDATE NOWAIT').find(@record.id)\n yield\n end\n rescue\n nil\n end", "title": "" }, { "docid": "86b48c40c2e572f770c0277b832d4ffb", "score": "0.5668224", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "853cb4a033fc36324802ba2b464b467c", "score": "0.566692", "text": "def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end", "title": "" }, { "docid": "e74bc2db7be6b9c60f1e2e2ca62d97cf", "score": "0.56597763", "text": "def execute(&block)\n block.call \nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.5658018", "text": "def execute(block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" }, { "docid": "158ff8e6973776ada55ece5ca5e51a69", "score": "0.5650092", "text": "def execute(&block)\n block.call\nend", "title": "" } ]
042efc3c06c2e2c05d17cd823e88af77
Given a hash with numeric values, return the key for the smallest value require "pry"
[ { "docid": "69917a83c8c8ad1b0d415ab74a5123bd", "score": "0.0", "text": "def key_for_min_value(name_hash)\n# low_price = Float::INFINITY\n low_price = nil\n low_item = nil\n name_hash.each do |item, price|\n if low_price == nil || price < low_price\n low_price = price\n low_item = item\n end\n end\n low_item\nend", "title": "" } ]
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8309639", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend", "title": "" }, { "docid": "8a58975f18d4954a20fccb99f6dc9b40", "score": "0.8228651", "text": "def key_for_min_value(num_hash)\n min_value = num_hash.collect{|key, num| num}.sort[0]\n key, num = num_hash.find {|key, num| num == min_value}\n key\nend", "title": "" }, { "docid": "10348c0f7efbf074c6402f6f47742839", "score": "0.8215408", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "5274f7bbba68cf15df3562d80d7ce3f1", "score": "0.8204484", "text": "def key_for_min_value(hash)\n low_key = nil\n low_val = 0\n hash.each do |key, val|\n if low_val == 0 || val < low_val\n low_val = val\n low_key = key\n end\n end\n low_key\n end", "title": "" }, { "docid": "226515ade14f33b0d702f287edd6fe9d", "score": "0.8198008", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\n end", "title": "" }, { "docid": "917f353c232d4640614845e6b7c840f9", "score": "0.81862557", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\n end", "title": "" }, { "docid": "d6c24d339b21831095c887c09768a0a6", "score": "0.8146922", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "d6c24d339b21831095c887c09768a0a6", "score": "0.8146922", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "90c5f24a7f0c6124d8f166cfd4439d06", "score": "0.81339973", "text": "def key_for_min_value(hash)\nlowest_key = nil\nlowest_val = Float::INFINITY\n hash.each do |key, val|\n if val < lowest_val\n lowest_val = val\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "4f23d7ac240865f09f0b4a3c14bcbc4a", "score": "0.8114155", "text": "def key_for_min_value(hash) \n small_key = nil\n small_value = nil\n hash.each do |a, b|\n if small_value == nil || b < small_value\n small_value = b\n small_key = a\n end\n end \n small_key\nend", "title": "" }, { "docid": "45c7290567499ca3ce034aafdea8b667", "score": "0.81126803", "text": "def key_for_min_value(name_hash)\n lowest_number = Float::INFINITY\n lowest_key = nil\n name_hash.collect do |key, value|\n if value < lowest_number\n lowest_number = value\n lowest_key = key\n end\n end\n lowest_key \nend", "title": "" }, { "docid": "659a8a8a1fc6ce648f753678621d782f", "score": "0.80925053", "text": "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n\n if min_key == nil\n min_key = key\n end\n if value <= hash[min_key]\n min_key = key\n end\n end\n # binding.pry\n min_key\nend", "title": "" }, { "docid": "f76a4cd2274f14f75d352b14c8d29bd1", "score": "0.8087996", "text": "def key_for_min_value(hash)\n if hash.empty?\n return nil\n else\n min_value = Float::INFINITY\n min_key = \"\"\n hash.each do |key, val|\n if val < min_value\n min_value = val\n min_key = key\n end\n end\n end\n min_key\nend", "title": "" }, { "docid": "4350b724f36fef31121f91da1137c1c1", "score": "0.80750763", "text": "def key_for_min_value(hash)\n lowest = 1000000000000000000000\n if hash.empty?\n return nil\n else\n arr = hash.map do |key, value|\n if hash[key] <= lowest\n lowest = hash[key]\n end\n end\n hash.each do |key, value|\n if lowest == hash[key]\n return key\n end\n end\n end\nend", "title": "" }, { "docid": "fd2efe9fd3810bfa002f7199cf8dab19", "score": "0.80468893", "text": "def key_for_min_value(hash)\n small_val = nil\n small_key = nil\n\n hash.collect do |key, value|\n if small_val == nil || small_val > value\n small_val = value\n small_key = key\n end\n end\n small_key\nend", "title": "" }, { "docid": "1cc15f9ecd834daad0140761a4b31ca3", "score": "0.8046133", "text": "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n \tsmallest = key if smallest.nil?\n \tsmallest = key if value < hash[smallest]\n end\n smallest\nend", "title": "" }, { "docid": "fc8481fa0f37bc7cbe43dc4d941b10aa", "score": "0.80368453", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_val = nil\n hash.each do |key, val|\n if lowest_val == nil || val < lowest_val\n lowest_val = val\n lowest_key = key\n end\n end\n lowest_key\n\nend", "title": "" }, { "docid": "c45c181efc7de1e218dc24ac2734e986", "score": "0.8036568", "text": "def key_for_min_value(name_hash)\n return nil if name_hash.size == 0\n numbers = name_hash.collect {|name, number| number}\n lowest_key = \"\"\n lowest_num = numbers[0]\n name_hash.each do|name, num|\n if num <= lowest_num\n lowest_key = name\n lowest_num = num\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "5931a9b151f13dba8e800b2da35f4657", "score": "0.8035739", "text": "def key_for_min_value(hash)\n least = hash.reduce do |key, value|\n key.last > value.last ? value : key\n end \n if hash == {}\n least\n else\n least.first\n end\n end", "title": "" }, { "docid": "35891c2372ee9459348a913a0898da90", "score": "0.80261755", "text": "def key_for_min_value(hash)\n ref = nil\n answer = nil\n hash.each do |key, value|\n if ref == nil || value < ref\n ref = value\n answer = key\n end\n end\n answer\nend", "title": "" }, { "docid": "abf68bb16569607b80dedf139280c6d1", "score": "0.8024022", "text": "def key_for_min_value(hash)\n hash.min_by {|k,v| k}\nend", "title": "" }, { "docid": "46cb8698c6271a1cc374219528e87211", "score": "0.8020145", "text": "def key_for_min_value(hash)\n low_key = nil\n hash.each do |key, value|\n if low_key == nil || (low_key != nil && value < hash[low_key])\n low_key = key\n end\n end\n low_key\nend", "title": "" }, { "docid": "99dc179f590c57b51993ee5538a0dec3", "score": "0.8017383", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n return_key = nil\n smallest = Float::INFINITY\n name_hash.each do |key, value|\n if value.to_i < smallest\n smallest = value.to_i\n return_key = key\n end\n end\n return_key\nend", "title": "" }, { "docid": "a12e2b92a2177eaf9075e9e4abaaf51b", "score": "0.80162156", "text": "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "5ced3d13f6443860d99f05be7d515c1b", "score": "0.7998038", "text": "def key_for_min_value(hash_value)\n hash.invert.min&.last\nend", "title": "" }, { "docid": "cbc05af89f66bfee58f5064b1d205024", "score": "0.7996701", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "83f467e9815c0a652cb12bacbb080468", "score": "0.7979604", "text": "def key_for_min_value(hash)\n smallest_key = nil\n smallest_value = nil\n\n hash.each do |key, value|\n if smallest_value == nil || value < smallest_value\n smallest_value = value\n smallest_key = key\n end\n end\n return smallest_key\nend", "title": "" }, { "docid": "c6b25d8461cbb575dfa919b8f81a332c", "score": "0.797551", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "c6b25d8461cbb575dfa919b8f81a332c", "score": "0.797551", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "7341ca23ed68b4691dab2252b518b7a1", "score": "0.7975053", "text": "def key_for_min_value(hash)\n smallest_name = nil\n smallest_number = nil\n hash.each do |name, number|\n if smallest_number == nil || number < smallest_number\n smallest_number = number\n smallest_name = name\n end\n end\n smallest_name\nend", "title": "" }, { "docid": "2d02c97195dd4c65890a5bf73a5eaaac", "score": "0.7945686", "text": "def key_for_min_value(hash)\nsmall_val=999999\nsmall_key= nil\n hash.each do |key, value|\n if value < small_val\n small_val = value \n small_key = key \n \n end\n end\n return small_key\nend", "title": "" }, { "docid": "c39b4b472ca2c3b934c6a4768c11d10b", "score": "0.7939449", "text": "def key_for_min_value(hash)\n out = nil\n nill = nil \n hash.each do |k,v|\n if nill == nil || v < nill\n out = k\n nill = v\n end\n end\n out\nend", "title": "" }, { "docid": "51a6cadf90ff0488493c451230083dc0", "score": "0.79278404", "text": "def key_for_min_value(hash)\n if hash.length == 0 \n return nil \n end\n \n min_key = 9999\n min_val = 9999\n \n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n return min_key\n \n \nend", "title": "" }, { "docid": "1dfbb98d6d40de92c01fb3bd4e166c03", "score": "0.7924336", "text": "def key_for_min_value(name_hash)\n least_value = 0\n least_key = nil\n name_hash.collect do |key, value|\n # binding.pry\n if least_value == 0 || value < least_value\n least_value = value\n least_key = key \n end \n end \n least_key\nend", "title": "" }, { "docid": "b8ab4fe1e885b44f703fa1fa6f07a509", "score": "0.7921484", "text": "def key_for_min_value(hash)\n if hash.length == 0\n return\n end\n min = hash.first[1]\n min_key = hash.first[0]\n hash.each do |key, value|\n if value < min \n min = value\n min_key = key\n end\n end\n min_key\nend", "title": "" }, { "docid": "5bf622df6f77ac34ecf5b2b18a63645a", "score": "0.7918632", "text": "def key_for_min_value(hash)\nlowest_k = nil\nlowest_v = nil\nhash.each do |k, v|\n if lowest_v == nil || v < lowest_v\n lowest_v = v\n lowest_k = k\n end\n end\n lowest_k\n end", "title": "" }, { "docid": "d1cf716c45a59a3f1faad1c83f59f7d7", "score": "0.7917773", "text": "def key_for_min_value(hash)\n\tnew_hash = Hash[hash.sort_by{|k,v| v}]\n\tnew_hash.keys.first\nend", "title": "" }, { "docid": "68c083b336f4655607cd05a6f4ce1e7b", "score": "0.7914037", "text": "def key_for_min_value(name_hash)\n smallest = nil\n smallest_key = nil\n if name_hash.empty?\n return smallest_key\n else\n name_hash.each do |key, number|\n if smallest == nil\n smallest = number\n smallest_key = key\n elsif number <= smallest\n smallest = number\n smallest_key = key\n else\n smallest_key\n end\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "3be616dbcc198bab000a36f9482a9e25", "score": "0.7911813", "text": "def key_for_min_value(name_hash)\n\tlowest_int = 9999999999999\n\tlowest_int_key = nil\n\tname_hash.each do |key, value|\n\t\tif value < lowest_int\n\t\t\tlowest_int = value\n\t\t\tlowest_int_key = key\n\t\tend\n\tend\n\treturn lowest_int_key\nend", "title": "" }, { "docid": "9fe8fd05d03cff6f26dd4fea5eead4d5", "score": "0.791037", "text": "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.collect do |word, num|\n if num < lowest_value\n lowest_value = num\n lowest_key = word\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "9b55bd5f3282b43ed301aaa310d69296", "score": "0.79045177", "text": "def key_for_min_value(name_hash)\n if name_hash == Hash.new\n return nil\n end\n\n lowest_priced = \"\"\n previous_value = 999\n\n name_hash.collect do |name, value|\n if value < previous_value # if value is lower, store the key\n previous_value = value\n lowest_priced = name\n end\n end\n return lowest_priced\nend", "title": "" }, { "docid": "ae712e1cd355755d634fa182a00e2eb7", "score": "0.7904419", "text": "def key_for_min_value(name_hash)\n \n lowest_number = 1000\n lowest_key = nil\n \n name_hash.each do |key, value|\n if value < lowest_number\n lowest_number = value \n lowest_key = key \n end\n end\n return lowest_key \nend", "title": "" }, { "docid": "d5553af71103c724668cba7fc4393ff5", "score": "0.7902175", "text": "def key_for_min_value(hash)\n value_array = []\n hash.each do |key, value|\n value_array << value\n end\n\n lowest_value = value_array.first\n value_array.each do |value|\n if value < lowest_value\n lowest_value = value\n end\n end\n\n hash.key(lowest_value)\nend", "title": "" }, { "docid": "3c6700cbd2ea0361870bd4d85c2db76f", "score": "0.789355", "text": "def key_for_min_value(hash)\n min_value = nil\n min_key = nil\n\n hash.each do |key, value|\n if min_value == nil || value < min_value\n \tmin_value = value\n \tmin_key = key\n end\n end\n min_key\nend", "title": "" }, { "docid": "f7db41a1cd50a93ab7a3e5aa0633e7ed", "score": "0.7891997", "text": "def key_for_min_value(hash)\n return nil if hash.empty?\n min_value_key = nil\n min_value = (2**(0.size * 8 -2) -1) #Theorectical Fixnum_max \n #http://stackoverflow.com/questions/535721/ruby-max-integer\n hash.each do |key, value|\n \tif value < min_value\n \t\tmin_value_key = key \n \t\tmin_value = value\n \tend\n end\n min_value_key\nend", "title": "" }, { "docid": "24cbce2787c5f157492fed1063e9b198", "score": "0.78854597", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n low_num = name_hash.first[1]\n low_key = name_hash.first[0]\n name_hash.each do |key, value|\n if value < low_num\n low_num = value\n low_key = key\n end\n end\n low_key \nend", "title": "" }, { "docid": "c82d264affee3c7aeee4771c0c2138ee", "score": "0.78770494", "text": "def key_for_min_value(hash)\n i = 0\n min = 0\n min_key = nil\n hash.each do |key, value|\n unless i > 0\n min = value\n min_key = key\n end\n if min > value\n min = value\n min_key = key\n end\n i += 1\n end\n min_key\nend", "title": "" }, { "docid": "4d5e3566f6f88e38d92c68ad888ac10f", "score": "0.7876757", "text": "def key_for_min_value(name_hash)\n min_key = nil\n number = 9999\n name_hash.each do |name, value|\n if value < number\n number = value\n min_key = name\n end\n end\n min_key\nend", "title": "" }, { "docid": "ded2ec0f491d9511b7412df8aeca5ef7", "score": "0.78695726", "text": "def key_for_min_value(name_hash)\n lowest_value = 1000\n lowest_key = nil\n name_hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n end\n if lowest_value == value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "b95a68401d61853e70592407ff571cd2", "score": "0.78679174", "text": "def key_for_min_value(hash)\n\n low_name = nil\n low_val = nil\n\n hash.each do |name, value|\n if low_val == nil || value < low_val\n low_val = value\n low_name = name\n end\n end\n return low_name\nend", "title": "" }, { "docid": "6cc12c11a6f7c41f0541165a1614caac", "score": "0.78618205", "text": "def key_for_min_value(name_hash)\n lowestnum = 900000000000000000000\n majorKey = nil\nname_hash.each do |name, value|\nif value < lowestnum\n lowestnum = value\n majorKey = name\nend\nend\nreturn majorKey\nend", "title": "" }, { "docid": "34216b1a9efadf20c9e0a84fcbc34eef", "score": "0.7861044", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n elsif\n currentlow = 9999999999999999999999\n lowestkey = \"\"\n name_hash.each do |key, value|\n if value < currentlow\n currentlow = value\n lowestkey = key\n end\n end\n lowestkey\n end\nend", "title": "" }, { "docid": "f0b4fe84074d3b429486583cb056e941", "score": "0.78600943", "text": "def key_for_min_value(hash)\n return nil if hash == {}\n ks = hash.map{|k, v| k}\n vs = hash.map{|k, v| v}\n min_index = vs.index(vs.min)\n ks[min_index]\nend", "title": "" }, { "docid": "b0b3d135407df1cd296dfea704f502c9", "score": "0.78582454", "text": "def key_for_min_value(hash)\n lowest_key = nil \n lowest_value = nil\n hash.collect do |a, b|\n if lowest_value == nil || b < lowest_value\n lowest_value = b\n lowest_key = a \n end\n end\n lowest_key\nend", "title": "" }, { "docid": "7f14531cc53cc34d9511f767e6802bc3", "score": "0.7858135", "text": "def key_for_min_value(hash)\n min_val = nil\n min_key = nil\n \n hash.each do |key, value|\n if min_val == nil || value < min_val \n min_val = value\n min_key = key\n end\n end \n return min_key\nend", "title": "" }, { "docid": "924d9371b7862d849e89b8037e61b74a", "score": "0.78570276", "text": "def key_for_min_value(name_hash)\n lowest_number = 0\n empty_hash = nil\n name_hash.collect do |name, number|\n if lowest_number == 0 || number < lowest_number\n lowest_number = number\n empty_hash = name\n end\n end\n empty_hash\nend", "title": "" }, { "docid": "fdcd20dc142920b8d4662027d722898e", "score": "0.7855648", "text": "def key_for_min_value(name_hash)\n lowest = 99999999\n if name_hash == {}\n nil\n else\n name_hash.collect do |key, value|\n if value < lowest\n lowest = value\n end\n end\n name_hash.key(lowest)\nend\nend", "title": "" }, { "docid": "23ed2879146c704a4237c2e30952bb26", "score": "0.78553516", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return nil\n end\n# binding.pry\nsmallest = name_hash.first[1]\nsmall_key = name_hash.first[0]\nname_hash.each do |key, value|\n if value <= smallest\n smallest = value\n small_key = key\n end\nend\nsmall_key\nend", "title": "" }, { "docid": "edaad4f808305fb93d8e80fdc6e45224", "score": "0.7853301", "text": "def find_key(hash)\n hash.key(hash.values.min)\nend", "title": "" }, { "docid": "8df01aa2faf978c607b835713ad334f8", "score": "0.78524685", "text": "def key_for_min_value(name_hash)\nsmall_key = nil\n small_value = 9999\n name_hash.each do |key, value|\n if value < small_value \n small_value = value\n small_key = key\n end\n end\n small_key\n end", "title": "" }, { "docid": "dd557f5393598205c4b2e991e2502023", "score": "0.7851436", "text": "def key_for_min_value(name_hash)\n smallestKey = nil\n smallestValue = 2000\n name_hash.collect do |item, num|\n if num < smallestValue\n smallestKey = item\n smallestValue = num\n end\n end\n smallestKey\nend", "title": "" }, { "docid": "e71b5e8fe7a76de9e34943f4fc34d2bc", "score": "0.7851338", "text": "def key_for_min_value(name_hash)\n lowest_thing = nil\n lowest_value = nil\n name_hash.each do |thing, value|\n if lowest_value == nil || value < lowest_value\n lowest_thing = thing\n lowest_value = value\n end\n end\n lowest_thing\nend", "title": "" }, { "docid": "3733b6d370fe956780d68a853c8a4368", "score": "0.78508675", "text": "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_value = 100\n lowest_key = 100\n name_hash.each do |key, value|\n lowest_value, lowest_key = value, key if value < lowest_value\n end\n return lowest_key\nend", "title": "" }, { "docid": "e0b51124441bb3a0844fd1cbb9841254", "score": "0.7849955", "text": "def key_for_min_value(has)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "c38491fddaa2fe9b333d19f06c52525e", "score": "0.7846489", "text": "def key_for_min_value(hash)\n small = nil\n tiny = nil\n hash.each do |key, value|\n if tiny == nil || value < tiny\n tiny = value\n small = key\n end\n end\n small\nend", "title": "" }, { "docid": "feb1673b541e2bc52eea736ad6461fe5", "score": "0.7846319", "text": "def key_for_min_value(name_hash)\n base_number = 10000000\n smallest = \"\"\n if name_hash == {}\n return nil\n else\n name_hash.collect do |name, value|\n if value < base_number\n smallest = name\n base_number = value\n end\n end\nend\n smallest\nend", "title": "" }, { "docid": "8ff3186ed34716366ce4489b764b2196", "score": "0.78462374", "text": "def key_for_min_value(hash) \n\n min_value = 0\n min_key = 0\n \n if hash.empty?\n return nil\n end\n \n hash.each do |key, value|\n\n if min_value == 0 || value < min_value \n min_value = value\n min_key = key\n end\n end\n min_key\n\n \n \n\n\nend", "title": "" }, { "docid": "769884cf17d9db6fbb75b9316ca174d7", "score": "0.78446764", "text": "def key_for_min_value(hash)\n return nil if hash.size == 0\n min = hash.first\n hash.each {|k, v| v <= min[1] ? min = [k, v] : nil}\n min[0]\nend", "title": "" }, { "docid": "0d3f2f6b853c02e607d0c0559e141f30", "score": "0.78439724", "text": "def key_for_min_value(name_hash)\n lowest_thing = nil\n lowest = nil\n\n name_hash.each do |thing, low|\n if lowest == nil || low < lowest\n lowest = low\n lowest_thing = thing\n end\n end\n lowest_thing\nend", "title": "" }, { "docid": "fea0eb5b81db16536604c58d63aeccff", "score": "0.7843505", "text": "def key_for_min_value(name_hash)\n smallest_key_value = 0\n desired_key = nil\n name_hash.each do |key, value|\n if value < smallest_key_value || smallest_key_value == 0\n smallest_key_value = value\n desired_key = key\n end\n end\n desired_key\nend", "title": "" }, { "docid": "31970d2d58d98703f4b41585e1b2963f", "score": "0.7843003", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n else\n smallest_key = nil\n name_hash.collect do |name, number|\n if smallest_key == nil || number < smallest_key\n smallest_key = number\n end\n end\n\n name_hash.each do |name, value|\n if value == smallest_key\n return name\n end\n end\n end\nend", "title": "" }, { "docid": "9b4a41cb37c1a6c3ed4a06e13fc83c50", "score": "0.78417814", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value #lowest_value = nil in this part\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "67fc803b393c9120086b050dd0ab8884", "score": "0.784169", "text": "def key_for_min_value(name_hash)\n hash_num = 0\n lowest_hash_key = \"\"\n if name_hash == {}\n return\n end\n\n name_hash.collect do |key, value|\n if hash_num == 0\n hash_num = value\n lowest_hash_key = key\n elsif hash_num > value\n hash_num = value\n lowest_hash_key = key\n\n end\n end\n lowest_hash_key\nend", "title": "" }, { "docid": "b16999cb8da6c5e1834d351837391d0d", "score": "0.783946", "text": "def key_for_min_value(name_hash)\n smallest = Float::INFINITY\n sel = nil\n name_hash.collect do |k,v|\n if v < smallest\n smallest = v\n sel = k\n end\n end\n sel\nend", "title": "" }, { "docid": "c28eae7efedf05a7308c485ad0abc4dd", "score": "0.78391594", "text": "def key_for_min_value(name_hash)\n return nil if name_hash == {}\n nums = Array.new\n name_hash.each {|key, value|\n nums.push(value)\n }\n cur_num = nums[0]\n nums.each{|x|\n cur_num = x if x < cur_num\n }\n name_hash.each {|key, value|\n return key if value == cur_num\n }\nend", "title": "" }, { "docid": "41f0d5d4371e7e781570c4842a0b94c6", "score": "0.7837228", "text": "def key_for_min_value(hash)\n min = nil\n k = nil\n hash.each do |key, value|\n if !min || value < min\n min = value\n k = key\n end\n end\n k\nend", "title": "" }, { "docid": "f5450105a7136bfe3f128170714828e5", "score": "0.78366524", "text": "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "title": "" }, { "docid": "a20616bf7fc77d9ceb14bfb8a0c1d081", "score": "0.7830954", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n nil\n else\n small_value = nil\n small_key = nil\n name_hash.each do |name, num|\n if small_value == nil || num < small_value\n small_value = num\n small_key = name\n end\n end\n small_key\n end\nend", "title": "" }, { "docid": "857cc51f5b6466f0430d231363675ebf", "score": "0.78307694", "text": "def key_for_min_value(name_hash)\nsmallest_key=nil\nsmallest_value = 10000\nname_hash.each do |key, number| \n if number<=smallest_value\n smallest_value=number\n end\nend\nname_hash.key(smallest_value)\nend", "title": "" }, { "docid": "f590293b3e870e93af674e64b5bccaed", "score": "0.78292453", "text": "def key_for_min_value(name_hash)\n smallest_number = \"\"\n new_value = 10000000000000\n key_house = nil\n name_hash.each do |key, value|\n if new_value > value\n smallest_number = value\n new_value = smallest_number\n key_house = key\n end\n end\n key_house\nend", "title": "" }, { "docid": "8ea89fee2b9b053283cd67f01b4bd116", "score": "0.78288424", "text": "def key_for_min_value(hash)\n\n smallest = hash.collect {|key, value| value}\n smallest = smallest.min\n\n output = nil\n hash.each do |key, val|\n if val==smallest\n output=key\n end\n end\n output\nend", "title": "" }, { "docid": "85a8990a2d65a4a50cc41262330aac5c", "score": "0.78285223", "text": "def key_for_min_value(name_hash)\n if name_hash.size == 0\n return nil\n else\n smallest_key, smallest_key_num = name_hash.first\n name_hash.each do |key, num|\n if num < smallest_key_num\n smallest_key_num = num\n smallest_key = key\n end\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "54267f4b76ae17968e3673fcf95dd264", "score": "0.78254396", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\np lowest_key\nend", "title": "" }, { "docid": "63ae293d812a5397303d3b9718bc7c32", "score": "0.7824967", "text": "def key_for_min_value(name_hash)\n answer = nil\n low_number = nil\n name_hash.each do |name, number|\n if low_number == nil || number < low_number\n low_number = number\n answer = name\n end\n end\n return answer\nend", "title": "" }, { "docid": "f6433b669cfc53e3a16fcb7150f69b0b", "score": "0.78221256", "text": "def key_for_min_value(the_hash)\n vals = the_hash.map { |k, v| v }\n keys = the_hash.map { |k, v| k }\n lowest = vals.sort[0]\n\n if the_hash.empty?\n nil\n else\n return keys[vals.index(lowest)]\n end\nend", "title": "" }, { "docid": "ffe79e9c5a2f246bebff97769837e7d6", "score": "0.78207123", "text": "def key_for_min_value(name_hash)\n x = 1000\n lowest_key = nil \n name_hash.each do |key, value|\n if value < x \n x = value \n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "ffe79e9c5a2f246bebff97769837e7d6", "score": "0.78207123", "text": "def key_for_min_value(name_hash)\n x = 1000\n lowest_key = nil \n name_hash.each do |key, value|\n if value < x \n x = value \n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "fd070b038a157309bcf80e81c9b56bc0", "score": "0.78198427", "text": "def key_for_min_value(name_hash)\n min_num = nil\n current_key = name_hash[0]\n name_hash.each do |key, value|\n if min_num == nil || value < min_num\n min_num = value\n current_key = key\n end\n end\n current_key\nend", "title": "" }, { "docid": "fd070b038a157309bcf80e81c9b56bc0", "score": "0.78198427", "text": "def key_for_min_value(name_hash)\n min_num = nil\n current_key = name_hash[0]\n name_hash.each do |key, value|\n if min_num == nil || value < min_num\n min_num = value\n current_key = key\n end\n end\n current_key\nend", "title": "" }, { "docid": "73a5bd3b8b46a6e68dad6296c171f06c", "score": "0.7819358", "text": "def key_for_min_value(hash)\n\tmin = Hash.new\n\tmin_value = 0\n\thash.each_pair do | key, num |\n\t\tif \tmin.empty?\n\t\t\tmin[key] = num\n\t\t\tmin_value = min[key]\n\t\telsif num < min_value\n\t\t\tmin.replace({key => num})\n\t\tend\n\tend\n\tmin.values\nend", "title": "" }, { "docid": "bf889e2ca4183c6286fc26d2577d14fa", "score": "0.78151894", "text": "def key_for_min_value(hash)\n key= nil\n value= nil\n hash.each do |cat, dog|\n if value == nil || dog < value\n value= dog\n key= cat\n end\n end\n key\nend", "title": "" }, { "docid": "b414e6e748b033108975ab3559eeb4ac", "score": "0.78145593", "text": "def key_for_min_value(name_hash)\n key_of_lowest_value = nil\n lowest_value = 999999999999\n name_hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n key_of_lowest_value = k\n end\n end\n key_of_lowest_value\nend", "title": "" }, { "docid": "0ec68a27d47bc14735c772b55f02ff92", "score": "0.781362", "text": "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_value=99\n name_hash.each { |key,value|\n lowest_value = value unless lowest_value < value\n }\n name_hash.key(lowest_value)\nend", "title": "" }, { "docid": "91f6e33b3609ad60d72b88e544c0652c", "score": "0.78125376", "text": "def key_for_min_value(name_hash)\n smallest_value = 9999999999999\n smallest_key = nil\n name_hash.each do |element|\n if element[1]< smallest_value\n smallest_value = element[1]\n smallest_key = element[0]\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "95e0ab7c417950b476dd8eebf6647f2b", "score": "0.7809894", "text": "def key_for_min_value(name_hash)\n value = nil\n select_key = nil\n\n name_hash.each do |key, num|\n if value == nil\n value = num\n select_key = key\n elsif num < value\n value = num\n select_key = key\n end\n end\n\n select_key\nend", "title": "" }, { "docid": "5a67ad385bebec655f7c2d75ca28158d", "score": "0.78056955", "text": "def key_for_min_value(hash)\n low_key = nil\n high_value = 100000\n hash.each do |key, value|\n if value < high_value\n high_value = value\n low_key = key\n end\n end\n low_key\nend", "title": "" }, { "docid": "71429da2eb250413a3b57bdbde630ba8", "score": "0.78054214", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return\n end\n val = 10000000000\n smallest_key = \"\"\n name_hash.collect do |key, value|\n if value < val\n smallest_key = key\n val = value\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "c4c1b38189ac774f09ab183528c0ebb6", "score": "0.78047186", "text": "def key_for_min_value(name_hash)\n number = nil\n object = nil\n name_hash.each {|key, value| if object == nil || value < number then number = value; object = key end }\n object\nend", "title": "" }, { "docid": "d5dfe37d5df260abb8710e463b1fe496", "score": "0.7802099", "text": "def key_for_min_value(name_hash)\n smallest = nil\n smallkey = nil\n if name_hash == {}\n nil\n else\n name_hash.collect do |key, value|\n if nil == smallest\n smallest = value\n smallkey = key\n elsif value < smallest\n smallest = value\n smallkey = key\n end\n end\n smallkey\n end\nend", "title": "" }, { "docid": "6e808f0dbde08485fe8003dfbe0ae78d", "score": "0.7801213", "text": "def key_for_min_value(hash)\n\n name, acc = hash.first\n\n if hash == {}\n nil\n else\n hash.each do |key, value|\n if value < acc\n acc = value\n name = key\n end\n end\n end\n name\nend", "title": "" }, { "docid": "b393a616dc6eb0e638b2fec00be397be", "score": "0.78002834", "text": "def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value #so lowest_value == nil MUST be first, or else get argumentative error because cant compare value \"<\" nil argumentative error\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" } ]
b0cd14ec6be7fbb3ff52626a4a0b42f3
DELETE /scraped_codes/1 DELETE /scraped_codes/1.json
[ { "docid": "cebae54e045f7c2302c2cacac0cbed71", "score": "0.741581", "text": "def destroy\n @scraped_code.destroy\n respond_to do |format|\n format.html { redirect_to scraped_codes_url, notice: 'Scraped code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "725b3b11701e04d87e00cec959662098", "score": "0.6805732", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to code_index_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44f01025cd2e31f57947fe78a35a389d", "score": "0.67544967", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5dba3e5f402ac300726e6e6bbb7ea7df", "score": "0.6743664", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "66c50019febf9f4fb6c48ee9bb420e37", "score": "0.671387", "text": "def destroy\n @audirt_code = AudirtCode.find(params[:id])\n @audirt_code.destroy\n\n respond_to do |format|\n format.html { redirect_to audirt_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.6688405", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "2508f66013880dd7389d69cf87d51dbc", "score": "0.6666753", "text": "def destroy\n @scrap_type = ScrapType.find(params[:id])\n @scrap_type.destroy\n\n respond_to do |format|\n format.html { redirect_to scrap_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.6620477", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "b4bf9199154bc6262968ba75bdbb3f40", "score": "0.6594207", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to(codes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "44d2fc96280f1f2fd49ad0bf38350939", "score": "0.6581982", "text": "def destroy\n @budget_code = BudgetCode.find(params[:id])\n @budget_code.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33ae3fbaabb68170de9f95477c22d5d1", "score": "0.65734065", "text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n # the G5K REST API sometimes fail with error 503. In that case we should just wait and retry\n puts(\"G5KRest: DELETE #{path} failed with error 503, retrying after #{RETRY_503_SLEEP} seconds\")\n retries += 1\n sleep RETRY_503_SLEEP\n retry\n end\n handle_exception(e)\n end\n end", "title": "" }, { "docid": "1a39500d0966753c20fb023d54a07a13", "score": "0.65174216", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to(codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "1a39500d0966753c20fb023d54a07a13", "score": "0.65174216", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to(codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "35870d1301fa714b56eed15145781d93", "score": "0.650316", "text": "def destroy\n @daily_code.destroy\n respond_to do |format|\n format.html { redirect_to daily_codes_url, notice: 'Daily code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "64e2e5782603ae2d8be3d00887bd30c8", "score": "0.6500743", "text": "def destroy\n @codeset = Codeset.find(params[:id])\n @codeset.destroy\n\n respond_to do |format|\n format.html { redirect_to codesets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17803e1f047a584c8781ea97b9017ca9", "score": "0.64908046", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to '/get_tiqued', notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c7e10d8bc6fe1e3b005990829978fd72", "score": "0.6488664", "text": "def destroy\n @drugcode = Drugcode.find(params[:id])\n @drugcode.destroy\n\n respond_to do |format|\n format.html { redirect_to drugcodes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f47e014e7c52b85a5b54f816298dc314", "score": "0.6485193", "text": "def destroy\n @response_code = ResponseCode.find(params[:id])\n @response_code.destroy\n\n respond_to do |format|\n format.html { redirect_to response_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f464b6bedfcb3fb517654ced814f0c25", "score": "0.6475037", "text": "def destroy\n @download_code = DownloadCode.find(params[:id])\n @download_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(download_codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ba7289c13a89ba15de8d4c7d1e5b6cc9", "score": "0.6474182", "text": "def destroy\n @code_download.destroy\n respond_to do |format|\n format.html { redirect_to code_downloads_url, notice: 'Code download was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.64589196", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7cb97f12621bb1c322544a23baed2602", "score": "0.6453393", "text": "def destroy\n @featured_code = FeaturedCode.find(params[:id])\n @featured_code.destroy\n\n respond_to do |format|\n format.html { redirect_to featured_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "deef2d66fa336e931106feb98f7f5eef", "score": "0.6446221", "text": "def destroy\n @scrap.destroy\n respond_to do |format|\n format.html { redirect_to scraps_url, notice: 'Scrap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "efee509b9acae37591d5f9a924e97911", "score": "0.6441659", "text": "def destroy\n @blorescrapurl = Blorescrapurl.find(params[:id])\n @blorescrapurl.destroy\n\n respond_to do |format|\n format.html { redirect_to blorescrapurls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2b1ae638e133ba40720fec54744ac1a0", "score": "0.64193", "text": "def destroy\n @coding = Coding.find(params[:id])\n @coding.destroy\n\n respond_to do |format|\n format.html { redirect_to codings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33b9714ef455c164c85d0cfcc1cce272", "score": "0.6410714", "text": "def destroy\n @client_code.destroy\n respond_to do |format|\n format.html { redirect_to client_codes_url, notice: 'Client code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c929fb4f7473ccc2184a7b40bf3f02ca", "score": "0.6408551", "text": "def destroy\n @evaluation_code.destroy\n respond_to do |format|\n format.html { redirect_to evaluation_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2148e2fd9383c12872890f51efee3615", "score": "0.6398939", "text": "def delete\n begin\n task_id = \"#{@file}\".gsub(/\\.\\/singularity\\//, \"\").gsub(/\\.json/, \"\")\n # delete the request\n RestClient.delete \"#{@uri}/api/requests/request/#{task_id}\"\n puts \"#{task_id} DELETED\"\n rescue\n puts \"#{task_id} #{$!.response}\"\n end\n end", "title": "" }, { "docid": "a7a6712c1a089ef2f01a95c8ec35a4ae", "score": "0.63969135", "text": "def destroy\n @discount_code.destroy\n respond_to do |format|\n format.html { redirect_to discount_codes_url, notice: 'Discount code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b3359c43b4766f1e5ea95f79774e99e", "score": "0.6376692", "text": "def destroy\n File.delete(Rails.root.join('public', 'test', @tester.code))\n @tester.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e6377eeca8a0012d6810728466d2daf1", "score": "0.6371499", "text": "def destroy\n @scrapbook = Scrapbook.find(params[:id])\n @scrapbook.destroy\n\n respond_to do |format|\n format.html { redirect_to scrapbooks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ea7b653d2b6fef0f66d70a9e5f877cf", "score": "0.63535726", "text": "def clear_code(code)\n Url.where(:code => code).delete_all\n end", "title": "" }, { "docid": "335de05a124f4777a08612ac19c9fed9", "score": "0.63426083", "text": "def destroy\n @mumscrapurl = Mumscrapurl.find(params[:id])\n @mumscrapurl.destroy\n\n respond_to do |format|\n format.html { redirect_to mumscrapurls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c162232f39db0abbdf726fd8ae57ac51", "score": "0.6337602", "text": "def destroy\n @scrap_order_item = @scrap_order.items.find(params[:id])\n @scrap_order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to scrap_order_items_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "47de0c8ac14703b52ecdbed9fd1d383d", "score": "0.6333672", "text": "def destroy\n @status_code.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "aab40e915a983b19a00c602b76a1ae9a", "score": "0.633263", "text": "def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end", "title": "" }, { "docid": "8cfbb0c87f5b7da668ace665751a0cc1", "score": "0.63307256", "text": "def destroy\n @class_code = ClassCode.find(params[:id])\n @class_code.destroy\n\n respond_to do |format|\n format.html { redirect_to class_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7b0eb181ccafc1f939dfb1c0abadf7f8", "score": "0.63236177", "text": "def destroy\n @taxcode = Taxcode.find(params[:id])\n @taxcode.destroy\n\n respond_to do |format|\n format.html { redirect_to taxcodes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cf3b8bfe6019d6a74b2abb7e203074b2", "score": "0.6318203", "text": "def destroy\n @scrape_method.destroy\n respond_to do |format|\n format.html { redirect_to scrape_methods_url, notice: 'Scrape method was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b23d86004ccf04d7bee686570d6a4b09", "score": "0.6306841", "text": "def destroy\n @chosakekka_code.destroy\n respond_to do |format|\n format.html { redirect_to chosakekka_codes_url, notice: 'Chosakekka code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f76369ba7a82c746d053004411dea9ad", "score": "0.6301647", "text": "def destroy\n @stockcode = Stockcode.find(params[:id])\n @stockcode.destroy\n\n respond_to do |format|\n format.html { redirect_to stockcodes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b0bd416c791c05acf8183bf6ffa95e10", "score": "0.63001513", "text": "def destroy\n @seal_code.destroy\n respond_to do |format|\n format.html { redirect_to seal_codes_url, notice: 'Seal code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e23fbd4a6753765ffffd90b5ee58025a", "score": "0.6296193", "text": "def destroy\n @n_code.destroy\n respond_to do |format|\n format.html { redirect_to n_codes_url, notice: 'N code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "643f13add72ffd2ce70d7e696795f075", "score": "0.62895554", "text": "def destroy\n @trackback_code = TrackbackCode.find(params[:id])\n @trackback_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(trackback_codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "a430203b79f2b70a65159c193b6ab020", "score": "0.6284591", "text": "def destroy\n @scraping_web.destroy\n respond_to do |format|\n format.html { redirect_to scraping_webs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9c4eb9230f0948eda91fe2a7fe8b465b", "score": "0.62824357", "text": "def destroy\n @code_file.destroy\n respond_to do |format|\n format.html { redirect_to theme_code_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b4bc15cd7d85c22cb010f645a408bcb8", "score": "0.6279883", "text": "def destroy\n @hab_code.destroy\n respond_to do |format|\n format.html { redirect_to hab_codes_url, notice: 'Hab code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ce18ab34c2ff1317be948e8ff7d5c43e", "score": "0.6278664", "text": "def destroy\n @scribble.destroy\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "896e7370998bce08cab9b7c921b8a458", "score": "0.62782264", "text": "def destroy\n @scrapsite.destroy\n respond_to do |format|\n format.html { redirect_to scrapsites_url, notice: 'Scrapsite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f8054bc97b36d62342df4ce89938c83f", "score": "0.6275776", "text": "def destroy\n @change_company_code = ChangeCompanyCode.find(params[:id])\n @change_company_code.destroy\n\n respond_to do |format|\n format.html { redirect_to change_company_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d4fc7231f236ac09016f3faaa72c3cce", "score": "0.62754935", "text": "def destroy\n @scribble.destroy\n respond_to do |format|\n format.html { redirect_to scribbles_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "07ef5b2373542856a499a992e259f5e6", "score": "0.6275127", "text": "def destroy\n @game_code.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3447df596f12b703e071e44f12d7d5bf", "score": "0.6270464", "text": "def destroy\n @alarm_code = AlarmCode.find(params[:id])\n @alarm_code.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a1f4f1a72ccad9161b1bb8b9c36af6be", "score": "0.6267609", "text": "def destroy\n @code_tambon = CodeTambon.find(params[:id])\n @code_tambon.destroy\n\n respond_to do |format|\n format.html { redirect_to code_tambons_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "ba67ebd85114998e01be10599c8943ca", "score": "0.6259581", "text": "def delete(path)\n RestClient.delete request_base+path\n end", "title": "" }, { "docid": "98b6ec9b312c78e96dc88e1ae01aec4e", "score": "0.62580866", "text": "def destroy\n @rate_code = RateCode.find(params[:id])\n @rate_code.destroy\n\n respond_to do |format|\n format.html { redirect_to rate_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "417c130f089951af242cd92201a4efa3", "score": "0.62550694", "text": "def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to newsboard_path(code: Code.first.code) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9106867cee9e8775ba817195d3bc2020", "score": "0.6254266", "text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end", "title": "" }, { "docid": "5d1c94b6e02dae3a6b0eb3b266ced100", "score": "0.6250281", "text": "def destroy\n @ext_code = ExtCode.find(params[:id])\n @ext_code.destroy\n\n respond_to do |format|\n format.html { redirect_to ext_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "284b0549dbc51e5ed4c4e00e8242686c", "score": "0.62480205", "text": "def destroy\n @promo_code.destroy\n respond_to do |format|\n format.html { redirect_to promo_codes_url, notice: 'Promo code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d2375b11675de0e152de07976b50e9c7", "score": "0.6247107", "text": "def delete_request(url, queries)\n results = @@client.delete url, queries\n results.to_json\nend", "title": "" }, { "docid": "a213ac49224c10908313e358159b7bb6", "score": "0.62371737", "text": "def destroy\n @code_tester = CodeTester.find(params[:id])\n @code_tester.destroy\n\n respond_to do |format|\n format.html { redirect_to code_testers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2ef99c8fb0113c4aaaff2e13b9b5ece4", "score": "0.6231189", "text": "def destroy\n set_discount_code\n @discount_code.destroy\n respond_to do |format|\n format.html { redirect_to admin_discount_codes_url, notice: 'Discount code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c9e65353a67a3d9ef984e3203dd6f38f", "score": "0.62183994", "text": "def test_delete_backup_codes\n test_identifier = rand(1000..9999).to_s\n\n backup_codes = @twizo.create_backup_codes(nil)\n backup_codes.params.identifier = test_identifier\n\n backup_codes = backup_codes.delete\n\n assert_equal '204', backup_codes.code\n end", "title": "" }, { "docid": "ffbef36ce535939d092322aaaae4f8ba", "score": "0.6207846", "text": "def destroy\n @code_amphoe = CodeAmphoe.find(params[:id])\n @code_amphoe.destroy\n\n respond_to do |format|\n format.html { redirect_to code_amphoes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "4610d64041e2c261accd055458917b8c", "score": "0.6195461", "text": "def destroy\n @base_rate_code = BaseRateCode.find(params[:id])\n @base_rate_code.destroy\n\n respond_to do |format|\n format.html { redirect_to base_rate_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ce3b6d04a669a7aa6cd6f13c254da47b", "score": "0.6192926", "text": "def destroy\n @secret_code = SecretCode.find(params[:id])\n @secret_code.destroy\n\n respond_to do |format|\n format.html { redirect_to secret_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1da40eac6a8b9cc5e48f356ac446e7bc", "score": "0.6181371", "text": "def destroy\n @spider_url = SpiderUrl.find(params[:id])\n @spider_url.destroy\n\n respond_to do |format|\n format.html { redirect_to spider_urls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f68ea389447600d34b47e4dcbe71373a", "score": "0.6180308", "text": "def destroy\n @handle_code = HandleCode.find(params[:id])\n @handle_code.destroy\n\n respond_to do |format|\n format.html { redirect_to handle_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1925f74505d42d49cd704e36eed9719a", "score": "0.617988", "text": "def destroy\n @fincode = Fincode.find(params[:id])\n @fincode.destroy\n\n respond_to do |format|\n format.html { redirect_to Fincodes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b7afff1a40de9c0d45c40d33457b11aa", "score": "0.61721635", "text": "def destroy\n @prize_code = PrizeCode.find(params[:id])\n @prize_code.destroy\n\n respond_to do |format|\n format.html { redirect_to prize_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3f2a9a41b79dc6af6836e69e95167ac2", "score": "0.617184", "text": "def destroy\n @runcode.destroy\n respond_to do |format|\n format.html { redirect_to runcodes_url, notice: 'Runcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc142eabc58084c65af1b90a2a3674f0", "score": "0.61702543", "text": "def destroy\n @promocode.destroy\n respond_to do |format|\n format.html { redirect_to promocodes_url, notice: 'Promocode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc142eabc58084c65af1b90a2a3674f0", "score": "0.61702543", "text": "def destroy\n @promocode.destroy\n respond_to do |format|\n format.html { redirect_to promocodes_url, notice: 'Promocode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5e641c99833da2da99804f479d2c23f4", "score": "0.61696845", "text": "def destroy\n @code_snippet = CodeSnippet.find(params[:id])\n @code_snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to code_snippets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b445c184893647d3482f8fbc6a507a52", "score": "0.61685467", "text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end", "title": "" }, { "docid": "492a69651b66d27af40e775f87863cd4", "score": "0.61664134", "text": "def destroy\n @scraping_correction = ScrapingCorrection.find(params[:id])\n @scraping_correction.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "da8eccac74201431bb357576298f0131", "score": "0.61658686", "text": "def destroy\n @code_prename = CodePrename.find(params[:id])\n @code_prename.destroy\n\n respond_to do |format|\n format.html { redirect_to code_prenames_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "00c90bc63b0302afbbc4b2979ae20b57", "score": "0.616416", "text": "def api_delete(path, data = {})\n api_request(:delete, path, :data => data).parsed\n end", "title": "" }, { "docid": "67b2e6b84d9c5637e7b32f01c58e1ab7", "score": "0.61632496", "text": "def destroy\n @codes_cpt = CodesCpt.find(params[:id])\n @codes_cpt.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_cpts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0abaf4faee86c743e20553b74418fdb9", "score": "0.61629814", "text": "def destroy\n @citocode.destroy\n respond_to do |format|\n format.html { redirect_to citocodes_url, notice: 'Citocode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1aafb22f51797d98411d831f8d7cb1aa", "score": "0.6162644", "text": "def destroy\n @barcode.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f2b64c770b5c8ac43bf55d04c1e9b42e", "score": "0.6162134", "text": "def destroy\n @scrapebot = Scrapebot.find(params[:id])\n @scrapebot.destroy\n\n respond_to do |format|\n format.html { redirect_to scrapebots_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f368ae324956473e26d2ea87f699cc5c", "score": "0.61553335", "text": "def destroy\n @ncit_disease_code.destroy\n respond_to do |format|\n format.html { redirect_to ncit_disease_codes_url, notice: 'Ncit disease code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ac9616f9a7353d9bd6e82f364aa4943", "score": "0.6153118", "text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "7ac9616f9a7353d9bd6e82f364aa4943", "score": "0.6153118", "text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "0527b830cd062ff2ac3f629932ef76ed", "score": "0.6147644", "text": "def destroy\n @access_code = AccessCode.find(params[:id])\n @access_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "526941166bbc9d1b43a2d0ec9ca406da", "score": "0.614537", "text": "def destroy\n @icdcode.destroy\n respond_to do |format|\n format.html { redirect_to icdcodes_url, notice: 'Icdcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "76e95ffd134074511da4eca54cc6c74f", "score": "0.6134572", "text": "def destroy\n @webcrawl = Webcrawl.find(params[:id])\n @webcrawl.destroy\n\n respond_to do |format|\n format.html { redirect_to webcrawls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "548e4d8aa27f2fba123bc427152aebdf", "score": "0.6134088", "text": "def destroy\n @test_code.destroy\n redirect_to project_test_codes_path(set_project)\n end", "title": "" }, { "docid": "3634b1fae327f44cf20df49ed9f30585", "score": "0.61301064", "text": "def destroy\n @tax_code.destroy\n respond_to do |format|\n format.html { redirect_to tax_codes_url, notice: 'tax code was successfully deleted.' }\n end\n end", "title": "" }, { "docid": "b5df583bb70d7066e5f9a84c0ad7c3ef", "score": "0.6124136", "text": "def destroy\n @screen_scraping.destroy\n respond_to do |format|\n format.html { redirect_to screen_scrapings_url, notice: 'Screen scraping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3654ca43764256086b09233f7871dd37", "score": "0.6122749", "text": "def destroy\n @scrapbook.destroy\n respond_to do |format|\n format.html { redirect_to scrapbooks_url, notice: 'Scrapbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ae3e78588191fb86141949c311a3d163", "score": "0.6121642", "text": "def destroy\n @crawler = Crawler.find(params[:id])\n @crawler.destroy\n\n respond_to do |format|\n format.html { redirect_to crawlers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1976878353b07397aec075864f20178a", "score": "0.61198246", "text": "def destroy\n @abstract_canonical_code.destroy\n respond_to do |format|\n format.html { redirect_to abstract_canonical_codes_url, notice: 'Abstract canonical code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ba88411bf10ce588fc4214d90d384abd", "score": "0.6118409", "text": "def destroy\n @iata_code.destroy\n respond_to do |format|\n format.html { redirect_to iata_codes_url, notice: 'Iata code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
7ca157e4ed8fa9e88e9e494df8d09366
def employee_codes_of_specific_date(employee_time_sheet_id, sun, monday, tuesday, wednesday, thursday, friday, sat)
[ { "docid": "b0d47a4ae23fb257f441fd39f4099ad1", "score": "0.7091505", "text": "def employee_cost_codes(day, employee)\n @timesheet = @project.employee_time_sheets.where(timesheet_created_at: day, employee_id: employee.id)\n end", "title": "" } ]
[ { "docid": "1f188794535baaeb18f3c4dc49ee0c68", "score": "0.595235", "text": "def w_day; end", "title": "" }, { "docid": "d8a5b3ebc9060c8248a9909032a53e65", "score": "0.5846084", "text": "def return_static_day(myday,day_map,human_label)\n\n static_day=myday\n my_1day=(60*60*24) #1 day in seconds\n\n #static holiday\n if ( myday.wday != day_map['sun'] and myday.wday != day_map['sat']) #not on a weekend\n static_day=(\"#{(myday).to_i}:#{human_label}\")\n elsif myday.wday == day_map['sun'] #push Monday after\n static_day=(\"#{(myday+my_1day).to_i}:#{human_label} Monday After\")\n elsif myday.wday == day_map['sat'] #Friday before\n static_day=(\"#{(myday-my_1day).to_i}:#{human_label} Friday Before\")\n else\n #we shouldn't see anything here\n end\n return static_day\nend", "title": "" }, { "docid": "01e1ce91ee99772e5f132829d343ad7a", "score": "0.5804931", "text": "def day() end", "title": "" }, { "docid": "f43f48e65d6b813e786bb71a53a3a22a", "score": "0.5803031", "text": "def day_name; Date::DAYNAMES[wday] end", "title": "" }, { "docid": "08d287fc30f80231f7155dcbf43b4d76", "score": "0.5769882", "text": "def day; end", "title": "" }, { "docid": "b59aaa3315c0be3132be7c43f6dafed3", "score": "0.57627845", "text": "def cwday\n end", "title": "" }, { "docid": "3eee528bf11e4d06ff18255c986ead55", "score": "0.57488364", "text": "def day_identifier\n day_baseline = Date.parse(\"2020-06-01\")\n number_baseline = 91\n\n baseline_shift = date.mjd - day_baseline.mjd\n\n number_baseline + baseline_shift\n end", "title": "" }, { "docid": "9dfaa81a2a891c1bea17c9ff7de05419", "score": "0.57135254", "text": "def date_for( day_number, as_date = false )\n Timesheet.date_for( self.year, self.week_number, day_number, as_date )\n end", "title": "" }, { "docid": "2971986afa2c06e8ce955421b3d775b7", "score": "0.56811553", "text": "def your_birthday_is_on_a_friday_in_the_year(birthday)\nend", "title": "" }, { "docid": "2971986afa2c06e8ce955421b3d775b7", "score": "0.56811553", "text": "def your_birthday_is_on_a_friday_in_the_year(birthday)\nend", "title": "" }, { "docid": "2a2f79d96592288ac1c52aeb7e3c57bf", "score": "0.56747943", "text": "def ord(day)\n\nend", "title": "" }, { "docid": "4c3f87db80c235620d82736a07984e45", "score": "0.56676424", "text": "def abbr_day_name; Date::ABBR_DAYNAMES[wday] end", "title": "" }, { "docid": "c9dbb2022597c6667e1f6170a52b1c58", "score": "0.56549317", "text": "def _week_day_numbers\n week_day_start = self.week_day_start\n week_day_start.capitalize if week_day_start.is_a? String\n [0, 1, 2, 3, 4, 5, 6].partition {|on| on >= day_names.index(week_day_start)%7 }.flatten\n end", "title": "" }, { "docid": "0c1a482fd4d388becd9e901bc32689da", "score": "0.5639233", "text": "def get_day_name(day)\n# setting a variable with an empty string first\n day_name = \"\"\n\n# instead of writing a LONG if statement for all 7 days\n# we will set up a case expression\n case day\n when \"mon\"\n day_name = \"Monday\"\n when \"tue\"\n day_name = \"Tuesday\"\n when \"wed\"\n day_name = \"Wednesday\"\n when \"thu\"\n day_name = \"Thursday\"\n when \"fri\"\n day_name = \"Friday\"\n when \"sat\"\n day_name = \"Saturday\"\n when \"sun\"\n day_name = \"Sunday\"\n #if user enters invalid abbreviation\n else\n day_name = \"Invalid abbreviation\"\n end #end of case\n return day_name\nend", "title": "" }, { "docid": "27f1009153671dd26c16560943f24517", "score": "0.56141907", "text": "def week_days\n {\n \"1\" => 'mon',\n \"2\" => 'tue',\n \"3\" => 'wed',\n \"4\" => 'thu',\n \"5\" => 'fri',\n \"6\" => 'sat',\n \"7\" => 'sun'\n }\n end", "title": "" }, { "docid": "39e094c07a9426826f1a1efc47e336ff", "score": "0.56011724", "text": "def tuesday\n day(:tuesday)\n end", "title": "" }, { "docid": "175fcf3e66ca00e31fec7de37ff7d31c", "score": "0.5600948", "text": "def day=(_arg0); end", "title": "" }, { "docid": "fd549bc770002b91cc0c822d4cd5aea8", "score": "0.55993426", "text": "def wday() end", "title": "" }, { "docid": "c22b18e793e732aa93959f8831f30362", "score": "0.5587471", "text": "def filling_dates (student_class, class_day)\n prefix = Dayweek.find_by_id(class_day.dayweek_id).dayname\n if prefix == \"Monday\"\n student_class.Mon_fromh = class_day.from_time[0,2]\n student_class.Mon_fromm = class_day.from_time[2,2]\n student_class.Mon_toh = class_day.to_time[0,2]\n student_class.Mon_tom = class_day.to_time[2,2] \n student_class.Mon_check = \"1\"\n end\n if prefix == \"Tuesday\"\n student_class.Tue_fromh = class_day.from_time[0,2]\n student_class.Tue_fromm = class_day.from_time[2,2]\n student_class.Tue_toh = class_day.to_time[0,2]\n student_class.Tue_tom = class_day.to_time[2,2]\n student_class.Tue_check = \"1\"\n end\n \n if prefix == \"Wednesday\"\n student_class.Wed_check = \"1\"\n student_class.Wed_fromh = class_day.from_time[0,2]\n student_class.Wed_fromm = class_day.from_time[2,2]\n student_class.Wed_toh = class_day.to_time[0,2]\n student_class.Wed_tom = class_day.to_time[2,2]\n student_class.Wed_check = \"1\" \n end\n if prefix == \"Thursday\"\n student_class.Thu_fromh = class_day.from_time[0,2]\n student_class.Thu_fromm = class_day.from_time[2,2]\n student_class.Thu_toh = class_day.to_time[0,2]\n student_class.Thu_tom = class_day.to_time[2,2]\n student_class.Thu_check = \"1\"\n end\n if prefix == \"Friday\"\n student_class.Fri_fromh = class_day.from_time[0,2]\n student_class.Fri_fromm = class_day.from_time[2,2]\n student_class.Fri_toh = class_day.to_time[0,2]\n student_class.Fri_tom = class_day.to_time[2,2] \n student_class.Fri_check = \"1\" \n end\n if prefix == \"Saturday\"\n student_class.Sat_fromh = class_day.from_time[0,2]\n student_class.Sat_fromm = class_day.from_time[2,2]\n student_class.Sat_toh = class_day.to_time[0,2]\n student_class.Sat_tom = class_day.to_time[2,2] \n student_class.Sat_check = \"1\" \n end\n if prefix == \"Sunday\" \n student_class.Sun_fromh = class_day.from_time[0,2]\n student_class.Sun_fromm = class_day.from_time[2,2]\n student_class.Sun_toh = class_day.to_time[0,2]\n student_class.Sun_tom = class_day.to_time[2,2]\n student_class.Sun_check = \"1\"\n end\n end", "title": "" }, { "docid": "170b2f06e0397ece7183675b6c8d9586", "score": "0.5574375", "text": "def dayIs(aDay)\n unless aDay == 'Saturday' || aDay == 'Sunday'\n daytype = 'weekday'\n else\n daytype = 'weekend'\n end\n daytype\nend", "title": "" }, { "docid": "974474d32bb3b4289cf6598988a9b68f", "score": "0.5573517", "text": "def get_day_name(day) \n day_name = \"\"\n\n case day \n when \"Mon\"\n day_name = \"Monday\"\n when \"Tues\"\n day_name = \"Tuesday\"\n when \"Wed\"\n day_name = \"Wednesday\"\n when \"Thur\"\n day_name = \"Thursday\"\n when \"Fri\"\n day_name = \"Friday\"\n when \"Sat\"\n day_name = \"Saturday\"\n when \"Sun\"\n day_name = \"Sunday\"\n else\n day_name = \"Invalid abbreviation\"\n end \n\n return day_name\nend", "title": "" }, { "docid": "c1d2e9fbd021f21e8fb3256b8ef6d1d7", "score": "0.55692214", "text": "def weekday\n fail \"A value cannot be provided for #{__method__}\" if @value\n return 'Mon..Fri'\n end", "title": "" }, { "docid": "3a18ec96ab0c341d35e746dd18142fd9", "score": "0.555987", "text": "def dayNum\n ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'].index(self.day.downcase)\n end", "title": "" }, { "docid": "1c054d88a2194a4177e565744333ba03", "score": "0.5544859", "text": "def work_day_employees\n all_week_employees = self.current_columns.each_slice(2).to_a\n\n return all_week_employees[Date.today.wday]\n end", "title": "" }, { "docid": "6281852fd68ea21fc9169c0c190d6411", "score": "0.5541154", "text": "def day\n end", "title": "" }, { "docid": "5add7762088096506cab081b02b60a13", "score": "0.5537972", "text": "def weekday\n fail \"A value cannot be provided for #{__method__}\" if @value\n\n 'Mon..Fri'\n end", "title": "" }, { "docid": "52aa7db01507903dcfbf01f0034e1568", "score": "0.553071", "text": "def day_of_the_week(day)\n @dias = {1 => \"LUNES\", 2 => \"MARTES\", 3 => \"MIERCOLES\", 4 => \"JUEVES\", 5 => \"VIERNES\", 6 => \"SÁBADO\", 7 => \"DOMINGO\"}\n return @dias[day]\n end", "title": "" }, { "docid": "308455e8119d8a6b71aeee2cb5a57281", "score": "0.55256486", "text": "def get_day_name(day) #convert name into the actual day_name\n day_name = \"\"\n\ncase day\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"mon\"\n day_name =\"Monday\"\nwhen \"thu\"\n day_name =\"Thursday\"\nwhen \"fri\"\n day_name =\"Friday\"\nwhen \"sat\"\n day_name =\"Saturday\"\nwhen \"sun\"\n day_name =\"Sunday\"\nelse #in case user write an option that doesnt exit we could use else keyword\n day_name = \"Invalid abbreviation\"\nend \n\nreturn day_name\nend", "title": "" }, { "docid": "2bf0a3ebff98405e1aa39aaab8c93ec6", "score": "0.5504983", "text": "def yday\n end", "title": "" }, { "docid": "fc3d9f79a77fb56966e2222051b64a42", "score": "0.5495619", "text": "def day_of_week\n Date::DAYNAMES.fetch(recurring_event.day).downcase.to_sym\n end", "title": "" }, { "docid": "01df3a8c4787246b498d6bdd905a16c3", "score": "0.5488833", "text": "def yday() end", "title": "" }, { "docid": "b80746ad0702da67322e05edb422f919", "score": "0.54865533", "text": "def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end", "title": "" }, { "docid": "fe76b03e665ca3b40c7bc6f8a312755d", "score": "0.5485181", "text": "def find_day_of(num)\n curr_day = Time.new(2016, 1, 1)\n day_find = curr_day + (3600 * 24 * num - 1)\n #the_day = curr_day.yday()\n\n\n p \"#{day_find} is Monday\" if day_find.monday?\n p \"#{day_find} is Tuesday\" if day_find.tuesday?\n p \"#{day_find} is Wednesday\" if day_find.wednesday?\n p \"#{day_find} is Thursday\" if day_find.thursday?\n p \"#{day_find} is Friday\" if day_find.friday?\n p \"#{day_find} is Saturday\" if day_find.saturday?\n p \"#{day_find} is Sunday\" if day_find.sunday?\n\n p day_find.ctime\nend", "title": "" }, { "docid": "ed53ef694b4a04d44239c2c72900bb5a", "score": "0.5480823", "text": "def specific_days_in_semester\n date_start = USDateParse(self.start_date)#USDateParse(self.start_date)\n date_end = USDateParse(self.end_date)#USDateParse(self.end_date)\n curr_date = date_start\n date_hash = Hash.new(0)\n while curr_date <= date_end do\n if (! self.individual_dates_with_no_classes.include?(curr_date))\n date_hash[curr_date.cwday] += 1\n end\n curr_date += 1\n end\n return date_hash\n end", "title": "" }, { "docid": "ed619f2b3e09530df919806c774decb7", "score": "0.54642904", "text": "def weekday(weekday)\n case weekday\n when 'tod'\n @now\n when 'tom'\n @now + 1\n when 'y'\n @now - 1\n end\n end", "title": "" }, { "docid": "c5eab2dc59525547c7ad5f813b352be5", "score": "0.5461423", "text": "def weekoff_present(i,employee)\n flag = 0\n flag = EmployeeAttendance.exists?(day: i,employee_id: employee,present: \"WO\")\n flag\n end", "title": "" }, { "docid": "52c28d5c754411c957c851d3243f1b6c", "score": "0.54400486", "text": "def day_of_the_week(time)\n Date::DAYNAMES[time.wday]\nend", "title": "" }, { "docid": "01813414eb7fb9d71a6c97d21fed5a3b", "score": "0.54367864", "text": "def get_days\n return 0b0 if @params[:type] != 'advanced'\n\n return get_weekday_bitmask(['weekday_sun', 'weekday_mon', 'weekday_tue', 'weekday_wed', 'weekday_thu', 'weekday_fri', 'weekday_sat']) if @params[:schedule] == 'weekly'\n\n return get_month_bitmask(@params[:dates_picked]) if @params[:schedule] == 'monthly' && @params[:days] == 'specific'\n\n return get_unspecific_days\n\n end", "title": "" }, { "docid": "d2c8cea68578a515c2ffab93274d756f", "score": "0.54180825", "text": "def calendar_day_opt_classes(date, date_index, month_info)\n css_classes = []\n css_classes.push \"week-day-number-#{date_index % 7}\"\n css_classes.push \"week-number-#{date_index / 7}\"\n css_classes.push 'inactive' if date[:date].month != month_info[:month_date].month\n css_classes.push 'critical' if date[:is_critical]\n css_classes.push 'future-critical' if date[:is_future_critical]\n css_classes.push 'current-day' if month_info[:current_date] == date[:date]\n\n css_classes.join(' ')\n end", "title": "" }, { "docid": "e108306e989de9a0eee575285dd526bb", "score": "0.5410183", "text": "def what_day?(n)\n answer = \"Wrong, please enter a number between 1 and 7\"\n lookup = [\n [1, \"Sunday\"], \n [2, \"Monday\"], \n [3, \"Tuesday\"], \n [4, \"Wednesday\"], \n [5, \"Thursday\"], \n [6, \"Friday\"], \n [7, \"Saturday\"]]\n lookup.each do |v, d|\n if n == v\n answer = d\n end\n end\n answer\nend", "title": "" }, { "docid": "a3de9d31e07127a23beac2f6c383ad6b", "score": "0.53941005", "text": "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", "title": "" }, { "docid": "eaa9063e0c1acb169ef6240d534e79d2", "score": "0.53762054", "text": "def weekend_and_holiday(day)\n holiday = Holidays.on(day, :federal_reserve, :observed).any?\n weekend = day.saturday? || day.sunday?\n [weekend, holiday]\n end", "title": "" }, { "docid": "18bba00b22bda2f174c4d10e4e8fad8a", "score": "0.53756726", "text": "def get_day_name(day_of_the_week)\n\t\tcase day_of_the_week\n\t\t\twhen 0\n\t\t\t\t\"Sunday\"\n\t\t\twhen 1\n\t\t\t\t\"Monday\"\n\t\t\twhen 2\n\t\t\t\t\"Tuesday\"\n\t\t\twhen 3\n\t\t\t\t\"Wednesday\"\n\t\t\twhen 4\n\t\t\t\t\"Thursday\"\n\t\t\twhen 5\n\t\t\t\t\"Friday\"\n\t\t\twhen 6\n\t\t\t\t\"Saturday\"\n\t\t\telse\n\t\t\t\t\"It is not a day of the week!\"\n\t\tend\n\tend", "title": "" }, { "docid": "cfd8949d7e42ad00a3ccfcc7b96c2b5b", "score": "0.53680146", "text": "def has_sunday_with_date_7(month, year)\n calender = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n day_count = 0\n\n calender.each do |num|\n (1..num).each do |i|\n if i == 7 && day_count = 7\n return true\n end\n if day_count <= 7\n day_count += 1\n else\n day_count = 7\n end\n end\n end\nend", "title": "" }, { "docid": "2d7f0194b8e2cba4ccd78f219234bbe5", "score": "0.53546286", "text": "def perfectDayChecker day\n\t\t\t# If all five prayers were performed\n\t\t\tif day[:fajr] == 2 && day[:zuhr] == 2 && day[:asr] == 2 && day[:maghrib] == 2 && day[:isha] == 2\n\t\t\t \ttrue \t# Return true\n\t\t\telse\n\t\t\t\tfalse\t# Return false\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "07cfb4ae534101c5209b57b40aa05ee8", "score": "0.5349561", "text": "def showDay(i)\n\tif i ==1 then puts \"The day is monday\"\n\telsif i ==2 then puts \"The day is tuesday\"\n\telsif i ==3 then puts \"The day is wednesday\"\n\telsif i ==4 then puts \"The day is thursday\"\n\telsif i ==5 then puts \"The day is friday\"\n\t#elsif (6..7)===i then puts \"Weekend time\"\n\telsif (6..7).include?(i) then puts \"Weekend time\"\n\t#equivalent statement in python\n\t#elif i in range(6,8)\n\telse puts \"That's not a real day\" \n\tend\n\t\nend", "title": "" }, { "docid": "de98a2bd51ceffef3ebdf217737cfb11", "score": "0.5342928", "text": "def weekday(days)\nt = Date.today\narr = []\n days.times do\n arr << \"ok\" if t.saturday? || t.sunday?; t = t - 1\n end\n arr.count\nend", "title": "" }, { "docid": "8d99e41e867b83c3bdd878719ef52c4c", "score": "0.5336576", "text": "def day_and_date(date_and_times)\n date_and_times.split(';').first\nend", "title": "" }, { "docid": "fc03a9915624d43b8a0f49e4c89503fa", "score": "0.53362304", "text": "def day_of_week(date)\n 7 - date.cwday\n end", "title": "" }, { "docid": "158c5b0a0f4c04071bbd1a3c241c71ab", "score": "0.533232", "text": "def sunday_5_54_plus1\n make_hash(draw(49, 5), draw(11, 1))\n end", "title": "" }, { "docid": "b63cda75f53f457279b2c88959386286", "score": "0.5313364", "text": "def date_filter(arg)\r\n sdate = edate = nil\r\n sflag = eflag = 0\r\n sm = sd = em = ey = nil\r\n sy = ey = $cur_year\r\n $date_map.each do |k, v|\r\n re = Regexp.new(v)\r\n ####################################\r\n if ((sflag==0) && (eflag==0) &&(k==1))\r\n if (arg =~ re)\r\n mh1 = $1\r\n sdate = $holiday_map[mh1][0].to_s\r\n edate = $holiday_map[mh1][1].to_s\r\n sflag = eflag = 1\r\n end\r\n end\r\n ####################################\r\n if ((sflag==0) && (eflag==0) &&(k==2))\r\n if (arg =~ re)\r\n mh1 = $1\r\n mh2 = $3\r\n sm = em = $num_map.has_key?(mh1) ? $num_map[mh1] : mh1\r\n sd = $general_map.has_key?(mh2) ? $general_map[mh2][0] : '01'\r\n ed = $general_map.has_key?(mh2) ? $general_map[mh2][1] : '01'\r\n sdate = sy.to_s + \"-\" + sm + \"-\" + sd\r\n edate = ey.to_s + \"-\" + em + \"-\" + ed\r\n sflag = eflag = 1\r\n end\r\n end\r\n ####################################\r\n if ((sflag==0) && (eflag==0) &&(k==3))\r\n if (arg =~ re)\r\n mh1 = $1\r\n mh2 = $3\r\n mh3 = $5\r\n sm = em = $num_map.has_key?(mh1) ? $num_map[mh1] : mh1\r\n sd = $num_map.has_key?(mh2) ? $day_hash[mh2] : mh2\r\n ed = $num_map.has_key?(mh3) ? $day_hash[mh3] : mh3\r\n sdate = sy.to_s + \"-\" + sm + \"-\" + sd\r\n edate = ey.to_s + \"-\" + em + \"-\" + ed\r\n sflag = eflag = 1\r\n end\r\n end\r\n ####################################\r\n if ((sflag==0) && (eflag==0) &&(k==4))\r\n if (arg =~ re)\r\n k1 = $1\r\n k2 = $3\r\n k3 = $5\r\n k4 = $6\r\n k5 = $7\r\n k6 = $8\r\n sm = $num_map.has_key?(k1) ? $num_map[k1] : k1\r\n sd = $num_map.has_key?(k2) ? $num_map[k2] : k2\r\n if (k3 =~ /-|~|\\u6708|\\u53F7/)\r\n em = $num_map.has_key?(k4) ? $num_map[k4] : k4\r\n ed = $num_map.has_key?(k6) ? $num_map[k6] : k6\r\n else\r\n em = $num_map.has_key?(k3) ? $num_map[k3] : k3\r\n ed = $num_map.has_key?(k5) ? $num_map[k5] : k5\r\n end\r\n sdate = sy.to_s + \"-\" + sm + \"-\" + sd\r\n edate = ey.to_s + \"-\" + em + \"-\" + ed\r\n sflag = eflag = 1\r\n end\r\n end\r\n ####################################\r\n if ((sflag==0) && (eflag==0) &&(k==5))\r\n if (arg =~ re)\r\n k1 = $1\r\n k2 = $3\r\n sm = $num_map.has_key?(k1) ? $num_map[k1] : k1\r\n sd = $num_map.has_key?(k2) ? $num_map[k2] : k2\r\n sdate = sy.to_s + \"-\" + sm + \"-\" + sd\r\n sflag = 1\r\n end\r\n end\r\n ####################################\r\n end\r\n puts \"date_filter>sdate #{sdate} edate #{edate}\"\r\n return [sdate, edate]\r\nend", "title": "" }, { "docid": "a893c03f8c81bf561df3f08ac29979ea", "score": "0.53110754", "text": "def day(date)\n \n days = self.days(14)\n \n day = Object\n \n days.each do |dayEach|\n break day = dayEach if dayEach.dia == date.strftime(\"%d-%m-%Y\") \n end\n \n day\n \n end", "title": "" }, { "docid": "3c744404de72c31771d9872702779384", "score": "0.5292051", "text": "def test\n WorkCalendar.configure do |c|\n c.weekdays = %i(mon tue wed thu fri)\n c.holidays = [Date.new(2015, 1, 1), Date.new(2015, 7, 3), Date.new(2015, 12, 25)]\n end\n end", "title": "" }, { "docid": "8521e591c0715abf182f4feb8af76c6c", "score": "0.5287445", "text": "def day_of_week\n dnum = day\n dnum -= 10 if dnum > 20\n dnum -= 10 if dnum > 10\n dnum -= 1\n dnum\n end", "title": "" }, { "docid": "c7d967337da7870cc800ee329b975b33", "score": "0.52779955", "text": "def select_wday(day = nil)\n day = Date.today.wday if day.nil?\n\n wday_symbol = if day.kind_of?(Integer)\n wday_symbol = case day\n when 0\n 'Su'\n when 1\n 'M'\n when 2\n 'T'\n when 3\n 'W'\n when 4\n 'R'\n when 5\n 'F'\n when 6\n 'Sa'\n end\n else\n day\n end\n\n @config['comics'].select {|c| c['update_schedule'].include?(wday_symbol)}\n end", "title": "" }, { "docid": "fc45a51366ee049d83d052658cde0ca3", "score": "0.52716285", "text": "def day_of_the_week(time)\n\tDate::DAYNAMES[time.wday]\nend", "title": "" }, { "docid": "8548c9b399ed6eacbbe6d0564dad9c17", "score": "0.52685344", "text": "def validate_day day_string\r\n day_int = day_string.to_i\r\n if day_int > 19850501 && day_int < 20850501\r\n return day_string.to_s\r\n else\r\n return current_day\r\n end\r\n end", "title": "" }, { "docid": "84975fd95c957d98bcf7fb746708b8ce", "score": "0.5265728", "text": "def day_of_week(year, month, day)\n d = day\n m = (month - 3) % 12 + 1\n yy = month < 3 ? year-1 : year\n y = yy % 100\n c = yy / 100\n (d + (2.6 * m - 0.2).floor + y + (y/4.0).floor + (c/4.0).floor - 2*c) % 7\nend", "title": "" }, { "docid": "c3ff4f4cdbdc5f8295dce1325b17f63c", "score": "0.525793", "text": "def this_type_day?(type_day, current_day)\n type_day.to_sym\n result = case (type_day)\n when :monday then\n current_day.monday?\n when :tuesday then\n current_day.tuesday?\n when :wednesday then\n current_day.wednesday?\n when :thursday then\n current_day.thursday?\n when :friday then\n current_day.friday?\n when :saturday then\n current_day.saturday?\n when :sunday then\n current_day.sunday?\n else\n false\n end\n end", "title": "" }, { "docid": "423ce9fbd0507e21606b91bfb2515532", "score": "0.5256941", "text": "def name_of_day\n if day_of_week == -1\n DAY_NAMES[day_of_week]\n else\n DAY_NAMES[day_of_week - 1]\n end\n end", "title": "" }, { "docid": "863dfb50c936ed6819f139b943125b55", "score": "0.5249659", "text": "def day_rule\n @day_rules[@this_day.key_by_date] || @day_rules[@this_day.key_by_day]\n end", "title": "" }, { "docid": "156eabbbe16ccbdfc489c70925383be8", "score": "0.52492404", "text": "def days_of_week_hash\n @days_of_week_hash ||= {\n :sunday => (days_of_week & SUNDAY ) > 0,\n :monday => (days_of_week & MONDAY ) > 0,\n :tuesday => (days_of_week & TUESDAY ) > 0,\n :wednesday => (days_of_week & WEDNESDAY ) > 0,\n :thursday => (days_of_week & THURSDAY ) > 0,\n :friday => (days_of_week & FRIDAY ) > 0,\n :saturday => (days_of_week & SATURDAY ) > 0\n }\n end", "title": "" }, { "docid": "3cfd9cc4acd50ebfd23a06f4aa9759a4", "score": "0.52479404", "text": "def days_of_week\n\n # create an array for processing\n days_array = [sunday, monday, tuesday, wednesday, thursday, friday, saturday]\n int_array = Array.new\n for day in days_array\n day ? int_array.push(1) : int_array.push(0)\n end\n\n # process with little recursive function\n r(int_array, 0)\n # fix first value, see note below\n int_array[0] == -1 ? int_array[0] = 1 : nil\n\n # final passes, change values into useable string\n int_array[0] == 1 ? int_array[0] = 'Su' : nil\n int_array[1] == 1 ? int_array[1] = 'M' : nil\n int_array[2] == 1 ? int_array[2] = 'Tu' : nil\n int_array[3] == 1 ? int_array[3] = 'W' : nil\n int_array[4] == 1 ? int_array[4] = 'Th' : nil\n int_array[5] == 1 ? int_array[5] = 'F' : nil\n int_array[6] == 1 ? int_array[6] = 'Sa' : nil\n\n int_array.delete(0)\n int_array.map{ |x| x == -1 ? '-' : x}.uniq.join\n\n end", "title": "" }, { "docid": "e0e9c5b9291cb99ca6123aa85188357c", "score": "0.52436745", "text": "def set_dates(spreadsheet, cal_date_row, cal_date_col, exp_date_row, exp_date_col)\r\n\r\n k = 0\r\n (cal_date_col+1...exp_date_col).each do |j|\r\n if spreadsheet.celltype(cal_date_row, j) == :date\r\n @calibration.caldate = spreadsheet.cell(cal_date_row, j)\r\n k = j + 1\r\n break\r\n end\r\n end\r\n\r\n #look for expiration date\r\n if (k != 0)\r\n\r\n (k..spreadsheet.last_column).each do |j|\r\n if spreadsheet.celltype(cal_date_row, j) == :date\r\n @calibration.expdate = spreadsheet.cell(cal_date_row, j)\r\n break\r\n end\r\n end\r\n end\r\n\r\n end", "title": "" }, { "docid": "cbf3b42701abf49c650f259719b2367c", "score": "0.5242021", "text": "def get_work_day(date_time)\n day_num = to_day_num(date_time)\n @days[day_num]\n end", "title": "" }, { "docid": "570937cbb37afca9f708b86028d1e3ae", "score": "0.5240763", "text": "def set_date_of_sheet(date, spreadsheet_id)\n day = date.day\n month = date.month\n year = date.year\n weekday = date.strftime('%A')\n formatted_date = \"#{month}/#{day}/#{year} #{weekday}\"\n range = \"#{day}!A2\" #sheet_name = date\n write_sheet_values(range, [[formatted_date]], date)\nend", "title": "" }, { "docid": "652c1b4982de5ffd63bdbb5374f82c1c", "score": "0.52353567", "text": "def method_missing(method, *params)\n valid_methods = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]\n unless valid_methods.include?(method)\n raise \"Method #{method.inspect} not recognised\"\n end\n day_number = valid_methods.index(method)\n set_day(day_number, params[0], params[1])\n end", "title": "" }, { "docid": "721e31d03511170f7b9138b7069aaead", "score": "0.5235208", "text": "def mday() end", "title": "" }, { "docid": "9c9935609234d3169e62ce5c45591252", "score": "0.5230221", "text": "def day_pred(day, times = 1)\n check_pre((\n (day?(day))\n ))\n\n if (day_num_elem?(day) or day.day_num?)\n return day_num_pred(day, times)\n elsif (day_sym_elem?(day) or day.day_sym?)\n return day_sym_pred(day, times)\n end\nend", "title": "" }, { "docid": "172f87a8f652ca2dd2e75df62bd62f6a", "score": "0.5214701", "text": "def day_in_week_int \n\t\tdays = []\n\t\ttoday = Time.now\n\t\tdays.push(today.to_i)\n\t\ttoday_week_day = today.wday\n\t\tanothers = (0..6).select {|e| e != today_week_day}\n\t\tanothers.map do |e|\n\t\t\tdays.push(today.to_i - e*day_second)\n\t\tend\n\n\t\tdays.sort\n\tend", "title": "" }, { "docid": "e679b1df08380ee4f25d8f641f41d4cb", "score": "0.5214276", "text": "def validate_date(spreadsheet_id)\n date = get_date_array(spreadsheet_id)\n if date[0].to_i >= 1 and date[0].to_i <= 12 and date[1].to_i == 1 and date[2].to_i >= 2016 and get_start_day(date[3]) != nil\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "90a77cfccb0458a757be1502a5ba60dd", "score": "0.52105755", "text": "def get_week_hash current_day\n monday_idx = current_day_id + 1 - current_day\n {monday: people.find(person_order[monday_idx]).name,\n tuesday: people.find(person_order[monday_idx + 1]).name,\n wednesday: people.find(person_order[monday_idx + 2]).name,\n thursday: people.find(person_order[monday_idx + 3]).name,\n friday: people.find(person_order[monday_idx + 4]).name}\n end", "title": "" }, { "docid": "f68e956120f707cd93dcbebe7a6e4034", "score": "0.5208411", "text": "def sunday\n day(:sunday)\n end", "title": "" }, { "docid": "c2af8c6e5bfea06082dd55d27088d91f", "score": "0.52070135", "text": "def mday\n end", "title": "" }, { "docid": "f4515d266a676d3d6eb040d600c8afff", "score": "0.5195075", "text": "def timesheet_value(date_string, start_string, finish_string)\r\n start_time = Time.parse(start_string.strftime('%I:%M%P'))\r\n finish_time = Time.parse(finish_string.strftime('%I:%M%P'))\r\n date = date_string\r\n dollar_value = 0\r\n if date.saturday? or date.sunday?\r\n dollar_value = 47 * (finish_time - start_time) / 1.hours\r\n elsif date.tuesday? or date.thursday?\r\n five_am = Time.parse(\"5:00am\")\r\n five_pm = Time.parse(\"5:00pm\")\r\n # Calculate time between 5am and 5pm, and 'outside' time\r\n total_work_time = (finish_time - start_time) / 1.hours\r\n five_am_to_five_pm_time = time_intersection(start_time, finish_time, five_am, five_pm)\r\n other_work_time = total_work_time - five_am_to_five_pm_time\r\n dollar_value = 25 * five_am_to_five_pm_time + 35 * other_work_time\r\n else\r\n seven_am = Time.parse(\"7:00am\")\r\n seven_pm = Time.parse(\"7:00pm\")\r\n # Calculate time between 7am and 7pm, and 'outside' time\r\n total_work_time = (finish_time - start_time) / 1.hours\r\n seven_am_to_seven_pm_time = time_intersection(start_time, finish_time, seven_am, seven_pm)\r\n other_work_time = total_work_time - seven_am_to_seven_pm_time\r\n dollar_value = 22 * seven_am_to_seven_pm_time + 33 * other_work_time\r\n end\r\n return dollar_value\r\n end", "title": "" }, { "docid": "77ca822f127c1991d1132444c2e87e7b", "score": "0.5194469", "text": "def getDayName(abv)\n day_name = \"\"\n case abv.downcase()\n when \"mon\"\n day_name = \"Monday\"\n when \"tue\"\n day_name = \"Tuesday\"\n when \"wed\"\n day_name=\"Wednseday\"\n when \"thur\"\n day_name=\"Thursday\"\n when \"fri\"\n day_name=\"Friday\"\n when \"sat\"\n day_name=\"Saturday\"\n when \"sun\"\n day_name=\"Sunday\"\n else\n day_name = \"Invalid Abbreviation\"\n end\n \n return day_name\nend", "title": "" }, { "docid": "f2cb3a06f55e1a77697325a02da87141", "score": "0.51932734", "text": "def week; end", "title": "" }, { "docid": "c95dafeb4614a51781abe4420cff3152", "score": "0.51898074", "text": "def get_schedule_cell_style( curr_date, is_curr_app_receipt_issued = false, is_curr_app_receipt_delivered = false )\n if ( curr_date != Date.today && is_curr_app_receipt_delivered )\n 'schedule-receipt-sent'\n elsif ( curr_date == Date.today && is_curr_app_receipt_delivered )\n 'schedule-receipt-sent-today'\n elsif ( curr_date != Date.today && is_curr_app_receipt_issued )\n 'schedule-receipt-done'\n elsif ( curr_date == Date.today && is_curr_app_receipt_issued )\n 'schedule-receipt-done-today'\n elsif ( curr_date == Date.today )\n 'schedule-today'\n else\n nil\n end\n end", "title": "" }, { "docid": "2401c9492280418661c7f6de11acfae0", "score": "0.51753825", "text": "def fetch_specific_days(day, date_or_time)\n days = date_or_time.beginning_of_month\n .to_date\n .step(date_or_time.end_of_month.to_date, 1)\n\n days.send(:select) { |current_day| current_day.send(\"#{day}?\".to_sym) }\n .map(&:to_time)\n end", "title": "" }, { "docid": "f4bf4a65ecb625976f428803e9c93605", "score": "0.5173686", "text": "def day_number_of_the_year day, month, hash \n if month > 1\n for i in 1...month\n day += hash[i]\n end\n end\n day\nend", "title": "" }, { "docid": "98ab740e879326d03beb3cc506784859", "score": "0.5170625", "text": "def weekend(day)\n case\n\n when day == 'Saturday'\n return true\n when day == 'Sunday'\n return true\n else\n return false\n\nend\nend", "title": "" }, { "docid": "b9e5f24ac8a4d98b6056ede2ed7877ef", "score": "0.51658696", "text": "def week_to_date_map\n week_of_year = Time.new.strftime(\"%V\").to_i\n week_count = week_of_year.modulo(4) + 1\n\n mapping = {}\n for i in 0..3 do\n date = Date.today.beginning_of_week(:monday)\n date += 1 + ((3-date.wday) % 7)\n date += i.week\n mapping[week_count] = date\n week_count += 1\n week_count = 1 if week_count > 4\n end\n\n mapping[0] = 'On Hold'\n mapping[99] = 'Not Yet Set'\n mapping\n end", "title": "" }, { "docid": "3868deb487d7ab152b762b81aa477ccd", "score": "0.5158344", "text": "def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend", "title": "" }, { "docid": "407c7f21d6b64ed1d765e55298994994", "score": "0.51519805", "text": "def to_work_day(date_time)\n day_num = to_day_num(date_time)\n @days[day_num]\n end", "title": "" }, { "docid": "0bb5355f7d9529766f213b1a05800116", "score": "0.51404834", "text": "def lunch(day)\n\nend", "title": "" }, { "docid": "f102837fce8c64ab8763ed3f1a006927", "score": "0.513932", "text": "def day_of_week\n start_on.strftime(WEEKDAY_NAME)\n end", "title": "" }, { "docid": "7958bf5d31de36b688fd48f5d36a644b", "score": "0.51381683", "text": "def check_day(meet_days_integer,day_to_check)\n\n day_shift = {monday: 0, tuesday: 1, wednesday: 2, thursday: 3, friday: 4, saturday: 5, sunday:6}\n\n# puts \"day_to_check = #{day_to_check}\"\n# puts \"day_shift[:tuesday] = #{day_shift[:tuesday]}\"\n# puts \"day_shift[day_to_check] = #{day_shift[day_to_check]}\"\n day_shift_int = day_shift[day_to_check].to_i\n# puts \"day_shift_int = #{day_shift_int}\"\n shifted_int = ( meet_days_integer >> day_shift_int ).to_s(2)\n# puts \"shifted_int = #{shifted_int}\"\n day_checked = shifted_int.to_i % 2\n# puts \"day_checked = #{day_checked}\"\n return day_checked.to_s\nend", "title": "" }, { "docid": "a466bce1a3eefd52d606ee8c574b2ae4", "score": "0.5137175", "text": "def create\n @work_day = WorkDay.new(work_day_params)\n\t\t#delete for today everything else \n\t\tWorkDay.select{|wd| wd.employee_id == @work_day.employee_id}.each do |wd|\n\t\t\twd.destroy\n\t\tend\n\t\t\n respond_to do |format|\n\t\t\t#validation line, make sure that this employee doesnt already have a schedule for today\n if !(WorkDay.all.select{|work_day| work_day.start_time.day == @work_day.start_time.day && work_day.employee_id == @work_day.employee_id}.any?)\n\t\t\t\t@work_day.save\n format.html { redirect_to @work_day, notice: 'Work day was successfully created.' }\n format.json { render :show, status: :created, location: @work_day }\n else\n format.html { render :new }\n format.json { render json: @work_day.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d558ca81cb6bfc00d25cae01603854dc", "score": "0.5131519", "text": "def hash_args\n [@month, @day_of_week] + super\n end", "title": "" }, { "docid": "f24f246cdd1a8c402cc8d9b23eaec9b9", "score": "0.51273096", "text": "def workday(value)\n if value.is_a? DateTime\n day_number = to_day_number(date_time)\n elsif value.is_a? Fixnum\n day_number = value\n else\n raise \"Invalid type specified: must be a DateTime or Fixnum\"\n end\n @days[day_number]\n end", "title": "" }, { "docid": "d6c121149eb85d2402bc0422c38630bb", "score": "0.51095587", "text": "def day_of_week(date)\n date.cwday # cwday returns the day of calendar week (1-7, Monday is 1).\nend", "title": "" }, { "docid": "899ef8536aa5dd476020caf63ed0c6fb", "score": "0.5107652", "text": "def unusual_day_3(num)\n if wrong_date(num).to_i == 3\n first_day(num).click\n elsif wrong_date(num).to_i == 30\n wrong_day_30(num)\n elsif wrong_date(num).to_i == 31\n calendar_date(num, 1)\n elsif wrong_date(num).to_i == 23\n unusual_day_4(num)\n end\nend", "title": "" }, { "docid": "182a1fe1b39abe1adcb7636ed35de2d0", "score": "0.5104611", "text": "def monday\n date\n end", "title": "" }, { "docid": "387b5310c4ef0d9058a51b72ca4cc1dd", "score": "0.50963223", "text": "def exercise_on_a_day(date)\n #iterate through workouts and find workouts.user_id == self\n my_workouts = Workout.all.select do |workout|\n workout[\"user_id\"] == self[\"id\"]\n end\n # find where date == workout date\n workouts_for_date = my_workouts.find_all do |workouts|\n workouts[\"date\"] == date\n end.map {|workout_instance| workout_instance.exercise_id}\n \n exercise_array = []\n exercise_list = workouts_for_date.each do |exercise_id|\n Exercise.all.each do |exercise_instances|\n exercise_array << exercise_instances.name if (exercise_instances.id == exercise_id)\n end\n end\n \n if exercise_array == []\n return \"Sorry. Doesn't look like you worked out on #{date}.\".colorize(:light_cyan)\n else\n return exercise_array\n end\n end", "title": "" }, { "docid": "c32ccfa0fcd1cd2d9ab739737b500a36", "score": "0.5089014", "text": "def day(date)\n forecasts.select { |k, _| k.to_date == date }\n end", "title": "" }, { "docid": "3f9ee6dfd8f84cf2ea90bcd6facc5338", "score": "0.5086894", "text": "def schedule_days(day_ints = [1,3,5])\n (0..6).each {|day_int|\n is_checked = day_checked?(day_int)\n # puts \"is checked : #{is_checked}\"\n should_be_checked = day_ints.include?(day_int)\n # puts \"should_be_checked : #{should_be_checked}\"\n if (!is_checked && should_be_checked)\n click_day_picker(day_int)\n elsif (is_checked && !should_be_checked)\n click_day_picker(day_int)\n else\n\n end\n } \n current_scheduled_days\n end", "title": "" }, { "docid": "b248b5a457138eb71c112c9de5c5a872", "score": "0.5080811", "text": "def translate_day_of_week( day )\n days = { :Mon => \"Понедельник\", :Tue => \"Вторник\", :Wed => \"Среда\", :Thu => \"Четверг\",\n :Fri => \"Пятница\" }\n days[ day.to_sym ]\n end", "title": "" }, { "docid": "219d2bb0952bedc2fa715433da161691", "score": "0.50702125", "text": "def meal_plan(week_time, week_day) #this is Ruby method\n if week_time == 'weekday'\n if week_day == 'breakfest'\n 'egss and cheese'\n elsif week_day == 'lunch'\n \"soup and potatos\"\n elsif week_day == 'dinner'\n \"Chicken nuggets\"\n end\n elsif week_time == 'weekend'\n if week_day == 'breakfest'\n \"French tost\"\n elsif week_day == 'lunch'\n \"2 pizza\"\n elsif week_day == 'dinner'\n \"meal stack\"\n end\n end\nend", "title": "" }, { "docid": "42db2aa5b6956316281b24287f989341", "score": "0.50683457", "text": "def first_sun?(days, year)\n\t(days % 7 == 0 && year > 1900) ? 1 : 0\n\tend", "title": "" }, { "docid": "413128dafb1687c25abb67abe6f73615", "score": "0.5062969", "text": "def your_birthday_is_on_a_friday_in_the_year(birthday)\n month = birthday.strftime(\"%m\").to_i\n day = birthday.strftime(\"%d\").to_i\n year = birthday.strftime(\"%Y\").to_i\n loop do\n year = year += 1\n time = Time.new(year, month, day)\n break if time.strftime(\"%u\") == \"5\"\n end\n year\nend", "title": "" } ]
4b494711e99260366ab5fb4f7dceaaf1
Customer edition, GET and POST.
[ { "docid": "968c083ad7b1b69dc36fc4c8a2db2896", "score": "0.67713827", "text": "def edit\n return if request.get?\n @customer.attributes = params[:customer]\n @customer.address.attributes = params[:address]\n Customer.transaction do\n @customer.save!\n @customer.address.save!\n @customer.renew_login_token if params[:change_login_url_for_customer] == '1'\n redirect_to :action => 'show', :id => @customer\n end rescue nil\n end", "title": "" } ]
[ { "docid": "2df8adfaea110f03a9134d3de5ff8f6a", "score": "0.74488765", "text": "def edit_customer_details\n end", "title": "" }, { "docid": "1955973018d726e532891c819c1dbb00", "score": "0.67933303", "text": "def edit\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "286fe663ce8a3e22f1f36e467f6cd4fb", "score": "0.6769564", "text": "def account_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n end", "title": "" }, { "docid": "04e0db94915cf2a9598d37720fd5d39e", "score": "0.67486435", "text": "def edit_customer \n cust_id = params[\"customer_id\"]\n @customer = Customer.where(florist_id: session[\"found_florist_id\"]).where(id: cust_id).first\n render(:cust_edit) and return\n end", "title": "" }, { "docid": "cc8489d997b4c3688ba2f27d7375b625", "score": "0.6708796", "text": "def cust_edit \n cust_id = params[\"customer_id\"]\n if params[\"save\"]\n @customer = Customer.where(id: cust_id).first #NEEDS TO BE TIED TO LOGIN INFO\n @customer.name = params[\"contact_name\"]\n @customer.company_name = params[\"company_name\"]\n @customer.phone1 = params[\"phone1\"]\n @customer.phone2 = params[\"phone2\"]\n @customer.email = params[\"contact_email\"]\n @customer.groom_name = params[\"groom_name\"]\n @customer.groom_phone = params[\"groom_phone\"]\n @customer.groom_email = params[\"groom_email\"]\n @customer.address = params[\"address\"]\n @customer.city = params[\"city\"]\n @customer.state = params[\"state\"]\n @customer.zip = params[\"zip\"]\n @customer.notes = params[\"notes\"]\n if @customer.save\n else\n render(:cust_edit) and return\n end\n elsif params[\"delete\"]\n event = Event.where(id: params[\"delete\"]).first\n event.destroy\n for each in DesignedProduct.where(event_id: params[\"delete\"])\n each.destroy\n end \n for specification in Specification.where(event_id: params[\"delete\"])\n specification.destroy\n for image in specification.images\n image.destroy\n end \n end\n deleted_quote = Quote.where(event_id: params[\"delete\"]).first\n if deleted_quote != nil\n deleted_quote.destroy\n else # do nothing\n end \n end\n redirect_to \"/cust_edit/#{cust_id}\" and return\n end", "title": "" }, { "docid": "9ef9798bfdff6c7a9fee216b95a70d14", "score": "0.6503371", "text": "def edit\n if (session['logged_in'] != 1) \n redirect_to url_for(:controller => :user, :action => :index_not_logged_in) and return\n end\n \t# Find the customer who needs to be edited\n \t@customer = Customer.find_by(id: params[:id])\n\n \tif(@customer)\n \t\t# Update the customer information using new information\n \t\t# which was submitted\n \t\t@customer.first_name = params[:first_name]\n \t\t@customer.last_name = params[:last_name]\n \t\t@customer.address = params[:address]\n \t\t@customer.phone = params[:phone]\n \t\t@customer.mobile = params[:mobile]\n \t\t@customer.email = params[:email]\n \t\t@customer.notes = params[:notes]\n \t\t@customer.deleted = false\n\n \t\t# Persist\n \t\t@customer.save\n \tend\n \t# Render view\n\n # Render index view\n # Add a flash message for the user\n flash[:message] = \"#{@customer.first_name} #{@customer.last_name} was successfully edited\"\n redirect_to url_for(:controller => :customer, :action => :index) and return\n\n end", "title": "" }, { "docid": "b50a3cb4dc1ca7ae39180796b6009fe7", "score": "0.6429496", "text": "def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.find(params[:id])\n\t\t@types = Typesobject.get_types(:customer)\n\t\t@status = Statusobject.find_for(@customer)\n\t\t@customer.update_accessor(current_user)\n\t\tif commit_promote?\n\t\t\tctrl_promote(@customer)\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @customer.update_attributes(params[:customer])\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_notupdated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a4759a72a76178e26d6bd4d368c458ee", "score": "0.6417508", "text": "def edit\n @customer = Effective::Customer.where(user: current_user).first!\n EffectiveOrders.authorized?(self, :edit, @customer)\n\n @subscripter = Effective::Subscripter.new(customer: @customer, user: @customer.user)\n\n @page_title ||= \"Customer #{current_user.to_s}\"\n end", "title": "" }, { "docid": "28fe1ad4ca53e36d17e391b2375e8e1c", "score": "0.6355912", "text": "def new_customer\n end", "title": "" }, { "docid": "e2f3ca2c54341300e2e30a23ddb5ab3b", "score": "0.63340527", "text": "def update_customer(customer, id)\n request(customer, \"customer\", :post, {id: id, method: \"edit\"})\n end", "title": "" }, { "docid": "7f1e7e47e0961ea530a6144303a8f8b0", "score": "0.6329824", "text": "def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8ebeeb018bc0783066ddfff006b57dd", "score": "0.6308764", "text": "def customer_params\n\n end", "title": "" }, { "docid": "392d53ba5864da37d12a0d8d1aa3d54b", "score": "0.6281082", "text": "def edit\n\t\tif Sale.joins(:payments).where(payments: {sale_id: @sale}).empty?\n\t\t\tset_sale\n\n\t\t\tpopulate_products\n\t\t\tpopulate_customers\n\n\t\t\t@sale.items.build\n\t\t\t@sale.payments.build\n\n\t\t\t@custom_customer = Customer.new\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to sales_url, alert: 'La venta no se puede editar.' }\n\t\t\tend\n\t\tend\n\n\tend", "title": "" }, { "docid": "38f5e72e4961016599d165b9cec1ac3c", "score": "0.62611216", "text": "def edit\n # @customer = Customer.find_by_id params[:id] \n @object = Invoice.find_by_id params[:id]\n end", "title": "" }, { "docid": "ae12c7ba378971fc076a38161bd05a81", "score": "0.62589943", "text": "def billing_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n @billing_address = result.customer.billing_address\n @country_codes = get_country_codes\n end", "title": "" }, { "docid": "e6d2b1b807260fe3ebee2c43c0dc32c8", "score": "0.6240034", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to [:admin, @customer], notice: t('messages.updated', model:Customer.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59d559d02335463e692b16ece7da15ca", "score": "0.6217323", "text": "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "551b7b289b1951a0b3e1f0a5e4b43544", "score": "0.62054324", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado com sucesso!' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a029c2515039abe5a268149d7739fc65", "score": "0.6189156", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "e04e40725a63bdb481ea6a839e0c968a", "score": "0.6172479", "text": "def update # it is impossible for a customer to update a referral, so no need to modify.\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to [@selector, @customer], :notice => 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.6161089", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.6161089", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.6161089", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.6161089", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "0185cfd36243ca8174e229780fb5abd1", "score": "0.6161089", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "54f58c761513ebd1c8cdf10954c42a1e", "score": "0.61460423", "text": "def update\n if @customer.update customer_params\n redirect_to @customer\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "cd37062daa407462eca603b581da3d6d", "score": "0.61205465", "text": "def new\n @customer = Customer.new\n\n render :edit\n end", "title": "" }, { "docid": "9b7ab4be2710d1f980093b4182e44648", "score": "0.6109604", "text": "def show\n @customer = current_customer\n end", "title": "" }, { "docid": "6756981fb962caa3bb6c7470f958ff1c", "score": "0.6078851", "text": "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "title": "" }, { "docid": "6756981fb962caa3bb6c7470f958ff1c", "score": "0.6078851", "text": "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "title": "" }, { "docid": "de8d6c46712e257373494148d3e410ec", "score": "0.60678977", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b47aa059025abb3beb18216a51e7f4dd", "score": "0.60638416", "text": "def index\n @customer = current_admin.customer\n end", "title": "" }, { "docid": "0f3381ddb4efcea2efe950ad42f3f2ed", "score": "0.60557204", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.updated\", :default => 'Customer was successfully updated.') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e71b7c4cee07fc85197692bbfb228f3", "score": "0.605011", "text": "def update\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n if @offer_customer.update_attributes(params[:offer_customer])\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28cba5164b38d9065801539ecfce44c2", "score": "0.6049947", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28cba5164b38d9065801539ecfce44c2", "score": "0.6049947", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28cba5164b38d9065801539ecfce44c2", "score": "0.6049947", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "f0984e0d1f92518b9bc9c65057e73280", "score": "0.6049174", "text": "def set_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "7c729370c829c809991e250b7697988f", "score": "0.6046039", "text": "def show_customer\n @customer = Customer.find(params[:id])\n end", "title": "" }, { "docid": "c8b212c30a76f3c6e2a002b37c6c3bf3", "score": "0.60433453", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.json { render action: 'show', status: :created, location: @customer }#format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac41031ab91b76149b7c7ee5a812520d", "score": "0.6042473", "text": "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51d7560d1531b5937f4bde8c7f532014", "score": "0.6029833", "text": "def admin_new # admin create customer\n @customer = Customer.new\n end", "title": "" }, { "docid": "92f63b91fd8110f6740139dc9d1dd7b2", "score": "0.60222685", "text": "def update\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n @customer = Customer.find(params[:id])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(@customer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae8bc39fdf4b58d9ea6180f91154d556", "score": "0.6008261", "text": "def update\n @customer = customer_scope.find(params[:id])\n\n respond_to do |format|\n if params[:company][:avatar] && @customer.update_attribute(:avatar, params[:company][:avatar])\n format.html { render action: \"edit\" }\n format.js #\n elsif @customer.update_attributes(customer_params)\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n format.html {\n redirect = customer_path(@customer)\n redirect = root_path if current_company.is_customer?\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = company_reseller_customer_path(current_company, @customer.parent_id, @customer) if session[:by_reseller] && @customer.parent && @customer.parent.is_partner?\n redirect = step3_homes_path if session['homes.step'] == 2\n redirect_to redirect, notice: I18n.t('commons.successfully_updated')\n }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86258fd6129653868375c99e9078b43e", "score": "0.60063046", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86258fd6129653868375c99e9078b43e", "score": "0.60063046", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86258fd6129653868375c99e9078b43e", "score": "0.60063046", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86258fd6129653868375c99e9078b43e", "score": "0.60063046", "text": "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
34e3656289cccb612f14b1903d9d86a4
We need to add width and height to the Image record manually, so we perform this after each save (but not after_save, only in controllers). The reason we cannot do this automatically during save is because a LOT of stuff updates images, and we only need to do this after a create or update. Not to mention, endless loop.
[ { "docid": "fbba66cb9305239cfd4e0d39f3da03b9", "score": "0.57525873", "text": "def save_metadata\r\n img = Magick::Image.read(file.path).first\r\n update_attributes(width: img.columns, height: img.rows)\r\n end", "title": "" } ]
[ { "docid": "41a7353b620862e7dac89d1b1f772cc4", "score": "0.7244207", "text": "def save_image_dimensions\n geo = Paperclip::Geometry.from_file(image.queued_for_write[:original])\n self.width = geo.width\n self.height = geo.height\n end", "title": "" }, { "docid": "864f44b8afbc47528ddc38cd00c44c66", "score": "0.6899877", "text": "def save_image_dimensions\n geo = Paperclip::Geometry.from_file(image.queued_for_write[:original])\n self.image_width = geo.width\n puts self.image_height\n self.image_height = geo.height\n end", "title": "" }, { "docid": "06c5cbf8fca2543766d1ca0c591a8a34", "score": "0.6895217", "text": "def apply_image_changes\n @image_width = @image.columns\n @image_height = @image.rows\n\n if @image_params[:width].to_i > 0\n @width = @image_params[:width].to_i\n else\n @width = @image_width\n end\n\n if @image_params[:height].to_i > 0\n @height = @image_params[:height].to_i\n else\n @height = @image_height\n end\n\n calcuate_sizes\n @image = @image.resize(@width, @height) if @width != @image_width || @height != @image_height\n apply_rounded_corners if @image_params[:rounded_corners]\n end", "title": "" }, { "docid": "da28cd91ca0048e10ba66451c74f5af1", "score": "0.6691392", "text": "def update_site_meta_image_dimensions\n\n if !site_meta_image.path.nil? && File.exist?(site_meta_image.path)\n image = MiniMagick::Image.open(site_meta_image.path)\n self.site_meta_image_height = image.height\n self.site_meta_image_width = image.width\n self.save\n end\n\n end", "title": "" }, { "docid": "7f28c66572bccea9ff34965348ccb13f", "score": "0.65637463", "text": "def capture_size_before_cache(new_file) \n if model.image_width.nil? || model.image_height.nil?\n model.image_width, model.image_height = `identify -format \"%wx %h\" #{new_file.path}`.split(/x/).map { |dim| dim.to_i }\n end\n end", "title": "" }, { "docid": "8d96f21c26163c2a55bfa47c38aacbe9", "score": "0.6550552", "text": "def set_image_size\n self.image_size = image_size\n end", "title": "" }, { "docid": "f7ce69d21024ab744bd4ce6222013236", "score": "0.654348", "text": "def capture_size_before_cache(new_file)\n if model.image_width.nil? || model.image_height.nil?\n model.image_width, model.image_height = `identify -format \"%wx %h\" #{new_file.path}`.split(/x/).map { |dim| dim.to_i }\n end\n end", "title": "" }, { "docid": "8f820bc54b686cee9caa92dcfb32f491", "score": "0.64745593", "text": "def store_dimensions(_params)\n if file && model\n width, height = ::MiniMagick::Image.open(file.file)[:dimensions]\n desktop_width, desktop_height = ::MiniMagick::Image.open(model.picture.fullscreen.file.file)[:dimensions]\n model.update(width: width, height: height, desktop_width: desktop_width, desktop_height: desktop_height)\n end\n end", "title": "" }, { "docid": "846385fc0df1afb96aee962f36b1c442", "score": "0.6431235", "text": "def before_update_save(record)\n record.upload\n record.style.save # to save the width\n end", "title": "" }, { "docid": "8df1bf9b35c68c485d47ba1cddb8fdb6", "score": "0.6431061", "text": "def set_image_width \n\t\tif !self.image.to_file(:original).nil?\n\t\t\tself.image_width = Paperclip::Geometry.from_file(self.image.to_file(:original)).width\n\t\tend\n\tend", "title": "" }, { "docid": "c87cac4a98bbfef7da13ffece2070844", "score": "0.63098603", "text": "def resize_to_fill_and_save_dimensions(new_width, new_height)\n manipulate! do |img|\n width, height = img.columns, img.rows\n new_img = img.resize_to_fill(new_width, new_height)\n destroy_image(img)\n\n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n\n ratio = [w_ratio, h_ratio].min\n\n self.w = ratio * new_width\n self.h = ratio * new_height\n self.x = (width - self.w) / 2\n self.y = (height - self.h) / 2\n\n new_img\n end\n end", "title": "" }, { "docid": "cbc7c21253bdcac06cf10bb92b49ca07", "score": "0.6290249", "text": "def image_dimensions(attribute)\n original = self.send(attribute).queued_for_write[:original]\n if original\n image_path = original.path\n image = HeritageImage.new image_path\n self.send \"#{attribute}_dpi=\", image.dpi\n self.send \"#{attribute}_width=\", image.width\n self.send \"#{attribute}_height=\", image.height\n end\n end", "title": "" }, { "docid": "48b0aa911582bc62df3094c36394bd4c", "score": "0.6272208", "text": "def preprocess\n @image = @original_image\n @image.scale! @image.columns, @image.rows / 2 unless @hd\n\n if @height.nil?\n @image = @image.resize_to_fit(@width)\n else\n @height /= 2 unless @hd\n @image = @image.resize_to_fit(@width, @height)\n end\n end", "title": "" }, { "docid": "009a7db6faf3b2fee530fcfaff894124", "score": "0.6271946", "text": "def update_asset_dimensions\n if data.present? and data_changed? and image?\n begin\n image = MiniMagick::Image.open(self.data.path)\n self.width = image[:width]\n self.height = image[:height]\n rescue => e\n end\n end\n true\n end", "title": "" }, { "docid": "35a3d78b377bdc1afc362fc937662260", "score": "0.62639844", "text": "def capture_size_before_cache(new_file)\n return unless model\n return unless new_file.path\n if model.respond_to?(setter(:width)) && model.respond_to?(setter(:height))\n w, h = `identify -format \"%wx %h\" #{new_file.path.shellescape}`.split(/x/).map { |dim| dim.to_i }\n model.send(setter(:width), w)\n model.send(setter(:height), h)\n end\n end", "title": "" }, { "docid": "0a9c660b77a8d4ad12f7240c2868036d", "score": "0.62457603", "text": "def image_height\n\t\tunless read_attribute(:image_height)\n\t\t\tunless digital_asset_file\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\twrite_attribute(:image_height, digital_asset_file.image_height)\n\t\t\twrite_attribute(:image_width, digital_asset_file.image_width)\n\t\t\tsave!\n\t\tend\n\t\tread_attribute(:image_height)\n\tend", "title": "" }, { "docid": "baa5eb55060ea745960256626ee30b7e", "score": "0.6243128", "text": "def image_dimensions\n canvas = self.convert_to_canvas\n self.height = canvas.height\n self.width = canvas.width\n end", "title": "" }, { "docid": "a31ea295c39697005ca095ba42aeef01", "score": "0.6166058", "text": "def resize_image\n return if logo.nil? || logo.height == 100\n\n self.logo = logo.thumb('x100') # resize height and maintain aspect ratio\n end", "title": "" }, { "docid": "4d1b97a0ce36ae3fbfcaadca09204c90", "score": "0.61516047", "text": "def find_dimensions\n temporary = image.queued_for_write[:original]\n filename = temporary.path unless temporary.nil?\n filename = attachment.path if filename.blank?\n geometry = Paperclip::Geometry.from_file(filename)\n self.image_width = geometry.width\n self.image_height = geometry.height\n end", "title": "" }, { "docid": "837c990b5caa18b0e388167ade9a8c0a", "score": "0.6141521", "text": "def resize_to_fill_and_save_dimensions(new_width, new_height)\n manipulate! do |img|\n width, height = img[:width], img[:height]\n new_img = resize_to_fill(new_width, new_height)\n\n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n\n ratio = [w_ratio, h_ratio].min\n\n self.w = ratio * new_width\n self.h = ratio * new_height\n self.x = (width - self.w) / 2\n self.y = (height - self.h) / 2\n\n new_img\n end\n end", "title": "" }, { "docid": "beccd0904ed0dae0965ebb3edc00e618", "score": "0.6139314", "text": "def after_create\r\n \r\n load_image\r\n \r\n ## change the format\r\n ## @image.format = format\r\n \r\n # save the original\r\n #mywrite(@image, local_path(:original))\r\n # save as jpg\r\n #`convert #{@image_path} #{local_path(:original)}`\r\n #create_copy @image_path, local_path(:original)\r\n \r\n # save different versions of the image\r\n versions = {:original => nil, :normal => 400, :thumb => 150} \r\n versions.each do |version, size| \r\n \r\n create_copy(@image_path, local_path(version), size)\r\n #mywrite(img1, local_path(version)) \r\n end \r\n \r\n end", "title": "" }, { "docid": "874a663243c59d882233bc749dc0a04a", "score": "0.6137327", "text": "def resize_image(img, size, model)\n # create a dummy temp file to write to\n # ImageScience doesn't handle all gifs properly, so it converts them to\n # pngs for thumbnails. It has something to do with trying to save gifs\n # with a larger palette than 256 colors, which is all the gif format\n # supports.\n filename.sub! /gif$/i, 'png'\n content_type.sub!(/gif$/, 'png')\n temp_paths.unshift write_to_temp_file(filename)\n grab_dimensions = lambda do |img|\n self.width = img.width if respond_to?(:width)\n self.height = img.height if respond_to?(:height)\n\n # We don't check for quality being a 0-100 value as we also allow FreeImage JPEG_xxx constants.\n quality = content_type[/jpe?g/i] && get_jpeg_quality(false)\n # Traditional ImageScience has a 1-arg save method, tdd-image_science has 1 mandatory + 1 optional\n if quality && img.method(:save).arity == -2\n img.save self.temp_path, quality\n else\n img.save self.temp_path\n end\n self.size = File.size(self.temp_path)\n callback_with_args :after_resize, img\n end\n\n size = size.first if size.is_a?(Array) && size.length == 1\n if size.is_a?(Integer) || (size.is_a?(Array) && size.first.is_a?(Integer))\n if size.is_a?(Integer)\n img.thumbnail(size, &grab_dimensions)\n else\n img.resize(size[0], size[1], 0, &grab_dimensions)\n end\n else\n new_size = [img.width, img.height] / size.to_s\n if size.ends_with? \"c\"\n aspect = new_size[0].to_f / new_size[1].to_f\n ih, iw = img.height, img.width\n width, height = (ih * aspect), (iw / aspect)\n\n width = [iw, width].min.to_i\n height = [ih, height].min.to_i\n\n unless (model.nil? or model.x1.nil? or model.x2.nil? or model.y2.nil? or model.y1.nil? or model.big_width.nil? or model.big_height.nil? or model.height.nil? or model.width.nil?)\n left = (model.x1.to_f / model.big_width) * model.width\n right = (model.x2.to_f / model.big_width) * model.width\n top = (model.y2.to_f / model.big_height) * model.height\n bottom = (model.y1.to_f / model.big_height) * model.height\n else\n left = (iw-width)/2\n top = (ih-height)/2\n right = (iw+width)/2\n bottom = (ih+height)/2\n end\n\n #( (iw-w)/2, (ih-h)/2, (iw+w)/2, (ih+h)/2) { |crop| crop.resize(new_size[0], new_size[1], &grab_dimensions ) }\n img.with_crop(left.to_i, top.to_i, right.to_i, bottom.to_i) { |crop| crop.thumbnail(new_size, false, &grab_dimensions) }\n elsif size.ends_with? \"g\"\n aspect = new_size[0].to_f / new_size[1].to_f\n ih, iw = img.height, img.width\n w, h = (ih * aspect), (iw / aspect)\n w = [iw, w].min.to_i\n h = [ih, h].min.to_i\n\n unless (model.nil? or model.x1.nil? or model.x2.nil? or model.y2.nil? or model.y1.nil? or model.big_width.nil? or model.big_height.nil? or model.height.nil? or model.width.nil?)\n left = (model.x1.to_f / model.big_width) * model.width\n right = (model.x2.to_f / model.big_width) * model.width\n top = (model.y2.to_f / model.big_height) * model.height\n bottom = (model.y1.to_f / model.big_height) * model.height\n else\n left = (iw-w)/2\n top = (ih-h)/2\n right = (iw+w)/2\n bottom = (ih+h)/2\n end\n\n img.with_crop(left.to_i, top.to_i, right.to_i, bottom.to_i) { |crop| crop.thumbnail(new_size, true, &grab_dimensions) }\n elsif size.ends_with? \"!\"\n aspect = new_size[0].to_f / new_size[1].to_f\n ih, iw = img.height, img.width\n w, h = (ih * aspect), (iw / aspect)\n w = [iw, w].min.to_i\n h = [ih, h].min.to_i\n img.with_crop((iw-w)/2, (ih-h)/2, (iw+w)/2, (ih+h)/2) { |crop|\n crop.resize(new_size[0], new_size[1], 0, &grab_dimensions)\n }\n else\n img.resize(new_size[0], new_size[1], 0, &grab_dimensions)\n end\n end\n end", "title": "" }, { "docid": "b9b0967f8b0e45a77c77f5decf0789d4", "score": "0.61307526", "text": "def find_dimensions\n temporary = photo.queued_for_write[:original]\n filename = temporary.path unless temporary.nil?\n filename = photo.path if filename.blank?\n geometry = Paperclip::Geometry.from_file(filename)\n self.image_width = geometry.width\n self.image_height = geometry.height\n end", "title": "" }, { "docid": "daaf863063003a8b1c414956d6d4a933", "score": "0.6110427", "text": "def extract_upload_dimensions\n return unless image?\n \n tempfile = image.queued_for_write[:original]\n \n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.width = geometry.width.to_i\n self.height = geometry.height.to_i\n # self.save\n end\n end", "title": "" }, { "docid": "15a2b550e0715b45a4b9c3d609e92e95", "score": "0.61036694", "text": "def resize_to_fill_and_save_dimensions(new_width, new_height)\n manipulate! do |img|\n width, height = img[:dimensions]\n img.combine_options do |i|\n if new_width != width || new_height != height\n scale_x = new_width/width.to_f\n scale_y = new_height/height.to_f\n if scale_x >= scale_y\n cols = (scale_x * (width + 0.5)).round\n rows = (scale_x * (height + 0.5)).round\n i.resize \"#{cols}\"\n else\n cols = (scale_y * (width + 0.5)).round\n rows = (scale_y * (height + 0.5)).round\n i.resize \"x#{rows}\"\n end\n end\n i.gravity 'Center'\n i.background \"rgba(255,255,255,0.0)\"\n i.extent \"#{new_width}x#{new_height}\" if cols != new_width || rows != new_height\n end\n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n\n ratio = [w_ratio, h_ratio].min\n\n self.w = ratio * new_width\n self.h = ratio * new_height\n self.x = (width - self.w) / 2\n self.y = (height - self.h) / 2\n\n img\n end\n end", "title": "" }, { "docid": "e8bf181f7c77379c03706eaee3963597", "score": "0.60952014", "text": "def resize_to_specified_dimensions!\n return unless specified_dimensions?\n return if model.respond_to?(:skip_auto_resize?) && model.skip_auto_resize?\n\n Rails.logger.info \"BaseUploader#resize_to_specified_dimensions! - Resizing to #{specified_dimensions.inspect}\"\n\n width, height = specified_dimensions\n\n manipulate! do |img|\n cols, rows = img[:dimensions]\n img.combine_options do |cmd|\n if width != cols || height != rows\n scale = [width/cols.to_f, height/rows.to_f].max\n cols = (scale * (cols + 0.5)).round\n rows = (scale * (rows + 0.5)).round\n cmd.resize \"#{cols}x#{rows}\"\n end\n\n cmd.background \"rgba(0, 0, 0, 0.0)\"\n cmd.gravity 'Center'\n cmd.extent \"#{width}x#{height}\" if cols != width || rows != height\n end\n img\n end\n end", "title": "" }, { "docid": "d9d230479abcfaccaee52a44bbb0d48d", "score": "0.609124", "text": "def update_original_sizes\n original_media = self.media.original.first\n unless original_media.nil?\n image = Magick::Image.from_blob(original_media.file_contents).first\n self.original_width = image.columns\n self.original_height = image.rows\n end\n return true\n end", "title": "" }, { "docid": "d9d230479abcfaccaee52a44bbb0d48d", "score": "0.609124", "text": "def update_original_sizes\n original_media = self.media.original.first\n unless original_media.nil?\n image = Magick::Image.from_blob(original_media.file_contents).first\n self.original_width = image.columns\n self.original_height = image.rows\n end\n return true\n end", "title": "" }, { "docid": "d164dc78e993f068d8ca83ade256e311", "score": "0.60598296", "text": "def extract_dimensions\n if width == nil && height == nil\n geometry = Paperclip::Geometry.from_file(img.path(:full))\n self.width, self.height = geometry.width.to_i, geometry.height.to_i\n self.save\n end\n end", "title": "" }, { "docid": "11e911c2a3d30868300d256df38dff0a", "score": "0.60197794", "text": "def extract_dimensions\n return unless image?\n tempfile = image.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.width = geometry.width.to_i \n self.height = geometry.height.to_i\n end\n end", "title": "" }, { "docid": "34f701e694bce8080dc1eb84c4a518fd", "score": "0.5977128", "text": "def create\n valid = false\n begin\n par = params[:image].except(:remote_upload_url, :width, :height, :medium_height, :medium_width)\n @image = Image.new(par)\n @image.user = current_user\n @image.remote_upload_url = params[:image][:remote_upload_url]\n @image.original_url = @image.remote_upload_url if has_value(@image.remote_upload_url)\n @image.page_url = params[:image][:page_url] if !params[:image][:page_url].blank?\n @image.width = params[:image][:width] if @image.width.nil?\n @image.height = params[:image][:height] if @image.height.nil?\n @image.medium_width = params[:image][:medium_width] if @image.medium_width.nil?\n @image.medium_height = params[:image][:medium_height] if @image.medium_height.nil?\n # validate image\n valid = @image.valid?\n rescue CarrierWave::DownloadError\n @image.errors.add(:remote_upload_url, \"^This url doesn't appear to be valid\")\n rescue CarrierWave::IntegrityError\n @image.errors.add(:remote_upload_url, \"^This url does not appear to point to a valid image\")\n end\n\n # only validate, don't save yet\n if valid\n # calculate best render dimensions for image\n if params['browser_width'] && params['browser_height']\n max_width = params['browser_width'].to_i - 50\n max_height = params['browser_height'].to_i - 50\n else\n logger.warn(\"no browser_width or browser_height set\")\n max_width = 800\n max_height = 600\n end\n\n render_dims = ScreenUtils.calculate_biggest_display_dimensions_possible(@image, max_width, max_height)\n @render_width, @render_height = render_dims[0], render_dims[1]\n\n logger.debug(\"rendering image of #{@image.width}x#{@image.height} at res #{@render_width}x#{@render_height}\" +\n \" to fit browser of dims #{max_width}x#{max_height}\")\n\n @scale = 100\n render :action => :configure, :layout => \"layouts/configure\"\n # redirect_to(images_configure_path)\n else\n \n render :action => :new\n end\n end", "title": "" }, { "docid": "5e3969da92689301c006a09adbe90903", "score": "0.5904162", "text": "def dc_new_record\n default_sizes = dc_get_site.params.dig('dc_image', 'sizes').to_s.split(',')\n @record.size_ls = default_sizes.shift\n @record.size_ms = default_sizes.shift\n @record.size_ss = default_sizes.shift\nend", "title": "" }, { "docid": "78e02d0c7c655a83701843498ae6a05d", "score": "0.5900342", "text": "def analize_image\n if !self.album_id.nil?\n album = Gallery::Album.find(self.album_id)\n if album\n album.images_count = album.images.count\n album.save\n end\n end\n\n #tags = Gallery::Image.find_allowed_tags_for_images\n\n end", "title": "" }, { "docid": "4bcb6cb879ab42faaf3a7d8bacbb6089", "score": "0.5896716", "text": "def dimensions\n if self.width == 0\n geo = Paperclip::Geometry.from_file(self.url)\n self.update_attributes({ width: geo.width, height: geo.height })\n geo\n else\n self\n end\n end", "title": "" }, { "docid": "6b66dabd21804cbe822d331730804e27", "score": "0.588758", "text": "def call\n max_image_size = Alchemy::Config.get(:preprocess_image_resize)\n image_file.thumb!(max_image_size) if max_image_size.present?\n # Auto orient the image so EXIF orientation data is taken into account\n image_file.auto_orient!\n end", "title": "" }, { "docid": "84253c52e9e9cca61dc6722d7fc41a3a", "score": "0.58668", "text": "def update_image_dimension(agent, img_url, optional_headers={})\n img_page = agent.get(:url=>img_url, :headers => optional_headers)\n img_file = JPEG.new(StringIO.new(img_page.body))\n @url = img_url\n @width = img_file.width\n @height = img_file.height\n end", "title": "" }, { "docid": "504e21618894a46c43edd6d160572d4c", "score": "0.58556014", "text": "def after_process_attachment\n if @saved_attachment\n save_to_storage\n update_thumbnails\n callback_with_args :after_attachment_saved, nil\n end\n end", "title": "" }, { "docid": "1cb2bea281af2652739d8474bd62dd40", "score": "0.58343315", "text": "def save_with_image_and_index\n returnvalue = nil\n image = Image.new\n begin\n self.transaction do\n if uploaded_image_data && uploaded_image_data.size > 0\n image.uploaded_data = uploaded_image_data\n image.save!\n self.image = image\n end\n returnvalue = save\n end\n rescue Exception => details\n logger.error(details)\n if image.errors.on(:size)\n errors.add_to_base(\"Uploaded image is too big (1 MB max).\")\n elsif image.errors.on(:content_type)\n errors.add_to_base(\"Uploaded image content-type is not valid.\")\n else\n errors.add_to_base(\"Error saving image.\")\n end\n return false\n end\n self.book.ferret_update if self.book\n return returnvalue\n end", "title": "" }, { "docid": "288597f9d2bfe18079693037f9283d26", "score": "0.5834028", "text": "def resize_img\n w = @width.to_s\n h = @height.to_s\n format = w + 'x' + h\n @img.resize format\n end", "title": "" }, { "docid": "b60fa18622afbff07a3a34830ffe11bf", "score": "0.58329535", "text": "def store_image_dimensions_for_cropping\n puts \"store_image_dimensions_for_cropping\"\n if image.exists?\n puts \"image exists\"\n img = ThumbMagick::Image.new(image.path('tocrop'))\n w,h = img.dimensions\n puts \"img.dimensions = #{img.dimensions.inspect}\"\n self.crop_w = w\n self.crop_h = h\n self.crop_x = self.crop_y = 0\n save\n end\n end", "title": "" }, { "docid": "64715ebb8bfcf8a47522a5541c42d1ec", "score": "0.58310276", "text": "def retain_geometry\n geometry = self.image.normal.geometry\n if geometry\n self.image_width = geometry[0]\n self.image_height = geometry[1]\n end\n end", "title": "" }, { "docid": "f799568680dca71464e8bc3189cf6d27", "score": "0.58223665", "text": "def dc_before_save\n return if @record.size_o.present? || !params[:upload_file]\n\n input_file_name = params[:upload_file].original_filename\n type = File.extname(input_file_name).to_s.downcase.gsub('.', '').strip\n unless %w(jpg jpeg png gif svg webp).include?(type)\n flash[:error] = t 'drgcms.dc_image.wrong_type'\n return false\n end\n name = File.basename(input_file_name)\n path = File.dirname(params[:upload_file].tempfile)\n\n @record.img_type = dc_get_site.params.dig('dc_image', 'img_type') || type\n @record.short = File.basename(input_file_name, '.*') if @record.short.blank?\n @record.name = File.join(path, name)\n FileUtils.mv(params[:upload_file].tempfile, @record.name, force: nil)\nend", "title": "" }, { "docid": "d704be9a4a1fcff8bee2468af604a813", "score": "0.58075464", "text": "def compute_image_metadata!\n @width = 0\n init_images\n compute_image_positions!\n init_engine\n end", "title": "" }, { "docid": "65d9a75ea4e31bfcb06ae7b01e57b1eb", "score": "0.5804145", "text": "def image_callback\n @image = Image.create(image_params)\n @company.update(image: @image)\n end", "title": "" }, { "docid": "fba0c2401f8350329bc94fb7ce7eb193", "score": "0.57936835", "text": "def extract_dimensions\n return unless image?\n tempfile = image.queued_for_write[:masonry]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.width = geometry.width.to_i\n self.height = geometry.height.to_i\n end\n end", "title": "" }, { "docid": "bcd9d2dc06702cd9da2dc261cfd37054", "score": "0.5789542", "text": "def update_site_meta_image_info\n update_site_meta_image_dimensions if saved_change_to_attribute?(:site_meta_image_updated_at)\n end", "title": "" }, { "docid": "9f578cd0b59ea52342324213250cdbc9", "score": "0.57875615", "text": "def width=(new_width)\n self.dirty = true\n @s3obj.metadata[:imgwidth] = new_width\n end", "title": "" }, { "docid": "9f578cd0b59ea52342324213250cdbc9", "score": "0.57875615", "text": "def width=(new_width)\n self.dirty = true\n @s3obj.metadata[:imgwidth] = new_width\n end", "title": "" }, { "docid": "725ea9fa89109e8e6f68463f527e3336", "score": "0.5782522", "text": "def set_image_data\n #logger.info \" --- dimensions now #{self.width}, #{self.height} w/ url #{self.url}\"\n #puts \" --- dimensions now #{self.width}, #{self.height} w/ url #{self.url}\"\n end", "title": "" }, { "docid": "0b965830f13d3cdf5d75e6e9e130bd10", "score": "0.5778041", "text": "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n update_image if cover_image\n save\n end", "title": "" }, { "docid": "42cef18e4ecbd30dbe36fa215e02ef83", "score": "0.57690805", "text": "def update_bitmap_size(width, height)\n @bitmap = Bitmap.update_bitmap_size(@bitmap, width, height)\n if @window != nil\n @window.contents = @bitmap\n elsif @sprite != nil\n @sprite.bitmap = @bitmap\n end\n end", "title": "" }, { "docid": "42cef18e4ecbd30dbe36fa215e02ef83", "score": "0.57690805", "text": "def update_bitmap_size(width, height)\n @bitmap = Bitmap.update_bitmap_size(@bitmap, width, height)\n if @window != nil\n @window.contents = @bitmap\n elsif @sprite != nil\n @sprite.bitmap = @bitmap\n end\n end", "title": "" }, { "docid": "2ca141a3e62442a565e1489b81e6cc3f", "score": "0.5755142", "text": "def save\n @image.save\n end", "title": "" }, { "docid": "d009a79aa6cab59e40f7d99af55a775a", "score": "0.5748911", "text": "def store_retina_dimensions\n if model\n width, height = `identify -format \"%wx%h\" '#{file.path}'`.split(/x/) ## Read dimensions\n\n ## Set original height and width attributes on model\n\n model.retina_dimensions = (model.retina_dimensions || {}).deep_merge!(\n mounted_as => {\n version_name => {\n :width => width.to_i / 2,\n :height => height.to_i / 2\n }\n }\n )\n end\n end", "title": "" }, { "docid": "8cfc214dc7ecc9cf0201fdf134fe1fa5", "score": "0.57452756", "text": "def resize(width, height) # :yields: image\n end", "title": "" }, { "docid": "12ea71520b21d6f68a886013dc1d745d", "score": "0.5732287", "text": "def size_image_relative_to_reference_values\n width_ratio = REFERENCE_WIDTH / photo_width\n height_ratio = REFERENCE_HEIGHT / photo_height\n\n resize_ratio = [width_ratio, height_ratio].min\n\n @width = (resize_ratio * photo_width).to_i\n @height = (resize_ratio * photo_height).to_i\n end", "title": "" }, { "docid": "80dc1db1c3e2f7ce1df672472380b821", "score": "0.57293296", "text": "def images_size\n self.original_image_size + \n self.byproduct_image_size\n end", "title": "" }, { "docid": "bc1f056b0184c740dd38b07866029438", "score": "0.5721462", "text": "def save_size\n model.meta_info[:size] = file.size\n end", "title": "" }, { "docid": "37e6a2f1856004a56d4c4fb621023b35", "score": "0.5714782", "text": "def get_and_set_post_size_dimensions\n\n tempfile = file.queued_for_write[:post_size]\n\n if tempfile\n\n geometry = Paperclip::Geometry.from_file(tempfile)\n\n self.dimensions = \"#{geometry.width.to_i}x#{geometry.height.to_i}\"\n\n end\n\n end", "title": "" }, { "docid": "79ee2c2a1c1dffdf5fda488a2cc7d6f7", "score": "0.57119066", "text": "def resize_image\n unless logo.nil?\n if logo.height != 100\n self.logo = logo.thumb('x100') # resize height and maintain aspect ratio\n end\n end\n end", "title": "" }, { "docid": "e43e53a72b1403ec42f007d8d1c7a08b", "score": "0.5709894", "text": "def resize!\n @img.resize(\"#{DIMENSIONS}^\")\n end", "title": "" }, { "docid": "ce9b242c12892eac8784ae623bc193d2", "score": "0.57089186", "text": "def store_best_geometry\n manipulate! do |img|\n if model\n model.height = img['height']\n model.width = img['width']\n end\n img = yield(img) if block_given?\n img\n end\n end", "title": "" }, { "docid": "a09164c3951107c40687f355baed9cb4", "score": "0.570879", "text": "def update_change_size\n update_change_width unless @new_width.nil?\n update_change_height unless @new_height.nil?\n end", "title": "" }, { "docid": "944a38e110b362cb6c4244d6fd85c228", "score": "0.57012534", "text": "def sizes\n PhotoAttachedImage.image_sizes(model.for_print)\n end", "title": "" }, { "docid": "86055e455be40635993c664912c39078", "score": "0.5693919", "text": "def resize_and_upload\n z = ZZ::ZZA.new\n z.track_transaction(\"photo.upload.resize.start\", self.id)\n attached_image.resize_and_upload_photos\n z.track_transaction(\"photo.upload.resize.done\", self.id)\n z.track_transaction(\"photo.upload.done\", self.id, {:photo_source => self.source}, 1, self.user_id)\n # tell the photo object it is good to go\n was_ready = ready?\n mark_ready\n save!\n\n # deliver any shares that might have been waiting for us to become ready\n deliver_shares\n\n # bump count of ready photos if this one just became ready\n Album.update_photos_ready_count(self.album_id, 1) unless was_ready\n # this is a sanity check to work around a small\n # race condition we currently have with client side batch closes\n batch = self.upload_batch\n if batch\n complete = batch.finish\n # update the status of this batch if not complete to show\n # that we've had activity\n batch.touch if complete == false\n end\n end", "title": "" }, { "docid": "bb7bc74a2f5c3b84245eb30391bdafea", "score": "0.5673731", "text": "def resize_image(img, size)\n processor = ::RedArtisan::CoreImage::Processor.new(img)\n size = size.first if size.is_a?(Array) && size.length == 1\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n if size.is_a?(Fixnum)\n processor.fit(size)\n else\n processor.resize(size[0], size[1])\n end\n else\n new_size = [img.extent.size.width, img.extent.size.height] / size.to_s\n processor.resize(new_size[0], new_size[1])\n end\n\n processor.render do |result|\n self.width = result.extent.size.width if respond_to?(:width)\n self.height = result.extent.size.height if respond_to?(:height)\n\n # Get a new temp_path for the image before saving\n temp_paths.unshift Tempfile.new(random_tempfile_filename, Technoweenie::AttachmentFu.tempfile_path).path\n result.save self.temp_path, OSX::NSJPEGFileType\n self.size = File.size(self.temp_path)\n end\n end", "title": "" }, { "docid": "e092cb0e915be129c2cdffa4993cac40", "score": "0.5667831", "text": "def create_complete\n @image = Image.new(params[:image])\n @image.user = current_user\n\n # calculate the image dpi.\n length_in_inches = @image.length_in_inches\n @image.ppi = @lifesize.calc_image_ppi_with_arrow(params['arrow_length'].to_f, length_in_inches, @image.width, params['render_width'].to_i)\n @image.calibrate_data(params['arrow_start'], params['arrow_end'])\n @image.image_type = Image::TYPE_LS\n @image.source = 'site'\n\n if @image.save\n redirect_to(images_user_path)\n else\n render :action => :new\n end\n end", "title": "" }, { "docid": "3e64ab55f895ab37a5f67f86cb9af452", "score": "0.56652164", "text": "def extract_dimensions\n tempfile = self.image.queued_for_write[:large]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end", "title": "" }, { "docid": "6a17a5a7671950cd245b946623efbc85", "score": "0.56328064", "text": "def image_size\n {\n width: image_file_width,\n height: image_file_height\n }\n end", "title": "" }, { "docid": "e28fff74b78de7f2d4e122d9a957d9e2", "score": "0.5632016", "text": "def after_process_attachment\n if @saved_attachment\n attachment_attributes_valid?\n return unless self.errors.empty?\n if thumbnailable? && !attachment_options[:thumbnails].blank? && parent_id.nil? #XZ1\n temp_file = temp_path || create_temp_file\n attachment_options[:thumbnails].each { |suffix, size|\n if size.is_a?(Symbol)\n parent_type = polymorphic_parent_type\n next unless parent_type && [parent_type, parent_type.tableize].include?(suffix.to_s) && respond_to?(size)\n size = send(size)\n end\n if size.is_a?(Hash)\n parent_type = polymorphic_parent_type\n next unless parent_type && [parent_type, parent_type.tableize].include?(suffix.to_s)\n size.each { |ppt_suffix, ppt_size|\n thumb = create_or_update_thumbnail(temp_file, ppt_suffix, *ppt_size)\n }\n else\n thumb = create_or_update_thumbnail(temp_file, suffix, *size)\n end\n errors.add(:base,\"error saving thumbnail. #{thumb.errors.full_messages}\") unless thumb.errors.empty?\n }\n end\n save_to_storage if self.errors.empty?\n @temp_paths.clear\n @saved_attachment = nil\n #callback :after_attachment_saved\n callback_with_args :after_attachment_saved, nil\n end\n end", "title": "" }, { "docid": "6e74476626aa5bacca962dca0f581301", "score": "0.56280535", "text": "def compute_dimensions\n return unless @file\n\n spec = ::ImageSpec.new(@file)\n if spec.content_type != 'application/x-shockwave-flash'\n raise SwfFormatException.new I18n.t('neofiles.swf_type_incorrect', content_type: spec.content_type)\n end\n self.width = spec.width\n self.height = spec.height\n end", "title": "" }, { "docid": "aeb5689bf75e820c39e295ec4a310bad", "score": "0.5623784", "text": "def read_dimensions\n if image? && file = asset.queued_for_write[:original]\n geometry = Paperclip::Geometry.from_file(file)\n self.original_width = geometry.width\n self.original_height = geometry.height\n self.original_extension = File.extname(file.path)\n end\n true\n end", "title": "" }, { "docid": "3d3dc5271afc80a6cb452b8e890c39b6", "score": "0.56170624", "text": "def extract_dimensions\n tempfile = img.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.img_dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end", "title": "" }, { "docid": "b1f74fe9864a479cd8d096556b4bbbbc", "score": "0.5614452", "text": "def file_dimensions\n if (picture.to_s <=> \"/images/post_picture_missing.png\") == 1\n dimensions = Paperclip::Geometry.from_file(picture.to_file(:original))\n self.picture_width = dimensions.width\n self.picture_height = dimensions.height\n \n if (self.picture_height / self.picture_width) == 1\n self.picture_orientation_horizontal = false\n else\n self.picture_orientation_horizontal = true\n end\n \n if dimensions.width < 300 && dimensions.height < 300\n self.has_big_picture = false\n else\n self.has_big_picture = true\n end\n end\n end", "title": "" }, { "docid": "66ca2782a115a3b74ff55cd7c34e081e", "score": "0.5613406", "text": "def extract_dimensions\n return unless image?\n tempfile = fb_image.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.fb_image_width = geometry.width.to_i\n self.fb_image_height = geometry.height.to_i\n puts \"HERE IS THE FB_IMAGE_HEIGHT\" + fb_image_height.to_s\n end\n end", "title": "" }, { "docid": "e029478e2b3927b8d2cca9797727b6be", "score": "0.56131744", "text": "def create \n @image ||= Image.new(image_params)\n @image.remote_image_url = params[:remote_image_url] unless params[:remote_image_url].nil?\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e7da0beeacc94e9ab55e1ee881e67936", "score": "0.55924314", "text": "def img_size()\n @img_size ||= @sequence.img_size() + @sequence.border_width() * 2\n end", "title": "" }, { "docid": "f5dd143fd807accd2559bdb2add9f86c", "score": "0.5591404", "text": "def update\r\n @imgWidth = @imgHeight = rand(3) + 1\r\n end", "title": "" }, { "docid": "3a0874166191fd3b353b5f6e8a8de839", "score": "0.55769897", "text": "def image_process\n # Add _t suffix to filename for thumbnail filename\n @thumbnail = convert_image(\"130x130\")\n @thumbnail.save\n ::MediaRocket::AssociatedFile.create(:media => self, :file => @thumbnail)\n \n # Add _m suffix to filename for medium filename\n @medium = convert_image(\"850x550\")\n @medium.save\n ::MediaRocket::AssociatedFile.create(:media => self, :file => @medium)\n end", "title": "" }, { "docid": "c7e388c87c82f9da7e51ec561c839d13", "score": "0.55650693", "text": "def save_images\n images_container.save\n end", "title": "" }, { "docid": "83e4f08d9044a49defd3af390857d638", "score": "0.5564954", "text": "def image_size\n {\n width: image_file_width,\n height: image_file_height\n }\n end", "title": "" }, { "docid": "f25d02f6befe155b526f22ffe3e5dfe9", "score": "0.5564522", "text": "def extract_dimensions\n\t return unless image?\n\t tempfile = asset.queued_for_write[:original]\n\t unless tempfile.nil?\n\t geometry = Paperclip::Geometry.from_file(tempfile)\n\t self.dimensions = [geometry.width.to_i, geometry.height.to_i]\n\t end\n\tend", "title": "" }, { "docid": "5b3b4726b316ade8250a79cf8f05c49a", "score": "0.55501413", "text": "def create\n # creates new image in database \n Image.create(image_params)\n end", "title": "" }, { "docid": "9d8a39a8ee3ff09f10aa83ec55c38b69", "score": "0.5545795", "text": "def save_image_types type_of_image,image\n @image = ImageType.new\n @image.image_type = type_of_image\n @image.images_for_job_id = image.id\n @image.image_page_number = image.image_number\n @image.save\n end", "title": "" }, { "docid": "411b684ba6f72607292198043b65c831", "score": "0.55369896", "text": "def redo_image \n\t\t@image.width = @width * @scale \n\t\t@image.height = @height * @scale\n\t\t@image.x = @width/2-@w_centre[:x]*@scale\n\t\t@image.y = @height/2-@w_centre[:y]*@scale\n\tend", "title": "" }, { "docid": "8a4372a7f9579a10ebae398e8e32b37a", "score": "0.55324906", "text": "def resizeImage(image)\n\t\tImage.resize(image, image, 50, 50)\n\tend", "title": "" }, { "docid": "f61d2195f4ee4ae650f4185178a1bb27", "score": "0.5532478", "text": "def process_images(record_with_images_attached)\n record_with_images_attached.images.each do |image|\n \n begin\n image_metadata = ActiveStorage::Analyzer::ImageAnalyzer.new(image.blob).metadata\n if image_metadata[:width] > 1280\n filename = image.filename.to_s\n \n attachment_path = \"#{Dir.tmpdir}/#{image.filename}\"\n \n File.open(attachment_path, 'wb') do |file|\n file.write(image.blob.download)\n file.close\n end\n \n new_image = MiniMagick::Image.open(attachment_path)\n \n new_image.resize \"1280\"\n new_image.quality \"85%\"\n new_image.interlace \"JPEG\" # Plane, JPEG\n #new_image.gaussian_blur \"0.05\"\n new_image.sampling_factor \"4:2:0\"\n new_image.colorspace \"RGB\"\n new_image.auto_orient\n #new_image.strip\n \n new_image.write attachment_path \n \n image.purge_later\n #record_with_images_attached.images.attach(io: File.open(attachment_path), filename: filename, content_type: \"image/jpg\")\n record_with_images_attached.images.attach(io: File.open(attachment_path), filename: filename)\n end \n rescue ActiveStorage::FileNotFoundError => e\n image.purge_later\n end \n end\n end", "title": "" }, { "docid": "4c2b9f88aa24fe076fac87f46bdd91c4", "score": "0.5526199", "text": "def resize_image\n unless logo.nil?\n if logo.height != 75\n self.logo = logo.thumb('x75') # resize height and maintain aspect ratio\n end\n end\n end", "title": "" }, { "docid": "5d4b82c0f5c8ef699a9a12bc04cc8e15", "score": "0.5519628", "text": "def set_image\n authorize @course, :update?\n @course.image.attach(helpers.resize_image(params[:image], '400x400'))\n @course.save\n render body: nil, status: :ok\n end", "title": "" }, { "docid": "fe8b5d4392f1c324d1717b04ab9fa7b9", "score": "0.5516469", "text": "def validate_dimensions\n manipulate! do |img|\n if img.dimensions.any?{|i| i > 8000 }\n raise CarrierWave::ProcessingError, \"dimensions too large\"\n end\n img\n end\n end", "title": "" }, { "docid": "e863a073e5c99a16a06e6737439ddf58", "score": "0.55146635", "text": "def set_image\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n created = false\n\n if params[:id].blank?\n @item = Item.new_info(0)\n @item.attributes = params.require(:item).permit(Item::PERMIT_BASE)\n @item.user_id = @login_user.id\n @item.title = t('paren.no_title')\n\n [:image0, :image1].each do |img|\n\n next if params[img].nil? or params[img][:file].size == 0\n\n @item.save!\n created = true\n break\n end\n else\n @item = Item.find(params[:id])\n end\n\n modified = false\n\n item_images = @item.images_without_content\n [:image0, :image1].each do |img|\n next if params[img].nil? or params[img][:file].nil? or params[img][:file].size == 0\n image = Image.new\n image.item_id = @item.id\n image.file = params[img][:file]\n image.title = params[img][:title]\n image.memo = params[img][:memo]\n image.xorder = item_images.length\n image.save!\n\n modified = true\n item_images << image\n end\n\n if modified and !created\n @item.update_attribute(:updated_at, Time.now)\n end\n\n render(:partial => 'ajax_item_image', :layout => false)\n\n rescue => evar\n Log.add_error(request, evar)\n\n @image = Image.new\n @image.errors.add_to_base(evar.to_s[0, 256])\n\n render(:partial => 'ajax_item_image', :layout => false)\n end", "title": "" }, { "docid": "c2f92cdf6c3696d56b96d189295f259b", "score": "0.5511195", "text": "def update_users_old_pic\r\n #KS- get the thumbnail and full image\r\n thumbnail = self.thumbnail\r\n full_image = self.image\r\n\r\n #KS- make entry in pictures_users for image and thumbnail\r\n self.pictures << thumbnail\r\n self.pictures << full_image\r\n self.save!\r\n\r\n #KS- set height, width, and size_type for thumbnail and full_image\r\n thumbnail.set_dimensions!\r\n thumbnail.size_type = Picture::SIZE_THUMBNAIL\r\n thumbnail.save_with_validation(false)\r\n full_image.set_dimensions!\r\n full_image.size_type = Picture::SIZE_FULL\r\n\r\n #KS- create a medium image and set the user's medium_image to it\r\n medium_image = full_image.create_medium\r\n medium_image.save_with_validation(false)\r\n self.pictures << medium_image\r\n self.medium_image = medium_image\r\n self.save!\r\n\r\n #KS- resize the full size pic to the new maximum dimensions\r\n full_image.resize_and_save!(Picture::MAX_HEIGHT, Picture::MAX_WIDTH, false)\r\n\r\n #KS- set the thumbnail's original\r\n thumbnail.original = full_image\r\n thumbnail.save_with_validation(false)\r\n end", "title": "" }, { "docid": "4a00642061fe86618962e1c4e2c7fc7e", "score": "0.5506269", "text": "def regenerate_styles!\n self.photo.reprocess! \n self.processing = false \n self.save(:validate => false) #save(false)\n end", "title": "" }, { "docid": "f376763560c0f46cd964c3b38e620e8b", "score": "0.5501357", "text": "def set_width_and_height\n self.width, self.height = media.width, media.height\n true\n end", "title": "" }, { "docid": "3c32a542497873abae5d6bde51c422c1", "score": "0.55000263", "text": "def resize_image(img, size) \n # resize_image take size in a number of formats, we just want \n # Strings in the form of \"crop: WxH\" \n \n if (size.is_a?(String) && size =~ /^crop: (\\d*)x(\\d*)/i) || \n (size.is_a?(Array) && size.first.is_a?(String) && \n size.first =~ /^crop: (\\d*)x(\\d*)/i)\n img.crop_resized!($1.to_i, $2.to_i) \n img.border!(2,2,'white') \n self.temp_paths.unshift write_to_temp_file(img.to_blob) \n elsif (size.is_a?(String) && size =~ /^thumb: (\\d*)x(\\d*)/i) || \n (size.is_a?(Array) && size.first.is_a?(String) && \n size.first =~ /^thumb: (\\d*)x(\\d*)/i)\n img.resize!(0.20)\n img.border!(4,4,'white') \n self.temp_paths.unshift write_to_temp_file(img.to_blob)\n #if (size.is_a?(String) && size =~ /^crop: (\\d*)x(\\d*)/i) || \n #(size.is_a?(Array) && size.first.is_a?(String) && \n #size.first =~ /^crop: (\\d*)x(\\d*)/i) \n #img.crop_resized!($1.to_i, $2.to_i) \n #img.border!(2,2,'white') \n # We need to save the resized image in the same way the \n # orignal does. \n #self.temp_paths.unshift write_to_temp_file(img.to_blob) \n # self.temp_path = write_to_temp_file(img.to_blob) \n else \n \n super # Otherwise let attachment_fu handle it \n #img.border!(5,5,'white') \n end \n end", "title": "" }, { "docid": "e30ae413d87f23780be2d1357a86a0df", "score": "0.5498489", "text": "def resize!(width, height)\n image.geometry \"#{width}x#{height}!\"\n end", "title": "" }, { "docid": "0cfe85e0788dff2ef3579a6e0ba3410a", "score": "0.54943115", "text": "def extract_dimensions\n tempfile = image.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n width = geometry.width.to_i\n height = geometry.height.to_i\n\n self.width_in_pixels, self.height_in_pixels = resize(width,height)\n #puts \"#{geometry.width.to_i}x#{geometry.height.to_i} => #{self.width_in_pixels}x#{self.height_in_pixels}\"\n require 'ImageResize'\n Image.resize(tempfile.path, tempfile.path, self.width_in_pixels, self.height_in_pixels)\n\n geometry = Paperclip::Geometry.from_file(tempfile)\n puts geometry.width.to_s\n end\n end", "title": "" }, { "docid": "ab0bc126a0e4189bcede8d1747accd1c", "score": "0.54941183", "text": "def add_finish\n if !current_user\n redirect_to_error(\"you are not logged in. Please log in first\")\n return\n end\n\n @image = Image.new(params[:image])\n @image.ref = nil if @image.ref.nil? || @image.ref.empty?\n @image.name = nil if @image.name.nil? || @image.name.empty?\n @image.description = nil if @image.description.nil? || @image.description.empty?\n\n # create a lifesize instance, needed to calculate DPI\n lifesize = LifeSize.new(screen_config)\n\n # calculate the image dpi.\n cd = ActiveSupport::JSON.decode(params[:configure_data])\n length_inches = cd['unit'] == 'cm' ? (cd['physLength']/2.54) : cd['physLength']\n @image.ppi = lifesize.calc_image_ppi_with_arrow(cd['pixLength'], length_inches, @image.width, cd['renderWidth'])\n @image.calibrate_data=cd\n @image.user = current_user\n @image.image_type = Image::TYPE_LS\n\n logger.info(\"PPI of new image is: #{@image.ppi}\")\n finish = (params['finish'] == 'true')\n\n #save the image\n resp = { :success => false }\n #begin\n if @image.save\n # move the temporary thumbnail url to it's permanent location\n ImageTool.save_thumbnail(params[:thumbnail_url], @image)\n resp[:success] = true\n resp[:redirect_to] = finish ? images_user_path : url_for(:action => :add_image)\n end\n #rescue => err\n # logger.error(err)\n #end\n # set errors in response\n if (!resp[:success])\n if @image.errors.count > 0\n errors = []\n @image.errors.each{ |attr,msg| errors << [attr, msg] }\n resp[:errors] = errors\n resp[:errorType] = VALIDATION_ERROR\n resp[:errorMsg] = \"There was a slight problem with the info you entered. Please correct the indicated fields.\"\n else\n resp[:errorMsg] = \"A database error occurred, please try again later.\"\n resp[:errorType] = DATABASE_ERROR\n end\n end\n render :json => resp\n end", "title": "" }, { "docid": "a94ae341774859525bbe9fccf1614aea", "score": "0.54858446", "text": "def set_size_image\n @size_image = SizeImage.find(params[:id])\n end", "title": "" }, { "docid": "4212cb7c5db2f7087342a0c3a66d93e8", "score": "0.5485682", "text": "def resize_to_fit(new_width, new_height)\n ::ImageScience.with_image(self.current_path) do |img|\n width, height = extract_dimensions(img.width, img.height, new_width, new_height)\n img.resize( width, height ) do |file|\n file.save( self.current_path )\n end\n end\n end", "title": "" } ]
d9846858d62c35ae5deeeec540c78a79
returns tags followed by my friends but not by self TODO: optimize
[ { "docid": "c88f30a39158956f48d116e2edfe85c6", "score": "0.615882", "text": "def suggested_tags(group, limit = 5)\n friends = Membership.where(:group_id => group.id,\n :user_id.in => self.friend_list.following_ids,\n :preferred_tags => {\"$ne\" => [], \"$ne\" => nil}).\n only(:preferred_tags, :login, :name, :user_id)\n\n friends_tags = { }\n friends.each do |friend|\n (friend.preferred_tags-self.preferred_tags_on(group)).each do |tag|\n friends_tags[\"#{tag}\"] ||= { }\n friends_tags[\"#{tag}\"][\"followed_by\"] ||= []\n friends_tags[\"#{tag}\"][\"followed_by\"] << friend\n end\n end\n result = friends_tags.to_a.sample(limit)\n if result.blank?\n return suggested_tags_by_suggested_friends(group, limit = 5)\n else\n return result\n end\n end", "title": "" } ]
[ { "docid": "fab047bf4aba939921e73bec24bbcf62", "score": "0.6953156", "text": "def following_tags\n Tag.joins(\"JOIN relationships AS r ON r.followed_id = tags.id\").where(\"r.follower_id = ? AND r.item_type = 'Tag'\", self.id)\n end", "title": "" }, { "docid": "44e60243e0eb5bceab0bfaf8b8341a59", "score": "0.68475693", "text": "def friends_with_same_tag(tag_id)\n\n end", "title": "" }, { "docid": "353078801991a4edab87c57a22ba97a8", "score": "0.65550524", "text": "def excluded_friends\n pending_friends + blocked_friends + friends\n end", "title": "" }, { "docid": "bdc3fd977b861ba0934270133819251a", "score": "0.65331584", "text": "def suggested_tags_by_suggested_friends(group, limit = 5)\n if suggested_social_friends(group, limit).count > 0\n friends = suggested_social_friends(group, limit).only(:_id).map{|u| u.id}\n end\n unless friends.blank?\n memberships = Membership.where(:group_id => group.id,\n :user_id.in => friends,\n :preferred_tags => {\"$ne\" => [], \"$ne\" => nil},\n :_id => {:$not => {:$in => self.friend_list.following_ids}}).\n only(:preferred_tags, :login, :name, :user_id)\n\n friends_tags = { }\n memberships.each do |membership|\n friend_preferred_tags = membership.preferred_tags\n\n if friend_preferred_tags\n (friend_preferred_tags-self.preferred_tags_on(group)).each do |tag|\n friends_tags[\"#{tag}\"] ||= { }\n friends_tags[\"#{tag}\"][\"followed_by\"] ||= []\n friends_tags[\"#{tag}\"][\"followed_by\"] << membership.user\n end\n end\n end\n friends_tags.to_a.sample(limit)\n end\n []\n end", "title": "" }, { "docid": "1e6de53eb09a62b28a688537b51889ad", "score": "0.64468217", "text": "def friends\n direct_friends | inverse_friends\n end", "title": "" }, { "docid": "5b87b68f002d3fca8eb314d4a5142563", "score": "0.63520896", "text": "def friends\n followers & follows\n end", "title": "" }, { "docid": "5dcda7dc77b6a2b1d827ad96f8f89897", "score": "0.63259184", "text": "def taggers\n taggings.map { |t| t.users }.flatten.compact.uniq\n end", "title": "" }, { "docid": "df59a94dde7fdfba9db26c6e5526e0bc", "score": "0.6321261", "text": "def friends_in_common receiver\n self.friends(true) & receiver.friends(true) if receiver.respond_to? :friends\n []\n end", "title": "" }, { "docid": "05eececa5b14f4fe0d7b99d2c68f1c5c", "score": "0.6320018", "text": "def friends_not_declined(current_user)\n friends_in_group = []\n \n self.groups.each do |group|\n friends_in_group << group.friends_in_group(current_user)\n end\n friends_in_group.flatten!.uniq! \n \n friends_in_group - self.friends_declined\n end", "title": "" }, { "docid": "7270071a30e7475c6bb6535c45633bdf", "score": "0.6270016", "text": "def coincident_tags\n tags = []\n self.tagged.each do |t|\n tags += t.attached_tags if t\n end\n tags.uniq - [self]\n end", "title": "" }, { "docid": "5db217b3d5f676c355afb0445492058c", "score": "0.6237871", "text": "def friends_declined\n friends_already_declined = []\n \n self.declined_requests.each do |decision|\n friends_already_declined << decision.user\n end\n friends_already_declined.uniq! \n friends_already_declined\n end", "title": "" }, { "docid": "1aa0ac3ff24ca73fa53f18ee75ac3621", "score": "0.6221584", "text": "def get_friends\n friends = []\n tweets.each do |tweet|\n friends << tweet.like\n end\n friends.flatten.uniq\n end", "title": "" }, { "docid": "09c6d4f81a2a36944b1b38d2a10c869f", "score": "0.62053233", "text": "def friends_and_own_posts\n my_friends = friends\n our_posts = []\n my_friends.each do |friend|\n friend.posts.each do |post|\n our_posts << post\n end\n end\n posts.each do |post|\n our_posts << post\n end\n our_posts\n end", "title": "" }, { "docid": "3bb6cf6cad0cc5264df6f4dcf5d5083c", "score": "0.6202748", "text": "def all_friends\n friends | inverse_friends \n end", "title": "" }, { "docid": "246db84abfa6592b97f67eb45137ca95", "score": "0.61949867", "text": "def friends_and_own_posts\n myfriends = friends\n our_posts = []\n myfriends.each do |f|\n f.posts.each do |p|\n our_posts << p\n end\n end\n posts.each do |p|\n our_posts << p\n end\n our_posts\n end", "title": "" }, { "docid": "6bdaaa59b5e52e79d164246b45afffd4", "score": "0.6194387", "text": "def find_friend_with_no_friends()\n no_friend = []\n for friend in @people\n if friend[:friends].empty?\n no_friend.push(person)\n end\n end\n return no_friend\nend", "title": "" }, { "docid": "3b617070bb884eafedb29276a1b9adde", "score": "0.61793923", "text": "def friends\n current_friends | bfriended_friends\n end", "title": "" }, { "docid": "630014780ac55a74a554f25826e87ce3", "score": "0.6161784", "text": "def friends_and_own_posts\n myfriends = friends\n our_posts = []\n myfriends.each do |f|\n f.posts.each do |p|\n our_posts << p\n end\n end\n\n posts.each do |p|\n our_posts << p\n end\n\n our_posts\n end", "title": "" }, { "docid": "55796ea6ffc4abdf2aa2c23800ee82e5", "score": "0.61599576", "text": "def related_content\n Status.tagged_with(self.tag_list, :on => :tags, :any => true).where(\"user_id != ?\", self.user_id)\n end", "title": "" }, { "docid": "94ae893bc85124825e308962b5c55606", "score": "0.61526567", "text": "def related\n Fight.find_tagged_with(tag_list).select{|f| f.id!=self.id}.sort_by(&:votes).reverse\n end", "title": "" }, { "docid": "f81702a724c6f93941df35d5637f34bd", "score": "0.614715", "text": "def responding_friends( request )\n Friend.all.select do |friend|\n filter_node_by_search request, \"#{friend.url}/edcat\"\n end\n end", "title": "" }, { "docid": "dbbff046b383d100c1fe1fa830bd9947", "score": "0.6113681", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "dbbff046b383d100c1fe1fa830bd9947", "score": "0.6113681", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "dbbff046b383d100c1fe1fa830bd9947", "score": "0.6113681", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "dbbff046b383d100c1fe1fa830bd9947", "score": "0.6113681", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "dbbff046b383d100c1fe1fa830bd9947", "score": "0.6113681", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "5c2c213043d3fd6d24e6260d3dc9337a", "score": "0.6105486", "text": "def friends\n active_friends | received_friends\nend", "title": "" }, { "docid": "9967c6256843c1615627eb2777070d12", "score": "0.6104095", "text": "def normal_tags\n node_tags = DrupalNodeCommunityTag.find(:all,:conditions => ['nid = ? AND tid IN (?)',self.id,DrupalTag.find(:all, :conditions => [\"name NOT LIKE ? AND name NOT LIKE ?\",\"%:%\",\"event\"]).collect(&:tid)])\n tags = []\n node_tags.each do |nt|\n tags << nt\n end\n tags\n end", "title": "" }, { "docid": "65ecbe1ad15df5ac3c8d6dfca48497e5", "score": "0.61033595", "text": "def mutual_friends_for(friend)\n self.friends & friend.friends\n end", "title": "" }, { "docid": "15676025becbee3f07db6a3722fe57ff", "score": "0.6091461", "text": "def friends_of(word)\n ret = []\n for candidate in bounding_words_of(word)\n ret << candidate if friends?(word, candidate)\n end\n ret\nend", "title": "" }, { "docid": "4157264dcb654b9bb79ebf31532e6378", "score": "0.60822207", "text": "def friends\n self.direct_friends | self.inverse_friends\n end", "title": "" }, { "docid": "1133c01c193b0eac80d26aa79c859cf4", "score": "0.60763514", "text": "def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end", "title": "" }, { "docid": "041571b6316855b6647a9dc96db0f43d", "score": "0.60600466", "text": "def links\n self.friends + self.inverse_friends\n end", "title": "" }, { "docid": "dfe95829e078cf3c845a96df50d6958c", "score": "0.60541254", "text": "def friends\n\t\tincoming_friends | outcoming_friends\n\tend", "title": "" }, { "docid": "5b31c22245052f2a12aba902ca9c1697", "score": "0.6019519", "text": "def friends\n friends_initiated | friends_received\n end", "title": "" }, { "docid": "6fdb4b0dd20b1dc875cde18e0045f50e", "score": "0.60177374", "text": "def friends\n \tactive_friends | received_friends\n end", "title": "" }, { "docid": "a3bc857c78f5902ca9e8a927d2e3dbbc", "score": "0.60155916", "text": "def related\n self.tags_array.map{|t| self.blog.posts.published.tagged_with(t) - [self]}.flatten\n end", "title": "" }, { "docid": "b43ea32703e841f95cd70503e3724eb6", "score": "0.6014956", "text": "def good_friends\n friends & followers\n end", "title": "" }, { "docid": "458d99be44229b9a2436672fae291806", "score": "0.6014153", "text": "def all_friends \n friends = []\n self.friends.each do |friend|\n friends << friend\n end\n self.inverse_friends.each do |friend|\n friends << friend\n end\n friends\n end", "title": "" }, { "docid": "f0ae177f2f4f52ff8b38e81bca1c59d6", "score": "0.599841", "text": "def friend_names\n @description.scan(/(?<=\\*\\*)\\w[^\\*]*(?=\\*\\*)/).uniq\n end", "title": "" }, { "docid": "85520a893c805c08ce5dd10bef0038af", "score": "0.5979847", "text": "def friends\n return []\n end", "title": "" }, { "docid": "0eb6c3dce3922d2e7e5fcc62341163ac", "score": "0.5975052", "text": "def common_friends\n \n end", "title": "" }, { "docid": "6e32a653168ab3b037a22f272f147f08", "score": "0.5974914", "text": "def common_friends(user2)\n self.friend_list & user2.friend_list\n end", "title": "" }, { "docid": "070b4cb63a1a1112724e5e55af22e0e7", "score": "0.5974024", "text": "def friends\n return [] if !has_friends?\n # and array of friend relationships NOT actual nodes\n array_of_hashes = neo_con.get_node_relationships(self.my_node, \"out\", FRIENDS_REL)\n # objects = array_of_hashes.map{|m| OpenStruct.new(m)}\n # even better, just get the full user objects\n # puts \"array_of_hashes.collect{|x| x['data'']['id']}::#{array_of_hashes.collect{|x| x['data']['id']}} \"\n # puts \"array_of_hashes.collect{ |x| neo_node_id(x) }::#{array_of_hashes.collect{ |x| neo_node_id(x) }} \"\n\n User.where(:node_id => array_of_hashes.collect{ |x| neo_end_node_id(x) })\n end", "title": "" }, { "docid": "0127a39108cc5bf76b404c1b5a61c570", "score": "0.596215", "text": "def friends\n\t active_friends | received_friends\n\tend", "title": "" }, { "docid": "9b2dffd9c11c864f274ffbe45bdbe4ea", "score": "0.5953414", "text": "def friends\n friends_arr = friendships.map do |friendship|\n friendship.friend if friendship.status\n end\n\n friends_arr += reverse_friendships.map do |friendship|\n friendship.user if friendship.status\n end\n\n friends_arr.compact\n end", "title": "" }, { "docid": "b20c6f3e57bf9e9a8a9daf7c4133aec5", "score": "0.5945634", "text": "def friend_names\n friends = source.participations.reject { |p| p.person_id == source.user_id }.map(&:person)\n friends.map(&:name).sort\n end", "title": "" }, { "docid": "28a9822d5b74fb072eab4eb47ca692fe", "score": "0.5941474", "text": "def friend_names\n description.scan(/(?<=\\*\\*)\\w[^\\*]*(?=\\*\\*)/).uniq\n end", "title": "" }, { "docid": "0e0701a773110a79e041f96fb305af3f", "score": "0.59406424", "text": "def friends_by_like\n followees = self.followees(User)\n followers = self.followers(User)\n mutual_follow = followers & followees\n\n return mutual_follow\n end", "title": "" }, { "docid": "afa408c1c30dfbc05071350251e36b08", "score": "0.5940221", "text": "def friends\n friends = relationships.by_accepted_role(:friends).collect(&:users).flatten.uniq\n friends.delete(self)\n friends\n end", "title": "" }, { "docid": "f7ae168cd277ec6c5f728c70e121d957", "score": "0.5921871", "text": "def list_favorite_friends\n list_favorite_things(:friend)\n end", "title": "" }, { "docid": "8af0f0e7cfe8087cc1b736e197da1c96", "score": "0.59194165", "text": "def me_and_followings\n self.followings+[self] \n end", "title": "" }, { "docid": "2f499e0388cd136123b082b4cbb9df5a", "score": "0.59193087", "text": "def friend_list\n friends + inverse_friends\n end", "title": "" }, { "docid": "9688afac0fb44637dbe32edeeab066e6", "score": "0.5895131", "text": "def followings(s)\n @t.all_friends_for(s).map(&:screen_name)\n end", "title": "" }, { "docid": "3b09c15d68caea24acffe9fff1425186", "score": "0.5894953", "text": "def friends\n requested_friends + requesting_friends\n end", "title": "" }, { "docid": "db8b365559066e4e0841b0cc00ec6cd5", "score": "0.5886701", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "db8b365559066e4e0841b0cc00ec6cd5", "score": "0.5886701", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "db8b365559066e4e0841b0cc00ec6cd5", "score": "0.5886701", "text": "def friends\n active_friends | received_friends\n end", "title": "" }, { "docid": "46820d4c9319acb3349e416e9f77cc21", "score": "0.58842665", "text": "def friends\n self.invited(true) + self.invited_by(true)\n end", "title": "" }, { "docid": "06ed5bd6430f64be6dd0679cecc4187f", "score": "0.5880157", "text": "def extract_friends(users)\n return self.friends & users\n end", "title": "" }, { "docid": "1904d4084f9ff55f11978da2ba4ebcb8", "score": "0.58733505", "text": "def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.acepted }.compact\n end", "title": "" }, { "docid": "3f37c049c1293ce28cbabe21312b8b20", "score": "0.5870983", "text": "def friends\n friends = self.friends_for_me + self.friends_by_me\n end", "title": "" }, { "docid": "a446c8c1ab31ee4911b398fb98210d10", "score": "0.5856524", "text": "def related_content\n Post.tagged_with(self.tag_list, :on => :tags, :any => true).where(\"user_id != ?\", self.user_id)\n end", "title": "" }, { "docid": "d3775f6ed69dcb77d0e65d060c722b6b", "score": "0.58500886", "text": "def fellow_cult_members_inclusive\n fellows = []\n Cult.all.each do |cult|\n if cult.get_followers.include?(self)\n cult.get_followers.each { |follower| fellows << follower if follower != self }\n end\n end\n fellows.uniq\n end", "title": "" }, { "docid": "a7803882c716db9c40a20a1d063ed01c", "score": "0.58465856", "text": "def no_friends(people)\n no_friends = []\n for person in people\n if person[:friends].empty?\n no_friends.push(person[:name])\n end\n end\n return no_friends\nend", "title": "" }, { "docid": "4da221cd2b02b4a5254e124a6f7d23ca", "score": "0.58404356", "text": "def friend_names\n friends.map{|e| e.name}\n end", "title": "" }, { "docid": "878c8afeebab165c3f1d4a53e1882135", "score": "0.5827327", "text": "def no_friends(people)\n no_friends = []\n for person in people\n if person[:friends].empty?\n no_friends.push(person[:name])\n end\n end\n\n return no_friends \nend", "title": "" }, { "docid": "8ff57b758ddacb9aebbdffcbe1fab32e", "score": "0.5817668", "text": "def all_friends_including_pending\n friends = []\n self.pending_friends.each do |friend|\n friends << friend\n end\n self.inverse_pending_friends.each do |friend|\n friends << friend\n end\n friends + all_friends\n end", "title": "" }, { "docid": "eb21453d5ab865876932b018ba45948f", "score": "0.5812117", "text": "def all_friends\n \n end", "title": "" }, { "docid": "472452371259bcdedb26e66ee9639dbc", "score": "0.58101016", "text": "def friends\n friends_array = confirmed_friends + confirmed_inverse_friends\n friends_array\n end", "title": "" }, { "docid": "a90b30e96d29ac6f94e3f441a408eafd", "score": "0.57916754", "text": "def not_friended_users\n User.all.select { |user| user != self && find_friendship(user).nil? }\n end", "title": "" }, { "docid": "b3f14bafce0f1774663f283955b14ff6", "score": "0.5782844", "text": "def common_friends_with(user)\n self.friends & user.friends\n end", "title": "" }, { "docid": "b3f14bafce0f1774663f283955b14ff6", "score": "0.5782844", "text": "def common_friends_with(user)\n self.friends & user.friends\n end", "title": "" }, { "docid": "b3f14bafce0f1774663f283955b14ff6", "score": "0.5782844", "text": "def common_friends_with(user)\n self.friends & user.friends\n end", "title": "" }, { "docid": "1651c422be4809f1d1c86bda136846fc", "score": "0.5775535", "text": "def related\n \t \ttags = self.tags\n \t \treturn if tags.nil? or self.id.nil?\n \t \treturn @related unless @related.nil?\n \t \tresults = []\n\n \t \ttags.each do |tag|\n \t \t\t_tags = Tag.where(:name => tag.name).where(\"`tags`.`listing` != ?\", self.id).all\n \t \t\tnext if _tags.count == 0\n\n \t \t\t_tags.each do |_tag|\n list = Listing.find(_tag.listing)\n \t \t\t\tresults.push(list) unless results.include?(list)\n \t \t\tend\n \t \tend\n\n \t \t(@related = results) || nil\n \t end", "title": "" }, { "docid": "672d741808f8d891706551a5c392ccbf", "score": "0.5769431", "text": "def current_hacker_tags(hacker_id)\n find_by_sql(\"SELECT DISTINCT t.* FROM tags AS t\n JOIN entries_tags AS et ON et.tag_id = t.id\n JOIN entries AS e ON e.id = et.entry_id\n WHERE e.hacker_id = #{hacker_id}\n ORDER BY t.name;\")\n end", "title": "" }, { "docid": "bd88035bc7f8f336f03e83fd16ebfc49", "score": "0.5766189", "text": "def suggest_friends\n # Retrieve the suggested friend IDs\n friend_ids = Neo4j::Session.current.query\n .match('(user:User {name: {name}})-[:follows]->(friend1:User)-[:follows]->(recommend:User)<--(friend2:User)')\n .params(name: self.name)\n .where('(user)-[:follows]->(friend2) AND NOT (user)-[:follows]->(recommend)')\n .return('distinct(recommend).uuid as id')\n .to_a.map { |n| n.id }\n # Return the friend objects\n # TODO: use only one query to get all users\n friend_ids.map {|uuid| User.find(uuid)}\n end", "title": "" }, { "docid": "1bd911f66993a8cdcb81686b709995bd", "score": "0.57646716", "text": "def users_not_in_friend_list\n User.where.not(id: self.friends.ids << self.id)\n end", "title": "" }, { "docid": "5b182d6624df0632a4f66e55e7fb6a92", "score": "0.5757939", "text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.acepted }.compact\n end", "title": "" }, { "docid": "a4a7eb53c3d58824b3a38695b705891c", "score": "0.57434803", "text": "def friend_requests\n inverted_friendships.map{|friendship| friendship.user if !friendship.status}.compact\n end", "title": "" }, { "docid": "4a1e9571d1cff3e6af79389682d6d259", "score": "0.5737852", "text": "def no_friends(people)\n friendless = Array.new()\n\n for person in people\n person[:friends] == nil\n end\n return friendless.push(person[:name])\nend", "title": "" }, { "docid": "4d44cd77cc13c592f13accf1293bcaa8", "score": "0.5735808", "text": "def filtered_tags; end", "title": "" }, { "docid": "fe48f78dda4137cbe60245c9fd7fc187", "score": "0.5735149", "text": "def common_friends_with(user)\n self.friends & user.friends\n end", "title": "" }, { "docid": "78f9794b693e440d0a8344d4b45b7d54", "score": "0.57347506", "text": "def download_tags;\n [(unread? ? Page::UNREAD : \"\"),\n *tags.not_fandom.not_info.not_author.map(&:name),\n ]\n end", "title": "" }, { "docid": "b2a16d3ceed22040d3986090adf90d22", "score": "0.5727434", "text": "def shared_friends_with(user)\n # Array#& returns items that are included in both arrays\n self.friends & user.friends\n end", "title": "" }, { "docid": "7716662fd011643b48b47bf3bf4830e7", "score": "0.57267624", "text": "def friends\n friends_array = friendships.map{|friendship| friendship.friend if friendship.confirmed}\n friends_array + inverse_friendships.map{|friendship| friendship.user if friendship.confirmed}\n friends_array.compact\n end", "title": "" }, { "docid": "4d1dc623b8f8257c7223c200ef9c3e33", "score": "0.5696126", "text": "def friends\n\tend", "title": "" }, { "docid": "ff23d79b177c1cb1bab317f3e6ea8418", "score": "0.5695587", "text": "def neo_friends\n return [] if !has_friends?\n # and array of friend nodes\n array_of_hashes = neo_con.get_node_relationships(self.my_node, \"out\", FRIENDS_REL)\n # objects = array_of_hashes.map{|m| OpenStruct.new(m)}\n end", "title": "" }, { "docid": "b5b2aa0cb0694bdd2d153a5a42ce15ed", "score": "0.56929696", "text": "def friends\n friends_array = friendships.map{ |friendship|\n friendship.friend if friendship.confirmed\n }\n\n friends_array += inverse_friendships.map{ |friendship|\n friendship.user if friendship.confirmed\n }\n friends_array.compact\n end", "title": "" }, { "docid": "95bf9996ce52a8a5a865e9cbb80f11ce", "score": "0.5680327", "text": "def filtered_picture_tags #returns all PictureTags where instance of Tag = pictureTag.tag\n PictureTag.all.select { |t| t.tag == self }\n end", "title": "" }, { "docid": "b72c793bd583b6461236f31fbed161c0", "score": "0.5680019", "text": "def no_friends (people)\n for person in @people\n if person[:friends].length<=0\n return person\n end\n end\nend", "title": "" }, { "docid": "2aee040723c2555f80bef0887ecf23a8", "score": "0.56763077", "text": "def get_uninvited_friends(user)\n uninvited = user.friends-self.users-[self.creator]\n for invi in self.trip_invitations\n uninvited -= [invi.invitee]\n end\n return uninvited\n end", "title": "" }, { "docid": "71f6ada62d17567618126c289f6f2f53", "score": "0.5675642", "text": "def filter_uninformative_names interactions\n bad_names = Set.new(%w[putative uncharacterized predicted_protein])\n good_interactions = []\n\n \n interactions.each do |i|\n bad = false\n \n bad_names.each do |name|\n if i.downstream.match(name) || i.upstream.match(name)\n bad = true\n break\n end\n end\n\n unless bad\n good_interactions << i\n end\n end\n\n return good_interactions\nend", "title": "" }, { "docid": "71f6ada62d17567618126c289f6f2f53", "score": "0.5675642", "text": "def filter_uninformative_names interactions\n bad_names = Set.new(%w[putative uncharacterized predicted_protein])\n good_interactions = []\n\n \n interactions.each do |i|\n bad = false\n \n bad_names.each do |name|\n if i.downstream.match(name) || i.upstream.match(name)\n bad = true\n break\n end\n end\n\n unless bad\n good_interactions << i\n end\n end\n\n return good_interactions\nend", "title": "" }, { "docid": "c6945799a8b37f9c09117104703c83ac", "score": "0.56676716", "text": "def friend_requests\n inverse_friendships.map { |fr| fr.user unless fr.status }.compact\n end", "title": "" }, { "docid": "462f5bfbb0808dce9739e023f6fd64f6", "score": "0.56640977", "text": "def no_friends(people)\n result = []\n for person in people \n result << person if person[:friends].empty?\n end\n return result\nend", "title": "" }, { "docid": "ab1a0d121011a0b3a9b907e028f32e2a", "score": "0.56627595", "text": "def get_friends\r\n login\r\n friends = []\r\n doc = hpricot_get_url '/friends.php'\r\n \r\n # loop through the friends and collect'em all! pokemon style.\r\n (doc/\"td.name/a\").each do |friend_row|\r\n friends << parse_friend_row(friend_row)\r\n end\r\n friends\r\n end", "title": "" }, { "docid": "451bfb83f8d0315988116cb7cc9b517c", "score": "0.5657079", "text": "def find_no_friends(people)\n array_of_people_with_no_friends = []\n # binding.pry\n for each_person in people\n if each_person[:friends] == []\n array_of_people_with_no_friends.push(each_person[:name])\n end\n end\n return array_of_people_with_no_friends\nend", "title": "" }, { "docid": "a754cdc8c76c6e0c485d753b6271d167", "score": "0.565693", "text": "def get_friends\n @friends ||= graph.get_connections(uid,'friends')\n end", "title": "" }, { "docid": "2a308db93373a9753e5e356d7945a488", "score": "0.56561166", "text": "def followers\n info.find_all(&:follower?)\n end", "title": "" } ]
19799aeb67b1f38fc99c1cbc70e2167b
calls the 2 methods. returns the value for the last method
[ { "docid": "1c22dd99fbe26a2677c5fca1ddf97f71", "score": "0.0", "text": "def virus_effects\r\n predicted_deaths\r\n speed_of_spread\r\n end", "title": "" } ]
[ { "docid": "5d120b92da13b2209b2149890f6c5538", "score": "0.6437458", "text": "def last_result=(_arg0); end", "title": "" }, { "docid": "5d120b92da13b2209b2149890f6c5538", "score": "0.6437458", "text": "def last_result=(_arg0); end", "title": "" }, { "docid": "846188f536139a95a4c14f440bafab22", "score": "0.63452286", "text": "def value\n @method.call\n end", "title": "" }, { "docid": "f08d07e5dae8099bbf64a6863af3e087", "score": "0.63003397", "text": "def result ; end", "title": "" }, { "docid": "c1d4dc36fce1f9d2be1d7ce24853e46f", "score": "0.6294685", "text": "def methodOne\n return 5\nend", "title": "" }, { "docid": "d4b51441e9803335f40f611467a77896", "score": "0.6254868", "text": "def returned; end", "title": "" }, { "docid": "d4b51441e9803335f40f611467a77896", "score": "0.6254868", "text": "def returned; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.6214408", "text": "def result; end", "title": "" }, { "docid": "c918c608568a07ccb7942829faf6d0ff", "score": "0.62111706", "text": "def result; end", "title": "" }, { "docid": "1377f42afce257a345c98e46db75416b", "score": "0.61603266", "text": "def call_or_value; end", "title": "" }, { "docid": "deb008afd2520c3b0d33f7921595aa15", "score": "0.6158377", "text": "def last_result; end", "title": "" }, { "docid": "deb008afd2520c3b0d33f7921595aa15", "score": "0.6158377", "text": "def last_result; end", "title": "" }, { "docid": "43a971e329cee954335ed6841a881b8d", "score": "0.61375016", "text": "def result ; end", "title": "" }, { "docid": "bc92d9e769de5b0c000ead784b6b5f0b", "score": "0.6108232", "text": "def retval; end", "title": "" }, { "docid": "bc92d9e769de5b0c000ead784b6b5f0b", "score": "0.6108232", "text": "def retval; end", "title": "" }, { "docid": "0667ff6517e8326adab43d49de502253", "score": "0.6086556", "text": "def get_value(p0, p1) end", "title": "" }, { "docid": "4c8ed4d0acf4838f2bc4a76d9aa145ca", "score": "0.60460526", "text": "def second()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "9100264f33cd3b88c425ce74d5342939", "score": "0.6044234", "text": "def next_result()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ae43cd0b58480edd1f9e64195f1da86c", "score": "0.60054576", "text": "def method2() end", "title": "" }, { "docid": "028e35d4af9ff401519fcecefad7abf0", "score": "0.6000006", "text": "def call1\n caller.size\n call2\n caller.size\nend", "title": "" }, { "docid": "2a6e508f96b12c7411570a1c3fc7f328", "score": "0.5981293", "text": "def method(a, b)\r\n\treturn a, b\r\nend", "title": "" }, { "docid": "2a6e508f96b12c7411570a1c3fc7f328", "score": "0.5981293", "text": "def method(a, b)\r\n\treturn a, b\r\nend", "title": "" }, { "docid": "2a6e508f96b12c7411570a1c3fc7f328", "score": "0.5981293", "text": "def method(a, b)\r\n\treturn a, b\r\nend", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.5949104", "text": "def call; end", "title": "" }, { "docid": "a2414c8cdf3afde3470d9e359d6a64ad", "score": "0.59388435", "text": "def call(a,b)\n\t\t\n\tend", "title": "" }, { "docid": "8a391425187ceff6461e558601ca3c06", "score": "0.5923666", "text": "def method_one; end", "title": "" }, { "docid": "91619f23da722c5330bba29155d587da", "score": "0.5910078", "text": "def my_second_method(num1, num2)\n number = num1 + num2\n puts number\nend", "title": "" }, { "docid": "ae6ae7b9991fb7bd204dbdc750ebcd1b", "score": "0.5900239", "text": "def method() end", "title": "" }, { "docid": "3a6c467b91b215d41d1bccfe04753402", "score": "0.5878678", "text": "def _return_value()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "9ee853e5ba249722f6bfacc1f524232f", "score": "0.5843946", "text": "def value() end", "title": "" }, { "docid": "92de995cee04073e7186e177704aba47", "score": "0.584188", "text": "def last_result\n # Interface method\n end", "title": "" }, { "docid": "140f4a1eb5e3eff23c019eebcc6433eb", "score": "0.58224493", "text": "def get_last_result( )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.57912254", "text": "def operations; end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.57912254", "text": "def operations; end", "title": "" }, { "docid": "e3457a9e0f867bd3dbaed6c6fcdb1fb7", "score": "0.57769036", "text": "def getSecond\n @second\n end", "title": "" }, { "docid": "9e54d2a46f439bb51da049ec504cc18c", "score": "0.57755905", "text": "def actual; end", "title": "" }, { "docid": "1c70e6bc54f6900b4a2c859a9e54f4b8", "score": "0.5765928", "text": "def method() 1 end", "title": "" }, { "docid": "1a16af3574807d28d5fce72587b576ef", "score": "0.57620245", "text": "def method(param_1, param_2)\n\n\t0\nend", "title": "" }, { "docid": "de88ac6d91b52902d222b846e8f92fcc", "score": "0.57615054", "text": "def last_value=(_arg0); end", "title": "" }, { "docid": "dbd2d9b822abe91d8ba9c0b907796d7e", "score": "0.5759876", "text": "def calldata(value); end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5758755", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5758755", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5758755", "text": "def operation; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.5758755", "text": "def operation; end", "title": "" }, { "docid": "3f8616b1d07a229912d449c023d6064c", "score": "0.57430905", "text": "def _get(_arg0); end", "title": "" }, { "docid": "6a2adede27d7d6fa1b479bfa9f91b501", "score": "0.57255477", "text": "def last_responses=(_arg0); end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" }, { "docid": "364004d9436f04b6a60bea0ff71669fd", "score": "0.5711395", "text": "def calldata; end", "title": "" } ]
e17cdea35ba1334cdb74fb946121ae0a
Returns a Hash with the limits for X and Y axis
[ { "docid": "8827912c9af686996c07f73781432b79", "score": "0.7269456", "text": "def edges\n { x: x_limits, y: y_limits }\n end", "title": "" } ]
[ { "docid": "0b6ce5f3275ecb4b677af9db1654d146", "score": "0.7849323", "text": "def x_limits\n { min: 0, max: @x-1 }\n end", "title": "" }, { "docid": "a67ee68dc1cb7d37fea140967686817b", "score": "0.729175", "text": "def bounds\n { x: [@attrs[:x1], @attrs[:x2]].max, y: [@attrs[:y1], @attrs[:y2]].max }\n end", "title": "" }, { "docid": "afa73b778e1c33845a006c30b765632a", "score": "0.7230963", "text": "def y_limits\n { min: 0, max: @y-1 }\n end", "title": "" }, { "docid": "e48fa656c4b118688ea69174afcbd139", "score": "0.70676374", "text": "def get_limits\n [@upper_limit, @lower_limit]\n end", "title": "" }, { "docid": "594673503baf69ec8bfc85d0df4e5756", "score": "0.7050273", "text": "def limits( )\n limits!\n mi = @min_stored_int * 1.0 / (1 << @frac_width)\n ma = @max_stored_int * 1.0 / (1 << @frac_width)\n\n [ mi, ma ]\n end", "title": "" }, { "docid": "3017cef21785341baeaf68deb42ddac8", "score": "0.6988344", "text": "def limits\n @limits ||= {}\n end", "title": "" }, { "docid": "79a0373321cb348c3e9e07c2a70ec188", "score": "0.6813782", "text": "def bounds\n { x: 0, y: 0 }\n end", "title": "" }, { "docid": "9e93dc0a1f4fe33727e6db5f7a8d5f58", "score": "0.669515", "text": "def bounds\n [xmin, ymin, xmax, ymax]\n end", "title": "" }, { "docid": "1038683a2e3883e92773a1c4feb2bdaa", "score": "0.6581149", "text": "def set_bounds()\n @x_max = @points.max {|a,b| a[0] <=> b[0] } [0]\n @y_max = @points.max {|a,b| a[1] <=> b[1] } [1]\n @x_min = @points.min {|a,b| a[0] <=> b[0] } [0]\n @y_min = @points.min {|a,b| a[1] <=> b[1] } [1]\n end", "title": "" }, { "docid": "fb6d117bbcc233642cce0d882dbcbf36", "score": "0.6519995", "text": "def bounds()\n a = Array.new\n minx, miny = ((2**31) - 1),((2**31) - 1)\n maxx, maxy = 0, 0\n @points.each {|x| (x.x > maxx) ? maxx = x.x : maxx = maxx; (x.y > maxy) ? maxy = x.y : maxy = maxy}\n @points.each {|x| (x.x < minx) ? minx = x.x : minx = minx; (x.y < miny) ? miny = x.y : miny = miny}\n a << minx << miny << (maxx - minx) << (maxy - miny) \n\n end", "title": "" }, { "docid": "17ef8976707ebd0a819fc7a3934a93ff", "score": "0.6472285", "text": "def bounds\n { x: @attrs[:cx] + @attrs[:r], y: @attrs[:cy] + @attrs[:r] }\n end", "title": "" }, { "docid": "fd112008209d2720e212675f0eeba72d", "score": "0.64634526", "text": "def get_cluster_domain_ranges\n domain_ranges = {}\n if !self.x_axis_min.nil? && !self.x_axis_max.nil? && !self.y_axis_min.nil? && !self.y_axis_max.nil?\n domain_ranges = {\n x: [self.x_axis_min, self.x_axis_max],\n y: [self.y_axis_min, self.y_axis_max]\n }\n if !self.z_axis_min.nil? && !self.z_axis_max.nil?\n domain_ranges[:z] = [self.z_axis_min, self.z_axis_max]\n end\n end\n domain_ranges\n end", "title": "" }, { "docid": "fd112008209d2720e212675f0eeba72d", "score": "0.64634526", "text": "def get_cluster_domain_ranges\n domain_ranges = {}\n if !self.x_axis_min.nil? && !self.x_axis_max.nil? && !self.y_axis_min.nil? && !self.y_axis_max.nil?\n domain_ranges = {\n x: [self.x_axis_min, self.x_axis_max],\n y: [self.y_axis_min, self.y_axis_max]\n }\n if !self.z_axis_min.nil? && !self.z_axis_max.nil?\n domain_ranges[:z] = [self.z_axis_min, self.z_axis_max]\n end\n end\n domain_ranges\n end", "title": "" }, { "docid": "984e486d5d1c69607fc33277f55ec41b", "score": "0.64470047", "text": "def bounds()\n coords = $slice.keys.to_set\n [\n coords.map { |pt| pt[0] }.min,\n coords.map { |pt| pt[0] }.max,\n coords.map { |pt| pt[1] }.min,\n coords.map { |pt| pt[1] }.max,\n ]\nend", "title": "" }, { "docid": "306d9f83eb67160b6d9e9acd6b5b8024", "score": "0.6432721", "text": "def bounds\n { x: @attrs[:cx] + @attrs[:rx], y: @attrs[:cy] + @attrs[:ry] }\n end", "title": "" }, { "docid": "4cd49aee5fcc470489c7173d16174870", "score": "0.634874", "text": "def limits=(limits)\n @@limits = limits&.with_indifferent_access\n end", "title": "" }, { "docid": "622a509253d67d223bdb263be1b2592c", "score": "0.63202876", "text": "def limits\n login\n\n uri = @services['compute'] + 'limits'\n\n body = request Net::HTTP::Get, uri\n\n limits = body['limits']\n\n @rate_limits = limits['rate']\n @absolute_limits = limits['absolute']\n\n limits\n end", "title": "" }, { "docid": "c9f1dedf95159bc98008eca0d26f344e", "score": "0.62627757", "text": "def absolute_limits\n @absolute_limits || limits['absolute']\n end", "title": "" }, { "docid": "5e04f0c7106828118f64a52b8c0c707a", "score": "0.623684", "text": "def limits; [Minuit.pout(@id)[3],Minuit.pout(@id)[4]].freeze; end", "title": "" }, { "docid": "74de177ebca51054ec4263d6274e01b7", "score": "0.62232554", "text": "def to_hash\n { \"min\" => min, \"max\" => max }\n end", "title": "" }, { "docid": "442dccc6e364fd9ec745df4bb07fe6dd", "score": "0.621911", "text": "def bounds\n @bounds\n end", "title": "" }, { "docid": "0b84fdc931533de212a16a1782ab3b4f", "score": "0.6214185", "text": "def bounds(coords)\n x_coords = coords.map { |coord| coord.first }\n y_coords = coords.map { |coord| coord.last }\n\n [x_coords.max, y_coords.max, x_coords.min, y_coords.min]\nend", "title": "" }, { "docid": "2d6ca31d0d3fc32f0716f7e4a43a7cd8", "score": "0.614692", "text": "def boundaries\n bounds = [mid_x - 2.0 * delta_max, mid_y - delta_max],\n \t\t\t [mid_x, mid_y + 2.0 * delta_max],\n \t [mid_x + 2.0 * delta_max, mid_y - delta_max]\n Matrix.from_array bounds\n end", "title": "" }, { "docid": "6141e2d3020add7b9ad1a8d77a40f78f", "score": "0.61403555", "text": "def bounds\n b = district.bounds\n center = Calculate.center(b)\n range = Calculate.range(b)\n half_edge = [range[:x], range[:y]].max\n edge = half_edge * 2\n {\n :min_x => center[:x] - half_edge,\n :min_y => center[:y] - half_edge,\n :max_x => center[:x] + half_edge,\n :max_y => center[:y] + half_edge,\n }\n end", "title": "" }, { "docid": "76fc4cc2927dbf6b76761e5e374d4e63", "score": "0.61143965", "text": "def limits=(limits); Minuit.set_lim(@id,limits[0],limits[1]); limits; end", "title": "" }, { "docid": "b332517e97e902d20ab6efa91d28fabd", "score": "0.60986054", "text": "def limits\n @@limits ||= load_config(limits_config)\n end", "title": "" }, { "docid": "03905514914d7329e8f148307b7c181e", "score": "0.6055301", "text": "def findMinMax\n # On the x-axis, we use the min date in seconds, and the day after the max date\n # to account of measures during the last day (e.g., maxDate @ 21:00)\n # For the y-axis, we scan the data to find the high/low values\n res = [@minDate.to_time.to_i, @xyPairs[0][1], (@maxDate+1).to_time.to_i, @xyPairs[0][1]]\n @xyPairs.each do |xy|\n res[1] = xy[1] if res[1] > xy[1]\n res[3] = xy[1] if res[3] < xy[1]\n end\n return res\n end", "title": "" }, { "docid": "ac4630b38dce9c050a70242df35b479f", "score": "0.6052395", "text": "def xValAxis; end", "title": "" }, { "docid": "ac4630b38dce9c050a70242df35b479f", "score": "0.6052395", "text": "def xValAxis; end", "title": "" }, { "docid": "d269d2ad322afcfbeb8d8bc376f2edf2", "score": "0.60071194", "text": "def geo_bounds_based_on_center\n viewport_radius_w = @viewport_w / 2\n viewport_radius_h = @viewport_h / 2\n max_lat = @center_lat + Rational(viewport_radius_h, pixel_per_lat)\n min_lat = @center_lat - Rational(viewport_radius_h, pixel_per_lat)\n max_long = @center_long + Rational(viewport_radius_w, pixel_per_long)\n min_long = @center_long - Rational(viewport_radius_w, pixel_per_long)\n @geo_bounds_based_on_center ||= {\n sw: [min_lat, min_long],\n ne: [max_lat, max_long]\n }\n end", "title": "" }, { "docid": "677f33557a1cea2cdb7f56c19813f6f5", "score": "0.59982246", "text": "def bounds\n return [Point.new(@c.x - @r, @c.y - @r), Point.new(@c.x + @r, @c.y + @r)]\n end", "title": "" }, { "docid": "af4cbd5917f3525a2a50643a2fe44efc", "score": "0.5996501", "text": "def bounds\n end", "title": "" }, { "docid": "49b2c7f651450b5594fbe70f18029a66", "score": "0.59928644", "text": "def y_range\n (y_min...y_max).to_a\n end", "title": "" }, { "docid": "223c9ff33bc01393a0faf4cd9ea237f5", "score": "0.5968633", "text": "def get_bounds stroke\n\t\t# Arrays for storing x and y values for the stroke currently being inspected\n\t\txvals = Array.new\n\t\tyvals = Array.new\n\n\t\tstroke.each_slice(3) do |point|\n\t\t\txvals.push(point[0])\n\t\t\tyvals.push(point[1])\n\t\tend\n\n\t\t# A temporary array that stores the min/max x/y for the stroke being inspected\n\t\tbounds = Array.new\n\t\tbounds << xvals.min << xvals.max << yvals.min << yvals.max\n\n\t\treturn bounds\n\tend", "title": "" }, { "docid": "a3b7b3ae607b94c55a9ee7878b528dba", "score": "0.59492636", "text": "def bounds; end", "title": "" }, { "docid": "482fa8a30958807ecede7aaf2b7b9a18", "score": "0.5942129", "text": "def set_limits\n\t\tsize.split('').each_with_index do |limit, index|\n\t\t\tif index.eql?(0)\n\t\t\t\tself.limit_x = limit.to_i\n\t\t\telsif index.eql?(1)\n\t\t\t\tself.limit_y = limit.to_i\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "6174137212f2728b2a7d990c35f1945b", "score": "0.5926661", "text": "def x_range\n (x_min...x_max).to_a\n end", "title": "" }, { "docid": "1dd4af011f44245aed26997707eb6365", "score": "0.5919493", "text": "def apply_limits(xo, yo, zo=nil)\r\n # - - - - - - - - - - - - - - - - - -\r\n if (yo > max_y)\r\n yo = max_y\r\n end #if\r\n if (yo < min_y)\r\n yo = min_y\r\n end #if\r\n\r\n\r\n if (xo > max_x)\r\n xo = max_x\r\n end #if\r\n if (xo < min_x)\r\n xo = min_x\r\n end #if\r\n\r\n if (zo != nil)\r\n if (zo > max_z)\r\n zo = max_z\r\n end #if\r\n if (zo < min_z)\r\n zo = min_z\r\n end #if\r\n end #if\r\n\r\n\r\n np = CNCPoint.new(xo,yo,zo)\r\n return np\r\n end", "title": "" }, { "docid": "bb94e127c21319d12f2ccd52c6696c11", "score": "0.5916803", "text": "def range\n @Y.keys\n end", "title": "" }, { "docid": "1c108246a3ab6f5232bf3acde92a164e", "score": "0.5913528", "text": "def extremes\n left = @position.x - @radius\n right = @position.x + @radius\n top = @position.y - @radius\n bottom = @position.y + @radius\n [left, right, top, bottom]\n end", "title": "" }, { "docid": "a6837ce91b6ae832a655f3b99d752a40", "score": "0.5904831", "text": "def min_max_to_xyz(min_x, min_y, max_x, max_y)\n @log.loginfo(\"TileEngine:min_max_to_xyz (#{min_x},#{min_y},#{max_x}, #{max_y})..\")\n dx = max_x - min_x\n dy = max_y - min_y\n\n zx = Math.log((@cfg['base_extents']['xmax'] - @cfg['base_extents']['xmin']) / dx) / Math.log(2)\n zy = Math.log((@cfg['base_extents']['ymax'] - @cfg['base_extents']['ymin']) / dy) / Math.log(2)\n\n x = (min_x - @cfg['base_extents']['xmin']) / dx\n y = (min_y - @cfg['base_extents']['ymin']) / dy\n\n x = x.to_i\n y = y.to_i\n\n @log.msgdebug(\"TileEngine:min_max_to_xyz:zlevels.. (#{zx},#{zy})..\")\n\n @log.msgdebug(\"TileEngine:min_max_to_xyz:results (#{x},#{y},#{zx})..\")\n [x, y, zx.to_i]\n end", "title": "" }, { "docid": "1c3167daafc51180716cdb6c2fc31763", "score": "0.5904416", "text": "def limits\n version_guard(29.0) { api_get(\"limits\").body }\n end", "title": "" }, { "docid": "c904f24732647d2da03a8ec37263f1e9", "score": "0.5891412", "text": "def vector_bounds\n match = /(?<=Extent:\\s).*?(?=\\n)/.match(doc)\n extent = match ? match[0] : \"\"\n\n # remove parens and spaces, split into array, and assign elements to variables\n w, s, e, n = extent.delete(\" \").gsub(\")-(\", \",\").delete(\"(\").delete(\")\").split(\",\")\n { north: n.to_f, east: e.to_f, south: s.to_f, west: w.to_f }\n end", "title": "" }, { "docid": "4842e16df265ceffb2fe0cc7b9098a43", "score": "0.589079", "text": "def get_limits\n lengths.map{|elem| elem[0]}.minmax\n end", "title": "" }, { "docid": "368c818b4b6a8d2c7b6aa358df0c610c", "score": "0.58813465", "text": "def x_range= xr\n @x_axis.min_val = xr[0]\n @x_axis.max_val = xr[1]\n end", "title": "" }, { "docid": "e20d057fb87c90b25f44046fa9422803", "score": "0.5838206", "text": "def field_limits\n {}\n end", "title": "" }, { "docid": "6cdc7ee01cc9b77db29b9edd672e8764", "score": "0.5823738", "text": "def bounds\n { x: @attrs[:x], y: @attrs[:y] + @attrs[:font_size].to_i }\n end", "title": "" }, { "docid": "87e24257309d23f25c0f5f5380f0e41d", "score": "0.5821002", "text": "def arguments_ranges(header, result_data)\n hash = {}\n header.each do |arg|\n param_data = result_data[arg]\n param_data = param_data.map { |param| param.to_f }\n hash[arg] = [param_data.min, param_data.max, param_data.max - param_data.min]\n end\n hash\n end", "title": "" }, { "docid": "0df51ddc648b701f544b5a12db94c623", "score": "0.5806642", "text": "def user_bounding_box\n [@user_xmin, @user_ymin, @user_xmax, @user_ymax]\n end", "title": "" }, { "docid": "91011c8ae1f3ddfb237d7a06951a0bcc", "score": "0.5806441", "text": "def x_val_axis; end", "title": "" }, { "docid": "91011c8ae1f3ddfb237d7a06951a0bcc", "score": "0.5806441", "text": "def x_val_axis; end", "title": "" }, { "docid": "fa95aacbcc35ec0f1e4d98d52e29c6f3", "score": "0.57973", "text": "def extremes\n point = @points[0]\n left = right = @position.x + point.x\n top = bottom = @position.y + point.y\n @points[1..-1].each do |point|\n x, y = (@position + point).to_a\n left = x if x < left\n right = x if x > right\n top = y if y < top\n bottom = y if y > bottom\n end\n [left, right, top, bottom]\n end", "title": "" }, { "docid": "9c4ffd2951a7fa63a7730734f7263fc0", "score": "0.57938987", "text": "def xmax\n @pos.x + (@w - @kx)/@scale\n end", "title": "" }, { "docid": "93fc89487621223385a1284accc26f25", "score": "0.57865137", "text": "def pixel_bounds_based_on_center\n viewport_radius_w = @viewport_w / 2\n viewport_radius_h = @viewport_h / 2\n @pixel_bounds_based_on_center ||= {\n sw: [pixel_coords[0] + viewport_radius_h, pixel_coords[1] - viewport_radius_w],\n ne: [pixel_coords[0] - viewport_radius_h, pixel_coords[1] + viewport_radius_w]\n }\n end", "title": "" }, { "docid": "bcfaecbfc5f7e5d26844f62c51d6e64b", "score": "0.57827085", "text": "def limits(options); end", "title": "" }, { "docid": "715fd1f37e73235add5d5838eb1c9a7a", "score": "0.57819", "text": "def min_max_to_xyz(min_x,min_y, max_x,max_y)\n @log.loginfo(\"TileEngine:min_max_to_xyz (#{min_x},#{min_y},#{max_x}, #{max_y})..\")\n dx = max_x - min_x\n dy = max_y - min_y\n \n zx = Math.log( (@cfg[\"base_extents\"][\"xmax\"] - @cfg[\"base_extents\"][\"xmin\"])/ dx) / Math.log(2)\n zy = Math.log( (@cfg[\"base_extents\"][\"ymax\"] - @cfg[\"base_extents\"][\"ymin\"])/ dy) / Math.log(2)\n \n x = (min_x - @cfg[\"base_extents\"][\"xmin\"])/dx\n y = (min_y - @cfg[\"base_extents\"][\"ymin\"])/dy \n \n x = x.to_i \n y = y.to_i \n \n \n @log.msgdebug(\"TileEngine:min_max_to_xyz:zlevels.. (#{zx},#{zy})..\")\n \n @log.msgdebug(\"TileEngine:min_max_to_xyz:results (#{x},#{y},#{zx})..\")\n return x,y,zx.to_i\n end", "title": "" }, { "docid": "07ab2e709a3016e177586e145cf3080e", "score": "0.57777137", "text": "def corrected_values\n Hash[@values.map do |key, value|\n next unless @defaults[key] && value\n\n if value > @defaults[key][:max]\n [key, @defaults[key][:max]]\n elsif value < @defaults[key][:min]\n [key, @defaults[key][:min]]\n end\n end.compact]\n end", "title": "" }, { "docid": "b2eb40c51e7482d300cc9dca13a1fccb", "score": "0.5774458", "text": "def xlimits_strings\n calculated_xlimits.map(&:to_s)\n end", "title": "" }, { "docid": "72520ba4b9de4a99ea7c675f0469fd41", "score": "0.57512003", "text": "def tile_meters_bounds(x, y, zoom)\n min_x, min_y = from_pixel_to_meters(x * TILE_SIZE, y * TILE_SIZE, zoom)\n max_x, max_y = from_pixel_to_meters((x + 1) * TILE_SIZE, (y + 1) * TILE_SIZE, zoom)\n [ min_x, min_y, max_x, max_y ]\n end", "title": "" }, { "docid": "bbc25e04202ac7e100d32c83095525bf", "score": "0.57389015", "text": "def y_range; end", "title": "" }, { "docid": "b75d0ebd180db03b46ca8fec6f78413e", "score": "0.5736263", "text": "def get_parameters\n output = {}\n\n output[:x_min] = self.points.min_by { |p| p.x }.x\n output[:x_max] = self.points.max_by { |p| p.x }.x\n output[:y_min] = self.points.min_by { |p| p.y }.y\n output[:y_max] = self.points.max_by { |p| p.y }.y\n\n output[:width] = (output[:x_max] - output[:x_min] + 2 * self.padding).ceil\n output[:height] = (output[:y_max] - output[:y_min] + 2 * self.padding).ceil\n\n output[:x_offset] = output[:x_min] - self.padding\n output[:y_offset] = output[:y_min] - self.padding\n\n output\n end", "title": "" }, { "docid": "05b816c2fe2b206a39b093a8998e1aea", "score": "0.57274306", "text": "def bounding_range(val) check_pre(val.range2d?); Range2d[self.first.bounding_range(val.first),self.last.bounding_range(val.last)] end", "title": "" }, { "docid": "a0f6a7e68febac0856d941eb015fd618", "score": "0.5719049", "text": "def limits_for_form\n available_limits.collect{|x| x.fetch(:value, nil)}.reject(&:nil?) || []\n end", "title": "" }, { "docid": "7f5e6c0322c656022e11b8e327046384", "score": "0.5718757", "text": "def boundaries p_x, p_y\n\n # We build up a list of boxes to represent the boundaries. These may (will?) overlap\n boxes = []\n\n # Apply the offset\n @boundaries.each do | boundary |\n boxes << {\n x1: boundary[:x1] + p_x, y1: boundary[:y1] + p_y,\n x2: boundary[:x2] + p_x, y2: boundary[:y2] + p_y,\n x3: boundary[:x3] + p_x, y3: boundary[:y3] + p_y,\n x4: boundary[:x4] + p_x, y4: boundary[:y4] + p_y\n }\n end\n\n boxes\n\n end", "title": "" }, { "docid": "aa5204838721bea9db6158b64e3da4b1", "score": "0.5718109", "text": "def bounds\n return @bounds if @bounds\n\n tc = [p1, p2, p3]\n xmm = tc.map(&:x).minmax\n ymm = tc.map(&:y).minmax\n zmm = tc.map(&:z).minmax\n Bounds.new(Tuple.point(xmm.first, ymm.first, zmm.first),\n Tuple.point(xmm.last, ymm.last, zmm.last))\n end", "title": "" }, { "docid": "269c2e5f584abdb5e194586864fe10f5", "score": "0.57073987", "text": "def bounding_range(val) check_pre(val.range1d?); Range1d[(self.first.min(val.first)),(self.last.max(val.last)) ] end", "title": "" }, { "docid": "0054b6e1cbb194b6986131ebcde31e2c", "score": "0.57072747", "text": "def yValAxis; end", "title": "" }, { "docid": "0054b6e1cbb194b6986131ebcde31e2c", "score": "0.57072747", "text": "def yValAxis; end", "title": "" }, { "docid": "41a5286530b75e147d9ba7cf1c9838e5", "score": "0.5698037", "text": "def bounds(values)\n q1 = values.percentile(25)\n q3 = values.percentile(75)\n iqr = q3 - q1\n lower = q1 - (iqr * 1.5)\n upper = q3 + (iqr * 1.5)\n inrange = values.select { |v| v >= lower && v <= upper }\n lower = [lower, inrange.min].max\n upper = [upper, inrange.max].min\n belowrange = values.select { |v| v < lower }\n aboverange = values.select { |v| v > upper }\n [belowrange, lower, upper, aboverange]\nend", "title": "" }, { "docid": "55b78c5af9dce5f9e9fee74b79920bcc", "score": "0.5637793", "text": "def inside_limits?(x, y)\n x >= 0 && x <= 7 && y >= 0 && y <= 7\n end", "title": "" }, { "docid": "b74be539a7545de4b6b4e1c4f26eceb0", "score": "0.56289387", "text": "def relative_min_max( )\n limits!\n [ @min_assigned_int.to_f/@min_stored_int.to_f, @max_assigned_int.to_f/@max_stored_int.to_f ] \n end", "title": "" }, { "docid": "0398fa2197026f801c6b6f2e8f563838", "score": "0.5623431", "text": "def inner_bounds_coordinates\n ox, oy, ow, oh = bounds_coordinates\n [\n ox + left_padding,\n oy + top_padding,\n ow - left_padding - right_padding,\n oh - top_padding - bottom_padding\n ] \n end", "title": "" }, { "docid": "a513340f694be22ce8f2d50d58aea647", "score": "0.5620552", "text": "def boundaries\n self.content.values\n end", "title": "" }, { "docid": "74fe53a9fc11c6d1b188543b03dbe51f", "score": "0.56189656", "text": "def boundaries\n @boundaries ||= ((0 + padding)..(size + padding))\n end", "title": "" }, { "docid": "3e9e73412756ca3736aa882d3dfc71b0", "score": "0.56059444", "text": "def bounds\n @bounds ||= Coordinate.new(columns, rows)\n end", "title": "" }, { "docid": "2fbf62fc8b7a528116b02a0071993d1b", "score": "0.5605565", "text": "def set_range(inputs)\n # select coordinate axes from inputs\n domain_keys = inputs.map(&:keys).flatten.uniq.select {|i| [:x, :y, :z].include?(i)}\n range = Hash[domain_keys.zip]\n if @cluster.has_range?\n # use study-provided range if available\n range = @cluster.domain_ranges\n else\n # take the minmax of each domain across all groups, then the global minmax\n @vals = inputs.map {|v| domain_keys.map {|k| RequestUtils.get_minmax(v[k])}}.flatten.minmax\n # add 2% padding to range\n scope = (@vals.first - @vals.last) * 0.02\n raw_range = [@vals.first + scope, @vals.last - scope]\n range[:x] = raw_range\n range[:y] = raw_range\n range[:z] = raw_range\n end\n range\n end", "title": "" }, { "docid": "3e922f66dbc9607d8f8191f6c275c190", "score": "0.5602437", "text": "def to_h\n { min_lat_lng: min.to_h, max_lat_lng: max.to_h }\n end", "title": "" }, { "docid": "2ebc37c8ac9320fcb32208315bc8d840", "score": "0.5590192", "text": "def maxpos\n v, opts = max :x => true, :y => true\n x = opts['x']\n y = opts['y']\n return v, x, y\n end", "title": "" }, { "docid": "2ebc37c8ac9320fcb32208315bc8d840", "score": "0.5590192", "text": "def maxpos\n v, opts = max :x => true, :y => true\n x = opts['x']\n y = opts['y']\n return v, x, y\n end", "title": "" }, { "docid": "33d5f796c947bf13eb511345001dc20a", "score": "0.5587818", "text": "def init_limits(config_limits = nil)\n\n\n if Rectangle.valid_limits?(config_limits)\n @limits = @@screen_rect.limit(config_limits)\n Logger.debug(\"#{self} initialized limits #{@limits} by limiting #{@@screen_rect} with #{config_limits}.\")\n return\n end\n\n excess_limits = 20\n @limits = @@screen_rect.expand(self.rectangle).expand!(excess_limits)\n Logger.debug(\"#{self} initialized limits #{@limits} by expanding #{@@screen_rect} with #{self.rectangle} & excess: #{excess_limits}\")\n\n end", "title": "" }, { "docid": "aa87ab2dea62d487a2b57b8b80281d2b", "score": "0.55802506", "text": "def get_bounds\t\t\t\n\t\t\tbounds = @model.bounds\n\t\t\tmodel_bounds = {\n\t\t\t\t:pt0 => from_inch_to_model_units(bounds.corner(0).to_a),\n\t\t\t\t:pt1 => from_inch_to_model_units(bounds.corner(1).to_a),\n\t\t\t\t:pt2 => from_inch_to_model_units(bounds.corner(3).to_a),\n\t\t\t\t:pt3 => from_inch_to_model_units(bounds.corner(2).to_a),\n\t\t\t\t:pt4 => from_inch_to_model_units(bounds.corner(4).to_a),\n\t\t\t\t:pt5 => from_inch_to_model_units(bounds.corner(5).to_a),\n\t\t\t\t:pt6 => from_inch_to_model_units(bounds.corner(7).to_a),\n\t\t\t\t:pt7 => from_inch_to_model_units(bounds.corner(6).to_a)\n\t\t\t}\n\t\t\treturn M_foamKit::M_calculations.round_bounds(model_bounds)\n\t\tend", "title": "" }, { "docid": "a322add0896fd2b1e16ac4ad7da72606", "score": "0.55742896", "text": "def api_limits\n return @opts['api_limits']\n end", "title": "" }, { "docid": "61a17cb185dedb4e452d8dc92ea78f0b", "score": "0.557414", "text": "def set_bounds\n @x_max = (@map_worldmap.width - 2 * BitmapOffset) / TileSize\n @y_max = (@map_worldmap.height - 2 * BitmapOffset) / TileSize\n end", "title": "" }, { "docid": "112fc2efde8e1138fc0738157d97b4c8", "score": "0.5570747", "text": "def bounds\n empty? ? nil : min...max\n end", "title": "" }, { "docid": "d48b3548aab956bd111cf5ef07fa206b", "score": "0.55492365", "text": "def x_span\n @max_x ? @max_x - @min_x : 0\n end", "title": "" }, { "docid": "d48b3548aab956bd111cf5ef07fa206b", "score": "0.55492365", "text": "def x_span\n @max_x ? @max_x - @min_x : 0\n end", "title": "" }, { "docid": "b2f0a95de55c2453f59ec0918748c0d0", "score": "0.55438006", "text": "def bounds\n return [] unless @gapi.bounding_poly\n @bounds ||= Array(@gapi.bounding_poly.vertices).map do |v|\n Vertex.from_gapi v\n end\n end", "title": "" }, { "docid": "460e2e4e40fc017735c54164f5b63442", "score": "0.55367666", "text": "def to_a\n [@min_x, @min_y, @max_x, @max_y]\n end", "title": "" }, { "docid": "0e54974d777195737bebd1b08f4e932a", "score": "0.5533136", "text": "def coordinate_bounds(sprite, axis)\n axis_sprites = (scene_size[axis.to_sym] / sprite.size.method(axis).call).to_i\n reverse_size = axis == \"width\" ? scene_size[:height] : scene_size[:width]\n\n coordinates = []\n\n 2.times do |bound|\n bound_coordinate = bound == 0 ? bound : reverse_size\n\n axis_sprites.times do |axis_sprite|\n coordinates << if axis == \"width\"\n [axis_sprite * sprite.size.width, bound_coordinate]\n else\n [bound_coordinate, axis_sprite * sprite.size.height]\n end\n end\n end\n\n coordinates\n end", "title": "" }, { "docid": "fc374d1c0eda5bf30b1c8515e1dc5cad", "score": "0.5526427", "text": "def to_array\n [{:xmin => xmin, :ymin => ymin, :xmax => xmax, :ymax => ymax}]\n end", "title": "" }, { "docid": "0d26907facdad46eee0eed0f18236c83", "score": "0.5518833", "text": "def minMaxX\n\t\thighest = @voxels[0].x\n\t\tlowest = @voxels[0].x\n\t\tfor v in @voxels\n\t\t\tif highest < v.x\n\t\t\t\thighest = v.x\n\t\t\tend\n\n\t\t\tif lowest > v.x\n\t\t\t\tlowest = v.x\n\t\t\tend\n\t\tend\n\t\treturn [lowest,highest]\n\tend", "title": "" }, { "docid": "d4da639ec6ff6baf4bb4f0249aa81ba8", "score": "0.5515493", "text": "def bounds\n Enumerator.new do |yielder|\n offsets.each do |offset|\n yielder << [offset, batch_size]\n end\n end\n end", "title": "" }, { "docid": "fbcb946a8ea79d174fc4fe1bcc03ba5e", "score": "0.55093837", "text": "def limit\n if @start_idx > 0\n { :limit => @limit, :offset => @start_idx }\n else\n { :limit => @limit }\n end\n end", "title": "" }, { "docid": "86b1c989a67df6f90de048fc5ff6c633", "score": "0.5507071", "text": "def bounding_range(r2)\nRange2d[self.x_range.bounding_range(r2.x_range), self.y_range.bounding_range(r2.y_range)]\nend", "title": "" }, { "docid": "b9dcaeea620aa1d6338b358075c9fe96", "score": "0.5499038", "text": "def calculate_new_bounds(dimensions)\n px = Utils.pixel_coord(@center[0], @center[1], zoom)\n\n top_left_px = [\n px[0] - (dimensions[0] / 2),\n px[1] - (dimensions[1] / 2)\n ]\n bottom_right_px = [\n px[0] + (dimensions[0] / 2),\n px[1] + (dimensions[1] / 2)\n ]\n\n top_left_ll = Utils.ll_coord(top_left_px[0], top_left_px[1], zoom)\n bottom_right_ll = Utils.ll_coord(bottom_right_px[0], bottom_right_px[1], zoom)\n\n bounds = [\n top_left_ll[0],\n bottom_right_ll[1],\n bottom_right_ll[0],\n top_left_ll[1]\n ]\n\n bounds\n end", "title": "" }, { "docid": "e0145084e64c2dc637faf9fa5134ce16", "score": "0.5498689", "text": "def projection_limits_window\n if @projector\n unless defined?(@projection_limits_window)\n @projection_limits_window = @projector.limits_window\n end\n @projection_limits_window\n end\n end", "title": "" }, { "docid": "961c3a31e5cb39394fd275041c48c100", "score": "0.54949147", "text": "def to_hash\n super.merge({\n minimum: @range.min,\n maximum: @range.max\n }).freeze\n end", "title": "" }, { "docid": "0e8229d3764d1af7b2fa618fc6335476", "score": "0.54933685", "text": "def boundingbox_range(item)\r\n range = 32\r\n {\r\n bl: RQuad::Vector.new([item.vector.x - range, 0].max, [item.vector.y + range, @height].min),\r\n tr: RQuad::Vector.new([item.vector.x + range, @width].min, [item.vector.y - range, 0].max)\r\n }\r\n end", "title": "" }, { "docid": "ee32085c14c6d64439d23c3b5d73c946", "score": "0.5483949", "text": "def set_bounds #returns range of x and range of y to check for possible reincarnation of dead cells\n\t\tself.bounds = []\n\t\tx=[]\n\t\ty=[]\n\t\tself.world.each do |cell|\n\t\t\tx<< cell.x\n\t\t\ty<< cell.y\n\t\tend\n\n\t\tself.bounds << x.min-1<< x.max+1 << y.min-1 << y.max+1\n\tend", "title": "" }, { "docid": "e3b7263f845e7a8e3ae289d72edf1783", "score": "0.5482587", "text": "def bin_limits(bins)\n bmin,bmax = 1e30,0\n bins.each{|bin|\n match,mean,min,max,title = bin_info(bin)\n bmin = min if min < bmin\n bmax = max if max > bmax\n }\n [bmin,bmax] \nend", "title": "" } ]
5a40dc3885ca9a5282d790e206a119a0
Lists current resolver tests
[ { "docid": "4adcb66bef26f461c2700d716b5f7066", "score": "0.594473", "text": "def tests(test_name=nil)\n unless test_name\n @registered_blocks[:test] ||= []\n else\n return @registered_blocks[:test].find do |registered_test|\n registered_test[:name] == test_name\n end\n end\n end", "title": "" } ]
[ { "docid": "807d454ff72dfe727bae6ca11b7f3495", "score": "0.7679375", "text": "def list_tests\n _requirement_hook { @test_collection.list_remote }\n end", "title": "" }, { "docid": "759493987a8c4c006cc338a9577f484f", "score": "0.70159394", "text": "def list_remote\n requirement_hook{ @testlink.list_testcases(self) }\n end", "title": "" }, { "docid": "d7546394770c10df11dae834d32de15d", "score": "0.6653512", "text": "def tests\n @tests ||= []\n end", "title": "" }, { "docid": "d7546394770c10df11dae834d32de15d", "score": "0.6653512", "text": "def tests\n @tests ||= []\n end", "title": "" }, { "docid": "fdcdb9f357c676ceec804cd64df42643", "score": "0.6649564", "text": "def tests\n @tests ||= []\n end", "title": "" }, { "docid": "af0f0c15fe8f666ce2831191c11a47fb", "score": "0.6552226", "text": "def tests\n @tests.keys\n end", "title": "" }, { "docid": "8088c09316ab8a428c3604922d31749a", "score": "0.650479", "text": "def tests\n IR.find_tests(results).flatten\n end", "title": "" }, { "docid": "8088c09316ab8a428c3604922d31749a", "score": "0.650479", "text": "def tests\n IR.find_tests(results).flatten\n end", "title": "" }, { "docid": "d92163d50ff4c3e130c012d9de1d7741", "score": "0.6432966", "text": "def discover_tests\n TestsSuite.tests\n end", "title": "" }, { "docid": "5a031d125f9483ebb460cc2fa1ba6b66", "score": "0.63773155", "text": "def index\n @admin_tests = ::Test.all\n end", "title": "" }, { "docid": "2263bdb03be0c86853b6506969081934", "score": "0.6356398", "text": "def index\n @tests = current_user.test.all\n end", "title": "" }, { "docid": "daab87a48f08e2e45744b8dab6d5953a", "score": "0.633461", "text": "def index\n $logger.debug{\"Test index.\"}\n @tests = Test.all\n end", "title": "" }, { "docid": "e88d0924e2bd8a56b924b1492b3a23de", "score": "0.6326875", "text": "def test_suite_list(_)\n test_suites = TestSuitePrivate.all_test_suites(@path_to)\n @console.info self, TestSuitePrivate.table(test_suites)\n end", "title": "" }, { "docid": "c8e45992911d3870ec5958b989446747", "score": "0.6296003", "text": "def index\n @tests_executors = TestsExecutor.all\n end", "title": "" }, { "docid": "05aa73202af7aa1bf57dd9f656622425", "score": "0.62932056", "text": "def tests\n ensure_valid\n @tests.keys\n end", "title": "" }, { "docid": "05aa73202af7aa1bf57dd9f656622425", "score": "0.62932056", "text": "def tests\n ensure_valid\n @tests.keys\n end", "title": "" }, { "docid": "d501e6a8bd6a1bc43dacaec61e0bf2bc", "score": "0.62610334", "text": "def tests\n return @tests.keys\n end", "title": "" }, { "docid": "159e16ddaec4a67f02e775e4390e77e5", "score": "0.6247607", "text": "def tests\n if test?\n @@tests\n end\n end", "title": "" }, { "docid": "71c0790113ff43965254b4fada89f7bc", "score": "0.62419236", "text": "def sites\n get('visitorTrackingTests').collect {|x| x[0]}\n end", "title": "" }, { "docid": "496ef049a6004b443e18ea1185446b22", "score": "0.62139404", "text": "def test_names\n @test_names ||= tests&.map { |test| test[:selector] }\n end", "title": "" }, { "docid": "1fb83e6c1694a9f2b4f44ec12364b450", "score": "0.6192738", "text": "def testDetailedList\n executeInstall(['--detailedlist'])\n end", "title": "" }, { "docid": "cb0d9d0b103f437a8a2fa5dc6bb8f1a2", "score": "0.61749834", "text": "def test_names\n @test_names ||= tests&.map { |test| test[:selector] }\n end", "title": "" }, { "docid": "601926fc30787dbda87a9a7776ab25cb", "score": "0.61703455", "text": "def test_e()\n pp [:test_e, ItkOacis::HostStub.getHostListInGroup(\"local_group\")] ;\n end", "title": "" }, { "docid": "726a6f18d48763b1592041c91fa85272", "score": "0.6151017", "text": "def index\n @realtests = Realtest.all\n @applications = Application.all\n @platforms = Platform.all\n @features = Feature.all\n @publishers = Publisher.all\n end", "title": "" }, { "docid": "301f6b6931410d162999e21f8b8fc8ed", "score": "0.6149119", "text": "def test_a()\n pp [:test_a, ItkOacis::HostStub.getHostNameList()] ;\n end", "title": "" }, { "docid": "1a3ea19ce4ee511458b4c53177224ff4", "score": "0.614469", "text": "def test_searchList\r\n end", "title": "" }, { "docid": "8c57500e04f8365278f59e771433b778", "score": "0.6121569", "text": "def run_tests(resolver)\n @logger.update line_item(resolver.class.demodulized_name, resolver.current_branch,'TESTING','0','-')\n \n resolver.class.before_filters(:test).each{|p| p.call}\n resolver.test!{|pct| \n @logger.update line_item(resolver.class.demodulized_name, resolver.current_branch,'TESTING',pct.to_s,'-')\n }\n resolver.class.after_filters(:test).each{|p| p.call}\n end", "title": "" }, { "docid": "ffa969d445f8d502b9f7535b5b869c12", "score": "0.61192954", "text": "def discover_tests\n InGameTestsSuite.tests\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "b186f23a905bdab62a8fe7ec5f94dfce", "score": "0.61054754", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "cccb71b6e6f8cf1d0e31989e18ba4957", "score": "0.609708", "text": "def index\n @test_runs = TestRun.all\n end", "title": "" }, { "docid": "a6a9a76846b7902abe36ba8b3a3763db", "score": "0.6096134", "text": "def index\n @projects = projects_for_testers(current_tester)\n end", "title": "" }, { "docid": "44189a4dd4168b3b3c6c2334995e208b", "score": "0.60930383", "text": "def test_f()\n pp [:test_f, ItkOacis::HostStub.getHostNameListInGroup(\"local_group\")] ;\n end", "title": "" }, { "docid": "2c1bd942da85fd2b2a747f1214f54c9d", "score": "0.6079357", "text": "def tests\n return Array.new\n end", "title": "" }, { "docid": "2c1bd942da85fd2b2a747f1214f54c9d", "score": "0.6079357", "text": "def tests\n return Array.new\n end", "title": "" }, { "docid": "d0491b36b7811691c3d173050e7f327b", "score": "0.60701144", "text": "def index\n @testers = Tester.all\n end", "title": "" }, { "docid": "a5d4b094def9c67f46c66a0d728db7f9", "score": "0.6051244", "text": "def index\n @test_suites = TestSuite.all\n end", "title": "" }, { "docid": "807728f934add34187f7b33396cff323", "score": "0.60440505", "text": "def index\n @test_suite_results = TestSuiteResult.all\n end", "title": "" }, { "docid": "ca615498f2ea96e720b81be669d3e54e", "score": "0.6029778", "text": "def index\n @automated_tests = AutomatedTest.all\n end", "title": "" }, { "docid": "ca615498f2ea96e720b81be669d3e54e", "score": "0.6029778", "text": "def index\n @automated_tests = AutomatedTest.all\n end", "title": "" }, { "docid": "561f2687552677561afe569de7a33835", "score": "0.60084665", "text": "def active_tests\n tests.active\n end", "title": "" }, { "docid": "06e6a15c716b388208f745d33a9815b8", "score": "0.60083807", "text": "def list(pipeline_id)\n @client.test_run.list(pipeline_id)\n end", "title": "" }, { "docid": "c1378366b746b170e86c67340f3dc12e", "score": "0.5997405", "text": "def index\n @tests = Test.all\n end", "title": "" }, { "docid": "d68411d7ecbd14638be87cc26ff20cce", "score": "0.59959006", "text": "def index\n @api_tests = ApiTest.all\n end", "title": "" }, { "docid": "f09964f784abe7277d26b1e084745bac", "score": "0.59860075", "text": "def tests\n @connections.map do |connection|\n connection.requests.map do |request|\n request.tests.map { |test| test }\n end\n end.flatten\n end", "title": "" }, { "docid": "008c118f66437b30ab6219e2d259fdc4", "score": "0.59847575", "text": "def test_executor_list\n metadata = Crucible::Tests::Executor.list_all(false, true)\n assert !metadata.blank?, 'Failed to gather Suite & TestScript metadata.'\n end", "title": "" }, { "docid": "ee0171e58b44f457681bfdd10a18782b", "score": "0.59591025", "text": "def tests\n @tests.map do |test|\n Test.new(@data, test)\n end\n end", "title": "" }, { "docid": "ee0171e58b44f457681bfdd10a18782b", "score": "0.59591025", "text": "def tests\n @tests.map do |test|\n Test.new(@data, test)\n end\n end", "title": "" }, { "docid": "da318b4f37a826b95241b132af220794", "score": "0.5955882", "text": "def index\n @creatinine_tests = CreatinineTest.all\n end", "title": "" }, { "docid": "af0be8dcde51bb3e1ede919a8aea6d89", "score": "0.59545386", "text": "def show(arg = nil)\n selected_tests = resolve_tests(arg)\n selected_tests.map(&:all_log).each { |log| puts log }\n nil\n end", "title": "" }, { "docid": "1ec7203033b0b51fe0f0db7f5320d773", "score": "0.59539175", "text": "def list_projects\n _requirement_hook { @testlink.find_projects(/\\w/) }\n end", "title": "" }, { "docid": "18b1a8c948206212094220713e332bd0", "score": "0.5953542", "text": "def index\n @test_configs = TestConfig.all\n end", "title": "" }, { "docid": "a09ea660b78ed3a7ea666fa413ed9800", "score": "0.59425086", "text": "def test_testscript_list\n metadata = Crucible::Tests::TestScriptEngine.list_all(true)\n assert !metadata.blank?, 'Failed to gather TestScriptEngine metadata.'\n end", "title": "" }, { "docid": "bb6d60c792a99068865d54f3b967913d", "score": "0.59312665", "text": "def index\n @test_registrations = TestRegistration.all\n end", "title": "" }, { "docid": "338d2c7caef52a8d6d59285a5780c148", "score": "0.59288013", "text": "def test_suites\n TestSuiteModelItem.list(self.root)\n end", "title": "" }, { "docid": "7eef2b515c4c34bed58dd7ac906e9d00", "score": "0.5925988", "text": "def test_g()\n pp [:test_g, ItkOacis::HostStub.getHostAndGroupNameList()] ;\n end", "title": "" }, { "docid": "66910376c3606e6f370bf49e05b56799", "score": "0.59248495", "text": "def testListShort\n executeInstall(['-l'])\n end", "title": "" }, { "docid": "b423985a860228428404cf637967b040", "score": "0.59078133", "text": "def test_names\n test_scenarios.collect{|t| t.name}\n end", "title": "" }, { "docid": "f7c0632309584cbf42a30ac6ce085d3a", "score": "0.59013313", "text": "def collect_tests\n # get local tests and get run list of profiles\n (local_suite_files + resolve_config_inspec_tests).compact.uniq\n end", "title": "" }, { "docid": "40eea34a13a34c9905788bde8713bbf7", "score": "0.58994323", "text": "def index\n @test_sets = TestSet.all\n end", "title": "" }, { "docid": "13bc7ae880bfeac281eb7da16deb84c9", "score": "0.58988047", "text": "def test_user_list\n return @test_users\n \n\tend", "title": "" }, { "docid": "6d301ea2c6491c04f8a7e12db485db99", "score": "0.5884811", "text": "def list_testplans(full=false)\n _requirement_hook do\n project_id = @testlink.project_id_from_name(self.project)\n res = @testlink.find_test_plans_for_project_id(project_id,/\\\\w/)\n return res\n end\n end", "title": "" }, { "docid": "444dc94e8d69828c91c1b243019cbdc4", "score": "0.58837676", "text": "def tests\n @test_definitions.collect do |test_definition|\n Test.new(self, test_definition)\n end\n end", "title": "" }, { "docid": "6faad1f63e8011e0120a0ea335ead8fc", "score": "0.588188", "text": "def index\n @test_groups = TestGroup.all\n end", "title": "" }, { "docid": "6faad1f63e8011e0120a0ea335ead8fc", "score": "0.588188", "text": "def index\n @test_groups = TestGroup.all\n end", "title": "" }, { "docid": "dcf63f25ee489feb688539e3c708d454", "score": "0.5879905", "text": "def index\n @test_results = TestResult.all\n end", "title": "" }, { "docid": "9bf45d81288224435d5e14d5fdbd7aa9", "score": "0.5873285", "text": "def index\n @fake_dns_servers = FakeDnsServer.order('name')\n end", "title": "" }, { "docid": "4e7af16f71a5af2824d1301c9de859ba", "score": "0.585351", "text": "def all_tests\n EMPTY_ARRAY\n end", "title": "" }, { "docid": "7a53fa77cfb8c087ce5e9badc87169fa", "score": "0.5850654", "text": "def show\n @results = {}\n @execution.results.each do |r|\n if @results.key?(r.check_list.suite.title)\n @results[r.check_list.suite.title] << r\n else\n @results[r.check_list.suite.title] = [r]\n end\n end\n puts @results\n @types = ExecutionTypes.all\n @test_objects = TestObject.where(component_id: @current_state.component)\n end", "title": "" }, { "docid": "252a648715ad50d6d7d4ba7d7707bb61", "score": "0.5843734", "text": "def index\n @testing_frameworks = TestingFramework.all\n end", "title": "" }, { "docid": "a09e92ee9307b4a52c97e0626af7e1a7", "score": "0.5831165", "text": "def index\n @testts = Testt.all\n end", "title": "" }, { "docid": "be73e7b480b8460b7e0c49ccb217f2e2", "score": "0.5830551", "text": "def tests\n @tests ||= tests_with_context.map do |filename, context|\n Test.new(filename, context)\n end\n end", "title": "" }, { "docid": "d94549abeb07a3c32c5f8181e562b411", "score": "0.5828765", "text": "def index\n @test_kinds = TestKind.all\n end", "title": "" }, { "docid": "3f7f1929c4edce1ccc1d33d53aab4d03", "score": "0.5828023", "text": "def tests\n @tests.map do |test|\n Mongo::CRUD::CRUDTest.new(self, @data, test)\n end\n end", "title": "" }, { "docid": "fe41514f2ca3b2d63086c5470de7c010", "score": "0.58263814", "text": "def test_a()\n pp [:test_a, ItkOacis::SimulatorStub.getSimulatorNameList()] ;\n end", "title": "" }, { "docid": "ca910472dc750715bd6ef575861284ce", "score": "0.58257234", "text": "def test_c()\n pp [:test_c, ItkOacis::HostStub.getHostGroupNameList()] ;\n end", "title": "" }, { "docid": "0fc529b604d462299101ec3a173a6747", "score": "0.5812121", "text": "def testmethods\n @test_methods ||= []\n end", "title": "" }, { "docid": "0fc529b604d462299101ec3a173a6747", "score": "0.5812121", "text": "def testmethods\n @test_methods ||= []\n end", "title": "" }, { "docid": "f24b8b08177b9f70ff7c9ead24d9a544", "score": "0.5809895", "text": "def listTestMethods()\n _r = [] ;\n self::Singleton.methods(true).each{|_method|\n _r.push(_method.to_s) if(_method.to_s =~ /^test_/) ;\n }\n return _r ;\n end", "title": "" }, { "docid": "9903b42bc01b7ae09db7019ef1d9d281", "score": "0.5801189", "text": "def tests(param = nil)\n if param\n raise ConfigurationException.new(\"'tests' is not a valid name for a test.\")\n end\n return @suite.tests\n end", "title": "" }, { "docid": "f7b8ee061886816e3224074f8deb1d3f", "score": "0.57898456", "text": "def test_list_page_for_current\n end", "title": "" }, { "docid": "cdf5829d08892eec8c8eef2b947ea28c", "score": "0.5786582", "text": "def index\n @testsets = Testset.all\n end", "title": "" }, { "docid": "4291c6814e3d4100c3e6e9754c75b74b", "score": "0.5785357", "text": "def test_cases\n all(QTest::TestCase,\n project: @project.id,\n module: @id)\n end", "title": "" }, { "docid": "5c6c0113c21345d95dcc64705af3c23d", "score": "0.5783316", "text": "def generate_results(resolver)\n if !self[:resolve] || resolver.class.resolutions.empty?\n _num_failed = resolver.failed.size\n \n @logger.display line_item(resolver.class.demodulized_name, resolver.current_branch,'TESTING','100',\"Failed: #{_num_failed}\",(_num_failed > 0 ? :red : :green))\n else #resolve and update interface\n _num_unresolved = resolver.unresolved.size\n \n @logger.display line_item(resolver.class.demodulized_name, resolver.current_branch,'RESOLVING','100',\"Unresolved: #{_num_unresolved}\",(_num_unresolved > 0 ? :red : :green))\n end\n end", "title": "" }, { "docid": "26d954aa6cab231dcc6941b1f5ae4e01", "score": "0.5780712", "text": "def test_runs\n all(QTest::TestRun, project: @project.id, test_suite: @id)\n end", "title": "" }, { "docid": "1732337ebefb4f5abdb6833ce6f8bafc", "score": "0.5776944", "text": "def test_list\n opts = { :controller => 'auto_admin', :action => 'list', :model => 'user', :id => nil }\n assert_routing url_for( opts ), opts\n end", "title": "" }, { "docid": "3ba051246580e24b36cf4d70f467cfec", "score": "0.57751817", "text": "def index\n @gives_tests = GivesTest.all\n end", "title": "" }, { "docid": "ee3a8cdc8426a2005357a389d1db04cc", "score": "0.57731724", "text": "def testCommandLineList\n executeMaster( [ '--list' ] )\n end", "title": "" }, { "docid": "b094c29770306322eace4b842156441e", "score": "0.57677025", "text": "def index\n @test_units = TestUnit.all \n end", "title": "" } ]
4995a107171a18fca9b3ece3a51b1050
build a month for year cal output
[ { "docid": "8ef0fea580b39789ebc094e1dbdd0869", "score": "0.697017", "text": "def to_year\n month_obj = []\n month_obj << \"#{month_name}\".center(DEFAULT_MONTH_WIDTH)\n month_obj << \"Su Mo Tu We Th Fr Sa\"\n month_obj.concat(format_body)\n end", "title": "" } ]
[ { "docid": "20476665aee07ea2f11c21eabfe3ea90", "score": "0.7466153", "text": "def month() end", "title": "" }, { "docid": "4b777002cc790e3f87c4136b1605e721", "score": "0.72174793", "text": "def build_date_from_year_month(data)\n dt = data['year']\n if data['month']\n dt += '-' + data['month'] + '-1'\n end\n dt\n end", "title": "" }, { "docid": "6f512cf46c451f1d515695d4b9750c4b", "score": "0.7146653", "text": "def month; end", "title": "" }, { "docid": "6f512cf46c451f1d515695d4b9750c4b", "score": "0.7146653", "text": "def month; end", "title": "" }, { "docid": "790bffef45b0d791da30b10dff4a89c7", "score": "0.7108075", "text": "def month=(_arg0); end", "title": "" }, { "docid": "ac9dd3a0d9f0a9e36fe65b018ea45efb", "score": "0.6996288", "text": "def month_name(number); end", "title": "" }, { "docid": "8f3285f0d957ef5483040387b529bc2b", "score": "0.69293416", "text": "def display_month_with_year\n puts (name_of_month + \" #{@year}\").center(20) +\" \"\n puts weeks_with_year\n end", "title": "" }, { "docid": "d3dc4468eee41147eff012cefe1e803a", "score": "0.6819543", "text": "def increment_month!\n if month != 12\n # just bump up a number\n self.date = ZDate.format_date(year_str, month + 1)\n else\n self.date = ZDate.format_date(year + 1)\n end\n end", "title": "" }, { "docid": "eb4e1d5a7c2f4df7584be2d0b63ebe3f", "score": "0.68127763", "text": "def build_cal from, to\n (from..to).map{ |d| [d.month, d.year ] }.uniq.map { |m,y|\n `cal #{m} #{y}`\n }.join(\"\\n\").split(/\\n/)\n end", "title": "" }, { "docid": "156caf95f1009c9900ff08b61ec57092", "score": "0.6796611", "text": "def year\n @year = params[:year].to_i\n @first_month = 1\n @last_month = (Date.today.year == @year) ? Date.today.month : 12\n end", "title": "" }, { "docid": "560774cfd9332dfa59afe120c96ea826", "score": "0.6749834", "text": "def months_in_year\n 12\nend", "title": "" }, { "docid": "a4177a0b51750f1b1aad072b16a8306d", "score": "0.6726986", "text": "def get_year_month_list()\n arr=[]\n start=\"2008_01\"\n str=\"\"\n var_date = Time.now\n while( start != str)\n str = var_date.year.to_s + \"_\" + \"%02d\" % var_date.month.to_s\n arr << str\n var_date = var_date - 1.month\n end\n return arr\n end", "title": "" }, { "docid": "d1dbfd6f11a24277db549fd1d128d5f1", "score": "0.67150366", "text": "def month_of_year(months, *extras)\n merge(month: months.array_concat(extras))\n end", "title": "" }, { "docid": "2dbd4d7be167291c13b33680b4a5b1e0", "score": "0.6702658", "text": "def year_month_int_to_year_and_month(year_month)\n [year_month / 12, (year_month % 12) + 1]\n end", "title": "" }, { "docid": "8a232aad37622c4c44008025fac8eda2", "score": "0.66731924", "text": "def month_result_string(day)\n start = day.beginning_of_month.yday - 1\n finish = day.end_of_month.yday - 1\n result_string(day.year).slice(start..finish)\n end", "title": "" }, { "docid": "f439e974c9682e9f99e442661d80c85d", "score": "0.6666134", "text": "def set_year(m)\n if set_month(m) > 2 and set_month(m) < 13\n @year.to_i\n else\n @year.to_i - 1\n end\n end", "title": "" }, { "docid": "15eed649cd530ac9bbf3fd1d69c06e9e", "score": "0.663943", "text": "def month_of_year(*months)\n merge(month: months)\n end", "title": "" }, { "docid": "860f26abd6e9eba6dfd6f6823c8fb116", "score": "0.6606486", "text": "def year_month_int_to_str(year_month)\n \"#{year_month / 12} #{MONTHS[year_month % 12]}\"\n end", "title": "" }, { "docid": "523947718a6767c8ce5600e8cd79ae80", "score": "0.6592471", "text": "def year_month(date, fmt=\"yyyy mmm\")\n return nil unless date\n yyyy = date.year.to_s\n mmm = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)[date.month-1]\n case fmt\n when \"mmm-yy\" then \"%s-%s\" % [mmm, yyyy[2, 2]]\n when \"mmm yyyy\" then \"%s %s\" % [mmm, yyyy]\n else \"%s %s\" % [yyyy, mmm]\n end\n end", "title": "" }, { "docid": "ac7ee3f6c3709d2632da225ea7d98df1", "score": "0.6585026", "text": "def month\n end", "title": "" }, { "docid": "29282ec75b0d0931cf82bb06852063b7", "score": "0.6575414", "text": "def set_year\n if set_month > 2 and set_month < 13\n @year.to_i\n else\n @year.to_i - 1\n end\n end", "title": "" }, { "docid": "b5d9b4929fa9aaa192a2f8bceb3b59f0", "score": "0.6561353", "text": "def test_yearly_by_month_loop\n parse(\n 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',\n '2012-01-01 15:45:00',\n [\n '2012-02-01 15:45:00'\n ],\n '2012-01-29 23:00:00'\n )\n end", "title": "" }, { "docid": "02f458bf128dda92d29da15cd0bd44bd", "score": "0.6542984", "text": "def to_s; \"%d-%02d\" % [@years, @months.abs] end", "title": "" }, { "docid": "9b617c055cb8f7b7985ff2cd0fa00729", "score": "0.6540461", "text": "def DrawMonth(month, start)\r\n\r\n # Display the day of the weeks.\r\n for day_week in @day_week\r\n printf(\"%7s\", day_week)\r\n end\r\n puts ''\r\n \r\n # calulate the start point of month.\r\n for j in 1..@start\r\n printf(\"%7s\", \" \");\r\n end\r\n \r\n # Display dates\r\n for j in 1..@end_month[month]\r\n printf(\"%7d\", j);\r\n @start += 1\r\n \r\n if @start == 7\r\n @start = 0\r\n puts ''\r\n end\r\n end\r\n\r\n # Move on to next month.\r\n @cal += j;\r\n printf(\"\\n\\n\");\r\n end", "title": "" }, { "docid": "007457c4a41051a140f8e72159e7ccf3", "score": "0.6525857", "text": "def years_to_month(years)\n years * 12.0\nend", "title": "" }, { "docid": "8f56ffe2ed74b7c426396b800daa1ed0", "score": "0.65153474", "text": "def month_names; end", "title": "" }, { "docid": "316bb3b37e1251abb8294b8b619fbaa3", "score": "0.65137684", "text": "def test_5_print_months\n year = Year.new(1983)\n assert_equal(\" 1983\\n\\n January February March\\nSu Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa\\n 1 1 2 3 4 5 1 2 3 4 5\\n 2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12\\n 9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19\\n16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26\\n23 24 25 26 27 28 29 27 28 27 28 29 30 31\\n30 31 \\n April May June\\nSu Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa\\n 1 2 1 2 3 4 5 6 7 1 2 3 4\\n 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11\\n10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18\\n17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25\\n24 25 26 27 28 29 30 29 30 31 26 27 28 29 30\\n \\n July August September\\nSu Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa\\n 1 2 1 2 3 4 5 6 1 2 3\\n 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10\\n10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17\\n17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24\\n24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30\\n31 \\n October November December\\nSu Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa\\n 1 1 2 3 4 5 1 2 3\\n 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10\\n 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17\\n16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24\\n23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\\n30 31 \\n\", year.print_everything)\n end", "title": "" }, { "docid": "14b05165212d2a4f91031d64b503110d", "score": "0.65027094", "text": "def months() 30 * days end", "title": "" }, { "docid": "b20dce279e6ac837e82a564652c59aed", "score": "0.6502476", "text": "def months\n @years * 12\n end", "title": "" }, { "docid": "68dc1cc65ac36d80443c112220e7e395", "score": "0.64500576", "text": "def format_month_year(date)\n date.strftime(\"%Y-%b\")\n end", "title": "" }, { "docid": "b1c32b5356b77eaafc0f5c1e6a4b5609", "score": "0.6431168", "text": "def print_year_body(mon, itr)\n index = mon\n @row.times do\n converted_line = format_month_body(@@months[index])[itr].map do |day|\n day.to_s.rjust(2)\n end\n index += 1\n print converted_line.join(\" \") + \" \"\n end\n end", "title": "" }, { "docid": "6d6bd68aa074b4935fe245ae1ebae347", "score": "0.64300066", "text": "def end_of_month\n self.class.new year, month + 1, 0\n end", "title": "" }, { "docid": "be06d3e5accedc09bae9bd63f0826eef", "score": "0.64280117", "text": "def monthly\n end", "title": "" }, { "docid": "976c8451a2c576d3a89d130088802a12", "score": "0.64174354", "text": "def each_april( n=1); each_monthnum(self.Apr,n); end", "title": "" }, { "docid": "9549c8c951b5310579dbb6b3197471a0", "score": "0.6402566", "text": "def beginning_of_month\n self.class.new year, month, 1\n end", "title": "" }, { "docid": "dd7de6b1ca86ae617b00bfeee179ce50", "score": "0.639784", "text": "def year_month_ranges year\n\t\t\tfrom = Date.new(year, Time.now.month, Time.now.beginning_of_month.day) - 1.year\n\t\t\tto = Date.new(year, Time.now.month, Time.now.end_of_month.day)\n\t\t\t(from..to).group_by(&:month).map { |n,v| v.first.beginning_of_month.to_s..(v.first.end_of_month + 1.day).midnight.to_s }\n\t\tend", "title": "" }, { "docid": "6562a4092b2acdad246c4b8c0d224983", "score": "0.6393719", "text": "def month_depot\n \"#{depot.name} \"+\"#{issue_date.strftime(\"%b\")} \"+\"#{issue_date.year}\"\n end", "title": "" }, { "docid": "747a453e768757fae4a1830e5ac66fb3", "score": "0.638591", "text": "def new_year(input)\n equinox = Integer === input ? @astro.solar_event(:march_equinox, input) : @astro.previous(:march_equinox, input)\n date = local_date(equinox)\n equinox.localtime(utc_offset).hour < 12 ? date : date + 1\n end", "title": "" }, { "docid": "3f66a5e6428a90f668d89f9404698ec1", "score": "0.6384507", "text": "def input_date_month_year(name, date = Time.zone.today)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n name_dd: \"#{id}_dd\",\n name_mm: \"#{id}_mm\",\n name_yy: \"#{id}_yy\",\n description: prop(field, 'description'),\n label: prop(field, 'label'),\n date: date,\n }\n end", "title": "" }, { "docid": "b89d4491accf71486a21c9a268564dbc", "score": "0.6382226", "text": "def to_month(**options) = convert_to('month', **options)", "title": "" }, { "docid": "98e62272fa8a76c39a1d53dfad56bb21", "score": "0.6372058", "text": "def each_march( n=1); each_monthnum(self.Mar,n); end", "title": "" }, { "docid": "0113536dc80e5fb3d347f66e0cd239ce", "score": "0.63497484", "text": "def month=(value)\n @month = value\n end", "title": "" }, { "docid": "6b650f0ba8d969b6ead8b881fb97f113", "score": "0.6349469", "text": "def year() end", "title": "" }, { "docid": "e7b58b6efadb07b03d38d467b5ef87ad", "score": "0.631757", "text": "def month\n start_date&.strftime('%b %Y')\n end", "title": "" }, { "docid": "7bfe666937ae5fe3ae2082f9fda4f353", "score": "0.63170207", "text": "def month\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end", "title": "" }, { "docid": "39f88885541a3cec315c116753f0a946", "score": "0.631572", "text": "def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end", "title": "" }, { "docid": "39f88885541a3cec315c116753f0a946", "score": "0.631572", "text": "def format_date(month, year)\n \"#{format(month,:two_digits)}/#{format(year, :two_digits)}\"\n end", "title": "" }, { "docid": "8b90294d052b09a9666a2b3046694b00", "score": "0.63080746", "text": "def print_month\n print \"#{@month.capitalize} #{@year}\".center(20) + \" \"\n puts \"\\n\"\n print \"Su Mo Tu We Th Fr Sa\" + \" \"\n puts \"\\n\"\n format_month_body.each do |line|\n converted_line = line.map do |day|\n day.to_s.rjust(2)\n end\n puts converted_line.join(\" \") + \" \"\n end\n end", "title": "" }, { "docid": "34f53dee37fbe7c6e3e6b1c62437919f", "score": "0.6299507", "text": "def associated_months\n result = [] # expect no months if no dates\n years = associated_years\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \t \n start_month_year = Time.parse(\"01/#{start_date}.month/#{start_date}.year\") if !start_date.blank?\n finish_month_year = Time.parse(\"01/#{event_finish}.month/#{event_finish}.year\") if !event_finish.blank?\n \n #this is the case when we only have a start month\n if !start_month_year.blank? and finish_month_year.blank?\n result << start_date.month\n #this is the tricky one...\n elsif !start_month_year.blank? and !finish_month_year.blank?\n delta_year = event_finish.year - start_date.year # year\n \n #if the range spans an entire year we have all the months\n if (delta_year) > 1\n result = [1,2,3,4,5,6,7,8,9,10,11,12]\n #this is the case of months being in the same year\n elsif delta_year == 0\n puts start_month_year.month\n puts finish_month_year.month\n for m in start_month_year.month..finish_month_year.month\n result << m\n end\n \n #this is the annoying one, going over new year\n elsif delta_year == 1\n #add months to year end\n for month in start_month_year.month..12\n result << month\n end\n \n #add months from start of year\n for month in 1.. finish_month_year.month\n result << month\n end \n end\n result\n end\n \n \n \n \n result\n end", "title": "" }, { "docid": "5eebcadeb76f0269fd9aa1e84ba14f03", "score": "0.6289727", "text": "def month\n start_on.strftime(MONTH_NAME)\n end", "title": "" }, { "docid": "f457976389db57072e5330f014e194a2", "score": "0.6283585", "text": "def test__individual_month__printing\n\t\tm = Month.new(1, 1, true)\n\t\texpected_output = \n\"Su Mo Tu We Th Fr Sa\n 1 2 3 4 5 6 7\n 8 9 10 11 12 13 14\n15 16 17 18 19 20 21\n22 23 24 25 26 27 28\n29 30 31\n\n\"\n\t\tassert_equal(expected_output, m.construct_month_for_printing)\n\tend", "title": "" }, { "docid": "7aa5cf3171a744073a2d85e3e31a7b56", "score": "0.6282407", "text": "def add_month(age) \n GenFactor::sanitize_age((age + (1.0/12.0)))\n end", "title": "" }, { "docid": "0b0db746acd057d1830b8bf99480bb25", "score": "0.6282099", "text": "def month\n return @month\n end", "title": "" }, { "docid": "a050d6d4ab716b379442c50224620d82", "score": "0.6275427", "text": "def make_year(year, bias); end", "title": "" }, { "docid": "7fd18e5649944e0a76c07c63d3272c49", "score": "0.62736446", "text": "def rsmonth(month)\n case month\n when 1\n return 'januar'\n when 2\n return 'februar'\n when 3\n return 'mart'\n when 4\n return 'april'\n when 5\n return 'maj'\n when 6\n return 'jun'\n when 7\n return 'jul'\n when 8\n return 'avgust'\n when 9\n return 'septembar'\n when 10\n return 'oktobar'\n when 11\n return 'novembar'\n when 12\n return 'decembar'\n end\nend", "title": "" }, { "docid": "237f7102de6ca8bf979062ca46a5bf4d", "score": "0.62652266", "text": "def each_may( n=1); each_monthnum(self.May,n); end", "title": "" }, { "docid": "babafc616a5b920eb04cd92b0e41d232", "score": "0.62642646", "text": "def month\n @month ||= date_calc.merch_to_julian(merch_month)\n end", "title": "" }, { "docid": "165996621591adf22ed74e63d95dfc30", "score": "0.62633324", "text": "def year_name(number); end", "title": "" }, { "docid": "68dcd40282c85a1473bb6af909b2fcfc", "score": "0.6260233", "text": "def calendar_month_header date\n \"#{I18n.translate('date.month_names')[date.month]} #{date.year}\"\n end", "title": "" }, { "docid": "783385ed95684c1963aceaf233f94591", "score": "0.6257437", "text": "def merch_month\n # TODO: This is very inefficient, but less complex than strategic guessing\n # maybe switch to a binary search or something\n @merch_month ||= (1..12).detect do |num|\n date_calc.end_of_month(start_of_year.year, num) >= date && date >= date_calc.start_of_month(start_of_year.year, num)\n end\n end", "title": "" }, { "docid": "47d8ba871c2f2240a97a13c60f2bbb49", "score": "0.6249182", "text": "def translated_month_names; end", "title": "" }, { "docid": "ee1661108e8b0ce466a6a1968a58de4d", "score": "0.6244526", "text": "def months; self * MONTH; end", "title": "" }, { "docid": "0221f05df2226b66f3c22eeb9fd374e7", "score": "0.62333757", "text": "def month_str\n ret = Datet.months(:trans => true)[@t_month]\n if args and args[:short]\n ret = ret.slice(0, 3)\n end\n \n return ret\n end", "title": "" }, { "docid": "55a53be1acd541099c90fe32e8ced10d", "score": "0.6232336", "text": "def monthstamp(year, month)\n \"#{year}#{month.to_s.rjust(2, \"0\")}\".to_i\nend", "title": "" }, { "docid": "d8dd246e5e0225369cfea58059f86555", "score": "0.6229246", "text": "def dob_mapping(month, day, year)\n month_arr = %w(January February March April May June July August September October November December)\n m_str = ((month_arr.index month) + 1).to_s\n m = (m_str.length > 1) ? m_str : '0' + m_str\n d = (day.length > 1) ? day : '0' + day\n y = year\n\n y + '-' + m + '-' + d\n end", "title": "" }, { "docid": "f2d5ff057703ca84d43a81401907f5f0", "score": "0.6229073", "text": "def month\n set_function_and_argument(:month, nil)\n end", "title": "" }, { "docid": "ed26bac1ef298eae2dc5ee561f7ee8ae", "score": "0.6222314", "text": "def start_of_month\n Date.new(self.strftime('%Y').to_i, self.strftime('%m').to_i, 1)\n end", "title": "" }, { "docid": "8d8ca679fd959172f44377afd357993a", "score": "0.6219599", "text": "def get_month(year, month)\n entries = month_entries(@pages, year, month) \n\n budget_month = BudgetMonth.new(entries, year, month)\n\n budget_month\n end", "title": "" }, { "docid": "c07116f7d204e423344e3912aedc0e9a", "score": "0.6207189", "text": "def months ; self * 30.days ; end", "title": "" }, { "docid": "434393f0ff1398705db6804a77e6eb8d", "score": "0.6206927", "text": "def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end", "title": "" }, { "docid": "18e753f61973bd4eea8b8cc1960302cf", "score": "0.62029254", "text": "def publish_month_and_year\n [publish_on.month, publish_on.year]\n end", "title": "" }, { "docid": "41feeb7c78c00eedd956b935df7cc641", "score": "0.6191379", "text": "def start_of_month\n @start_of_month ||= date_calc.start_of_month(year, merch_month)\n end", "title": "" }, { "docid": "10dbda5b072e8d99af01d38ad991efeb", "score": "0.6189505", "text": "def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[4])\n end", "title": "" }, { "docid": "02ce0e336a4e6441429748bbfd47d5d4", "score": "0.6180937", "text": "def number_to_full_month_name(num)\n return Date::MONTHNAMES[num]\nend", "title": "" }, { "docid": "cdd8f9506766225dc58b0df2e513d702", "score": "0.61809003", "text": "def initialize(month, year)\n @month = month\n @year = year\n end", "title": "" }, { "docid": "0e1968839a182329ac502934dca2ab27", "score": "0.617687", "text": "def month\n running_days = 0\n DAYS_IN_MONTH.each_with_index do |days, idx|\n running_days += days\n return idx + 1 if self.day_of_year <= running_days\n end\n end", "title": "" }, { "docid": "ff66aa74964e0a39387bffd9d4bf3b4a", "score": "0.61680245", "text": "def date_parse raw_day, raw_month\n str_month = raw_month.scan(@regex_monthes)[0]\n month = @monthes[str_month]\n return if not month\n day = raw_day.to_i\n return if day==0\n today = Date.today\n if day < today.day and month == 12\n year = today.year + 1\n else\n year = today.year\n end\n #puts year, year.class, month, month.class, day, day.class\n return \"#{year}-#{\"%02d\"%month}-#{\"%02d\"%day}\"\nend", "title": "" }, { "docid": "a6cd5460182114e538e3f1e40c497c45", "score": "0.6165981", "text": "def get_month(month)\n month = month.to_s\n month.length == 2 ? month : \"0#{month}\"\n end", "title": "" }, { "docid": "96dd2d490ef8b8fc3a72fa77bda60989", "score": "0.6150356", "text": "def month\n @month.to_s.rjust(2, '0')\n end", "title": "" }, { "docid": "62e60476ec27f2bae34fc7da38677201", "score": "0.6147091", "text": "def month_label\n \"#{label}\"\n end", "title": "" }, { "docid": "16ecc3357ce16addf4ff6108584950cf", "score": "0.61406094", "text": "def roman_month(date)\n date[1]\n end", "title": "" }, { "docid": "8e274a1ff9f35da913f3e17e25456393", "score": "0.6136159", "text": "def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[1])\n end", "title": "" }, { "docid": "8dfa8ec12f4015edffe9fa850d84ced8", "score": "0.61328876", "text": "def calculate_month_and_next_month(year, month)\n check_date = Time.new(year, month)\n {:actual => check_date, :next => check_date.next_month}\n end", "title": "" }, { "docid": "6b032f25b6ed3da54829d86a1602a6a9", "score": "0.6127572", "text": "def month_of_calendar (year, month)\n\tfirst_day_of_this_month = Time.mktime(year, month, 1, 0, 0)\n\tfirst_day_of_first_week = first_day_of_this_month - first_day_of_this_month.wday * 86400\n\tlast_day_of_this_month = Time.mktime(year, month + 1, 1, 0, 0) - 1\n\tlast_day_of_last_week = last_day_of_this_month + (6 - last_day_of_this_month.wday) * 86400\n\n\t# Make calendar\n\ttmp_day = Time.mktime(first_day_of_first_week.year,\n\t\t\t\t\t\tfirst_day_of_first_week.month,\n\t\t\t\t\t\tfirst_day_of_first_week.day, 0, 0)\n\ttmp_calendar = Array.new()\n\n\twhile tmp_day <= last_day_of_last_week\n\t\ttmp_calendar = tmp_calendar + [[Time.mktime(tmp_day.year, tmp_day.month, tmp_day.day, 0, 0),\"\"]]\n\t\ttmp_day = tmp_day + 86400\n\tend\n\t\n\t# Get this month's todo\t\n todo_list = Todo.find(:all,\n\t\t:conditions => [ \"member_id = ? AND limit_datetime >= ? AND limit_datetime <= ? \", \n\t\t@current_user.id, first_day_of_this_month, last_day_of_this_month],\n\t\t:order => 'limit_datetime')\n\n\t# Insert todos into calendar\n\ttodo_list.each do |todo|\n\t\ttmp_index = first_day_of_this_month.wday + todo.limit_datetime.day - 1\n#\t\tif todo.text.length >= 12\n# 字数制限をしない。<div><nobr>で制御しているので必要ない。\n\t\tif todo.text.length == -1\n\t\t\ttmp_calendar[tmp_index][1] = tmp_calendar[tmp_index][1] + \"<br>\" + todo.text[0,11] + \"...\"\n\t\telse\n\t\t\ttmp_calendar[tmp_index][1] = tmp_calendar[tmp_index][1] + \"<br>\" + todo.text\n\t\tend\n\tend\n\n\treturn tmp_calendar\n end", "title": "" }, { "docid": "c6e8fc50eeaffcd2a9c38a7463ee269b", "score": "0.612725", "text": "def year(input) = new_year(input).year - 621", "title": "" }, { "docid": "6e32ad56e9f0fd757c8b032c0dc563b1", "score": "0.6109931", "text": "def each_august( n=1); each_monthnum(self.Aug,n); end", "title": "" }, { "docid": "59df0bc4b168823e0ce1689bcb1183d8", "score": "0.6109323", "text": "def month(date)\n [MONTHS[date.month - 1], year(date)].join(', ')\n end", "title": "" }, { "docid": "c1b6c4588b1595287546c01aeccce9ab", "score": "0.61024106", "text": "def each_july( n=1); each_monthnum(self.Jul,n); end", "title": "" }, { "docid": "52f7aa46ac37f03704191b6f20363dd4", "score": "0.60953164", "text": "def month\n Thread.current[:datet_mode] = :months\n return @t_month\n end", "title": "" }, { "docid": "43e1efb90712c4304970eb892eb1946b", "score": "0.60918325", "text": "def each_october( n=1); each_monthnum(self.Oct,n); end", "title": "" }, { "docid": "fad0cbb72953ac70ef1ff1b7f62a8aae", "score": "0.6089501", "text": "def number_to_short_month_name(a)\n return number_to_full_month_name(a).slice(0,3)\nend", "title": "" }, { "docid": "8e5f4dc3f2a56b31424dfb851dfdc9f3", "score": "0.6076966", "text": "def get_months(years, months)\n if years > 0\n (years * 12) + months\n elsif years > 0 && months == 0\n years * 12\n else\n months\n end\nend", "title": "" }, { "docid": "de49c02f8e21c70eb1a0d1119c27ddf3", "score": "0.60738456", "text": "def months\n Thread.current[:datet_mode] = :months\n return self\n end", "title": "" }, { "docid": "4adfae5f813845eb937c86d908a63b20", "score": "0.6071117", "text": "def to_s\n\t\tMonth.month_names[@month-1][0..2] + \" \" + @year.to_s\n\tend", "title": "" }, { "docid": "70d52e27ae3e629e5f0f88cc20798407", "score": "0.6065146", "text": "def setup_months(start_month, end_month)\n @months = []\n while start_month <= end_month\n @months << start_month\n start_month += 1\n end\n end", "title": "" }, { "docid": "fa23ae8c3f956a8f224481f325c97009", "score": "0.60614634", "text": "def show_date month_of_year, day_of_week\n month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n day = dom\n return month[month_of_year-1] + day[day_of_week].to_s\nend", "title": "" }, { "docid": "51a75ee93e556a5857fa46842f3cebae", "score": "0.60533637", "text": "def cwyear\n end", "title": "" }, { "docid": "e9f2109f1b370f1af9879763ad01d52c", "score": "0.60513604", "text": "def normalize_month(month)\n month % 12 + 1\n end", "title": "" }, { "docid": "9b6894cedc22066bbe5a484a490bf3ce", "score": "0.6049447", "text": "def each_january( n=1); each_monthnum(self.Jan,n); end", "title": "" }, { "docid": "80b3abfc83122c0222776596a9267930", "score": "0.6047844", "text": "def month_array\r\n\t\t[[\"January\", \"1\"],[\"February\", \"2\"], \r\n\t\t[\"March\", \"3\"],[\"April\",4],\r\n\t\t[\"May\",5],[\"June\",6],\r\n\t\t[\"July\",7],[\"August\",8],\r\n\t\t[\"September\",9],[\"October\",10],\r\n\t\t[\"November\",11],[\"December\",12]]\r\n\tend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fec958f4306c3285fcc2ceca38c0a6bb", "score": "0.0", "text": "def set_template\n @template = Template.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
0636c2f0ff24bcfafddeb5d1e9c389ac
Replace the inspect method so that it doesn't kill RSpec
[ { "docid": "7e84edb9f28384859f6296e305fccd94", "score": "0.0", "text": "def inspect\n \"I'm located at row #{row} and col #{col}\"\n end", "title": "" } ]
[ { "docid": "f76b3c73f7a0ff8121985dfd29ce546a", "score": "0.70268404", "text": "def define_inspect_method; end", "title": "" }, { "docid": "10d17657d3ce2c02fe2680bc294c24a3", "score": "0.6903507", "text": "def trace_inspect\n inspect\n end", "title": "" }, { "docid": "38882a03b832b4cded5c08afa9d32963", "score": "0.6773479", "text": "def inspect!\n warn(inspect)\n self\n end", "title": "" }, { "docid": "38882a03b832b4cded5c08afa9d32963", "score": "0.6773479", "text": "def inspect!\n warn(inspect)\n self\n end", "title": "" }, { "docid": "51f79b66a7fb05c064d1ef8883efc93c", "score": "0.67425543", "text": "def inspect!\n warn(inspect)\n end", "title": "" }, { "docid": "51f79b66a7fb05c064d1ef8883efc93c", "score": "0.67425543", "text": "def inspect!\n warn(inspect)\n end", "title": "" }, { "docid": "51f79b66a7fb05c064d1ef8883efc93c", "score": "0.67425543", "text": "def inspect!\n warn(inspect)\n end", "title": "" }, { "docid": "41d25ab77066b1e00a8ccabd990b5e80", "score": "0.6693667", "text": "def inspect\n redacted_string(:inspect)\n end", "title": "" }, { "docid": "c2ecf78db8d316c56cc2d5275f5746a2", "score": "0.6678835", "text": "def inspect() end", "title": "" }, { "docid": "f85af03eba1795c854031d7d9727b2f9", "score": "0.6585464", "text": "def inspect(*) end", "title": "" }, { "docid": "f85af03eba1795c854031d7d9727b2f9", "score": "0.6585464", "text": "def inspect(*) end", "title": "" }, { "docid": "f85af03eba1795c854031d7d9727b2f9", "score": "0.6585464", "text": "def inspect(*) end", "title": "" }, { "docid": "f85af03eba1795c854031d7d9727b2f9", "score": "0.6585464", "text": "def inspect(*) end", "title": "" }, { "docid": "f85af03eba1795c854031d7d9727b2f9", "score": "0.6585464", "text": "def inspect(*) end", "title": "" }, { "docid": "b0264f2f24e26e02711f4264ea6f297d", "score": "0.65554345", "text": "def inspectable?; true; end", "title": "" }, { "docid": "b0264f2f24e26e02711f4264ea6f297d", "score": "0.65554345", "text": "def inspectable?; true; end", "title": "" }, { "docid": "73b6d2adcbc0c32f8ddb3a92d00ee399", "score": "0.65483403", "text": "def inspect?; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" }, { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.6518649", "text": "def inspect; end", "title": "" } ]
d6c52628ba14363a19cb6470ac928e5c
Enables a plugin if not already enabled. Raises error if plugin cannot be found in the plugin registry.
[ { "docid": "4a4d40e80bb0572b1e952e02e0fa84f4", "score": "0.55517596", "text": "def use(name, **options)\n return self if enabled_plugins.include?(name)\n\n raise PluginNotFoundError, name unless (plugin = Dry::System::Plugins.registry[name])\n\n plugin.load_dependencies\n plugin.apply_to(self, **options)\n\n enabled_plugins << name\n\n self\n end", "title": "" } ]
[ { "docid": "73319a8a5f995722dd89ca9506307ed1", "score": "0.6434789", "text": "def load!\n begin\n require name unless enabled?\n rescue LoadError => error\n puts(\"Unable to load plugin #{name} due to #{error}.\")\n rescue => error\n puts(\"require '#{name}' failed with #{error}\")\n end\n @enabled = true\n end", "title": "" }, { "docid": "637a91e76ef58bcb5b6a2b5070547422", "score": "0.6271028", "text": "def on_plugin_enable(evt)\n @@job_plugins << self unless @@job_plugins.include?(self)\n end", "title": "" }, { "docid": "87ce3b2e5140212945daa3876ab43e4b", "score": "0.62218744", "text": "def install\n # Load the plugin\n self.load\n # Also, if there is an \"install.rb\" script present, run that to setup anything the plugin needs (database tables etc)\n require File.join(self.path, \"install.rb\") if File.exists?(File.join(self.path, \"install.rb\"))\n rescue Exception => err\n # Catch the error, delete the plugin, and raise an error again\n self.destroy!\n raise \"Error installing plugin: #{err.message}!\"\n end", "title": "" }, { "docid": "33a2d7c1a78d720e69a60ef439421066", "score": "0.61985755", "text": "def enable_plugins plugs=plugins\n plugs.each(&:enable)\n end", "title": "" }, { "docid": "33a2d7c1a78d720e69a60ef439421066", "score": "0.61985755", "text": "def enable_plugins plugs=plugins\n plugs.each(&:enable)\n end", "title": "" }, { "docid": "3433a229933d9058758c72596f4ba6d9", "score": "0.61942273", "text": "def register(name, plugin = false)\n return unless plugin && !loaded?(name)\n @plugins << plugin\n end", "title": "" }, { "docid": "778793c9d262f393130d01f9c2f2ee22", "score": "0.61204875", "text": "def register(name, plugin = false)\n Vedeu.log(type: :debug,\n message: \"Attempting to register plugin: #{name}\")\n\n plugins << plugin if plugin && not_loaded?(name)\n end", "title": "" }, { "docid": "c8490ae124527f715f8004cb1eb4d343", "score": "0.6086855", "text": "def onEnable\n @enabled = true\n process_plugins(@required_plugins, true)\n process_plugins(@optional_plugins, false)\n on_enable if respond_to? :on_enable\n printStateChange 'ENABLED'\n end", "title": "" }, { "docid": "7cca589f8e0f2775e8dd51a8c33aecaa", "score": "0.60342443", "text": "def plugin_installed! plugin_manager, plugin\n _logger.debug do\n \" plugin installed #{plugin.name.inspect} #{plugin.file.inspect}\"\n end\n @plugins << plugin\n end", "title": "" }, { "docid": "d195e14c4d4d587524b9c897611b7ce8", "score": "0.59604996", "text": "def add_plugin(options={})\n register_plugin Plugin, options\n end", "title": "" }, { "docid": "194b33505e9da042e904b01d555c237b", "score": "0.59494287", "text": "def activate_plugin(name)\n begin\n return false unless n = get_plugin(name)\n info_message(\"activating plugin: #{n.class}\")\n n.monitor = self\n @active_plugins << n\n\tn.start_up if n.respond_to? :start_up\n return true\n rescue Exception=>e\n warning_message(\"problem activating plugin: #{name} (#{e})\")\n end\n return false\n end", "title": "" }, { "docid": "fcc8dab585f44803bf3c1a10a1715c32", "score": "0.59486973", "text": "def install\n return true unless plugins.any?\n plugins.each { |plugin| vendor(plugin) }\n end", "title": "" }, { "docid": "9a27f0f1547826effebd7d1e1c0dd154", "score": "0.5944385", "text": "def register(name, plugin = false)\n if plugin && !loaded?(name)\n plugins << plugin\n end\n end", "title": "" }, { "docid": "98251c2bd40568685b025ee0253073b2", "score": "0.5913161", "text": "def register_plugin(plugin)\n @plugins << plugin.new\n end", "title": "" }, { "docid": "d37f867ca271232aa9d8705fcc29fb3a", "score": "0.5897489", "text": "def load!\n begin\n require gem_name\n rescue LoadError => e\n warn \"Found slugin #{gem_name}, but could not require '#{gem_name}.rb'\"\n warn e\n rescue => e\n warn \"require '#{gem_name}' failed, saying: #{e}\"\n end\n\n self.enabled = true\n end", "title": "" }, { "docid": "c1af610522cb00512a4c5f91a840a237", "score": "0.5819886", "text": "def start_plugin(path)\n Thread.new do\n begin\n load_plugin path\n enable_plugin path\n rescue\n puts \"Problem starting #{path}: #{$!}\"\n end\n end\n end", "title": "" }, { "docid": "42fa5ebb2a05e8a3873a97ed1f57290d", "score": "0.5807919", "text": "def register(plugin)\n if !@registered.include?(plugin)\n @logger.info(\"Registered plugin: #{plugin.name}\")\n @registered << plugin\n end\n end", "title": "" }, { "docid": "42fa5ebb2a05e8a3873a97ed1f57290d", "score": "0.580741", "text": "def register(plugin)\n if !@registered.include?(plugin)\n @logger.info(\"Registered plugin: #{plugin.name}\")\n @registered << plugin\n end\n end", "title": "" }, { "docid": "109328d83dfc10c7ee936c28aedeedb0", "score": "0.5795513", "text": "def install_plugin(path)\n abs_path = File.absolute_path(path)\n raise \"Plugin already installed in project: #{abs_path}.\" unless\n metadata[:plugins].nil? or not metadata[:plugins].include?(abs_path)\n raise \"Malformed MiGA plugin: #{abs_path}.\" unless\n File.exist?(File.expand_path(\"miga-plugin.json\", abs_path))\n self.metadata[:plugins] ||= []\n self.metadata[:plugins] << abs_path\n save\n end", "title": "" }, { "docid": "c6d124a40d62304c290a812b56a10c32", "score": "0.5786394", "text": "def register_plugin(plugin, options={})\n options[:type] ||= 'plugin'\n Plugins.register_plugin(plugin, options)\n end", "title": "" }, { "docid": "af4394415e8ca2c3c36d9492c228bba2", "score": "0.57780826", "text": "def onEnable\n @enabled = true\n process_gems(@gems)\n process_plugins(@required_plugins, true)\n process_plugins(@optional_plugins, false)\n on_enable if respond_to? :on_enable\n printStateChange 'ENABLED'\n end", "title": "" }, { "docid": "4f33d20c68fbb46293778a0dd8e41eae", "score": "0.5771284", "text": "def enable_plugin_shim!\n disable_plugin_shim!\n str = \"#{path} #{integration_key} #{secret_key} #{hostname}\"\n resources(openvpn_conf: 'server').plugins << str\n end", "title": "" }, { "docid": "63c2bfc3c6a791f37c532f76c8ef350e", "score": "0.5749269", "text": "def enablePlugin( name )\n\n # parameter TypeCheck\n #BIMserverAPI::TypeCheck::String( name )\n\n # BIMserver request\n request( { name: name } )\n end", "title": "" }, { "docid": "4a5a28cc20376fba53d87404721f5775", "score": "0.57421845", "text": "def register_plugin(plugin)\n Log.info('plugins', \"registered #{plugin}\")\n synchronize do\n @plugins << plugin\n end\n end", "title": "" }, { "docid": "5bcf2c0c83ef2468642336396b02ddf8", "score": "0.5738296", "text": "def enable_feature_for(plugin, *raw_features)\n PluginList.find_plugin! plugin\n _resolve_features(plugin, raw_features).each do |feature|\n f = self.features[plugin][feature]\n next if f.enabled?\n f.enable\n end\n end", "title": "" }, { "docid": "d6a08b0f5490cd085a70b55a3e1475e2", "score": "0.5736071", "text": "def can_proceed(plugin)\n plugin_name = plugin['name']\n\n if !TeracyDev::Plugin.installed?(plugin_name)\n @logger.debug(\"#{plugin_name} is not installed\")\n return false\n end\n\n if plugin['enabled'] != true\n @logger.debug(\"#{plugin_name} is installed but not enabled so its settings is ignored\")\n return false\n end\n return true\n end", "title": "" }, { "docid": "944c006a07f7e909b3a1c158f4c6a77e", "score": "0.5732854", "text": "def load_plugin(plugin_name, **options)\n plugin_to_use = plugins.find { |plugin| plugin.name == plugin_name }\n fail PluginNotFound, plugin_name unless plugin_to_use\n vputs \"[config] Using plugin: #{plugin_name}\"\n\n plugin_to_use.load!(options)\n loaded_plugins << plugin_to_use\n\n true\n end", "title": "" }, { "docid": "711e66d425060fd11d1908272dd9c9f7", "score": "0.5720679", "text": "def add(plugin, options = {})\n if options[:force]\n remove(plugin)\n end\n\n if find(plugin.name, plugin.version, remote: false)\n return nil\n end\n\n @plugins.add(plugin)\n plugin\n end", "title": "" }, { "docid": "8ad3918570979165d609f8065296ee2e", "score": "0.569969", "text": "def register plugin, id\n plugin_hash[validate_id(id)] = plugin\n end", "title": "" }, { "docid": "0ff64d3d51bb2b9f5bb3bb0c05a949f4", "score": "0.5686141", "text": "def load\n plugins.each do |plugin|\n plugin.load! unless plugin.enabled?\n end\n end", "title": "" }, { "docid": "0ff64d3d51bb2b9f5bb3bb0c05a949f4", "score": "0.5686141", "text": "def load\n plugins.each do |plugin|\n plugin.load! unless plugin.enabled?\n end\n end", "title": "" }, { "docid": "c9f8425d442dbaa7e731273f51c39ef3", "score": "0.5658731", "text": "def enable\n @enabled = _enable_provider\n end", "title": "" }, { "docid": "10fbe0ead40387b45918460d130881d8", "score": "0.5655024", "text": "def load_plugins\n @plugins.each do |plugin|\n plugin.activate! if plugin.enabled?\n end\n end", "title": "" }, { "docid": "a3e49084cc9916696d0acce7e8406214", "score": "0.5646389", "text": "def install_plugin(plugin)\n system \"vagrant plugin install #{plugin}\" unless Vagrant.has_plugin? plugin\n end", "title": "" }, { "docid": "ca36c5679448852d2d40623defa3724b", "score": "0.5619996", "text": "def activate!\n begin\n require gem_name\n rescue LoadError\n $stderr.puts \"Warning: The plugin '#{gem_name}' was not found!\"\n end\n self.active = true\n self.enabled = true\n end", "title": "" }, { "docid": "f1bc3488c80ce2c6849b04bf64fd8fa0", "score": "0.5611606", "text": "def register_plugin klass\n self.plugins << klass\n end", "title": "" }, { "docid": "a3ded106a1a73efdc89d30eaa20b560d", "score": "0.5602521", "text": "def enable\n return if enabled?\n @_enabled = true\n i = _trigger_enable_hooks\n i.send :init if i.respond_to? :init\n end", "title": "" }, { "docid": "3268cb9a487d55eabce0dba3e2875eff", "score": "0.55995136", "text": "def add\n raise PluginNotFound.new(plugin.name) unless cache_content.keys.include?(plugin.name)\n puts plugin.name.titleize + \"\\n\"\n copy_plugin_and_remove_hidden_folders\n rename_temp_folder\n run_install_hook\n end", "title": "" }, { "docid": "95dd2a0bf3c710a222bb757fe66a8474", "score": "0.5597077", "text": "def enable!\n providers.values.each(&:enable)\n end", "title": "" }, { "docid": "c5018b36052c639fb7ecbe25a4c24d22", "score": "0.55854195", "text": "def load\n plugins.each { |plugin| plugin.load! unless plugin.enabled? }\n end", "title": "" }, { "docid": "f39cb3cfedd7f24400c1618de0b1c251", "score": "0.55533826", "text": "def enable!\n run(:enable)\n end", "title": "" }, { "docid": "5639b3cc3c23bc91faab921f0ce8cb55", "score": "0.55427295", "text": "def update_plugin(name)\n notify \"Plugin #{name} is already installed\"\n end", "title": "" }, { "docid": "b082f1b1719f42fb57855f9d9b0b6ebf", "score": "0.55374503", "text": "def register(plugin, id); end", "title": "" }, { "docid": "d755bb670af6ae55dbc42d41b4f62a2e", "score": "0.55205894", "text": "def load_plugins\n print \"Enabled plugins:\\n\"\n @config['plugins'].each do |name,state|\n next if state == '0'\n print \"#{name}... \"\n\n # instantiate plugin class\n begin\n clazz = Object.const_get(\"Foxplorer#{name.capitalize}\")\n plugin = clazz.new(@hooks)\n print \"ok\\n\"\n rescue Exception => error\n print \"error: #{error}\\n\"\n abort\n end\n end\n end", "title": "" }, { "docid": "e8eab0a4ad62fc09b8313bb845575e90", "score": "0.551995", "text": "def exercise_plugin_is_available\n assert (not @plugin.nil?), \"Plugin was not initialized\"\n\n assert ::OpenShift::Runtime::Frontend::Http::Plugins.plugins.include?(@plugin.class), \"Plugins should include #{@plugin.class}\"\n end", "title": "" }, { "docid": "bd5984807c36391a45d38020ddb9c462", "score": "0.55127835", "text": "def install_attempt_install(plugin_name) # rubocop: disable Metrics/AbcSize\n installer.install(plugin_name, version: options[:version])\n rescue Inspec::Plugin::V2::PluginExcludedError => ex\n puts(red { \"Plugin on Exclusion List\" } + \" - #{plugin_name} is listed as an incompatible gem - refusing to install.\")\n puts \"Rationale: #{ex.details.rationale}\"\n puts \"Exclusion list location: \" + File.join(Inspec.src_root, \"etc\", \"plugin_filters.json\")\n puts \"If you disagree with this determination, please accept our apologies for the misunderstanding, and open an issue at https://github.com/inspec/inspec/issues/new\"\n exit 2\n rescue Inspec::Plugin::V2::InstallError\n raise if Inspec::Log.level == :debug\n\n results = installer.search(plugin_name, exact: true)\n if results.empty?\n puts(red { \"No such plugin gem \" } + plugin_name + \" could be found on rubygems.org - installation failed.\")\n elsif options[:version] && !results[plugin_name].include?(options[:version])\n puts(red { \"No such version\" } + \" - \" + plugin_name + \" exists, but no such version #{options[:version]} found on rubygems.org - installation failed.\")\n else\n puts(red { \"Unknown error occured \" } + \" - installation failed.\")\n end\n exit 1\n end", "title": "" }, { "docid": "916c1260fc8ebc2e9c6e0b4aeec584b7", "score": "0.55040795", "text": "def register(plugin)\n plugins = @plugins + [plugin]\n copy { @plugins = plugins }\n end", "title": "" }, { "docid": "916c1260fc8ebc2e9c6e0b4aeec584b7", "score": "0.55040795", "text": "def register(plugin)\n plugins = @plugins + [plugin]\n copy { @plugins = plugins }\n end", "title": "" }, { "docid": "575ceb38d1fd80c8008be86de2c61ea1", "score": "0.54942286", "text": "def install_plugins\n\t\t\tif self.plugins_installed?\n\t\t\t\tself.log.warn \"Plugins were already installed for %p from %p\" %\n\t\t\t\t\t[ self, self.plugins_installed_from ]\n\t\t\t\tself.log.info \"I'll attempt to install any new ones, but plugin ordering\"\n\t\t\t\tself.log.info \"and other functionality might exhibit strange behavior.\"\n\t\t\telse\n\t\t\t\tself.log.info \"Installing plugins for %p.\" % [ self ]\n\t\t\tend\n\n\t\t\tsorted_plugins = self.loaded_plugins.tsort.reverse\n\n\t\t\tsorted_plugins.each do |name|\n\t\t\t\tmod = self.loaded_plugins[ name ]\n\n\t\t\t\tunless @plugins.include?( name ) || @plugins.include?( mod )\n\t\t\t\t\tself.log.debug \" skipping %s\" % [ name ]\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\tself.log.info \" including %p in %p.\" % [ mod, self ]\n\t\t\t\tinclude( mod )\n\t\t\tend\n\n\t\t\tself.plugins_installed_from = caller( 1 ).first\n\t\tend", "title": "" }, { "docid": "80a919c2e3c6403effe07a3532cadaa9", "score": "0.5479652", "text": "def install\n if new_record?\n # Ensure we don't have any errors while saving already\n if self.errors.empty?\n begin\n # Load the plugin\n self.load\n # Also, if there is an \"install.rb\" script present, run that to setup anything the plugin needs (database tables etc)\n require File.join(self.path, \"install.rb\") if File.exists?(File.join(self.path, \"install.rb\"))\n rescue Exception => err\n # If we have an issue installing, lets destroy the plugin to rollback, and put an error on the object so it displays on the form\n self.destroy\n self.errors.add \"Error installing plugin: #{err.message}\"\n end\n else\n # If we do, destroy the plugin to rollback, and then the form will display the errors\n self.destroy\n end\n end\n end", "title": "" }, { "docid": "476b0be7733cfafdc3ae5723457db807", "score": "0.54739875", "text": "def enable_feature(*features)\n PluginFeatures.enable_feature_for @_plugin_name, *features\n end", "title": "" }, { "docid": "18860d0d7daac850190126dfd50771b9", "score": "0.54536617", "text": "def register_plugins\n plugin_directory = Pathname.new(@options[:plugins_path])\n plugin_directory.entries.each { |p| next unless p.to_s =~ /\\w-plugin\\.rb$/; load plugin_directory+p }\n end", "title": "" }, { "docid": "8284547b2fc4c8d9dbcedef12f48071a", "score": "0.5451847", "text": "def required(plugin_name, options = {})\n required_plugins[plugin_name.to_s] = options\n end", "title": "" }, { "docid": "9046aa45623f1ab04c5348aadf38a87e", "score": "0.54475397", "text": "def activate_plugins\n if @options[:requested_plugins].empty?\n Plugin::registered_plugins.each { |p| activate_plugin(p.to_s) }\n else\n @options[:requested_plugins].each { |p| activate_plugin(p.to_s) }\n end\n end", "title": "" }, { "docid": "bc65400595b2dfcbb5126ff0626729b8", "score": "0.54421324", "text": "def add_plugin(plugin)\n @plugins[plugin.name] = plugin\n end", "title": "" }, { "docid": "9f4ffa242eeb12565932602cc0d72947", "score": "0.54380363", "text": "def add_plugin(plugin)\n @plugins.add(plugin)\n end", "title": "" }, { "docid": "96945b2fdc4d16903995205ce503fb5b", "score": "0.54340255", "text": "def add_plugin(plugin)\n @plugins[plugin.command] = plugin\n plugin.register(self)\n end", "title": "" }, { "docid": "3627877a9d87dd6a0585b42e4ef87447", "score": "0.543078", "text": "def enable!\n set_enabled!(true)\n end", "title": "" }, { "docid": "7e036713f2f352d18acb56f1f3c67da9", "score": "0.54021305", "text": "def enable\n damage(:enabled)\n return (@enabled = true)\n end", "title": "" }, { "docid": "8703273524f38b82f42a133eda41477f", "score": "0.5386513", "text": "def plug(name, options = {})\n if Array === name # Obviously `name.respond_to?(:each)` is better, but for 1.8.6 compatibility we cannot.\n name.each {|i| plug(i, options) }\n return\n end\n\n name = name.to_s\n\n return if config.system.disable_plugins.include?(name.gsub('defaults/', ''))\n\n name_sym = name.gsub(/-/, '_').to_sym\n options.each do |key, value|\n config.plugins.__refer__(name_sym).__assign__(key.to_sym, value)\n end\n load \"plugins/#{name}.rb\"\n rescue Exception => e\n Termtter::Client.handle_error(e)\n end", "title": "" }, { "docid": "1755cd056f9c8e5fa993442636054a88", "score": "0.5376102", "text": "def register(plugin)\n @plugins[plugin.name] = plugin\n plugin.registered(self)\n end", "title": "" }, { "docid": "4d29faf08331d034fd32cdc8f97dd4d4", "score": "0.5363238", "text": "def require_plugin plugin\n puts `cd ~/ >/dev/null && vagrant plugin install #{plugin}` unless `cd ~/ && vagrant plugin list`.chomp.split(\"\\n\").select{|x| x.include? plugin}.length > 0\n end", "title": "" }, { "docid": "79cf0bdb997afe25d2289564297c0118", "score": "0.5351033", "text": "def enable!\n @enabled = true\n end", "title": "" }, { "docid": "79cf0bdb997afe25d2289564297c0118", "score": "0.5351033", "text": "def enable!\n @enabled = true\n end", "title": "" }, { "docid": "d6afb5c336150b73f264963f0d6c6c9b", "score": "0.5342882", "text": "def load_plugin(name)\n\t\t\treturn false if PluginLoader.known?(name)\n\n\t\t\tmod = PluginLoader.load(name)\n\t\t\tadd_plugin mod\n\t\tend", "title": "" }, { "docid": "078a243d1487f94216842e640c489881", "score": "0.53325087", "text": "def []=(plugin_id, plugin_class)\n if @plugins.key?(plugin_id)\n log_warn \"[ #{@plugins_type} ] - A plugin of type #{@plugins_type} named #{plugin_id} is already registered. Can't overwrite #{@plugins[plugin_id]} with #{plugin_class.name}. Will ignore #{plugin_class.name}.\"\n else\n # Set the logger in the class so that we can use it in class methods\n plugin_class.logger = @logger\n plugin_class.logger_stderr = @logger_stderr\n if plugin_class.valid?\n log_debug \"[ #{@plugins_type} ] - Register #{plugin_id} to #{plugin_class.name}.\"\n @plugins[plugin_id] = @init_plugin.nil? ? plugin_class : @init_plugin.call(plugin_class)\n else\n log_error \"[ #{@plugins_type} ] - The plugin #{plugin_id} (#{plugin_class.name}) is missing some dependencies to be activated. Will ignore it.\"\n end\n end\n end", "title": "" }, { "docid": "b68042a87ed8c22b4d4b7929a5f2af75", "score": "0.5324216", "text": "def add_plugin(name, **options)\n vputs \"[config] Adding plugin: #{name}\"\n plugin = Plugin.new(name, options)\n yield plugin\n plugins << plugin\n vputs \"[config] Added plugin: #{name}\"\n\n plugin\n rescue => ex\n # rubocop:disable Metrics/LineLength\n vputs \"[config] Exception adding plugin: #{ex.class}: #{ex.message}\\n#{ex.backtrace[0]}\"\n # rubocop:enable Metrics/LineLength\n end", "title": "" }, { "docid": "f298a89a292ce08f129f0420c483e87e", "score": "0.53148586", "text": "def enable\n Puppet.notice _(\"Enabling Puppet.\")\n disable_lockfile.unlock\n end", "title": "" }, { "docid": "446ded8982475d0aac5eee36ec4ae23f", "score": "0.5305139", "text": "def install\n plugin = Heroku::Plugin.new(shift_argument)\n validate_arguments!\n\n action(\"Installing #{plugin.name}\") do\n if plugin.install\n unless Heroku::Plugin.load_plugin(plugin.name)\n plugin.uninstall\n exit(1)\n end\n else\n error(\"Could not install #{plugin.name}. Please check the URL and try again\")\n end\n end\n end", "title": "" }, { "docid": "b9ab28da7d8b926c4c8d5b4be756658a", "score": "0.52987516", "text": "def register(name, mod)\n raise(FederationKit::InvalidPluginModuleError) unless mod.is_a?(Module)\n raise(FederationKit::InvalidPluginNameError) if name.nil?\n raise(FederationKit::PluginAlreadyRegisteredError) if registered?(name)\n\n store[name.to_s] = mod\n fetch(name)\n end", "title": "" }, { "docid": "fc714d0b82cc07f6de170bb6a72ff50b", "score": "0.52910006", "text": "def install_plugin(plugin)\n system(\"vagrant plugin install #{plugin}\") unless Vagrant.has_plugin? plugin\nend", "title": "" }, { "docid": "3191dd797930880a94195e410905d514", "score": "0.527387", "text": "def add_plugin(mod)\n\t\t\treturn false if plugin?(mod)\n\n\t\t\tmixin mod\n\t\t\tmod.plugin_added(self)\n\t\t\tadd_timers_for(mod)\n\t\t\tcache_events\n\t\t\t@plugins << mod\n\t\t\tmod\n\t\tend", "title": "" }, { "docid": "47108b73121d4fde9632ffbba185ce7e", "score": "0.52676743", "text": "def InstallPlugin(name: T.unsafe(nil), &proc); end", "title": "" }, { "docid": "dc740c80af3d41448d8a2115c4a35345", "score": "0.526438", "text": "def enable() @enabled = true end", "title": "" }, { "docid": "34ecdf0ed3e69d050b5a992907814539", "score": "0.52606237", "text": "def checkPlugin(name)\n if !Vagrant.has_plugin?(name)\n puts \"'#{name}' plugin is required, installing it...\"\n install = `vagrant plugin install #{name}`\n end\nend", "title": "" }, { "docid": "c7c0b80532a57792c27249b9f139b1bd", "score": "0.5242212", "text": "def install_plugin(plugin)\n system \"vagrant plugin install #{plugin}\" unless Vagrant.has_plugin? plugin\nend", "title": "" }, { "docid": "c7c0b80532a57792c27249b9f139b1bd", "score": "0.5242212", "text": "def install_plugin(plugin)\n system \"vagrant plugin install #{plugin}\" unless Vagrant.has_plugin? plugin\nend", "title": "" }, { "docid": "c7c0b80532a57792c27249b9f139b1bd", "score": "0.5242212", "text": "def install_plugin(plugin)\n system \"vagrant plugin install #{plugin}\" unless Vagrant.has_plugin? plugin\nend", "title": "" }, { "docid": "fe66a24c412f6e0b70095b720066370b", "score": "0.52356726", "text": "def installed?(id)\n registered_plugins[id.to_sym].present?\n end", "title": "" }, { "docid": "cc88acec3e199b1331d76ee2cd8db27d", "score": "0.5228339", "text": "def plugin(name)\n @plugins << @config.load_plugin(name)\n end", "title": "" }, { "docid": "60a1c24218e5bc51c8070cec97c3663d", "score": "0.5218436", "text": "def enable_service\n if @current_resource.enabled\n logger.debug(\"#{@new_resource} already enabled, not enabling\")\n else\n load_service\n end\n end", "title": "" }, { "docid": "b4a50838e74f95a2f99c62ae1cf05523", "score": "0.5217067", "text": "def add_plugin(plugin)\n plugin_collection.add(plugin)\n end", "title": "" }, { "docid": "b62384de1f7329bc25dc2ef23839dd0a", "score": "0.52114207", "text": "def checkPlugin(pluginName)\n unless Vagrant.has_plugin?(pluginName)\n raise Vagrant::Errors::VagrantError.new, pluginName + ' plugin missing. Install it with \"sudo vagrant plugin install ' + pluginName + '\"'\n end\nend", "title": "" }, { "docid": "d0ea6ed546c6fbcf96c38240bde4458a", "score": "0.52053976", "text": "def plugin(plugin_module)\n plugin_module.register(self)\n end", "title": "" }, { "docid": "965e238f78e19904054f914997fe42fb", "score": "0.51951176", "text": "def core_plugin?; true; end", "title": "" }, { "docid": "10f069f1d2928e945ceef245a2a66b32", "score": "0.5190076", "text": "def enable\n authorize! @extension, :disable?\n @extension.update_attribute(:enabled, true)\n redirect_to owner_scoped_extension_url(@extension), notice: t(\"extension.enabled\", extension: @extension.name)\n end", "title": "" }, { "docid": "a203b9234c075226a94a6b997ea8b302", "score": "0.5186306", "text": "def enable_module!(name)\n enabled_modules << EnabledModule.new(:name => name.to_s) unless module_enabled?(name)\n end", "title": "" }, { "docid": "b5d4e5484e388ef1521def0b4b893d90", "score": "0.5177534", "text": "def enable!\n self.enabled = true\n end", "title": "" }, { "docid": "70587009ca637fa9e75fc3293cf26616", "score": "0.51717615", "text": "def enable!\n raise NotImplementedError, \"Not implemented by subclass\"\n end", "title": "" }, { "docid": "9002f58caac6290aa083b09c4aabb3ee", "score": "0.5169425", "text": "def cmd_enable(m, params)\n # access control: require authentication\n nick, user = auth m, true\n return if not user\n\n option = params[:option].to_sym\n if user.keys.include? option\n if user[option] == true\n m.reply 'Already enabled.'\n elsif user[option] == false\n user[option] = true\n m.okay\n else\n m.reply 'Invalid type.'\n end\n else\n m.reply 'Invalid option.'\n end\n end", "title": "" }, { "docid": "f03c6f0f5d602bbe2b278557734432f8", "score": "0.5164154", "text": "def ensure_plugin_enabled\n raise Discourse::InvalidAccess.new('Reset Bump plugin is not enabled') if !SiteSetting.reset_bump_enabled\n end", "title": "" }, { "docid": "6227e92ff8b44cb80f758ce50f567ef7", "score": "0.5155329", "text": "def add_plugin\n business.business_plugins.add_if_needed(\"audits\", nil, \"Audits\", true, 9999) if business\n rescue\n end", "title": "" }, { "docid": "2b3e793cf4828334aaa85f83f4154a82", "score": "0.51527876", "text": "def enable(arg = nil)\n set_or_return(:enable, arg, kind_of: [TrueClass, FalseClass])\n end", "title": "" }, { "docid": "2fb2087cdf025dccbec2a9c3e919b16a", "score": "0.5150785", "text": "def enable\n @enabled = true\n end", "title": "" }, { "docid": "998f06e2f726169710aa79d16bf1a985", "score": "0.51430106", "text": "def install_plugin(name)\n notify \"Installing plugin #{name}\"\n vagrant('plugin', 'install', name)\n end", "title": "" }, { "docid": "e77f3ffc04aa8b73d4d3748f423e6ab6", "score": "0.5134443", "text": "def enable\n\t\t\t\t\tconnection.post(build_path('enable')).code == '302'\n\t\t\t\tend", "title": "" }, { "docid": "0f7d0cbc87a2ad55f3e451eb3e50555e", "score": "0.5130404", "text": "def add_plugin_settings_to_project(project, settings)\n return unless project.plugin_settings[unique_id].blank?\n settings = settings || {}\n settings[:enabled] = enabled?(project)\n project.plugin_settings[unique_id] = settings\n end", "title": "" }, { "docid": "dd33045186dd36b3873ab3c8f67b3f39", "score": "0.5130084", "text": "def install(plugins)\n # Convert the input argument to an array if it is not already an array\n plugins = [plugins] unless plugins.is_a?(Array)\n @logger.info \"Installing plugins: #{plugins.inspect}\"\n\n # Build the form data to post to jenkins\n form_data = {}\n plugins.each { |plugin| form_data[\"plugin.#{plugin}.default\"] = \"on\" }\n @client.api_post_request(\"/pluginManager/install\", form_data)\n end", "title": "" }, { "docid": "fa9a98992051fe20af4b500cf1e64937", "score": "0.5129832", "text": "def set_plugin\n @plugin = Plugin.find(params[:id])\n end", "title": "" }, { "docid": "fa9a98992051fe20af4b500cf1e64937", "score": "0.5129832", "text": "def set_plugin\n @plugin = Plugin.find(params[:id])\n end", "title": "" } ]
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "f61758865047f06ba95487ee218f519f", "score": "0.0", "text": "def key_for_min_value(name_hash)\n values = []\n key_of_smallest_value = []\n\n if name_hash == nil\n key_of_smallest_value = [nil]\n else\n name_hash.each do |key, value|\n values << value\n end\n\n sorted_values = values.sort do |a, b|\n a <=> b\n end\n\n smallest_value = sorted_values[0]\n\n name_hash.each do |key, value|\n if value == smallest_value\n key_of_smallest_value = [key]\n end\n end\n end\n\n key_of_smallest_value[0]\nend", "title": "" } ]
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.88810027", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend", "title": "" }, { "docid": "226515ade14f33b0d702f287edd6fe9d", "score": "0.88777244", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\n end", "title": "" }, { "docid": "917f353c232d4640614845e6b7c840f9", "score": "0.8853504", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\n end", "title": "" }, { "docid": "10348c0f7efbf074c6402f6f47742839", "score": "0.88225716", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "d6c24d339b21831095c887c09768a0a6", "score": "0.87791526", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "d6c24d339b21831095c887c09768a0a6", "score": "0.87791526", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "5274f7bbba68cf15df3562d80d7ce3f1", "score": "0.87599903", "text": "def key_for_min_value(hash)\n low_key = nil\n low_val = 0\n hash.each do |key, val|\n if low_val == 0 || val < low_val\n low_val = val\n low_key = key\n end\n end\n low_key\n end", "title": "" }, { "docid": "1cc15f9ecd834daad0140761a4b31ca3", "score": "0.87394536", "text": "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n \tsmallest = key if smallest.nil?\n \tsmallest = key if value < hash[smallest]\n end\n smallest\nend", "title": "" }, { "docid": "90c5f24a7f0c6124d8f166cfd4439d06", "score": "0.86837065", "text": "def key_for_min_value(hash)\nlowest_key = nil\nlowest_val = Float::INFINITY\n hash.each do |key, val|\n if val < lowest_val\n lowest_val = val\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "d5553af71103c724668cba7fc4393ff5", "score": "0.8609664", "text": "def key_for_min_value(hash)\n value_array = []\n hash.each do |key, value|\n value_array << value\n end\n\n lowest_value = value_array.first\n value_array.each do |value|\n if value < lowest_value\n lowest_value = value\n end\n end\n\n hash.key(lowest_value)\nend", "title": "" }, { "docid": "8a58975f18d4954a20fccb99f6dc9b40", "score": "0.86074907", "text": "def key_for_min_value(num_hash)\n min_value = num_hash.collect{|key, num| num}.sort[0]\n key, num = num_hash.find {|key, num| num == min_value}\n key\nend", "title": "" }, { "docid": "45c7290567499ca3ce034aafdea8b667", "score": "0.85901284", "text": "def key_for_min_value(name_hash)\n lowest_number = Float::INFINITY\n lowest_key = nil\n name_hash.collect do |key, value|\n if value < lowest_number\n lowest_number = value\n lowest_key = key\n end\n end\n lowest_key \nend", "title": "" }, { "docid": "abf68bb16569607b80dedf139280c6d1", "score": "0.8578772", "text": "def key_for_min_value(hash)\n hash.min_by {|k,v| k}\nend", "title": "" }, { "docid": "a12e2b92a2177eaf9075e9e4abaaf51b", "score": "0.8574464", "text": "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "d1cf716c45a59a3f1faad1c83f59f7d7", "score": "0.8571103", "text": "def key_for_min_value(hash)\n\tnew_hash = Hash[hash.sort_by{|k,v| v}]\n\tnew_hash.keys.first\nend", "title": "" }, { "docid": "83f467e9815c0a652cb12bacbb080468", "score": "0.8561723", "text": "def key_for_min_value(hash)\n smallest_key = nil\n smallest_value = nil\n\n hash.each do |key, value|\n if smallest_value == nil || value < smallest_value\n smallest_value = value\n smallest_key = key\n end\n end\n return smallest_key\nend", "title": "" }, { "docid": "4350b724f36fef31121f91da1137c1c1", "score": "0.85604614", "text": "def key_for_min_value(hash)\n lowest = 1000000000000000000000\n if hash.empty?\n return nil\n else\n arr = hash.map do |key, value|\n if hash[key] <= lowest\n lowest = hash[key]\n end\n end\n hash.each do |key, value|\n if lowest == hash[key]\n return key\n end\n end\n end\nend", "title": "" }, { "docid": "f76a4cd2274f14f75d352b14c8d29bd1", "score": "0.8545519", "text": "def key_for_min_value(hash)\n if hash.empty?\n return nil\n else\n min_value = Float::INFINITY\n min_key = \"\"\n hash.each do |key, val|\n if val < min_value\n min_value = val\n min_key = key\n end\n end\n end\n min_key\nend", "title": "" }, { "docid": "4f23d7ac240865f09f0b4a3c14bcbc4a", "score": "0.85398656", "text": "def key_for_min_value(hash) \n small_key = nil\n small_value = nil\n hash.each do |a, b|\n if small_value == nil || b < small_value\n small_value = b\n small_key = a\n end\n end \n small_key\nend", "title": "" }, { "docid": "c6b25d8461cbb575dfa919b8f81a332c", "score": "0.8530813", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "c6b25d8461cbb575dfa919b8f81a332c", "score": "0.8530813", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "fd2efe9fd3810bfa002f7199cf8dab19", "score": "0.8505148", "text": "def key_for_min_value(hash)\n small_val = nil\n small_key = nil\n\n hash.collect do |key, value|\n if small_val == nil || small_val > value\n small_val = value\n small_key = key\n end\n end\n small_key\nend", "title": "" }, { "docid": "fc8481fa0f37bc7cbe43dc4d941b10aa", "score": "0.850431", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_val = nil\n hash.each do |key, val|\n if lowest_val == nil || val < lowest_val\n lowest_val = val\n lowest_key = key\n end\n end\n lowest_key\n\nend", "title": "" }, { "docid": "cbc05af89f66bfee58f5064b1d205024", "score": "0.84952796", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "3c6700cbd2ea0361870bd4d85c2db76f", "score": "0.8464652", "text": "def key_for_min_value(hash)\n min_value = nil\n min_key = nil\n\n hash.each do |key, value|\n if min_value == nil || value < min_value\n \tmin_value = value\n \tmin_key = key\n end\n end\n min_key\nend", "title": "" }, { "docid": "73a5bd3b8b46a6e68dad6296c171f06c", "score": "0.84629285", "text": "def key_for_min_value(hash)\n\tmin = Hash.new\n\tmin_value = 0\n\thash.each_pair do | key, num |\n\t\tif \tmin.empty?\n\t\t\tmin[key] = num\n\t\t\tmin_value = min[key]\n\t\telsif num < min_value\n\t\t\tmin.replace({key => num})\n\t\tend\n\tend\n\tmin.values\nend", "title": "" }, { "docid": "5ced3d13f6443860d99f05be7d515c1b", "score": "0.8460142", "text": "def key_for_min_value(hash_value)\n hash.invert.min&.last\nend", "title": "" }, { "docid": "b8ab4fe1e885b44f703fa1fa6f07a509", "score": "0.84545606", "text": "def key_for_min_value(hash)\n if hash.length == 0\n return\n end\n min = hash.first[1]\n min_key = hash.first[0]\n hash.each do |key, value|\n if value < min \n min = value\n min_key = key\n end\n end\n min_key\nend", "title": "" }, { "docid": "35891c2372ee9459348a913a0898da90", "score": "0.8447649", "text": "def key_for_min_value(hash)\n ref = nil\n answer = nil\n hash.each do |key, value|\n if ref == nil || value < ref\n ref = value\n answer = key\n end\n end\n answer\nend", "title": "" }, { "docid": "3be616dbcc198bab000a36f9482a9e25", "score": "0.8445423", "text": "def key_for_min_value(name_hash)\n\tlowest_int = 9999999999999\n\tlowest_int_key = nil\n\tname_hash.each do |key, value|\n\t\tif value < lowest_int\n\t\t\tlowest_int = value\n\t\t\tlowest_int_key = key\n\t\tend\n\tend\n\treturn lowest_int_key\nend", "title": "" }, { "docid": "5931a9b151f13dba8e800b2da35f4657", "score": "0.84450835", "text": "def key_for_min_value(hash)\n least = hash.reduce do |key, value|\n key.last > value.last ? value : key\n end \n if hash == {}\n least\n else\n least.first\n end\n end", "title": "" }, { "docid": "2d02c97195dd4c65890a5bf73a5eaaac", "score": "0.84361047", "text": "def key_for_min_value(hash)\nsmall_val=999999\nsmall_key= nil\n hash.each do |key, value|\n if value < small_val\n small_val = value \n small_key = key \n \n end\n end\n return small_key\nend", "title": "" }, { "docid": "68c083b336f4655607cd05a6f4ce1e7b", "score": "0.84343725", "text": "def key_for_min_value(name_hash)\n smallest = nil\n smallest_key = nil\n if name_hash.empty?\n return smallest_key\n else\n name_hash.each do |key, number|\n if smallest == nil\n smallest = number\n smallest_key = key\n elsif number <= smallest\n smallest = number\n smallest_key = key\n else\n smallest_key\n end\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "99dc179f590c57b51993ee5538a0dec3", "score": "0.84325874", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n return_key = nil\n smallest = Float::INFINITY\n name_hash.each do |key, value|\n if value.to_i < smallest\n smallest = value.to_i\n return_key = key\n end\n end\n return_key\nend", "title": "" }, { "docid": "7341ca23ed68b4691dab2252b518b7a1", "score": "0.842919", "text": "def key_for_min_value(hash)\n smallest_name = nil\n smallest_number = nil\n hash.each do |name, number|\n if smallest_number == nil || number < smallest_number\n smallest_number = number\n smallest_name = name\n end\n end\n smallest_name\nend", "title": "" }, { "docid": "020830f22425fece3b77fc5e8838f5cb", "score": "0.8426978", "text": "def key_for_min_value(hash)\n if hash == {}\n return nil\n else\n key_array = []\n value_array = []\n\n hash.each do |name, value|\n key_array << name\n value_array << value\n end\n\n i = 0\n smallest = value_array[0]\n\n value_array.each_with_index do |value, index|\n if value < smallest\n smallest = value\n i = index\n end\n end\n\n return key_array[i]\n end\nend", "title": "" }, { "docid": "46cb8698c6271a1cc374219528e87211", "score": "0.84262836", "text": "def key_for_min_value(hash)\n low_key = nil\n hash.each do |key, value|\n if low_key == nil || (low_key != nil && value < hash[low_key])\n low_key = key\n end\n end\n low_key\nend", "title": "" }, { "docid": "f0b4fe84074d3b429486583cb056e941", "score": "0.84187645", "text": "def key_for_min_value(hash)\n return nil if hash == {}\n ks = hash.map{|k, v| k}\n vs = hash.map{|k, v| v}\n min_index = vs.index(vs.min)\n ks[min_index]\nend", "title": "" }, { "docid": "8ea89fee2b9b053283cd67f01b4bd116", "score": "0.84126496", "text": "def key_for_min_value(hash)\n\n smallest = hash.collect {|key, value| value}\n smallest = smallest.min\n\n output = nil\n hash.each do |key, val|\n if val==smallest\n output=key\n end\n end\n output\nend", "title": "" }, { "docid": "c82d264affee3c7aeee4771c0c2138ee", "score": "0.84092647", "text": "def key_for_min_value(hash)\n i = 0\n min = 0\n min_key = nil\n hash.each do |key, value|\n unless i > 0\n min = value\n min_key = key\n end\n if min > value\n min = value\n min_key = key\n end\n i += 1\n end\n min_key\nend", "title": "" }, { "docid": "769884cf17d9db6fbb75b9316ca174d7", "score": "0.8402325", "text": "def key_for_min_value(hash)\n return nil if hash.size == 0\n min = hash.first\n hash.each {|k, v| v <= min[1] ? min = [k, v] : nil}\n min[0]\nend", "title": "" }, { "docid": "c45c181efc7de1e218dc24ac2734e986", "score": "0.83974236", "text": "def key_for_min_value(name_hash)\n return nil if name_hash.size == 0\n numbers = name_hash.collect {|name, number| number}\n lowest_key = \"\"\n lowest_num = numbers[0]\n name_hash.each do|name, num|\n if num <= lowest_num\n lowest_key = name\n lowest_num = num\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "9fe8fd05d03cff6f26dd4fea5eead4d5", "score": "0.83929235", "text": "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.collect do |word, num|\n if num < lowest_value\n lowest_value = num\n lowest_key = word\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "f7db41a1cd50a93ab7a3e5aa0633e7ed", "score": "0.83928937", "text": "def key_for_min_value(hash)\n return nil if hash.empty?\n min_value_key = nil\n min_value = (2**(0.size * 8 -2) -1) #Theorectical Fixnum_max \n #http://stackoverflow.com/questions/535721/ruby-max-integer\n hash.each do |key, value|\n \tif value < min_value\n \t\tmin_value_key = key \n \t\tmin_value = value\n \tend\n end\n min_value_key\nend", "title": "" }, { "docid": "5bf622df6f77ac34ecf5b2b18a63645a", "score": "0.8392043", "text": "def key_for_min_value(hash)\nlowest_k = nil\nlowest_v = nil\nhash.each do |k, v|\n if lowest_v == nil || v < lowest_v\n lowest_v = v\n lowest_k = k\n end\n end\n lowest_k\n end", "title": "" }, { "docid": "4eaac21f353e79687cc22e2dc77383ce", "score": "0.8387395", "text": "def key_for_min_value(hash)\n return nil if hash.empty? == true\n minimum = [nil, Float::INFINITY]\n hash.each do |key, value|\n if value < minimum[1]\n minimum = [key, value]\n end \n end\n minimum[0]\nend", "title": "" }, { "docid": "41f0d5d4371e7e781570c4842a0b94c6", "score": "0.83581704", "text": "def key_for_min_value(hash)\n min = nil\n k = nil\n hash.each do |key, value|\n if !min || value < min\n min = value\n k = key\n end\n end\n k\nend", "title": "" }, { "docid": "7f14531cc53cc34d9511f767e6802bc3", "score": "0.8354745", "text": "def key_for_min_value(hash)\n min_val = nil\n min_key = nil\n \n hash.each do |key, value|\n if min_val == nil || value < min_val \n min_val = value\n min_key = key\n end\n end \n return min_key\nend", "title": "" }, { "docid": "b95a68401d61853e70592407ff571cd2", "score": "0.8346988", "text": "def key_for_min_value(hash)\n\n low_name = nil\n low_val = nil\n\n hash.each do |name, value|\n if low_val == nil || value < low_val\n low_val = value\n low_name = name\n end\n end\n return low_name\nend", "title": "" }, { "docid": "d5dfe37d5df260abb8710e463b1fe496", "score": "0.8344885", "text": "def key_for_min_value(name_hash)\n smallest = nil\n smallkey = nil\n if name_hash == {}\n nil\n else\n name_hash.collect do |key, value|\n if nil == smallest\n smallest = value\n smallkey = key\n elsif value < smallest\n smallest = value\n smallkey = key\n end\n end\n smallkey\n end\nend", "title": "" }, { "docid": "b16999cb8da6c5e1834d351837391d0d", "score": "0.83442867", "text": "def key_for_min_value(name_hash)\n smallest = Float::INFINITY\n sel = nil\n name_hash.collect do |k,v|\n if v < smallest\n smallest = v\n sel = k\n end\n end\n sel\nend", "title": "" }, { "docid": "857cc51f5b6466f0430d231363675ebf", "score": "0.83361584", "text": "def key_for_min_value(name_hash)\nsmallest_key=nil\nsmallest_value = 10000\nname_hash.each do |key, number| \n if number<=smallest_value\n smallest_value=number\n end\nend\nname_hash.key(smallest_value)\nend", "title": "" }, { "docid": "cfce992210d54da8d8e0779dd767fa8c", "score": "0.8334391", "text": "def key_for_min_value(name_hash)\n low = Float::INFINITY # express infinity\n name_hash.each do |key, value|\n if value < low\n low = value\n end\n end\n name_hash.key(low)\nend", "title": "" }, { "docid": "f6433b669cfc53e3a16fcb7150f69b0b", "score": "0.83285975", "text": "def key_for_min_value(the_hash)\n vals = the_hash.map { |k, v| v }\n keys = the_hash.map { |k, v| k }\n lowest = vals.sort[0]\n\n if the_hash.empty?\n nil\n else\n return keys[vals.index(lowest)]\n end\nend", "title": "" }, { "docid": "5a67ad385bebec655f7c2d75ca28158d", "score": "0.83268636", "text": "def key_for_min_value(hash)\n low_key = nil\n high_value = 100000\n hash.each do |key, value|\n if value < high_value\n high_value = value\n low_key = key\n end\n end\n low_key\nend", "title": "" }, { "docid": "aa1f9c93291d2bc18f48a727341b1d48", "score": "0.8325287", "text": "def key_for_min_value(name_hash)\n smallest = nil\n final_key = nil\n name_hash.each do |key, value|\n if !smallest\n smallest = value\n final_key = key\n else\n if value < smallest\n smallest = value\n final_key = key\n end\n end\n end\n final_key\nend", "title": "" }, { "docid": "93060b60c5fc8699ce56aab3aa5aa633", "score": "0.8322426", "text": "def key_for_min_value(name_hash)\n\tskey, smallest = name_hash.first\n\tname_hash.each do |key, value|\n\t\tif value < smallest\n\t\t\tskey = key\n\t\tend\n\tend\n\tskey\nend", "title": "" }, { "docid": "b414e6e748b033108975ab3559eeb4ac", "score": "0.8321538", "text": "def key_for_min_value(name_hash)\n key_of_lowest_value = nil\n lowest_value = 999999999999\n name_hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n key_of_lowest_value = k\n end\n end\n key_of_lowest_value\nend", "title": "" }, { "docid": "51a6cadf90ff0488493c451230083dc0", "score": "0.83170885", "text": "def key_for_min_value(hash)\n if hash.length == 0 \n return nil \n end\n \n min_key = 9999\n min_val = 9999\n \n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n return min_key\n \n \nend", "title": "" }, { "docid": "ded2ec0f491d9511b7412df8aeca5ef7", "score": "0.8313793", "text": "def key_for_min_value(name_hash)\n lowest_value = 1000\n lowest_key = nil\n name_hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n end\n if lowest_value == value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "cae87c3799e039dd1987880e1b822b73", "score": "0.83044046", "text": "def key_for_min_value(hash)\n min_k = nil\n min_v = nil\n hash.each do |key, value|\n min_k = key if min_k == nil\n min_v = value if min_v == nil\n if value < min_v\n min_v = value\n min_k = key\n end\nend\n min_k\nend", "title": "" }, { "docid": "648bd9d1f9348e215d9d8b065f08807f", "score": "0.83016783", "text": "def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = nil\n name_hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value \n lowest_key = key\n end\n end\n lowest_key\n end", "title": "" }, { "docid": "e0b51124441bb3a0844fd1cbb9841254", "score": "0.8300265", "text": "def key_for_min_value(has)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "b0b3d135407df1cd296dfea704f502c9", "score": "0.8297667", "text": "def key_for_min_value(hash)\n lowest_key = nil \n lowest_value = nil\n hash.collect do |a, b|\n if lowest_value == nil || b < lowest_value\n lowest_value = b\n lowest_key = a \n end\n end\n lowest_key\nend", "title": "" }, { "docid": "c39b4b472ca2c3b934c6a4768c11d10b", "score": "0.8291352", "text": "def key_for_min_value(hash)\n out = nil\n nill = nil \n hash.each do |k,v|\n if nill == nil || v < nill\n out = k\n nill = v\n end\n end\n out\nend", "title": "" }, { "docid": "475cc305ddb149081fa9fba1de97c060", "score": "0.8286612", "text": "def key_for_min_value(hash)\n\tif hash != {}\n\t\tarray = hash.sort_by{|k,v| v}\n\t\tnew_hash = Hash[array.map {|key, value| [key, value]}]\n\t\tkey_array = new_hash.keys\n\t\tkey_array[0]\n\telse\n\t\tnil\n\tend\nend", "title": "" }, { "docid": "67fc803b393c9120086b050dd0ab8884", "score": "0.82831943", "text": "def key_for_min_value(name_hash)\n hash_num = 0\n lowest_hash_key = \"\"\n if name_hash == {}\n return\n end\n\n name_hash.collect do |key, value|\n if hash_num == 0\n hash_num = value\n lowest_hash_key = key\n elsif hash_num > value\n hash_num = value\n lowest_hash_key = key\n\n end\n end\n lowest_hash_key\nend", "title": "" }, { "docid": "fdcd20dc142920b8d4662027d722898e", "score": "0.8281909", "text": "def key_for_min_value(name_hash)\n lowest = 99999999\n if name_hash == {}\n nil\n else\n name_hash.collect do |key, value|\n if value < lowest\n lowest = value\n end\n end\n name_hash.key(lowest)\nend\nend", "title": "" }, { "docid": "5527b3ba0bcb7869fd27f7d5f7410ab3", "score": "0.8275122", "text": "def key_for_min_value(name_hash)\n smallest_value = 10000\n name_hash.each do |key, value|\n if value < smallest_value\n smallest_value = value\n end \n end\n smallest_value\n name_hash.key(smallest_value)\nend", "title": "" }, { "docid": "dd557f5393598205c4b2e991e2502023", "score": "0.8273796", "text": "def key_for_min_value(name_hash)\n smallestKey = nil\n smallestValue = 2000\n name_hash.collect do |item, num|\n if num < smallestValue\n smallestKey = item\n smallestValue = num\n end\n end\n smallestKey\nend", "title": "" }, { "docid": "f320036f51c62e20e03d41242df7e80a", "score": "0.82722396", "text": "def key_for_min_value(name_hash)\n\tsmallest_value = 0\n\tsmallest_value_key = nil\n\n\tname_hash.each_with_index do |(key, value), i|\n\t\tif i == 0\n\t\t\tsmallest_value = value\n\t\t\tsmallest_value_key = key\n\t\tend\n\t\tif smallest_value > value\n\t\t\tsmallest_value = value \n\t\t\tsmallest_value_key = key\n\t\tend\n\tend\n\tsmallest_value_key\nend", "title": "" }, { "docid": "793438733ebf3f09ab385967728f189c", "score": "0.82700664", "text": "def key_for_min_value(name_hash)\n key = nil\n num = nil\n name_hash.each do |name, value|\n if num == nil\n num = value\n key = name\n elsif value < num\n num = value\n key = name\n end\n end\n key\nend", "title": "" }, { "docid": "24cbce2787c5f157492fed1063e9b198", "score": "0.82699126", "text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n low_num = name_hash.first[1]\n low_key = name_hash.first[0]\n name_hash.each do |key, value|\n if value < low_num\n low_num = value\n low_key = key\n end\n end\n low_key \nend", "title": "" }, { "docid": "b393a616dc6eb0e638b2fec00be397be", "score": "0.8269708", "text": "def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value #so lowest_value == nil MUST be first, or else get argumentative error because cant compare value \"<\" nil argumentative error\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "328fe637744c9da882e74cca5dfcc629", "score": "0.8266963", "text": "def key_for_min_value(name_hash)\n values = name_hash.collect {|key, value| value}\n smallest = values[0]\n for value in values\n if value < smallest\n smallest = value\n end\n end\n name_hash.key(smallest)\nend", "title": "" }, { "docid": "85a8990a2d65a4a50cc41262330aac5c", "score": "0.82645655", "text": "def key_for_min_value(name_hash)\n if name_hash.size == 0\n return nil\n else\n smallest_key, smallest_key_num = name_hash.first\n name_hash.each do |key, num|\n if num < smallest_key_num\n smallest_key_num = num\n smallest_key = key\n end\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "91f6e33b3609ad60d72b88e544c0652c", "score": "0.8256929", "text": "def key_for_min_value(name_hash)\n smallest_value = 9999999999999\n smallest_key = nil\n name_hash.each do |element|\n if element[1]< smallest_value\n smallest_value = element[1]\n smallest_key = element[0]\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "9b4a41cb37c1a6c3ed4a06e13fc83c50", "score": "0.82563484", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value #lowest_value = nil in this part\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "ae712e1cd355755d634fa182a00e2eb7", "score": "0.82539773", "text": "def key_for_min_value(name_hash)\n \n lowest_number = 1000\n lowest_key = nil\n \n name_hash.each do |key, value|\n if value < lowest_number\n lowest_number = value \n lowest_key = key \n end\n end\n return lowest_key \nend", "title": "" }, { "docid": "8ff3186ed34716366ce4489b764b2196", "score": "0.8252522", "text": "def key_for_min_value(hash) \n\n min_value = 0\n min_key = 0\n \n if hash.empty?\n return nil\n end\n \n hash.each do |key, value|\n\n if min_value == 0 || value < min_value \n min_value = value\n min_key = key\n end\n end\n min_key\n\n \n \n\n\nend", "title": "" }, { "docid": "fea0eb5b81db16536604c58d63aeccff", "score": "0.8250185", "text": "def key_for_min_value(name_hash)\n smallest_key_value = 0\n desired_key = nil\n name_hash.each do |key, value|\n if value < smallest_key_value || smallest_key_value == 0\n smallest_key_value = value\n desired_key = key\n end\n end\n desired_key\nend", "title": "" }, { "docid": "54267f4b76ae17968e3673fcf95dd264", "score": "0.82493806", "text": "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\np lowest_key\nend", "title": "" }, { "docid": "d6a9f5ef7d887c611613c767f0e140fd", "score": "0.8246938", "text": "def key_for_min_value(hash)\n key2 = nil\n value2 = nil\n hash.collect do |key, value|\n if value2 == nil\n key2 = key\n value2 = value\n elsif value2 > value\n key2 = key\n value2 = value\n end\n end\n key2\nend", "title": "" }, { "docid": "88192afde83c8678ab9af58808ffd384", "score": "0.8244805", "text": "def key_for_min_value(name_hash)\n num = 0\n name_hash.each do |key,value|\n if num == 0\n num = value\n elsif value < num\n num = value\n end\n end\n name_hash.key(num)\nend", "title": "" }, { "docid": "c576f4496abe817d198d25ea16588771", "score": "0.8243904", "text": "def key_for_min_value(name_hash)\n lowest = 1000000\n lowest_item = nil\n name_hash.each do |item, value|\n if value < lowest\n lowest = value\n lowest_item = item\n end\n end\n lowest_item\nend", "title": "" }, { "docid": "fbdc95c4d6850f1cdcf75c33bed5ad62", "score": "0.8243451", "text": "def key_for_min_value(name_hash)\n lowest_value = find_lowest(name_hash)\n name_hash.key(lowest_value)\nend", "title": "" }, { "docid": "71429da2eb250413a3b57bdbde630ba8", "score": "0.823718", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return\n end\n val = 10000000000\n smallest_key = \"\"\n name_hash.collect do |key, value|\n if value < val\n smallest_key = key\n val = value\n end\n end\n smallest_key\nend", "title": "" }, { "docid": "647eb140844a5332166368d3bcfecc8a", "score": "0.8236949", "text": "def key_for_min_value(name_hash)\n lowest = 0\n lowest_key = nil\n name_hash.each do |k, v|\n if lowest == 0\n lowest = v\n lowest_key = k\n elsif lowest > v\n lowest = v\n lowest_key = k\n end\n end\n lowest_key\nend", "title": "" }, { "docid": "c38491fddaa2fe9b333d19f06c52525e", "score": "0.82322043", "text": "def key_for_min_value(hash)\n small = nil\n tiny = nil\n hash.each do |key, value|\n if tiny == nil || value < tiny\n tiny = value\n small = key\n end\n end\n small\nend", "title": "" }, { "docid": "7c062fa83e9059d43e1039279afbf733", "score": "0.8231087", "text": "def key_for_min_value(name_hash)\n smallest_key=nil \n smallest_value=nil\n name_hash.each do |key, val|\n if smallest_key== nil||val<smallest_value\n smallest_value=val\n key=smallest_key= key\n end\n end\n\n smallest_key\n end", "title": "" }, { "docid": "97eae1a02a7297721cbdf2d1285d7425", "score": "0.82306457", "text": "def key_for_min_value(name_hash)\n hash_values = name_hash.collect {|key, value| value}\n least = hash_values[0]\n hash_values.each do |value| \n if value < least\n least = value\n end\n end\n name_hash.key(least)\nend", "title": "" }, { "docid": "7d7b08d498c532430b3c70f1f9c1c5f8", "score": "0.82298714", "text": "def key_for_min_value(name_hash)\n smallest_value = 0 \n smallest_key = nil \n name_hash.each do |key,value|\n if smallest_value == 0 || value < smallest_value\n smallest_value = value \n smallest_key = key \n end \n end\n smallest_key\nend", "title": "" }, { "docid": "0ec68a27d47bc14735c772b55f02ff92", "score": "0.82284343", "text": "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_value=99\n name_hash.each { |key,value|\n lowest_value = value unless lowest_value < value\n }\n name_hash.key(lowest_value)\nend", "title": "" }, { "docid": "bf221d5a2dee3eb005185f3bdfc2df65", "score": "0.8227852", "text": "def key_for_min_value(name_hash)\nlowest = 999999\nresult = nil\nname_hash.each do |key, value|\n if value < lowest\n result = key\n lowest = value\nend\n end\nresult\nend", "title": "" }, { "docid": "a20616bf7fc77d9ceb14bfb8a0c1d081", "score": "0.8227016", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n nil\n else\n small_value = nil\n small_key = nil\n name_hash.each do |name, num|\n if small_value == nil || num < small_value\n small_value = num\n small_key = name\n end\n end\n small_key\n end\nend", "title": "" }, { "docid": "6e808f0dbde08485fe8003dfbe0ae78d", "score": "0.8226128", "text": "def key_for_min_value(hash)\n\n name, acc = hash.first\n\n if hash == {}\n nil\n else\n hash.each do |key, value|\n if value < acc\n acc = value\n name = key\n end\n end\n end\n name\nend", "title": "" }, { "docid": "8df01aa2faf978c607b835713ad334f8", "score": "0.82251215", "text": "def key_for_min_value(name_hash)\nsmall_key = nil\n small_value = 9999\n name_hash.each do |key, value|\n if value < small_value \n small_value = value\n small_key = key\n end\n end\n small_key\n end", "title": "" }, { "docid": "0285361eac212bf1042b9aa8c81ed8f5", "score": "0.8219871", "text": "def key_for_min_value(h)\n\tmin = h.collect do |key, value|\n\t\tvalue\n\tend\n\tsmallest = min[0]\n\tcount = 0\n\twhile count < min.length\n\t\tmin.each_with_index do |num, index|\n\t\t\tif min[index] < min[count]\n\t\t\t\tsmallest = min[index]\n\t\t\tend\n\t\tend\n\t\tcount += 1\n\tend\n\th.index(smallest)\nend", "title": "" }, { "docid": "95e0ab7c417950b476dd8eebf6647f2b", "score": "0.8218913", "text": "def key_for_min_value(name_hash)\n value = nil\n select_key = nil\n\n name_hash.each do |key, num|\n if value == nil\n value = num\n select_key = key\n elsif num < value\n value = num\n select_key = key\n end\n end\n\n select_key\nend", "title": "" }, { "docid": "6795b9b3296b44c68a6c377481104209", "score": "0.82172865", "text": "def key_for_min_value(name_hash)\n low_value = 0\n name_hash.each do |key, value|\n if low_value == 0\n low_value = value\n elsif low_value < value\n else\n low_value = value\n end\n end\n low_value\n\n name_hash.key(low_value)\nend", "title": "" }, { "docid": "20383784bc7faed9218241bdf579d458", "score": "0.8216739", "text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return nil\n end\n highest_value = 999999\n smallest_key = 0\n name_hash.collect do |key, value|\n if value < highest_value\n highest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7c84580f0cfdea23bdba7fa937962514", "score": "0.0", "text": "def ventilation_log_params\n params.require(:ventilation_log).permit(:fan_id, :grid_id, :start_time, :end_time, :speed)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980629", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.67819995", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67467666", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.67419875", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.67347664", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.65928614", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6504013", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6498014", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64819515", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64797956", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64562726", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.64400834", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6380117", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6377456", "text": "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", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.63656694", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6320543", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.63002014", "text": "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", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62997127", "text": "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", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.629425", "text": "def valid_params_request?; end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6293866", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.62909746", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62904227", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.62837297", "text": "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", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6240993", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.6239739", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217764", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214983", "text": "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", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62112504", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6194765", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6178", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.61755055", "text": "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", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61729854", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.61636627", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6153461", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151674", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61478525", "text": "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", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6122671", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61188513", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.61075556", "text": "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", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6105721", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6092412", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081011", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071054", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6064436", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6022111", "text": "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", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.6018135", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60151577", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.60108894", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60070235", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60070235", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6000806", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6000464", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.5998811", "text": "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", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59926987", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5992257", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5991173", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980311", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59660876", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59596545", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5959415", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.59589994", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957478", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.5953214", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5952233", "text": "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", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5944033", "text": "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", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59396756", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59396756", "text": "def filter_parameters; end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59386414", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.59345603", "text": "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", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5931261", "text": "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", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5926345", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5925795", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59174526", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59108645", "text": "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", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.5909469", "text": "def url_whitelist; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5908263", "text": "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", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.59053195", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.58980685", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5897738", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589657", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5895971", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.58942044", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5892847", "text": "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", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.588742", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.58834344", "text": "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", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.5880024", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58739793", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5868253", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.5867907", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58670515", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.58668053", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865756", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5863549", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5863236", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.5862728", "text": "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", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5861283", "text": "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", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58591247", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5855159", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.5854291", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.58512247", "text": "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", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.58498096", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
c4fed9f6f152033af2e447f69db1f508
=begin PROBLEM Input: string Output: string rules: Explicit Requirements Write a method that returns the middle word of a phrase/sentence Words are any sequence of nonblank characters Problem Domain: What is the middle word? Odd numbered sentence: array.size / 2 1 Even numbered sentence: array.size / 2 array_middle = array.size / 2 array[(array_middle 1)..array_middle] Edge Cases: Empty String Multiple spaces Even numbered sentence Single word ALGORITHM If the number of words is odd, then we will obtain the word that has equal amount of words to the left and right If the number of words is even, we will obtain the two middle words PSEUDOCODE Split array by spaces Obtain size of array If array size is == 1: Return only element in array If array size is == 2 Return the two only words If array size is odd: index value for middle word is array.size / 2 If array size is even: index range for middle words is: array.size / 2 array_middle = array.size / 2 array[(array_middle 1)..array_middle] =end
[ { "docid": "34edf0354190fa205733158f951796d8", "score": "0.71863127", "text": "def penultimate(string)\n \n string_array = string.split(\" \")\n number_of_words = string_array.size\n \n return string if string.empty?\n \n if number_of_words == 1\n return string\n elsif number_of_words == 2\n return string\n elsif number_of_words.odd?\n middle_word = (string_array.size / 2) \n string_array[middle_word]\n elsif number_of_words.even?\n middle_word = string_array.size / 2\n string_array[(middle_word - 1)..middle_word].join(\" \")\n else\n string\n end\nend", "title": "" } ]
[ { "docid": "d26de8ea1f94955c655a2b69af69eab2", "score": "0.85807574", "text": "def middle_word(string)\n words_array = string.split\n array_size = words_array.size\n\n if array_size == 0\n \"empty string entered.\"\n elsif array_size == 1\n words_array[0]\n elsif array_size == 2\n words_array[0] + ' ' + words_array[1]\n elsif array_size.even?\n half_length = array_size / 2\n words_array[-half_length -1] + ' ' + words_array[-half_length]\n else\n half_length = (array_size / 2.0).ceil\n words_array[-half_length]\n end\nend", "title": "" }, { "docid": "a9136ebe9f72f866bce64f461f73fc5e", "score": "0.84698004", "text": "def middle_word(words)\n words_array = words.split\n number_of_words = words_array.size\n middle = number_of_words / 2\n\n if number_of_words.zero?\n words\n elsif number_of_words.even?\n words_array[middle - 1..middle].join(' ')\n else\n words_array[middle]\n end\nend", "title": "" }, { "docid": "4e1ffc033e2adfc3257113304416c830", "score": "0.8247665", "text": "def middle(string)\n words_array = string.split\n halfway = words_array.size/2\n return '' if words_array.empty?\n return words_array[halfway] if words_array.size.odd?\n [words_array[halfway - 1], words_array[halfway]].join ' '\nend", "title": "" }, { "docid": "23d3f26559a11733ac4bc776594b0a8a", "score": "0.8167921", "text": "def middle(string)\n word_arr = string.split\n index = word_arr.length / 2\n if word_arr.length.even?\n word_arr[index - 1..index].join(\" \")\n else\n word_arr[index]\n end\nend", "title": "" }, { "docid": "8bdeaafe8135d9817693f2013d8da397", "score": "0.809716", "text": "def middle(string)\n string_array = string.split(' ')\n if string_array.length == 0\n nil\n elsif string_array.length == 1\n string_array[0]\n elsif string_array.length.even? == true\n \"No middle word\"\n else\n string_array[string_array.length/2]\n end\nend", "title": "" }, { "docid": "1c38ecebd8f33c405bde425813ffac78", "score": "0.80455077", "text": "def get_middle_word(string)\r\n return string if string.empty? || string.split.size == 1\r\n\r\n arr = string.split\r\n middle = (arr.size - 1) / 2 \r\n \r\n arr.size.even? ? arr[middle] : arr[middle + 1]\r\nend", "title": "" }, { "docid": "ddc51873e7676d808891dc17be44ac91", "score": "0.7952253", "text": "def middle_word(words, include_even: false)\n word_ary = words.split\n return nil if include_even != true && word_ary.size.even?\n middle = (word_ary.size.to_f / 2).round\n puts \"Word no. #{middle} for size of #{word_ary.size}\"\n word_ary[middle - 1]\nend", "title": "" }, { "docid": "fc09a0e2b50ecde298f99b0bc72ecc53", "score": "0.7928159", "text": "def return_middle_word(string)\n middle_word = \"\"\n words = string.split\n length = words.length\n return middle_word if length == 0\n if length.odd?\n middle_word = words[length/2]\n end\n if length.even?\n halfway = length/2\n middle_word << words[halfway-1] << \" \" << words[halfway]\n end\n middle_word\nend", "title": "" }, { "docid": "ba89b17d1cff22cbcb2e5a02dbe62147", "score": "0.79262024", "text": "def middle_word(str)\n arr = str.split\n arr.size > 1 && arr.size.odd? ? arr[arr.size / 2] : 'No middle word!'\nend", "title": "" }, { "docid": "8cf82227090fd201fde2441882010302", "score": "0.7909065", "text": "def middle_of_phrase(sentence)\n middle = \"\"\n return middle if sentence.empty?\n \n words = sentence.split\n halfway = words.size / 2\n\n if words.size.odd?\n middle << words[halfway]\n else\n middle << (words[halfway - 1] + ' ' + words[halfway])\n end\n\n middle\nend", "title": "" }, { "docid": "3b726795ab059ddc2282c5675cbd825e", "score": "0.78613883", "text": "def middle_word(string)\n return \"this sentence is empty\" if !string\n middle = string.split.size / 2\n idx = middle - string.split.size\n string.split(' ')[idx]\nend", "title": "" }, { "docid": "8669ec22bd82e7b2cc5b74ac7355a1e4", "score": "0.7859555", "text": "def middleword(string)\n return '' if string.empty?\n words_arr = string.split\n words_index = (words_arr.size - 1) / 2\n words_arr[words_index]\nend", "title": "" }, { "docid": "f7de1f13f072f4219c28ae5d12462470", "score": "0.7855793", "text": "def middle_word(sentence)\n return '' if sentence.empty?\n words = sentence.split\n l = words.size\n\n return words[0] if l == 1\n return words[l / 2] if l.odd?\n (words[l / 2 - 1] + ' ' + words[l / 2])\nend", "title": "" }, { "docid": "937444bd4ebac261e98180816812b30b", "score": "0.7826008", "text": "def middle_word(str)\n return \"\" if str.empty?\n words_array = str.split\n middle_index = (words_array.length - 1) / 2\n words_array[middle_index]\nend", "title": "" }, { "docid": "f87009e8a4ce99c306be4bc40791fc5c", "score": "0.7756039", "text": "def middle_word(string)\n return string if string.length == 1 || string.length == 0\n words = string.split\n index = words.size / 2\n even_set = []\n if words.size.odd?\n return words[index]\n elsif \n even_set << words[index - 1] << words[index]\n end\n even_set\nend", "title": "" }, { "docid": "61c7cdb5f0573c58136c9adf188e88c1", "score": "0.7747604", "text": "def find_middle_word(sentence)\n words = sentence.split(\" \")\n return words[0] if words.count == 1\n return \"\" if words.empty?\n return \"No middle word\" if words.count.even?\n midpoint = (words.count / 2).round\n words[midpoint]\nend", "title": "" }, { "docid": "c0464376c069a770cf52dac86078bb0f", "score": "0.77186924", "text": "def middle_one(word)\n arr = word.split('')\n if arr.length.even?\n return \"#{arr[(arr.length/2)-1]}#{arr[(arr.length/2)]}\"\n else\n return arr[arr.length/2]\n end\nend", "title": "" }, { "docid": "8c6124c9e6f978f1a9d2f8fdff92649e", "score": "0.7717042", "text": "def middle_word(str)\n words = str.split\n return nil if words.size.even?\n \n words[words.size / 2]\nend", "title": "" }, { "docid": "30b9b94c701b5a6b3eada09994a6ed9b", "score": "0.76679754", "text": "def get_middle(s)\n split_word = s.split(\"\")\n len = split_word.length\n \n if len.odd?\n return (split_word[(len - 1) / 2] )\n elsif len.even?\n return (split_word[(len - 1) / 2] + split_word[len / 2]) \n end\n end", "title": "" }, { "docid": "94911017936c72d9a16ec78a8f7eec5c", "score": "0.759818", "text": "def get_middle(s)\n letters = s.split(\"\") # splits word into array of its letters\n mid_digit = s.length / 2 # gets middle digit from length of word\n if s.length % 2 == 0 # Check if length of word is even\n middle = letters[mid_digit-1..mid_digit].join(\"\") # joins two middle letters\n else\n middle = letters[mid_digit]\n end\nend", "title": "" }, { "docid": "9e7f35ed52fa9bf91b6621dd91bc5a19", "score": "0.7504574", "text": "def mid_word(str)\n words_arr = str.split(' ')\n words_arr[(words_arr.length - 1) / 2]\nend", "title": "" }, { "docid": "737d2a8297d28f6eb5db6929a28bd5cf", "score": "0.7447949", "text": "def middle_word(string)\n words = string.split\n middle = (words.size) / 2\n words[middle]\nend", "title": "" }, { "docid": "64f5568106901f95bbb04e1b26e46a59", "score": "0.74318343", "text": "def middle(str)\n words = str.split\n\n return \"\" if words.empty?\n\n middle = words.length.even? ? -2 : (words.length / 2.0).floor\n\n words[middle]\nend", "title": "" }, { "docid": "c5c266ad0309fc82d5ca03bdac5ffacc", "score": "0.7373248", "text": "def middle_word(string)\n words = string.split\n middle_index = (words.length / 2.0).floor\n\n words[middle_index]\nend", "title": "" }, { "docid": "62329e046853622cfa666276225f277c", "score": "0.72811484", "text": "def middle(word)\n half = word.length/2\n if word.length % 2 == 1\n middle = word[half]\n else\n middle = word[half - 1] + word[half]\n end\nend", "title": "" }, { "docid": "5d5e085c65a94fc02f06ade86cbe7948", "score": "0.7050567", "text": "def medium(str, first_half:true)\n return '' if str.empty?\n decrease_even = first_half ? 1 : 0\n all_words = str.scan(/\\S+/)\n num_words = all_words.size\n medium_word_position = num_words % 2 == 0 ? num_words / 2 - decrease_even : num_words / 2\n all_words[medium_word_position]\nend", "title": "" }, { "docid": "4f3fd30c9513b45ebd15a503bea5b086", "score": "0.6988155", "text": "def get_middle(word)\n middle_letter_position = word.length / 2\n\n if (word.length % 2 == 0)\n word[middle_letter_position - 1..middle_letter_position]\n else\n word[middle_letter_position]\n end\nend", "title": "" }, { "docid": "705a8e7316f597fe7674c8b794586e3b", "score": "0.69670355", "text": "def middle(string)\n mid_index = string.split.size.to_f / 2\n p mid_index\n if mid_index % 2 == 0\n ''\n else \n mid_index = mid_index.round\n string.split[mid_index - 1]\n end\nend", "title": "" }, { "docid": "e51ec3b17d2afc7e1f6c55f5e89eefde", "score": "0.69299334", "text": "def get_middle(string)\n letters = string.split('')\n\n if letters.length % 2 == 0\n puts \"#{letters[((string.length / 2) - 1)]}#{letters[string.length / 2]}\"\n else\n puts \"#{letters[string.length / 2]}\"\n end\nend", "title": "" }, { "docid": "b19c5e1b634459f4ba155ec279970ccd", "score": "0.6920109", "text": "def inside_out s\n #..\n word_arr = s.split(' ')\n\n word_arr.each do |word|\n mid = (word.length / 2).floor\n if word.length % 2 == 0\n first = word[0..mid]\n second = word[mid + 1..-1]\n \n temp_word = word.split('')\n temp_word.each do |letter|\n\n end\n end\nend\n\n\n\np inside_out('what time are we climbing up the volcano') #, 'hwta item are we milcgnib up the lovcona'", "title": "" }, { "docid": "64b434aa1f2e09b45e9438a5e3218b21", "score": "0.6903594", "text": "def penultimate(string)\n words = string.split\n p words\n if words.size % 2 == 0\n puts \"There is no middle word in this string.\"\n elsif words.empty?\n puts \"There is no middle word in an empty string.\"\n else\n words[words.size / 2]\n end\nend", "title": "" }, { "docid": "e52e3180569906c1b99508c4af50f0b3", "score": "0.6812486", "text": "def make_word_phrase(array)\n array.each do |word|\n n = array.index(word)\n # creates a two word array\n two_word = array[n..n+1]\n check_two(two_word)\n if two_word[1].nil?\n two_word.clear\n else\n two_word.each do |c|\n strip_punct(c)\n end\n if proper_two(two_word)\n two_word.join(\" \")\n Wordbank.create(word: two_word, brand: true, headline: false)\n else\n two_word.join(\" \")\n Wordbank.create(word: two_word, brand: false, headline: false)\n end\n end\n # creates a three word array\n three_word = array[n..n+2]\n check_three(three_word)\n if three_word[2].nil?\n three_word.clear\n else\n three_word.each do |c|\n strip_punct(c)\n end\n if proper_three(three_word)\n three_word.join(\" \")\n Wordbank.create(word: three_word, brand: true, headline: false)\n else\n three_word.join(\" \")\n Wordbank.create(word: three_word, brand: false, headline: false)\n end\n end\n end\nend", "title": "" }, { "docid": "3ce7f2b6a5156a3da55cdee037b265d6", "score": "0.67838424", "text": "def get_middle(s)\n ar = s.split(//)\n ar_len = ar.length\n if ar_len % 2 != 0\n arr = ar_len/2.ceil\n p ar[arr]\n else \n arr = ar_len/2\n puts \"#{ar[arr-1]}#{ar[arr] }\"\n end\n end", "title": "" }, { "docid": "9f9f07ff79eed32a43f71e5efaf08e9d", "score": "0.67769605", "text": "def middle(string)\n mid = (string.split.size/2.0)\n return '' if string.empty?\n (mid % 1 == 0) ? (puts \"There is no middle!\") : string.split[-mid.round]\nend", "title": "" }, { "docid": "c832005b001f7d6f9453cebfdac84a3b", "score": "0.67641944", "text": "def segment_string(str)\n array = str.split(\"\")\n result_array=[]\n new_array = []\n third_array = []\n string2 = \"\"\n string3 = \"\"\n string4 = \"\"\n word = \"\"\n word2 = \"\"\n until array.empty?\n string2 << array.shift\n if valid_word?(string2)\n word2 = string2.dup\n word = string2.dup\n new_array = array.dup\n until new_array.empty?\n string2 << new_array.shift\n if valid_word?(string2)\n word = string2.dup\n third_array = new_array.dup\n end\n third_array.each do |x|\n string3 << x\n if valid_word?(string3)\n else\n ##go back a step\n new_array.each do |x|\n string4 << x\n if valid_word?(string4) == false\n \n end\n word = word2.dup\n end\n end\n end\n end\n result_array << word\n string2 = \"\"\n word = \"\"\n end\n end\n p result_array\nend", "title": "" }, { "docid": "24f6933141e29b9b47619bba558d9eae", "score": "0.6762138", "text": "def middle_substring(str)\n string_length = str.length\n if string_length.even?\n puts str[(string_length / 2) - 1..(string_length / 2)]\n else\n puts str[string_length / 2]\n end\nend", "title": "" }, { "docid": "6fc104b9fdc811df8f5b7e461fd132ef", "score": "0.6731263", "text": "def make_word_phrase(array_of_words)\n array_of_words.each do |word|\n n = array_of_words.index(word)\n # Creates a two word array\n two_word = array_of_words[n..n+1]\n # Checks for the punctuations\n check_two(two_word)\n # Checks for two words\n if two_word[1].nil?\n two_word.clear\n else\n two_word.each do |c|\n # removes unnecessary punctuation\n strip_punct(c)\n end\n if proper_two(two_word)\n two_word = two_word.join(\" \")\n else\n two_word = two_word.join(\" \")\n end\n end\n # Creates a three word array\n three_word = array_of_words[n..n+2]\n # Checks for the punctuations\n check_three(three_word)\n if three_word[2].nil?\n three_word.clear\n else\n three_word.each do |c|\n strip_punct(c)\n end\n if proper_three(three_word)\n three_word = three_word.join(\" \")\n else\n three_word = three_word.join(\" \")\n end\n end\n end\n end", "title": "" }, { "docid": "45e9bf0c50993b0bfee80b941bc35da4", "score": "0.6723625", "text": "def middle_substring(str)\n # your code goes here\n # arr_str = str.chars\n if str.length % 2 == 0\n return str[str.length / 2] * 2\n elsif str.length % 2 == 1\n return str[str.length / 2]\n end\nend", "title": "" }, { "docid": "c5b9d585846b24e5351b2468eb288526", "score": "0.6715786", "text": "def center_of(word)\n word.length.odd? ? word.slice(word.length / 2) : word.slice(((word.length / 2) - 1), 2)\nend", "title": "" }, { "docid": "9c2a579ad8560f42fd582dee0241e028", "score": "0.67120993", "text": "def center_of_lesson(string)\n size = string.size\n\n size.odd? ? string[size/2] : string[((size/2)-1), 2]\nend", "title": "" }, { "docid": "19e035111662fc14ec738c28f114d812", "score": "0.66904736", "text": "def get_middle(s)\n s.length.even? ? s[(s.length/2)-1] + s[s.length/2] : s[s.length/2]\nend", "title": "" }, { "docid": "33011d0669c3c22789a56577d104eab2", "score": "0.6688108", "text": "def get_middle(s)\n if s.length.even?\n return s[s.length / 2-1] + s[s.length / 2]\n else \n return s[s.length / 2]\n end\nend", "title": "" }, { "docid": "40e4fd22e8b880b7682a7ffe8225619e", "score": "0.6682267", "text": "def get_middle(s)\n return s if s.size <= 1\n \n s.size.even? ? s.slice(s.size / 2 - 1, 2) : s.slice(s.size / 2)\nend", "title": "" }, { "docid": "1a693bc21eb2c061127249808d5013e9", "score": "0.6665062", "text": "def middle(word)\n length = word.length\n length > 2 ? word[1, length - 2] : ''\n end", "title": "" }, { "docid": "d05ce21a5fea842c266a41f5ca66dbe8", "score": "0.665688", "text": "def get_middle(s)\n if s.length.even?\n return s[((s.length/2)-1)]+s[(s.length/2)]\n else\n return s[s.length/2]\n end\nend", "title": "" }, { "docid": "0b9665d15e133a616b959804598f6d3e", "score": "0.66547114", "text": "def middle_substring(str)\n size = str.length\n index = size / 2\n\n if(size.odd?)\n return str[index]\n else\n return str[index - 1..index]\n end\nend", "title": "" }, { "docid": "0bbdc4d6971314b1b37258a67e640980", "score": "0.6652568", "text": "def middle_substring(str)\n middle = str.length/2\n if middle.odd?\n return str[middle]\n else\n return str[middle - 1..middle]\n end\n\nend", "title": "" }, { "docid": "b7d5fab3e9ac80ac54da5ed33243e341", "score": "0.6648491", "text": "def middle_substring(str)\n if str.length.odd? #odd string length\n return str[str.length / 2]\n else #even string length\n return str[(str.length/2) - 1] + str[str.length/2]\n end\nend", "title": "" }, { "docid": "b224429cc278123046185f5825f2a632", "score": "0.66311747", "text": "def sentence_maker(array)\n sentence = ''\n array.each do |word|\n if word == array[-1]\n sentence += word\n else\n sentence += word.to_s + \" \"\n end\n end\n sentence.capitalize + \".\"\nend", "title": "" }, { "docid": "d73de16033a564ce4b44c4bbe04ce073", "score": "0.660911", "text": "def middle_substring(str)\n mid = str.length / 2\n if str.length.odd?\n return str[mid]\n end\n\n str[mid - 1] + str[mid]\n\nend", "title": "" }, { "docid": "5804cd00453f20acbe353261407dd969", "score": "0.66084945", "text": "def middle_substring(str)\n l = str.length\n if l.odd?\n str[l/2]\n else\n str[l/2-1..l/2]\n end\n\nend", "title": "" }, { "docid": "83b5d10d7a68af31748d154181996cc5", "score": "0.6600193", "text": "def sentence_maker(array)\n body_sentence = \"\"\n first_word = \"\"\n last_word = \"\"\n​\n first_word << array.shift.capitalize!\n last_word << array.pop + \".\"\n​\n array.each do |word|\n body_sentence << word.to_s + \" \"\n end\n​\n return first_word + \" \" + body_sentence + last_word\n​\nend", "title": "" }, { "docid": "de03e2e20dd7198044697e0464312183", "score": "0.6594859", "text": "def sentence_maker(array)\n sentence = \"\"\n word = 0\n while word < array.length\n array.each do |x|\n x.to_s\n sentence += \"#{x} \"\n word += 1\n end\n if word == array.length\n# last = array[-1].to_s\n# sentence + \"#{last}.\"\n end\n# for x in array[0...-1]\n# x.to_s\n# sentence += \"#{x} \"\n# last = array[-1].to_s\n# sentence + \"#{last}.\"\n return sentence.capitalize.strip + \".\"\n end\nend", "title": "" }, { "docid": "f46db723893019a32257baef5601318f", "score": "0.657842", "text": "def reverse_sentence(my_sentence)\n if my_sentence == nil || my_sentence == \"\"\n return my_sentence\n end \n\n length = my_sentence.length \n # space_index stores all space index location\n space_index = []\n i = 0 \n while i < length \n if my_sentence[i] =~ /\\s+/\n space_index << i\n end \n i +=1\n end\n\n\n if space_index == []\n return my_sentence\n end \n\n# word_index stores all words index location\n words_index = []\n\n if space_index[0] > 0 \n words_index << [0,(space_index[0]-1)]\n end \n\n (space_index.length-1).times do |num|\n if (space_index[num] + 1) <= (space_index[num+1]-1)\n words_index << [(space_index[num] + 1),(space_index[num+1]-1)]\n end \n end \n\n if length > space_index[-1]\n words_index << [(space_index[-1]+1),(length-1)]\n end \n\n new_sentence = \"\"\n j = 0\n s = -1\n w = -1\n \n\n num_times = (space_index.length)+(words_index.length)\n # stitch everything together here\n num_times.times do |n|\n\n if w * (-1) > words_index.length\n new_sentence[j] = \" \"\n\n j += 1\n s -= 1\n\n\n elsif s *(-1) > space_index.length\n new_sentence[j] = my_sentence[(words_index[w][0])..(words_index[w][1])]\n\n j += ((words_index[w][1])-(words_index[w][0])+1)\n w -= 1\n\n elsif space_index[s] > words_index[w][0]\n new_sentence[j] = \" \"\n\n j += 1\n s -= 1\n\n else \n new_sentence[j] = my_sentence[(words_index[w][0])..(words_index[w][1])]\n\n j += ((words_index[w][1])-(words_index[w][0])+1)\n w -= 1\n\n end \n end \n\n \n length.times do |n|\n my_sentence[n] = new_sentence[n]\n end \n\n return my_sentence\n raise NotImplementedError\nend", "title": "" }, { "docid": "f3f736af6eda4422ac34bd25182373c9", "score": "0.657246", "text": "def penultimate(string)\n words = string.split(\" \")\n return words[0] if words.count == 1\n return \"\" if words.empty?\n return \"No middle word\" if words.count.even?\n midpoint_index = (words.count / 2).round\n words[midpoint_index]\nend", "title": "" }, { "docid": "58c922cfe213a6929ead445e8e7570ca", "score": "0.657083", "text": "def center_of(string)\n middle_char = ''\n if string.length.odd?\n middle_char = string[string.length / 2] \n elsif string.length.even?\n middle_char = string[(string.length / 2) - 1, 2] \n end\n middle_char\nend", "title": "" }, { "docid": "39ab0cca2784367d29bd517cd33cfd62", "score": "0.65663546", "text": "def low_tech_split(sentence)\n words = []\n i, j = 0\n\n while i < sentence.length\n if sentence[i] == ' '\n i += 1\n else\n words << sentence[j..i]\n \"asdf\".\n sentence = sentence.\n i += 1\n j = i\n end\n end\n words\nend", "title": "" }, { "docid": "33a05eba03efd3ff96497d5883718b57", "score": "0.65653783", "text": "def alternate_words (sentence)\n\t# I had to look for that first block. \n\t#I got close but the 2nd sentence was giving me [\"Can\", \"we\", \"get\"] because of '\n\t# and this part of the script array = sentence.scan(/\\w+/) had to be replaced with array = sentence.split for it to work.\n # \n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n sentence = sentence.gsub(char, ' ')\n\tend\n\tarray = sentence.split\n\t# This part was working. Still does. \n\tnew_array=[]\n array.each.with_index do |word, index|\n new_array << word if index.even?\n end\nnew_array\nend", "title": "" }, { "docid": "2b9cd55db27671dc459ae3ef17c2a9c7", "score": "0.65603614", "text": "def middle_substring(str)\n mid_idx = str.length / 2\n if (str.length.even?)\n return str[mid_idx - 1] + str[mid_idx]\n else\n return str[mid_idx.floor]\n end\n\nend", "title": "" }, { "docid": "d9c3254ccadd2a9f2a954a488d9c8cb9", "score": "0.6558672", "text": "def get_middle(s)\n x = (s.length/2)\n s.length.even? ? s[x-1..x] : s[x]\nend", "title": "" }, { "docid": "1731570d20d1a9c9cc09fe078a154b33", "score": "0.6557015", "text": "def odd_words(phrase)\n phrase[0..-2].split.map.with_index do |word, idx|\n idx.odd? ? word.reverse : word\n end.join(' ') + '.' \nend", "title": "" }, { "docid": "51da5f6393ec4142dc177bf2f88f942d", "score": "0.654409", "text": "def get_middle(s)\n len = s.length\n if len <=1 \n return s\n end\n if len % 2 == 0 \n return s[len/2 -1] + s[len/2]\n else\n return s[len/2]\n end\nend", "title": "" }, { "docid": "b51b1d7e47b468e08749360764dc5034", "score": "0.65298474", "text": "def sentence_maker(array)\n n = \"\"\n while array != []\n n += array.shift.to_s\n if array.length >= 1\n n += \" \"\n end\n end\n n += \".\"\n n.capitalize\nend", "title": "" }, { "docid": "4785ba2ac493bd35e689bdcc68d3ca07", "score": "0.65254927", "text": "def middle_substring(str)\n half_length = str.length / 2\n if str.length.even?\n return str[(half_length - 1)..half_length]\n else\n return str[half_length]\n end\nend", "title": "" }, { "docid": "ce08f46a40ecedc2169b4188649205a2", "score": "0.65177983", "text": "def odd_words(string)\n result = \"\"\n word_count = 0\n i = 0\n while i < string.length\n char = string[i]\n if char == \" \"\n word = false\n char_count = 0\n result << char unless word_count == 0 || result [-1] == \" \"\n \n elsif char != \" \" && char != \".\"\n word_count += 1 unless word\n word = true\n \n if word_count.odd?\n result << char\n else \n char_count += 1\n result = result[0..-char_count] + char + result[-(char_count - 1), char_count - 1]\n end\n \n elsif char == \".\"\n while result[-1] == \" \"\n result[-1] = \"\"\n end\n result << char\n end \n \n i += 1\n end\n result\nend", "title": "" }, { "docid": "76623258c710f62cb24b8b00abd44afe", "score": "0.65082735", "text": "def get_middle(s)\n if s.length % 2 == 1\n s[(s.length + 1) / 2 - 1]\n else\n s[s.length / 2 - 1..s.length / 2]\n end\nend", "title": "" }, { "docid": "5a3be0d6bec1bfb8551dfb405581dff7", "score": "0.6491228", "text": "def sentence_maker(array)\n #iterate through string of the array\n #add each string together\n #return final string \n total =''\n for i in 0...array.length\n if i == 0 \n total << (array[i].to_s.capitalize + ' ')\n elsif i == (array.length - 1)\n total << (array[i].to_s)\n total << ('.')\n else\n total << (array[i].to_s)\n total << (' ')\n end\n i+=1\n end \n return total\nend", "title": "" }, { "docid": "140141a4184078a75175404b4e1ea677", "score": "0.6489008", "text": "def middle_substring(str)\n if str.length.even?\n str[str.length/2 -1..str.length/2]\n else\n str[str.length/2 ]\n end\nend", "title": "" }, { "docid": "25af69725ce2ab1c5ef2d7b8a2985f42", "score": "0.6487654", "text": "def even_splitters(string)\n # letters = string\n # arr = []\n # holder = letters.each_char do |char|\n # string.split(char).select { |x| \n # x.length != 1\n # }\n # end\n # p holder.split(\"\").uniq \n\n# **********************\n # word_array = []\n # holder = string.each_char { |char| \n # characters = string.split(char).uniq\n # word_array << characters\n # }\n # word_array.each_with_index { |el, idx| \n # unless word_array[idx].length == 1\n # p word_array[idx]\n # p word_array[idx][0]\n # p word_array[idx][1]\n # end\n # }\n # word_array\n\n# ************************\n letters = string\n arr = []\n holder = letters.each_char do |char|\n substrings = string.split(char)\n new_subs = substrings.reject { |string| string == ''}\n arr << char if new_subs.all? { |string| string.length == new_subs.last.length}\n end\nend", "title": "" }, { "docid": "e05eb64b7e0237db18027a3013ddd3a8", "score": "0.6487451", "text": "def middle_substring(str)\n if str.length.even?\n return str[str.length / 2-1..str.length / 2]\n else \n return str[str.length / 2]\n end\nend", "title": "" }, { "docid": "a01133b35ea6f9cdfe6725eb2b209bea", "score": "0.6485498", "text": "def middle_substring(str)\n if str.length.even?\n return str[str.length/2-1..str.length/2]\n else\n return str[str.length/2]\n end\nend", "title": "" }, { "docid": "18b00b4f0b3f37f2e7ce60d49d860bde", "score": "0.64712995", "text": "def middle_substring(str)\n middle = str.length / 2\n\n if str.length.odd?\n return str[middle]\n else\n return str[(middle-1)..middle]\n end\nend", "title": "" }, { "docid": "1ada558fc0aef02e2e9d39b838c14a9d", "score": "0.64679956", "text": "def alternate_words(array)\n\n#was finding it hard to do a gsub or delete with the characters as the hash etc\n#kept breaking it .. Answer from stackoverflow\n#testing this out now in irb hence not as many revisions of the challenge\n\n new_string = array.downcase.gsub(/[^a-z0-9\\s]/i, '').split\n\n\nreturn_this = []\nnew_string.select.with_index do |value, index|\n\n if (index %2 == 0) then\n return_this.push(value)\n end\n long_array= return_this.join(\" \")\n\np long_array\n\nend\n\nend", "title": "" }, { "docid": "81c7bfb8394e806e33f4dd775e84692f", "score": "0.64658874", "text": "def center_of(str)\n index = str.size / 2\n middle = str[index]\n middle = str[index-1] + middle if str.size.even?\n middle\nend", "title": "" }, { "docid": "ea6edcaa8ce11ecd5cbdaa5fb8041a10", "score": "0.6461857", "text": "def middle_substring(str)\n half = str.length / 2\n return str.length.odd? ? str[half] : str[half - 1] + str[half]\nend", "title": "" }, { "docid": "1efb8423a47def5aba4a46da90493fc1", "score": "0.6461549", "text": "def center_of(str)\n middle_char = ''\n middle = str.size / 2\n\n middle_char << str[middle - 1] if str.size.even?\n middle_char << str[middle]\n\n middle_char\nend", "title": "" }, { "docid": "3cb79b953ca5f4b9519def0e0f4420fd", "score": "0.6459938", "text": "def middle str\n\tmid = str.size/2\n\tstr.length.even? ? str[(mid-1)..mid] : str[mid] \n\t\n\t# or\n\t# str[(str.size-1)/2..str.size/2]\nend", "title": "" }, { "docid": "a2bbd4d880d67b18fa1f3eb517522cb0", "score": "0.6454313", "text": "def get_middle(s)\n mid =(s.length - 1)/2\n s.length.even? ? s[mid..mid+1]:s[mid]\nend", "title": "" }, { "docid": "6ccde9a1eeacaf43acbde3788263c364", "score": "0.6448296", "text": "def alternate_words(sentence)\n# this line takes all the chars that are to be excluded, splits them and assigns them to char, then\n# substitutes them with a blank space.\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n sentence = sentence.gsub(char, ' ')\n end\n# this line takes sentence, splits it into a new array, and assigns the array to words\n words = sentence.split\n# this is an empty array, waiting to be filled:\n return_to = []\n# this line takes the words array, splits it and assigns each object an index number\n words.each_with_index do |word, index|\n# this line adds the word into the return_to array if the index number is even\n return_to << word if index.even?\n end\n return_to\n end", "title": "" }, { "docid": "0a99cb45c08071df3cf65e5995d7965c", "score": "0.644439", "text": "def middle_substring(str)\n if str.length.odd?\n return str[str.length / 2]\n else\n return str.slice(str.length / 2 - 1, 2)\n end\nend", "title": "" }, { "docid": "7abb117e5047556ca83ad4f7c36c1294", "score": "0.6440019", "text": "def center_of(string)\n characters = ''\n half_way = string.size / 2\n\n if string.size.odd?\n characters << string[half_way]\n else\n characters << string[half_way - 1] << string[half_way]\n end\n characters\nend", "title": "" }, { "docid": "43eee890c3f1c16d3de8ef040e2c9725", "score": "0.643187", "text": "def middle_substring(str)\n mid_idx = str.length / 2\n\n if str.length.even?\n str[mid_idx - 1..mid_idx]\n else\n str[mid_idx]\n end\nend", "title": "" }, { "docid": "ae054e475261676b2450fe942c63e7b1", "score": "0.6420032", "text": "def center_of(string)\n if string.length.even?\n first_middle_char = string[((string.length / 2) -1)]\n last_middle_char = string[string.length / 2]\n first_middle_char + last_middle_char\n else\n string[string.length / 2]\n end\nend", "title": "" }, { "docid": "20a421da500fb957deae9bf52ba273cc", "score": "0.6414499", "text": "def center_of(string)\n string.length.even? ? even = true : even = false\n if even\n string.slice((string.length / 2)-1 , 2)\n else\n string.slice(string.length / 2, 1)\n end\nend", "title": "" }, { "docid": "2531bbd4cb8806936753c7775c701359", "score": "0.6412644", "text": "def middle_substring(str)\n # your code goes here\n x = str.length\n\n if x % 2 == 1\n str[x/2]\n\n else str[x/2 - 1] + str[x/2]\n end\nend", "title": "" }, { "docid": "0f05109d22d205d39cb113ff132eccc4", "score": "0.64049387", "text": "def middle_substring(str)\n new_str = \"\"\n if str.length.even?\n new_str = str[(str.length / 2) - 1, 2]\n else\n new_str = str[str.length / 2]\n end\n return new_str\nend", "title": "" }, { "docid": "cc235e1c8814853c1713a939db908f28", "score": "0.6402166", "text": "def center_of(string)\n if string.size.odd?\n num = string.size / 2\n string[num]\n else \n num = (string.size / 2) - 1\n string[num, 2]\n end \nend", "title": "" }, { "docid": "15707d5b8ad6e74cfe9f1697e384ac52", "score": "0.6399212", "text": "def find_longest_word_in_sentence sentence\narray_of_words = sentence.split(' ')\n while array_of_words.size > 1 do\n if array_of_words[1].length > array_of_words[0].length\n array_of_words.delete_at(0)\n else\n array_of_words.delete_at(1)\n end\n end\np array_of_words\nend", "title": "" }, { "docid": "3a99306ac524d5088a24d5208517ee79", "score": "0.6397081", "text": "def sentence_maker(word_array)\n traversal_length = word_array.length - 1\n first_word = word_array[0].capitalize\n sentence = first_word\n\n for word in 1..traversal_length\n sentence += \" #{word_array[word]}\"\n end\n\n return sentence + \".\"\nend", "title": "" }, { "docid": "ebf58da6838d0cfee5763dfe4a87094e", "score": "0.6394634", "text": "def middle_substring(str)\n mid = str.length / 2\n\n str.length.even? ? str[mid - 1..mid] : str[mid]\nend", "title": "" }, { "docid": "d3ead640d1054b79a792e3e6179916c9", "score": "0.6393866", "text": "def center_of(phrase)\n center = phrase.length/2\n if phrase.length % 2 == 1\n phrase[center]\n else\n phrase.values_at(center-1, center)\n end\nend", "title": "" }, { "docid": "2518040f74001755cd2d2320b5ec5d59", "score": "0.63798463", "text": "def middle_character(str)\n\t\n\tif str.length == 0 \n\t\tp str\n\telsif str.length.odd? \n\t\tp str[str.length/2]\n\telsif str.length.even?\n\t\tp str[str.length / 2-1] + str[str.length/2]\n\t#Your code here\nend\nend", "title": "" }, { "docid": "8c5166f38df0932362a3054dfa797741", "score": "0.6360567", "text": "def middle_substring(str)\n # your code goes here\n \n if str.length%2 == 0\n str[(str.length/2)-1..(str.length/2)]\n else str[(str.length/2)]\n end\n end", "title": "" }, { "docid": "7933ee1bb26d9ef83c5ba2620a0638c9", "score": "0.6360541", "text": "def middle_substring(str)\n return str[str.length / 2] if str.length.odd?\n str[str.length / 2 - 1] + str[str.length / 2]\nend", "title": "" }, { "docid": "16e70cdf1e1f192eb19118263a276e40", "score": "0.6358098", "text": "def munsters_confusing_word_transformation(string)\n string_array = string.upcase!.split(' ').zip\n first_word = string_array[0]\n second_word = string_array[1]\n first_word_letters = first_word.join('').split('')\n second_word_letters = second_word.join('').split('')\n first_word_letters.unshift(first_word_letters[0].downcase)\n first_word_letters.delete_at(1)\n first_word_letters.join('')\n second_word_letters.unshift(second_word_letters[0].downcase)\n second_word_letters.delete_at(1)\n second_word_letters.join('')\n string_array.delete(string_array[0])\n string_array.delete(string_array[0])\n string_array.join(' ')\n puts \"#{first_word_letters.join('')} #{second_word_letters.join('')} #{string_array.join(' ')}\"\nend", "title": "" }, { "docid": "1a30f6af686391ed0b98f53656348c08", "score": "0.6351943", "text": "def sentence_maker(array)\n full_sentence = \" \"\n length = array.length\n\n while length > 0\n full_sentence += array[length]\n length -= 1\n end\n\n return full_sentence\nend", "title": "" }, { "docid": "a59414d7c742366bc3be86b379dc06a5", "score": "0.63512486", "text": "def middle_substring(str)\n mid_len = str.length / 2\n str.length.even? ? str[mid_len - 1..mid_len] : str[mid_len]\nend", "title": "" }, { "docid": "d314af092474defc94180b96b7b5a1af", "score": "0.6336066", "text": "def sentence_maker(arr)\n counter = 0\n sentence = \"\"\n until counter == arr.length\n word = arr[counter].to_s\n sentence = sentence + word + \" \"\n counter += 1\n end\n return sentence.capitalize.rstrip + \".\"\nend", "title": "" }, { "docid": "d4be386ca8982ebc7c8b3a2ea95a21ce", "score": "0.6327882", "text": "def middle_substring(str)\n len = str.length\n if len % 2 == 0\n return str[len/2 -1...len/2 +1]\n else\n return str[(len -1)/2]\n end\nend", "title": "" }, { "docid": "c0051707cfafb73dc27036ad395d9a8a", "score": "0.63267815", "text": "def alternate_words(array)\n # this will get better when we learn regular expressions :)\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n array = array.gsub(char, ' ')\n end\n words = array.split\n solution = []\n words.each_with_index do |word, index|\n solution << word if index.even?\n end\n solution\nend", "title": "" } ]
0d01ee3e493677a5609d0ae1a6793a84
DELETE /examenes/1 DELETE /examenes/1.json
[ { "docid": "5f887419fdbeb83b7b60fa3c33c3f692", "score": "0.7019953", "text": "def destroy\n @examen.destroy\n respond_to do |format|\n format.html { redirect_to examenes_url, notice: 'Examen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "ad86927f1fcde37e80086f508ce163d0", "score": "0.7688692", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.delete\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44be7965fe23e9bef8954a0445578c52", "score": "0.7565225", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "6c0f9adf05fa7122ac4e24ab912ae455", "score": "0.7558561", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c0f9adf05fa7122ac4e24ab912ae455", "score": "0.7558561", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c0f9adf05fa7122ac4e24ab912ae455", "score": "0.7558561", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6c0f9adf05fa7122ac4e24ab912ae455", "score": "0.7558561", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7edea04fcb69626c4d9cea5146f45aff", "score": "0.748717", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "94818f639e5518dd4ad2e2522a6ed77f", "score": "0.73663753", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e2ad6ac4d34134d40e6f8ca7b158174c", "score": "0.7331509", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a9b31cc6610ebd7bc94991ea7dfe43f", "score": "0.72778547", "text": "def destroy\n @sequoia_exam.destroy\n respond_to do |format|\n format.html { redirect_to sequoia_exams_url, notice: 'Sequoia exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ae8c1c07654397ded291b3b82a8107da", "score": "0.7263345", "text": "def destroy\n\t @exam = Exam.find(params[:id])\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "83992eb51f276569ba70e118b31f01e5", "score": "0.7248901", "text": "def destroy\n @last_exam = LastExam.find(params[:id])\n @last_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to last_exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "508091edc30a1eaaff835bb34a0224f0", "score": "0.7243566", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "649503554ff525e61be36a0533d0b64e", "score": "0.72380906", "text": "def destroy\n @centro_examenes.destroy\n respond_to do |format|\n format.html { redirect_to centro_examenes_url, notice: 'Centro examene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "819f3be10ffc1e501997f3e40d14dbad", "score": "0.7215755", "text": "def destroy\n @exam_level = ExamLevel.find(params[:id])\n @exam_level.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_levels_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "df7611170337c8ed0e85e9697b96cbbf", "score": "0.7206009", "text": "def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a2ea5729f0671d0b24c63b9480be9f5c", "score": "0.72009534", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to appointment_exams_path(@appointment), notice: 'Exame foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a8d45ba54f5d66f9f0a64f52f60247ed", "score": "0.71975815", "text": "def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0429dd06e3521e7125fa5fac7c25237b", "score": "0.7183715", "text": "def destroy\n @examiner = Examiner.find(params[:id])\n @examiner.destroy\n\n respond_to do |format|\n format.html { redirect_to examiners_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "050e354b6c8781111b1c0ad01ad916b3", "score": "0.71555847", "text": "def destroy\n @exam_type = ExamType.find(params[:id])\n @exam_type.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb006b188207f3c1cbe1db16b2a2dbed", "score": "0.71280783", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_path(@course), notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b55fdd903e99c35327c5940cfa183c10", "score": "0.7118805", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d6413be1932286d65093660a929bee9a", "score": "0.7108511", "text": "def destroy\n\n\n @proyecto_exam.destroy\n respond_to do |format|\n format.html { redirect_to proyecto_exams_url, notice: 'Proyecto exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "167ec17dfb8603162e20961ab4402829", "score": "0.71062917", "text": "def destroy\n @examiner.destroy\n respond_to do |format|\n format.html { redirect_to examiners_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "80fdb4b4dbdd979c19ad7968b3a85e6e", "score": "0.7100595", "text": "def destroy\n @second_exam.destroy\n respond_to do |format|\n format.html { redirect_to second_exams_url, notice: 'Second exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7780e9db70ff1216c728cee73e8aadec", "score": "0.709516", "text": "def destroy\n\t\t@exam.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exams_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "c0c756bd72f14c8dcdf109bd420628ae", "score": "0.7092599", "text": "def destroy\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.70677143", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "bcaf9748949fe9412a6ca27dfdaf8cce", "score": "0.7059953", "text": "def destroy\n @exam = @course.exams.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to teacher_course_exams_url(@course) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "22b4c24965b9b6b9b962155dcd68ccab", "score": "0.7057268", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n File.unlink(@exercise.path)\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9b488712014efe7af26ae0a0c6520d45", "score": "0.70545906", "text": "def destroy\n @exam_answer = @user.exam_answers.find(params[:id])\n @exam_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_answers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c161b7b7afd8f1102e03b0014609a46", "score": "0.70502555", "text": "def destroy\n\n if (File.exist?(Rails.root.join('public', 'uploads/examinees/', @exam.persona_url.to_s)) && !@exam.persona_url.blank?)\n FileUtils.rm(Rails.root.join('public', 'uploads/examinees/', @exam.persona_url.to_s))\n end\n\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f207b0cf11476302b95372ebe2ce276b", "score": "0.7045816", "text": "def destroy\n @exam_question = ExamQuestion.find(params[:id])\n @exam_question.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_questions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eb9c02926d445226ecdb04df08a9ce15", "score": "0.7044847", "text": "def destroy\n @examn.destroy\n respond_to do |format|\n format.html { redirect_to examns_url, notice: 'Examn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cd6135de58df7c8e2e8df1c81193f78f", "score": "0.7037333", "text": "def destroy\n get_event\n @event_exam = @event.exams.find(params[:id])\n @event_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to event_exams_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5b3dd86868a0fd1159b8527e5374f0e4", "score": "0.7027888", "text": "def destroy\n @exam_type.destroy\n respond_to do |format|\n format.html { redirect_to exam_types_url}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "926d9365e3a073db26584e61ac55fe70", "score": "0.7011624", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n end\n end", "title": "" }, { "docid": "796ee6256f8a6f42b4d1f286f3e891ea", "score": "0.70047194", "text": "def destroy\n @admission_exam.destroy\n respond_to do |format|\n format.html { redirect_to admission_exams_url, notice: 'Admission exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b04346a7340da835f1251d6a3e9d99b6", "score": "0.69918656", "text": "def destroy\n @tipo_examene.destroy\n respond_to do |format|\n format.html { redirect_to tipo_examenes_url, notice: 'Tipo examene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08dd9085123f5ef031d34e89bf53e4de", "score": "0.69867486", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exame removido com sucesso!' }\n format.js { flash.now[:notice] = 'Exame removido com sucesso!'}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "485e9b81f2a8e4206c6b2c9ba609e744", "score": "0.6986333", "text": "def destroy\n @resume_exam.destroy\n respond_to do |format|\n format.html { redirect_to resume_exams_url, notice: 'Resume exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e3ea6a969e73a14e9f8081c09873cb5d", "score": "0.6985238", "text": "def destroy\n @laboratorio_examn.destroy\n respond_to do |format|\n format.html { redirect_to laboratorio_examns_url, notice: 'Laboratorio examn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f7c7da877e272acb8b2605868f210f10", "score": "0.69632477", "text": "def destroy\n @exam_paper = ExamPaper.find(params[:id])\n @exam_paper.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_papers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e744bbfde407eca82c8933ad75e5002c", "score": "0.6961671", "text": "def destroy\n @gyn_exam = GynecologicExamination.find(params[:id])\n @gyn_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to gynecologic_examinations_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ae63bd8bfb9120134a0d2f27b06a7b86", "score": "0.6957142", "text": "def destroy\n @exam_course = ExamCourse.find(params[:id])\n @exam_course.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_courses_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e7bcc5c550741682714a34dfac8dcdb", "score": "0.69534945", "text": "def destroy\n @regiment_exercise.destroy\n respond_to do |format|\n format.html { redirect_to regiment_exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.6939741", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "48c91f3d537992b7110e170c0dda8b91", "score": "0.6937286", "text": "def destroy\n @exam_list = ExamList.find(params[:id])\n @exam_list.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_lists_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2e9126342216eb2a5cf6d59d7bf0d9b9", "score": "0.6922786", "text": "def destroy_exam\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>:exam_index) }\n end\n end", "title": "" }, { "docid": "cfc71f09a47dec975b9df2da205c6676", "score": "0.69139516", "text": "def destroy\n @exam_item.destroy\n respond_to do |format|\n format.html { redirect_to return_path, notice: \"Exam item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a41be49f6458790d5a2d38db09348203", "score": "0.6913361", "text": "def destroy\n require 'net/http'\n require 'json'\n\n # Correct URL for deleting a resource.\n uri = URI(\"http://localhost:3000/students/#{params[:id]}.json\")\n\n request = Net::HTTP::Delete.new uri\n\n # Hitting the endpoint.\n response = Net::HTTP.start uri.hostname, uri.port do |http|\n http.request request\n end\n\n if response.code == '200'\n redirect_to students_path, notice: 'Successfully removed record.'\n else\n redirect_to students_path, notice: 'Failed to delete.'\n end\n end", "title": "" }, { "docid": "0e6d620c524c0ff5d3e7f79cc5a7710f", "score": "0.69109565", "text": "def destroy\n @exam_instance.destroy\n respond_to do |format|\n format.html { redirect_to exam_instances_url, notice: t(:Exam_destroyed) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8c484ef247ad1a8ebfca1f29a66d22d", "score": "0.6904258", "text": "def destroy\n @ejercicio1 = Ejercicio1.find(params[:id])\n @ejercicio1.destroy\n\n respond_to do |format|\n format.html { redirect_to ejercicio1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ef00bebad89a884cd16fdf17ca787dd9", "score": "0.6900043", "text": "def destroy\n @medical_exam.destroy\n respond_to do |format|\n format.html { redirect_to medical_exams_url, notice: 'Medical exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "957b5b687ad5862d86088a1f2c75d48f", "score": "0.68996805", "text": "def destroy\n @exam_info.destroy\n respond_to do |format|\n format.html { redirect_to exam_infos_url, notice: 'Exam info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fcdf98d22e808ce23bd2ec3ae8b39d51", "score": "0.68955874", "text": "def destroy\n @matriculation_exam.destroy\n respond_to do |format|\n format.html { redirect_to matriculation_exams_url, notice: 'Matriculation exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d9b15757e6343d53471f0d2d495a0a7c", "score": "0.689428", "text": "def destroy\n @examen = Examen.find(params[:id])\n @examen.destroy\n\n respond_to do |format|\n format.html { redirect_to(examens_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "927a4479b1e502b548f302e22b80ecdc", "score": "0.6892117", "text": "def destroy\n @exam_score = ExamScore.find(params[:id])\n @exam_score.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_scores_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "54834df46afc825506d70afbc10bfc4b", "score": "0.68894106", "text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "54834df46afc825506d70afbc10bfc4b", "score": "0.68894106", "text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2c6b7659c37b27727bc853f258b5b157", "score": "0.6854374", "text": "def destroy\n @exam_content_area = ExamContentArea.find(params[:id])\n @exam_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_content_areas_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6bacb8b804d19597d75e6250dbab7c48", "score": "0.6850688", "text": "def destroy\n @gyn_exam = GynecologicExamination.find(params[:id])\n @patient = @gyn_exam.patients.first\n PatientExamination.where(:gynecologic_examination_id => @gyn_exam.id).each {|exam| exam.destroy }\n @gyn_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_path(@patient) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "67d7b793ac10999889b873c2b7e5f21b", "score": "0.68435675", "text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy rescue flash[:notice] = 'No se puede borrar el examen'\n\n respond_to do |format|\n format.html { redirect_to(signature_part_exams_url(@signature, @part)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6c695a394c8d499965140a273c6fe2c9", "score": "0.6837559", "text": "def destroy\n @examroom.destroy\n respond_to do |format|\n format.html { redirect_to examrooms_url, notice: 'Examroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e8eb6811a1695483cc99aa0b117b7ae", "score": "0.68372387", "text": "def destroy\n @target_exam.destroy\n respond_to do |format|\n format.html { redirect_to target_exams_url, notice: 'Target exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1942b49f0c0a5eacab13a9350f6165f3", "score": "0.6835751", "text": "def destroy\n @types_exam.destroy\n respond_to do |format|\n format.html { redirect_to types_exams_url, notice: 'Types exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "df57275425b1dd9036ae9145e8f19330", "score": "0.68320227", "text": "def destroy\n @exercise.destroy\n render json: @exercise\n end", "title": "" }, { "docid": "05a0a41650f76fb5dbd9041db3e05bc5", "score": "0.68258244", "text": "def destroy\n excursao = Excursao.find params[:id]\n\n if excursao.delete\n render status: :no_content, json: {}\n else\n render status: :bad_request, json: excursao.errors.messages\n end\n end", "title": "" }, { "docid": "3fd744dfde94b6da5a0b05fe7bfeba22", "score": "0.68230987", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3fd744dfde94b6da5a0b05fe7bfeba22", "score": "0.68230987", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3fd744dfde94b6da5a0b05fe7bfeba22", "score": "0.68230987", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3fd744dfde94b6da5a0b05fe7bfeba22", "score": "0.68230987", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ff59c6c49a93bb0551fd31473c00f514", "score": "0.681941", "text": "def destroy\n @exam_report = ExamReport.find(params[:id])\n @exam_report.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_reports_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "470bb512342f2f33eb33bd10988e3c74", "score": "0.68118393", "text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\nend", "title": "" }, { "docid": "a8b284ec79fe86f39d690cef0f1a0225", "score": "0.6807439", "text": "def destroy\n @exame.destroy\n respond_to do |format|\n format.html { redirect_to exames_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dde5510a3a322009ae735ca5885fbf56", "score": "0.68035877", "text": "def destroy\n @exhaust = Exhaust.find(params[:id])\n @exhaust.destroy\n\n respond_to do |format|\n format.html { redirect_to exhausts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d35f8ffd77ddd63899a2a6a17bde9c40", "score": "0.6799163", "text": "def destroy\n @amnesty = Amnesty.find(params[:id])\n @amnesty.destroy\n\n respond_to do |format|\n format.html { redirect_to amnesties_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a4b897d2aa1f302bc68873276c234c4", "score": "0.6797223", "text": "def destroy\n validate_user_access(@exam.course)\n\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f89ecbd9a14a1da38e910199fb8023c0", "score": "0.6790011", "text": "def destroy\n @example = Example.find(params[:id])\n @example.destroy\n\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "2c038db74f04e7d9b76964dde7a0c136", "score": "0.678207", "text": "def destroy\n @paciente_examn.destroy\n respond_to do |format|\n format.html { redirect_to paciente_examns_url, notice: 'Paciente examn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "caa8fcc177f9d62b2060498716883601", "score": "0.6780976", "text": "def destroy\n go_back = @exam.signature_id\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to signature_path(go_back), notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "03f823c96eba003ead364004108f0e21", "score": "0.6780065", "text": "def destroy\n @example = Example.find(params[:id])\n @example.destroy\n\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a14485452dd1eec3b3cd1841b2737848", "score": "0.6778455", "text": "def destroy\n @examination.destroy\n respond_to do |format|\n format.html { redirect_to examinations_url, notice: 'Examination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "28d876c4c7a900f129060170bc35d2e1", "score": "0.6774065", "text": "def destroy\n @exam.destroy\n respond_to do |format|\n format.js { }\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b445c184893647d3482f8fbc6a507a52", "score": "0.67735094", "text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end", "title": "" }, { "docid": "ef9cfb780434e99426753aba54a1d141", "score": "0.6771301", "text": "def destroy\n @exercice.destroy\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ae0e291d21a3be36e2cdd135cbb69c0c", "score": "0.67602164", "text": "def destroy\n @question = @exam.questions.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to teacher_course_exam_questions_url(@course, @exam) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42b407ea3260b711cb13ee974659f427", "score": "0.6753855", "text": "def destroy\n @explanation.destroy\n respond_to do |format|\n format.html { redirect_to explanations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e57aae14424d91877a1f295c337e8516", "score": "0.67454463", "text": "def destroy\n @superset_exercise.destroy\n respond_to do |format|\n format.html { redirect_to superset_exercises_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "864af646e38d331c9ac565eeb8a6fc6f", "score": "0.67447114", "text": "def destroy\n @examanswer = Examanswer.find(params[:id])\n @examanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to(examanswers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "545a430f8de36d8a85ac96c28e787f7d", "score": "0.67446053", "text": "def destroy\n @json_sample = JsonSample.find(params[:id])\n @json_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to json_samples_url }\n format.json { render json: {msg: \"complete\", status: \"OK\"} }\n end\n end", "title": "" }, { "docid": "7ceabb5ef1ecc0edbe0acd9628fe6685", "score": "0.674362", "text": "def destroy\n @exam = current_user.organization.exams.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2fdd5c86a2857ffd993394d2450679f8", "score": "0.6733339", "text": "def destroy\n @intro.destroy\n respond_to do |format|\n format.html { redirect_to intros_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5314bef29c6663d32875c05f2f5faecd", "score": "0.6731472", "text": "def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
5a7eca1e95ea7a80b9808cf5c0e6fcbe
Convert the self string into the list of the names of the each base.
[ { "docid": "848379948b5f022669f9584d61080a3a", "score": "0.547855", "text": "def names\n array = []\n self.each_byte do |x|\n array.push(Bio::NucleicAcid.names[x.chr.upcase])\n end\n return array\n end", "title": "" } ]
[ { "docid": "6a21ca9bb70f9114afbb86abdaf951f7", "score": "0.61282736", "text": "def split_names\n @adapter.find_strings_by_prefix(namespace_key('.split.'))\n .map { |split| split.gsub(namespace_key('.split.'), '') }\n end", "title": "" }, { "docid": "7d1cc20e1485305a7a92a7b1909c5d81", "score": "0.5872565", "text": "def names; self.map(&:name) end", "title": "" }, { "docid": "6b149935c9acdc0e3bcb0782343bf5b3", "score": "0.57304764", "text": "def unique_bases\n strand.split('').uniq\n end", "title": "" }, { "docid": "42efc7fab2166382acc1469eeb971f43", "score": "0.56816465", "text": "def full_name\n (self.ancestors.to_a << self).reverse.map{|a| a.long_name}.join(', ')\n\n end", "title": "" }, { "docid": "072c9a9e0bac300f5eabfd5834b26308", "score": "0.56229377", "text": "def base_name\n @base_name ||= begin\n word = \"#{name.split(/::/).last}\"\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end\n end", "title": "" }, { "docid": "50a3dc07279d49d4892a0fa4b7161f80", "score": "0.5615489", "text": "def base_list\n @data['base_list']\n end", "title": "" }, { "docid": "ea12ddf40efd95450b678f110206c801", "score": "0.56105804", "text": "def objects_to_names \n self.collect{ |object| object.name.downcase }\n end", "title": "" }, { "docid": "dffa46829d8bd186103babd1d4f53979", "score": "0.5569635", "text": "def name_from_base(base) = base.name.to_s.split('::')[1].downcase.to_sym", "title": "" }, { "docid": "31f22a52dd9aae160da51a92f6d1c184", "score": "0.5548317", "text": "def list_of_names\n self.lifters.map do |member_instance|\n member_instance.name\n end #returns new array with list of names\n end", "title": "" }, { "docid": "6fdcf215aa5cc9c4f6738077593950d7", "score": "0.5516852", "text": "def base_name\n base.name\n end", "title": "" }, { "docid": "0bbf04a206024267c44e8041adde5870", "score": "0.5496861", "text": "def name_components\n @_name_components ||= toolname.scan(/[\\w_]+/)[0].split(/_/)\n end", "title": "" }, { "docid": "2a023ad69a0dbb09efb767fa93dfee52", "score": "0.5482498", "text": "def names\n map { |s| s.name }\n end", "title": "" }, { "docid": "152cadbbd18a44f1f5369dffd42c4c6c", "score": "0.5455735", "text": "def parents\n ret = []\n parts = name.split('/')[0..-2]\n\n parts.each_with_index do |v, i|\n ret << self.class.new(parts[0..i].join('/'), base: base)\n end\n\n ret.reverse!\n end", "title": "" }, { "docid": "a24fb3abc8827846c385023168a4d096", "score": "0.54242617", "text": "def lifters_name_list\n lifters.map {|l| l.name}\n end", "title": "" }, { "docid": "6b22f9e45badb1f70b7478bc43ecbe39", "score": "0.54236335", "text": "def names\n @names.join(\":\")\n end", "title": "" }, { "docid": "857011c8d70084bce746e099b0e24353", "score": "0.5418767", "text": "def names\n pieces.map {|piece| piece.name}\n end", "title": "" }, { "docid": "092c7243bd3639c3fe29bf4e5d3c173f", "score": "0.5415026", "text": "def all_names\n all.map {|inst| inst.name}\n end", "title": "" }, { "docid": "3dac1178ee6e99f9b7867b9e1eb057a6", "score": "0.54011637", "text": "def base_dns\n\t\treturn self.branchsets.collect {|bs| bs.base_dn }\n\tend", "title": "" }, { "docid": "200511b574d4addb2da5f617e3162afc", "score": "0.5399", "text": "def string_class_list\n super\n end", "title": "" }, { "docid": "04339188882c2558181ae087530fee89", "score": "0.53975224", "text": "def ruby_name\n base_name = base_name_of self\n\n return \"ANON:IMPL_ME\" unless base_name\n\n # Likely incorrect if Foo::Object where this Object is not ::Object\n return base_name if base_name == \"Object\" || base_name == \"BasicObject\"\n\n names = [base_name]\n\n cls = self\n loop do\n cls = cls.field 'parent'\n base_name = base_name_of cls\n\n break if !base_name || base_name == 'Object'\n names << base_name\n end\n\n names.reverse.join '::'\n end", "title": "" }, { "docid": "f87be5298dabf4800ee8486005236863", "score": "0.5383361", "text": "def split_name \n return @name.scan( NAME_RE ).flatten\n end", "title": "" }, { "docid": "f2b549ea89ae1ea05a95cf0ba54aa92b", "score": "0.5367209", "text": "def to_s\n names = name.to_s\n names += \".#{@next_slot}\" if @next_slot\n names\n end", "title": "" }, { "docid": "2a0e6371bd6646729224437d8e9a63ae", "score": "0.5366726", "text": "def traverse\n @str ||= ''\n handle_segments if segments.size > 0\n klassify(base)\n end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "8ac88afb9253a20cc35b947ec3992f70", "score": "0.5364193", "text": "def names; end", "title": "" }, { "docid": "fd31d493d0fbea9ad57236921ca9020e", "score": "0.5357269", "text": "def parts\n name.split('/')\n end", "title": "" }, { "docid": "bd2a6dc7d09114fe3ca1f851e48e310b", "score": "0.53556275", "text": "def base_name\n @base_name ||= begin\n if base = name.to_s.split(\"::\").first\n base.underscore\n end\n end\n end", "title": "" }, { "docid": "a453e94ca70f123dd5ea2328da7bc788", "score": "0.53425556", "text": "def split_name\n [name, name.split(/([A-Z]?[a-z]+)/).map(&:downcase)].flatten\n end", "title": "" }, { "docid": "55912d9276d1f4aa805d5f2e67eb14ce", "score": "0.53401613", "text": "def all_names\r\n @all_names\r\n end", "title": "" }, { "docid": "e6dd36776e3076c3c07b7f38b5fe86b2", "score": "0.53377384", "text": "def base_name\n name.split('/').last\n end", "title": "" }, { "docid": "8e95edb12265631ec601d05d2ac5d637", "score": "0.5327875", "text": "def all_names\n []\n end", "title": "" }, { "docid": "81cec6845eb4191332a7b1cb29f0ebe2", "score": "0.5326809", "text": "def names\r\n end", "title": "" }, { "docid": "e47f7281c224f3d53415c48e13a9f76b", "score": "0.5296602", "text": "def values\n @strings.collect { |s| s.name }\n end", "title": "" }, { "docid": "ab6cf3d7ea179ba628bfe188816bb453", "score": "0.5288466", "text": "def name\n lifters.map {|l| l.name}\n end", "title": "" }, { "docid": "3b5dd5a90cba29a2256b7577a0cd3967", "score": "0.5284028", "text": "def descendent_names\n self_and_descendents.map(&:name).flatten \n end", "title": "" }, { "docid": "5ab89e4e2911d34903968a1278d2eed2", "score": "0.5283244", "text": "def segment_names_a\n segment_names.value.split(/[,;]/).map { |i| i.gsub(/[+-]$/, '') }\n end", "title": "" }, { "docid": "b55d22dcfae85bfc1c5d7ab8f39422b8", "score": "0.5281712", "text": "def names\n self.traverse([:name])\n end", "title": "" }, { "docid": "61ea21765570a31b7dfae564760b2178", "score": "0.528006", "text": "def names\n\n get_list['list'].map { |re, pa| re }\n end", "title": "" }, { "docid": "42efc6702eecfd32e85920efa1579a8e", "score": "0.52754784", "text": "def to_list\n list = []\n case self.upcase\n when /[A|T|C|G]/\n list << self\n when \"W\"\n list = ['A','T']\n when \"S\"\n list = ['C','G']\n when \"M\"\n list = ['A','C']\n when 'K'\n list = ['G','C']\n when 'R'\n list = ['A','G']\n when 'Y'\n list = ['C','T']\n when 'B'\n list = ['C','G','T']\n when 'D'\n list = ['A','G','T']\n when 'H'\n list = ['A','C','T']\n when 'V'\n list = ['A','C','G']\n when 'N'\n list = ['A','T','C','G']\n end\n return list\n end", "title": "" }, { "docid": "fe2f20968304635c86aae1e428645f21", "score": "0.5272736", "text": "def names(string)\n Names.parse(string)\n end", "title": "" }, { "docid": "39f88694700d4106ad68387a308a3dbd", "score": "0.52717435", "text": "def child_list\n children.map(&:full_name).join(', ')\n end", "title": "" }, { "docid": "be7e56e4d196c5b551e24bfd284deaa3", "score": "0.52644634", "text": "def usernames\n @subclasses.map { |subclass| subclass.username }\n end", "title": "" }, { "docid": "9024730bef682120fb959e520e18fe9d", "score": "0.52637726", "text": "def as_names\n __getobj__.map { |i| i.name }\n end", "title": "" }, { "docid": "f6b1bb1a146af4cb2d336f9b91a88427", "score": "0.5263678", "text": "def names\n self.map {|c| \"#{c.key.name if c.key} #{c.name}\".strip }\n end", "title": "" }, { "docid": "a6ad4f65aa996e260381de32b5ed0a30", "score": "0.52618915", "text": "def split(name); end", "title": "" }, { "docid": "e57dbce6ee7e6610046b95b085d83a10", "score": "0.5260526", "text": "def name_and_base\n base, name = cid.children\n\n if base.nil?\n [name, \"#{scope.nesting}[0]\"]\n else\n [name, expr(base)]\n end\n end", "title": "" }, { "docid": "0c41112955a2ee61b8bb9ac7bdf8da10", "score": "0.5258116", "text": "def info_all\n names.map { |n| info_one(n.to_s) }\n end", "title": "" }, { "docid": "be57884203c6f0ff86f23eee1fa51fd3", "score": "0.5255146", "text": "def list_bases\n @index.base_dirs.each do |b|\n puts b\n end\n end", "title": "" }, { "docid": "b03275392dac89db9e670e005f5ee3bd", "score": "0.5253867", "text": "def words\n words = [self]\n if self =~ / /\n words = self.split(' ')\n elsif self =~ /_/\n words = self.split('_')\n else\n words = self.scan(/[A-Z][a-z]*/)\n end\n words\n end", "title": "" }, { "docid": "e354cfafc91f4584cbac1cacf2cfd748", "score": "0.5251094", "text": "def compute_new_base\n ActiveLdap::DN.parse([base_prefix,self.class.base.to_s].compact.join(','))\n end", "title": "" }, { "docid": "1b705bff75ece917e81999476e01a168", "score": "0.5249957", "text": "def lifter_names\n #get lifters then get their names\n self.lifters.map do |l|\n l.name\n end\n end", "title": "" }, { "docid": "f312054c29944c515c8841672cef80e2", "score": "0.52420455", "text": "def as_names\n __getobj__.map(&:name)\n end", "title": "" }, { "docid": "3528e1fba3f6d936658c221beadfb24a", "score": "0.5226839", "text": "def names\n map(&:name)\n end", "title": "" }, { "docid": "a9eb2d8bf92a3f4f3f29d5268fee79e5", "score": "0.51778305", "text": "def names\n map{|x| x.name }\n end", "title": "" }, { "docid": "4501dabe43bdd12c0431b3cc5a103210", "score": "0.5176372", "text": "def namespace_component_names\n if self.name.nil? || self.name == ''\n []\n else\n unprefixed_names = unprefixed_namespace_component_names\n \n names = []\n\n while current_name = unprefixed_names.pop\n current_full_name = (unprefixed_names + [current_name]).join('::')\n names.unshift(current_full_name)\n end\n \n names\n end\n end", "title": "" }, { "docid": "0213a1f8cba1b2124ede349e52511c34", "score": "0.517227", "text": "def name\n names\n end", "title": "" }, { "docid": "ef69a2fc417ad4a0f235769c3a6af2fc", "score": "0.5171336", "text": "def rakazim_names\n @rakazim_names = \"\"\n self.rakazim.each do |r|\n @rakazim_names = @rakazim_names + r.name + \", \"\n end\n return @rakazim_names.chop.chop!\n end", "title": "" }, { "docid": "ce61a7dc97cd99eafade4fa861b12264", "score": "0.5160849", "text": "def full_name ()\n fullpathArray = Array.new\n node = self\n begin\n fullpathArray.unshift(node.name)\n node = node.parentCat\n end until (node.nil?)\n\n return fullpathArray.join(\":\")\n end", "title": "" }, { "docid": "0de61e5f18148dd5dc22d3885ea47851", "score": "0.51583236", "text": "def parents\r\n parents = []\r\n parts = name.split('::')[0..-2]\r\n until parts.empty?\r\n parents << (parts * '::').constantize\r\n parts.pop\r\n end\r\n parents << Object unless parents.include? Object\r\n parents\r\n end", "title": "" }, { "docid": "32285266db46805535aa609a042d78d9", "score": "0.5157725", "text": "def names\n raise NotImplementedError\n end", "title": "" }, { "docid": "36a17c90969347233eba449289fa5410", "score": "0.5148938", "text": "def names_list\n @@list.each { |item|\n puts item.name_obj\n }\n end", "title": "" }, { "docid": "25127155cb1e5bcfc779e51dc0b81e10", "score": "0.5143477", "text": "def all_names\n res = []\n find_names_in(res, @cache.toplevel)\n end", "title": "" }, { "docid": "53f0b48a71bba85b8bb94c4086b55740", "score": "0.5138356", "text": "def names \n self.lifters.map do |lifter|\n lifter.name \n end \n end", "title": "" }, { "docid": "7c1ce27f0370d76ec6ab62cbb7b88151", "score": "0.51381326", "text": "def namespaces\n names = self.class.name.split(\"::\")\n names.pop\n \n names.map(&:underscore).map(&:to_sym)\n end", "title": "" }, { "docid": "e137f6fa9b2719d9578dd9a07d5d3783", "score": "0.5127448", "text": "def to_s\n names = node.map do |child|\n if child.kind_of?(String) || child.kind_of?(Symbol)\n child.to_s\n elsif child.respond_to?(:name)\n child.name.to_s\n end\n end\n\n names.compact.uniq.join('_')\n end", "title": "" }, { "docid": "c97677333953480cf0a94b31a91b4d2b", "score": "0.512482", "text": "def all_lifter_names\n self.all_lifters.map do |elements|\n elements.name\n end\n end", "title": "" }, { "docid": "db3fc5cbe362bdcc726041be406a73b4", "score": "0.51237035", "text": "def split_name\n @model.name.to_s.split(\"::\").each {|n| n.gsub!(/([a-z])([A-Z])/, '\\1_\\2'); n.downcase!}\n end", "title": "" }, { "docid": "d74aa216b4374d77ae7c4da03e4a9fca", "score": "0.51182777", "text": "def names\n end", "title": "" }, { "docid": "3f7aa235b87ec615877cf8f52618c4f5", "score": "0.51135457", "text": "def base_parent_resources\r\n return [] unless options[:under].present?\r\n options[:under].split('/').map{|m| m.underscore}\r\n end", "title": "" }, { "docid": "8ec858cbd97e4ae4c1c8b442032ce167", "score": "0.5113329", "text": "def names\n raise 'This method should have been overwritten by a subclass.'\n end", "title": "" }, { "docid": "304e013c635eba7f23ece6771429f5b7", "score": "0.5107771", "text": "def find_or_create_name_and_parents(in_str)\n result = []\n if (parsed_name = parse_name(in_str))\n result = find_or_create_parsed_name_and_parents(parsed_name)\n end\n result\n end", "title": "" }, { "docid": "86e655f0204c3e7ff81ad8c0e61ed250", "score": "0.51053584", "text": "def find_parent_names\n @father_names = []\n @mother_names = []\n\n Sample.all.each do |sample|\n parents = sample.source_name.split(\"-\")\n @father_names << parents[0]\n @mother_names << parents[1]\n end\nend", "title": "" }, { "docid": "8d550aaffd8839b495a1e7a4672958f5", "score": "0.51009256", "text": "def names(chars)\n return chars.map { |c| c[:name] }\nend", "title": "" }, { "docid": "63954681db4eff316e91d19994c798dd", "score": "0.5092629", "text": "def normalized_names\n\t\treturn self.names.collect {|name| normalize_key(name) }\n\tend", "title": "" }, { "docid": "37926ae292b5d019392bec9fc7918f68", "score": "0.50918376", "text": "def getLoserNames\n self.joinNames @loserNames\n end", "title": "" }, { "docid": "bbfc08f0ecdd92e091a9bb806a936ca6", "score": "0.509145", "text": "def base_str\r\n @base_str\r\n end", "title": "" }, { "docid": "97590463a96e726c79c102df11615545", "score": "0.5081308", "text": "def fullname()\n\t\tself.hierarchy.join(' ')\n\tend", "title": "" }, { "docid": "9ad30de26476267a0a847ffbc79b7fe2", "score": "0.5076159", "text": "def to_s\n return \"#{self.names}\"\n end", "title": "" }, { "docid": "7e0e9ba735383da9d76b77e29ca1b4c7", "score": "0.5074857", "text": "def string_list\n\t\tStringList.new(@ida)\n\tend", "title": "" }, { "docid": "40acf39cb04379f0eaac42c944e7f869", "score": "0.50667274", "text": "def parents\n parents = []\n parts = name.split('::')[0..-2]\n until parts.empty?\n parents << (parts * '::').constantize\n parts.pop\n end\n parents << Object unless parents.include? Object\n parents\n end", "title": "" }, { "docid": "6573b88e9efe05b0b329e1b14d80d16a", "score": "0.50633615", "text": "def leaser_names\n leasers.map do |l|\n model = l.constantize\n model.leaser_names\n end.flatten\n end", "title": "" }, { "docid": "995287c17028888773dcbed166c5e5f2", "score": "0.5055684", "text": "def names()\n names = []\n names.push \"nsfw\"\n return names\n end", "title": "" }, { "docid": "1498a5720578f4a3563e1cef543181e6", "score": "0.50424725", "text": "def lifter_names\n lifters.map do |lifter|\n lifter.name\n #array of lifters name\n #in order to get to the name of each lifter you have to iterate through the lifter to get the name of the lifter\n end\nend", "title": "" }, { "docid": "7709f7f411a64faae9574a95cf4a241d", "score": "0.50421953", "text": "def names_from_synonymous_genera(str, parent = nil)\n parent ||= parent_if_parent_deprecated(str) # parent = <Agaricus>\n parse = parse_name(str)\n result = []\n if parent && parse\n # child = \"bogus var. namus\"\n child = parse.real_text_name.sub(/^#{parent.real_text_name}/, \"\").strip\n # child_pat = \"bog% var. nam%\"\n child_pat = child.gsub(/(a|um|us)( |$)/, '%\\2')\n # synonym = <Lepiota>\n parent.synonyms.each do |synonym|\n # \"Lepiota bog% var. nam%\"\n result += Name.with_correct_spelling.\n where(Name[:text_name].\n matches(\"#{synonym.text_name} #{child_pat}\")).\n select do |name|\n # name = <Lepiota boga var. nama>\n valid_alternate_genus?(name, synonym.text_name, child_pat)\n end\n end\n # Return only valid candidates if any are valid.\n result.reject!(&:deprecated) if result.any? { |n| !n.deprecated? }\n end\n result\n end", "title": "" }, { "docid": "309fb9ddee09cdcc75d58a11f37b0f04", "score": "0.5035536", "text": "def fetch_names(str)\n [] unless str\n\n list = str.split(/\\s*,\\s*/).map(&:downcase)\n\n # make array string + single splitted words [\"thomas eugene kurtz\", \"thomas\", \"eugene\", \"kurtz\"]\n list += match_one_word(list) + make_word_levels(list)\n\n # left uniq item\n list.uniq\n end", "title": "" }, { "docid": "f26f7c2d701bdb8e0a9d1065d0c428af", "score": "0.5034288", "text": "def unicode_names; end", "title": "" }, { "docid": "e33ee99c547963941b3f501108fe77ae", "score": "0.5033966", "text": "def tag_names\n self.tags.map(&:name).join(\", \")\n #The & symbol is used to tell Ruby that the following argument\n #should be given as a block to the method. So the line:\n # self.tags.map(&:name).join(\", \") is equivalent to:\n # self.tags.map { |x| x.name.join(\", \") }\n #So the above will iterate over the collection self.tags\n #and build an array with the results of the name method\n #called on every item\n end", "title": "" }, { "docid": "26e74021745ba7e35319496533d1cca9", "score": "0.5033882", "text": "def to_list\n @fields.to_a.map {|a| [a[0].to_s.downcase, a[1]]}\n end", "title": "" }, { "docid": "fe956a8d2c94b8085aeed6f5f58206b2", "score": "0.5033134", "text": "def names()\n names = []\n names.push \"rules\"\n return names\n end", "title": "" }, { "docid": "49a217f2014976cd9a1768a9aca808fc", "score": "0.50323254", "text": "def list\n Blazing::Recipe.list.each { |r| puts r.to_s.demodulize.underscore }\n end", "title": "" }, { "docid": "000a96aa19c103687093a7a26bdc10c0", "score": "0.50305915", "text": "def names\n Array(name)\n end", "title": "" }, { "docid": "b9be12b16d1ae74b40c44b0162ef18a2", "score": "0.5028633", "text": "def names()\n names = []\n names.push \"commands\"\n return names\n end", "title": "" }, { "docid": "d2cfa5e2785924e0180835251923520f", "score": "0.50270796", "text": "def bases\n @map.bases\n end", "title": "" }, { "docid": "d2cfa5e2785924e0180835251923520f", "score": "0.50270796", "text": "def bases\n @map.bases\n end", "title": "" } ]
7f6638fb4e41c4c645f289ac7e5e1808
Compare inequality to nil, an image, constant or array.
[ { "docid": "ecff79f6b28ad2134af239e615b4261d", "score": "0.65008956", "text": "def !=(other)\n if other == nil\n true\n elsif other.is_a?(Vips::Image) \n relational(other, :noteq) \n else\n relational_const(other, :noteq)\n end\n end", "title": "" } ]
[ { "docid": "9532b992c5440813c8233d1432d03cbc", "score": "0.61652726", "text": "def ==(other)\n other.nil?\n end", "title": "" }, { "docid": "7f32ea91a9f0ad96cee0443b6812f6f1", "score": "0.6103084", "text": "def match(rhs)\n if @is_null and rhs.is_null\n true\n elsif @is_null or rhs.is_null\n false\n else\n @data == rhs.data\n end\n end", "title": "" }, { "docid": "d7d4b9fbe45a0b01c920b7d972439103", "score": "0.6078961", "text": "def ==(other)\n if other == nil\n false\n elsif other.is_a?(Vips::Image) \n relational(other, :equal) \n else\n relational_const(other, :equal)\n end\n end", "title": "" }, { "docid": "d7d4b9fbe45a0b01c920b7d972439103", "score": "0.6078961", "text": "def ==(other)\n if other == nil\n false\n elsif other.is_a?(Vips::Image) \n relational(other, :equal) \n else\n relational_const(other, :equal)\n end\n end", "title": "" }, { "docid": "01b8289fbb34e458dcfe84264af8d3b4", "score": "0.6013552", "text": "def <=>(*)\n\t\t\traise RunError, 'comparisons with null are disallowed.'\n\t\tend", "title": "" }, { "docid": "350d8701389d6e6145051eb078d6af66", "score": "0.5942386", "text": "def inequality_with_same_attributes?\n left_inequality? &&\n right_inequality? &&\n same_attribute? &&\n constant_value?\n end", "title": "" }, { "docid": "9f2951a9db72f85ce86deaa12b399a87", "score": "0.590596", "text": "def ==(rhs)\n if @is_null or rhs.is_null\n false\n else\n @data == rhs.data\n end\n end", "title": "" }, { "docid": "b4c66116c42456bd36653dc09f51f53f", "score": "0.58735234", "text": "def nil_safe_compare(a, b)\n if a.nil? && b.nil?\n 0\n elsif a.nil?\n -1\n elsif b.nil?\n 1\n else\n a <=> b\n end\nend", "title": "" }, { "docid": "b4c66116c42456bd36653dc09f51f53f", "score": "0.58735234", "text": "def nil_safe_compare(a, b)\n if a.nil? && b.nil?\n 0\n elsif a.nil?\n -1\n elsif b.nil?\n 1\n else\n a <=> b\n end\nend", "title": "" }, { "docid": "7a8f4a59d05ec17a77fa49f3d7a8fbc5", "score": "0.58694464", "text": "def scalar?\n not ( array? || hash? )\n end", "title": "" }, { "docid": "a4ff5c40cda0b5cb5c3a61c6575addfa", "score": "0.58456564", "text": "def ==; end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.58399457", "text": "def ==(*) end", "title": "" }, { "docid": "df3cc5cf66bb4c652ef55d30c829cb07", "score": "0.58399457", "text": "def ==(*) end", "title": "" }, { "docid": "12dc994d681789df90606339364315f6", "score": "0.5833201", "text": "def assignment_or_similar?(param0 = T.unsafe(nil)); end", "title": "" }, { "docid": "12dc994d681789df90606339364315f6", "score": "0.5833201", "text": "def assignment_or_similar?(param0 = T.unsafe(nil)); end", "title": "" }, { "docid": "b40d105becd980a1e07d5541c767db55", "score": "0.5825508", "text": "def lhs_nil_allowed?\n false\n end", "title": "" }, { "docid": "b1265e6571fe3a14b12de5d0d4db0f6a", "score": "0.5820248", "text": "def is_lesser_or_equal(img_to_compare)\n return is_compared(img_to_compare, :lesser_or_equal)\n end", "title": "" }, { "docid": "8bd3727d8a3a1e0905cbf214596075f9", "score": "0.58156437", "text": "def is_equal(img_to_compare)\n return is_compared(img_to_compare, :equal)\n end", "title": "" }, { "docid": "99815b59c465b88ae5d1aad4cff213b9", "score": "0.5814144", "text": "def compare_neq(_other)\n false\n end", "title": "" }, { "docid": "da5d6eb22ac18c5c6b312473af1595f5", "score": "0.5806448", "text": "def not_nil?\n ! nil?\n end", "title": "" }, { "docid": "48246b863670b1e5f1dc9b1f5aa9225f", "score": "0.57871985", "text": "def null?\n Mao::Filter::Binary.new(:op => 'IS', :lhs => self, :rhs => nil)\n end", "title": "" }, { "docid": "af3c3a9e4623ab32a3b225e206405481", "score": "0.57800955", "text": "def ==(array); end", "title": "" }, { "docid": "5ff01d3ad6cec8b0d1ef18980e21be04", "score": "0.5762721", "text": "def nil_compare(other, attrName)\n result = 0\n if self[attrName].nil?\n unless other.any(attrName).nil?\n result = 1\n end\n else\n if other.nil? || other[attrName].nil?\n result -1\n else\n result = self[attrName] <=> other[attrName]\n end\n end\n result\n end", "title": "" }, { "docid": "c81c4d008a991cf57547e144e949596c", "score": "0.57519037", "text": "def compare?; end", "title": "" }, { "docid": "973213ca79ee0d3be5088e2565ea9884", "score": "0.5744626", "text": "def check_element(element)\n nil != element\n end", "title": "" }, { "docid": "5f56b730d208004f4edf925cf3bb1d73", "score": "0.5721225", "text": "def test_nilclass?(data)\r\n return data == 'nil'\r\n end", "title": "" }, { "docid": "855ac1727c6cdf3177c1010071d29d45", "score": "0.56758565", "text": "def comparable?(obj1, obj2, strict = T.unsafe(nil)); end", "title": "" }, { "docid": "d1924979b54980bdd796d52dfff094f1", "score": "0.56553", "text": "def _comparable_nil(val, is_positive: true)\n return val if !val.nil?\n is_positive ? RangeExtd::Infinity::POSITIVE : RangeExtd::Infinity::NEGATIVE\n end", "title": "" }, { "docid": "6a0863dbd53bc8b464d85a2e1a4b83a0", "score": "0.5647746", "text": "def ==(comparison_object); end", "title": "" }, { "docid": "d6d3f7e1aa42e0120e4e5b055ffe1c56", "score": "0.56442946", "text": "def != other\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "4e5a0e8839960c97c262732f4ae77c78", "score": "0.5639346", "text": "def <=> real\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "374f62b56862af00427ab916bc01ea8a", "score": "0.5619917", "text": "def not_nil(arg)\n return !arg.nil?\n end", "title": "" }, { "docid": "7efb1cd6c6a66ff58db60579aa19c492", "score": "0.56096333", "text": "def ==(other)\n !other.nil? && self.class == other.class\n end", "title": "" }, { "docid": "58e53693bdbe8b620a79e4375b3d3663", "score": "0.5600701", "text": "def equality_with_same_attributes?\n left_equality? &&\n right_equality? &&\n same_attribute? &&\n constant_value?\n end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.557037", "text": "def ==(p0) end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.557037", "text": "def ==(p0) end", "title": "" }, { "docid": "5350938ad9c21a3b67986b1c723f8235", "score": "0.557037", "text": "def ==(p0) end", "title": "" }, { "docid": "5558ac36fd0a16078f615d61ff2cf42a", "score": "0.5569086", "text": "def ==(other)\n other.is_a?(None)\n end", "title": "" }, { "docid": "5558ac36fd0a16078f615d61ff2cf42a", "score": "0.5569086", "text": "def ==(other)\n other.is_a?(None)\n end", "title": "" }, { "docid": "b866df3f867912ff8522a039e3858a96", "score": "0.5558614", "text": "def ==(ct); end", "title": "" }, { "docid": "c3ec943f6573d9a73bd582c98d68272d", "score": "0.55507624", "text": "def is_not_null\n ArelExtensions::Nodes::IsNotNull.new [self]\n end", "title": "" }, { "docid": "371f11de7fa457d502dc0c99ea7cf15b", "score": "0.55500203", "text": "def refute_equal(exp, act, msg = T.unsafe(nil)); end", "title": "" }, { "docid": "7367b3a44dc25e3a5530a1ece058c33a", "score": "0.55338347", "text": "def have_nil arr\n # TODO\nend", "title": "" }, { "docid": "0adf8e1421f7b72ae129ed1c4c83040a", "score": "0.5529786", "text": "def eql?(p0) end", "title": "" }, { "docid": "0adf8e1421f7b72ae129ed1c4c83040a", "score": "0.5529786", "text": "def eql?(p0) end", "title": "" }, { "docid": "3b96484b4da3d1275f0dde459aaa5487", "score": "0.55283", "text": "def ==(ary)\n `if(ary.m$class()!==c$Array||ary.length!==this.length){return false;}`\n `for(var i=0,l=this.length;i<l;++i){if(!(this[i].m$_eql2(ary[i]))){return false;};}`\n return true\n end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "992b09b676a400bfde68954c1c27c479", "score": "0.55234396", "text": "def ==(r); end", "title": "" }, { "docid": "b280a2c6f190a8c3a52b068b1a9ca6e1", "score": "0.5520987", "text": "def is_greater_or_equal(img_to_compare)\n return is_compared(img_to_compare, :greater_or_equal)\n end", "title": "" }, { "docid": "742948d59d307b6b20b82b2ee7078152", "score": "0.55206484", "text": "def ===(value); end", "title": "" }, { "docid": "867b5cbb2bcc724bb3e623deec81c03e", "score": "0.55202", "text": "def not_nil?\n not self.nil?\n end", "title": "" }, { "docid": "e9d3245a90e5bbb5a921e7411b05cf24", "score": "0.55177546", "text": "def ==(tti); end", "title": "" }, { "docid": "bb79da99e27fc106d2aef1b0a2e18706", "score": "0.55092597", "text": "def images? ; !(@images.nil? || @images.empty?); end", "title": "" }, { "docid": "d63f88123e5a888ac2a1e979aabd21ee", "score": "0.55081755", "text": "def generate_comparaison?() nil end", "title": "" }, { "docid": "8d731df088df50c63672fcb07ad08d53", "score": "0.5504253", "text": "def compare_eq(_other)\n false\n end", "title": "" }, { "docid": "a34c776c6e3e742e5d1a0e189e2ecbda", "score": "0.5497854", "text": "def array_equals(array1, array2)\n return true if array1 == nil && array2 == nil\n return false if array1 == nil || array2 == nil\n return false if array1.length != array2.length\n return false if array1 != array2\n return true if array1 == array2\n raise NotImplementedError\nend", "title": "" }, { "docid": "52c33805ceb84b4ec7ecc40318dbdc59", "score": "0.54918766", "text": "def can_eq?\n false\n end", "title": "" }, { "docid": "f01179582349d5c24cfd7bdca30ed484", "score": "0.5491681", "text": "def null?\n self == NULL; end", "title": "" }, { "docid": "3fe735ed339a4512948a1e16d63a6de7", "score": "0.5483372", "text": "def eql?(c); end", "title": "" }, { "docid": "fd7fbf34b27d1a7fd3dd4032fec5c4eb", "score": "0.547838", "text": "def is_not_null?\n @flags & NOT_NULL_FLAG != 0\n end", "title": "" }, { "docid": "daa0bec55d3da6c7de0a667b96307e58", "score": "0.54777914", "text": "def b?() @a != nil; end", "title": "" }, { "docid": "d8b4cfb05e8a85b66d699ff8ebe39362", "score": "0.5474509", "text": "def unitless?\n (@numerator == UNITY_ARRAY && @denominator == UNITY_ARRAY)\n end", "title": "" }, { "docid": "456b05ecac778033492ad1ce34b5c3f8", "score": "0.5471364", "text": "def unitless?\n (@numerator == UNITY_ARRAY && @denominator == UNITY_ARRAY)\n end", "title": "" }, { "docid": "cd3b576b5b62300244bc2b23d26ab2ab", "score": "0.545575", "text": "def ==(o); end", "title": "" }, { "docid": "cd3b576b5b62300244bc2b23d26ab2ab", "score": "0.545575", "text": "def ==(o); end", "title": "" }, { "docid": "c5a15ae230b19e1d737d0806e51237b1", "score": "0.5454856", "text": "def vals_equal?(left, right)\n return true if left.nil? && right.nil?\n return false if left.nil? || right.nil?\n\n left.eql? right\n end", "title": "" }, { "docid": "858adc79cdd9e7aba2dddf96ba3b824c", "score": "0.54408926", "text": "def compare!(order: T.unsafe(nil)); end", "title": "" }, { "docid": "f1cf3a881cd42ffe58e896e83f44c1a0", "score": "0.5435588", "text": "def non_polymorphic_collection?(param0 = T.unsafe(nil)); end", "title": "" }, { "docid": "57db87f8903973e82770f699bdd6f82a", "score": "0.54249823", "text": "def eql?(comparison_object); end", "title": "" }, { "docid": "b4e392e80616e470207bb2e6b1b31f16", "score": "0.54192567", "text": "def null?\n equals?(CF::NULL)\n end", "title": "" }, { "docid": "33550397482c3e54e3070bab54e17963", "score": "0.54182476", "text": "def ==(_other); end", "title": "" }, { "docid": "5b7544936b59b3fe58e47ed043115bfb", "score": "0.5413876", "text": "def null?\n return false if @args[:data][:notnull].to_i == 1\n return true\n end", "title": "" }, { "docid": "2d467552c886063420ddbd6d4b1784f3", "score": "0.54110384", "text": "def ===(p0) end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.54060566", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.54060566", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.54060566", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.54060566", "text": "def ==\n end", "title": "" }, { "docid": "9fa3ce7f1e10e456e7115c5728ead2a8", "score": "0.54060566", "text": "def ==\n end", "title": "" }, { "docid": "3d1972ae8bc5361d2230b8a7c9c46bb4", "score": "0.5400318", "text": "def strict_equal?(other)\n return JSValue::FALSE if self.type != other.type\n return JSValue::TRUE if self.type == :undefined\n return JSValue::TRUE if self.type == :null\n if self.type == :number\n self_f = self.value.to_f\n if self_f.nan?\n return JSValue::FALSE\n end\n other_f = other.value.to_f\n if other_f.nan?\n return JSValue::FALSE\n end\n if self.value == other.value # includes +0 and -0\n return JSValue::TRUE\n end\n return JSValue::FALSE\n else\n if self.type == :string\n if self.value == other.value\n return JSValue::TRUE\n else\n return JSValue::FALSE\n end\n elsif self.type == :boolean\n if self.value == other.value\n return JSValue::TRUE\n else\n return JSValue::FALSE\n end\n else\n if self.equal?(other) # check if these refer to same objects\n return JSValue::TRUE\n else\n return JSValue::FALSE\n end\n end\n end\n end", "title": "" }, { "docid": "61915f3749aec99ed024b5a2719e7b2b", "score": "0.5398494", "text": "def >= real\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "61915f3749aec99ed024b5a2719e7b2b", "score": "0.5398494", "text": "def >= real\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "61915f3749aec99ed024b5a2719e7b2b", "score": "0.5398494", "text": "def >= real\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "bded19af6b25b168c0a58616bb529f9e", "score": "0.53921264", "text": "def comparison_method?; end", "title": "" }, { "docid": "bded19af6b25b168c0a58616bb529f9e", "score": "0.53921264", "text": "def comparison_method?; end", "title": "" }, { "docid": "6c59827132384193cbe0ae738e25ccd0", "score": "0.5390859", "text": "def attr_equal?(arr)\n if ( (arr[0] == arr[1]) && (arr[0] == arr[2] ) )\n true\n else\n false\n end\n end", "title": "" }, { "docid": "a71e4bb30a969ae40bb320bf553c5398", "score": "0.5388246", "text": "def constant_value?\n util = Util\n util.constant?(left.right) && util.constant?(right.right)\n end", "title": "" }, { "docid": "7a7c00e25f830a78f7678c36def32b13", "score": "0.53873205", "text": "def literal?(element)\n\t\t\tfalse\n\t\tend", "title": "" }, { "docid": "8381c8e4e6d3f74b8dd827c38bcf78e5", "score": "0.5381937", "text": "def eql?(ary)\n `if(ary.m$class()!==c$Array||ary.length!==this.length){return false;}`\n `for(var i=0,l=this.length;i<l;++i){if(!(this[i].m$eqlBool(ary[i]))){return false;};}`\n return true\n end", "title": "" }, { "docid": "caa7330d1b2bcc2120e602638b287039", "score": "0.5377038", "text": "def !=(other)\n (self <=> other) != 0\n end", "title": "" }, { "docid": "5efd1c82377272010eec88a7695cd9eb", "score": "0.5365036", "text": "def ==(o) abstract end", "title": "" }, { "docid": "5efd1c82377272010eec88a7695cd9eb", "score": "0.5365036", "text": "def ==(o) abstract end", "title": "" }, { "docid": "f978d74220ea698e3fc8283cedab38c0", "score": "0.5359753", "text": "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n comparator == o.comparator &&\n custom_bg_color == o.custom_bg_color &&\n custom_fg_color == o.custom_fg_color &&\n hide_value == o.hide_value &&\n image_url == o.image_url &&\n metric == o.metric &&\n palette == o.palette &&\n timeframe == o.timeframe &&\n value == o.value\n end", "title": "" }, { "docid": "dd753fcda47ca2963b720eca3a56bd69", "score": "0.5357869", "text": "def nil?\r\n false\r\n end", "title": "" }, { "docid": "09609d590f5a3aef88f463596292e845", "score": "0.5357589", "text": "def nil?\n end", "title": "" } ]
d891f8bf8038ede1d54c8c4a62e3c8fa
PATCH/PUT /systemic_exams/1 PATCH/PUT /systemic_exams/1.json
[ { "docid": "5fad7db4bdfb1ef04379960194088964", "score": "0.685448", "text": "def update\n respond_to do |format|\n if @systemic_exam.update(systemic_exam_params)\n format.html { redirect_to @systemic_exam, notice: 'Systemic exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @systemic_exam }\n else\n format.html { render :edit }\n format.json { render json: @systemic_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "4e73139db4bdafe9e0ee1a9dd5a6508a", "score": "0.6762382", "text": "def update\n @exam = Exam.find(params[:id])\n\n if @exam.update!(exam_params)\n render json: @exam, status: :ok\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9562430560671e11fbba16e75a6a575f", "score": "0.6492566", "text": "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9562430560671e11fbba16e75a6a575f", "score": "0.6492566", "text": "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9562430560671e11fbba16e75a6a575f", "score": "0.6492566", "text": "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9562430560671e11fbba16e75a6a575f", "score": "0.6492566", "text": "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db64b8dba2387e94ad3524c7fe355c46", "score": "0.64278865", "text": "def update\n get_event\n @event_exam = @event.exams.find(params[:id])\n @event_exam.update_attributes(params[:event_exam])\n\n respond_to do |format|\n format.html { redirect_to event_event_exam_path(@event, @event_exam), notice: 'Event exam was successfully updated.' }\n # format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "782e93fb20139c9c2383ed777c70744c", "score": "0.6372622", "text": "def update\n @exam = @course.exams.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to [:teacher, @course, @exam], :notice => 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d2b65e72a844e8911a063ec91215493", "score": "0.6364306", "text": "def update\n respond_to do |format|\n if @system_example.update(system_example_params)\n format.html { redirect_to @system_example, notice: 'System example was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_example }\n else\n format.html { render :edit }\n format.json { render json: @system_example.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56e46996b270e5f9b0e163c598c1f067", "score": "0.63632196", "text": "def update\n @exam = Exam.find(params[:id])\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0edb531f3041ac23723494fdb9f64ba3", "score": "0.63416386", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e02b2d3414ab6d91c85390cd0892aec", "score": "0.63384867", "text": "def update\n set_labels\n set_json_master\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to select_questions_exam_path(@exam), notice: 'Exam was successfully updated.' }\n format.json { render :select_question, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "648c7b3a758b3a9285999a242adf880e", "score": "0.6319483", "text": "def update\n @experiment_system_app = ExperimentSystemApp.find(params[:id])\n\n respond_to do |format|\n if @experiment_system_app.update_attributes(params[:experiment_system_app])\n format.html { redirect_to @experiment_system_app, notice: 'Experiment system app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_system_app.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4caeb7091b59a197df7f95ce9d80da21", "score": "0.6311379", "text": "def update\n @exam_question = ExamQuestion.find(params[:id])\n\n respond_to do |format|\n if @exam_question.update_attributes(params[:exam_question])\n format.html { redirect_to @exam_question, notice: 'Exam question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70882a9ba3e60dfdb1901424dffb91cf", "score": "0.6301898", "text": "def updateexam\n @global_exam = GlobalExam.find(params[:id])\n\n respond_to do |format|\n if @global_exam.update_attributes(params[:global_exam])\n format.html { redirect_to global_exam_root_url, notice: 'Global exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @global_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f17837617ef82da924a2a80f4cfc2333", "score": "0.62150073", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "afed44afc63cad3579072c572e3717a7", "score": "0.62080765", "text": "def update\n respond_to do |format|\n if @sequoia_exam.update(sequoia_exam_params)\n format.html { redirect_to @sequoia_exam, notice: 'Sequoia exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @sequoia_exam }\n else\n format.html { render :edit }\n format.json { render json: @sequoia_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ac7eead209cb686e70a6d29c95ff83f", "score": "0.62013245", "text": "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to(signature_part_exam_url(@signature, @part, @exam), :notice => 'El examen se modifico correctamente..') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a78025c270de3cbdca90ae7552612765", "score": "0.6186187", "text": "def update\n @exams = Exam.all\n @exam=Exam.find_by_id(params[:id])\n @currentUser = current_user.id\n respond_to do |format|\n if @exam_application.update(exam_application_params)\n format.html { redirect_to @exam_application, notice: 'Exam application was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_application }\n else\n format.html { render :edit }\n format.json { render json: @exam_application.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d40399b92446274a01a28c8d7e3a24c3", "score": "0.6185617", "text": "def update\n redirect_to(exams_url) and return if params['cancel']\n @exam = current_user.organization.exams.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = 'Exam was successfully updated.'\n format.html { redirect_to(destination_given_params(params)) and return }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5e0f352d752ad536247ebb75d66226a", "score": "0.6181804", "text": "def update\n @myspec = Myspec.find(params[:id])\n\n respond_to do |format|\n if @myspec.update_attributes(params[:myspec])\n format.html { redirect_to @myspec, notice: 'Myspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myspec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc26d7d8951cde08da4da997cf7d7a3d", "score": "0.6127509", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n # Ao fazer a atualização você voltará para tela de update\n format.html { redirect_to appointment_path(@appointment), notice: 'Exame foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19be32efcb72e3d3e664e82d6091593a", "score": "0.61017704", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @exam.update(exam_params)\n\t\t\t\tformat.html { redirect_to @exam, notice: \"Exam was successfully updated.\" }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @exam.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "cc0268d4ee2eeb7caab2bd4a60c32f4e", "score": "0.6096696", "text": "def update\n respond_to do |format|\n if @physical_exam.update(physical_exam_params)\n format.html { redirect_to clinic_history_physical_exams_path(@clinic_history, @physical_exam), notice: 'Physical exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @physical_exam }\n else\n format.html { render :edit }\n format.json { render json: @physical_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8bfa4c4681c54e80b2eda3549ba81591", "score": "0.60790783", "text": "def update\n @last_exam = LastExam.find(params[:id])\n\n respond_to do |format|\n if @last_exam.update_attributes(params[:last_exam])\n format.html { redirect_to @last_exam, notice: 'Last exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @last_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96dcd3b56cab99a19a4f6d390cbb389d", "score": "0.6050063", "text": "def update\n @question = Question.find(params[:id])\n exam_ids = [params[:exam_id1],params[:exam_id2],params[:exam_id3],params[:exam_id4]]\n exams = exam_ids.reject(&:empty?)\n respond_to do |format|\n if exams.length > 0\n if @question.update_attributes(params[:question])\n ExamsQuestion.find_all_by_question_id(@question.id).each do |eq|\n eq.delete\n end\n exams.each do |ex|\n @exam_question = ExamsQuestion.new\n @exam_question.exam_id = ex\n @exam_question.question_id = @question.id\n @exam_question.save\n end\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n else\n redirect_to edit_question_path(@question)\n end\n end\n end", "title": "" }, { "docid": "5e6d9883e9cfda01d71d15cc9f2eedc9", "score": "0.6022696", "text": "def update\n @example_sentence = ExampleSentence.find(params[:id])\n\n respond_to do |format|\n if @example_sentence.update_attributes(params[:example_sentence])\n format.html { redirect_to @example_sentence, notice: 'Example sentence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @example_sentence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "569eeb6558c061255bb8d13bc8c29172", "score": "0.6018508", "text": "def update\n @exam_course = ExamCourse.find(params[:id])\n\n respond_to do |format|\n if @exam_course.update_attributes(params[:exam_course])\n format.html { redirect_to @exam_course, notice: 'Exam course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_course.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e31b445d35752f94361436284b7c095", "score": "0.5993356", "text": "def update\n @exam_type = ExamType.find(params[:id])\n\n respond_to do |format|\n if @exam_type.update_attributes(params[:exam_type])\n format.html { redirect_to @exam_type, notice: 'Exam type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18832a82e0e2797e36c0dc4573a92abc", "score": "0.59905237", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to subject_exam_path(@exam.subject, @exam), notice: 'Examen édité avec succes.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b8383d8828d52ba61b9d610f105c88a", "score": "0.5988725", "text": "def update\n respond_to do |format|\n if @experience.update(experience_params)\n format.html { redirect_to '/api/v1/experiences', notice: 'Experience was successfully updated.' }\n format.json { render :show, status: :ok, location: '/api/v1/experiences' }\n else\n format.html { render :edit }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94b284ad28fcf15686025dde8e75c705", "score": "0.5974487", "text": "def update\n @experiment = Experiment.find(params[:id])\n @title = \"Microarray experiments\"\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to(@experiment, :notice => 'Microarray experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94b284ad28fcf15686025dde8e75c705", "score": "0.5974487", "text": "def update\n @experiment = Experiment.find(params[:id])\n @title = \"Microarray experiments\"\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to(@experiment, :notice => 'Microarray experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fe4c884839da6c10ef983747a324cd1", "score": "0.5971171", "text": "def update\n respond_to do |format|\n exam = @question.exam\n course = exam.course\n if @question.update(question_params)\n format.html { redirect_to course_exam_questions_path(course, exam), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80138c2132ff19b52822cc35ed52733d", "score": "0.5958422", "text": "def update\n respond_to do |format|\n if @system_requirement.update(system_requirement_params)\n format.html { redirect_to @system_requirement, notice: 'System requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c2be1585c29e0f0048b7bf3fcd9a795", "score": "0.59506744", "text": "def update\n respond_to do |format|\n if @admission_exam.update(admission_exam_params)\n format.html { redirect_to @admission_exam, notice: 'Admission exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission_exam }\n else\n format.html { render :edit }\n format.json { render json: @admission_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1fd356f7f00986084ab349b2fd283c6f", "score": "0.5950287", "text": "def update\n respond_to do |format|\n if @exam_info.update(exam_info_params)\n format.html { redirect_to @exam_info, notice: 'Exam info was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_info }\n else\n format.html { render :edit }\n format.json { render json: @exam_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd3e5130ff0f9ca4a988f7183d5e8c11", "score": "0.59351104", "text": "def update\n respond_to do |format|\n if @exam_hub.update(exam_hub_params)\n format.html { redirect_to exam_hubs_path, notice: 'Exam hub was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_hub }\n else\n format.html { render :edit }\n format.json { render json: @exam_hub.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63699fdaa322a1b5bffa88b82317e09f", "score": "0.593429", "text": "def update\n @question_assessment.skill_ids = scribing_question_params[:question_assessment][:skill_ids]\n respond_to do |format|\n if @scribing_question.update(scribing_question_params.except(:question_assessment))\n format.json { render_scribing_question_json }\n else\n format.json { render_failure_json t('.failure') }\n end\n end\n end", "title": "" }, { "docid": "60e5d05992da254bac8b2a396e2bb575", "score": "0.5932975", "text": "def update\n @question = @exam.questions.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to [:teacher, @course, @exam, @question], :notice => 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1c61a99edb67ac51686c6b85758f7b8", "score": "0.5905126", "text": "def update\n @system_appropriateness = SystemAppropriateness.find(params[:id])\n\n respond_to do |format|\n if @system_appropriateness.update_attributes(params[:system_appropriateness])\n format.html { redirect_to @system_appropriateness, notice: 'System appropriateness was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_appropriateness.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d10ea7ef98a1458ee166a9beb069f306", "score": "0.5903914", "text": "def update\n @eqm = Eqm.find(params[:id])\n\n respond_to do |format|\n if @eqm.update_attributes(params[:eqm])\n format.html { redirect_to @eqm, notice: 'Eqm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @eqm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "885bbdf78882cf9a3bcfd4fbc29a9027", "score": "0.590151", "text": "def update_exam\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = \"Exam #{@exam.name} was successfully updated.\"\n format.html { redirect_to(:action=>:index) }\n else\n format.html { render :action => \"edit_exam\" }\n end\n end\n end", "title": "" }, { "docid": "09513ae57100a9dc2885c269ca4424b3", "score": "0.5900648", "text": "def update\n respond_to do |format|\n if @exam_instance.update(exam_instance_params)\n format.html { redirect_to @exam_instance, notice: t(:Exam_updated) }\n format.json { render :show, status: :ok, location: @exam_instance }\n else\n format.html { render :edit }\n format.json { render json: @exam_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7188b5423261fe1cf1216a6d3aa1167", "score": "0.589797", "text": "def update\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to(@exam, :notice => 'Exam was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7364a4f19e96e345e07406fa2ae1b007", "score": "0.589548", "text": "def update\n respond_to do |format|\n if @target_exam.update(target_exam_params)\n format.html { redirect_to @target_exam, notice: 'Target exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @target_exam }\n else\n format.html { render :edit }\n format.json { render json: @target_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4df64123f8b2c8562c6ebfdac9b8007", "score": "0.5890914", "text": "def update\n respond_to do |format|\n if @matriculation_exam.update(matriculation_exam_params)\n format.html { redirect_to @matriculation_exam, notice: 'Matriculation exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @matriculation_exam }\n else\n format.html { render :edit }\n format.json { render json: @matriculation_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45c402177b75619b39d58f46a56ac845", "score": "0.58900136", "text": "def update\n @exam_question = ExamQuestion.find(params[:id])\n\n respond_to do |format|\n if @exam_question.update_attributes(params[:exam_question])\n format.html { redirect_to(@exam_question, :notice => 'Exam question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9df8a3295cf849a485a5d5b63b269838", "score": "0.58856267", "text": "def update\n respond_to do |format|\n if @medical_exam.update(medical_exam_params)\n format.html { redirect_to @medical_exam, notice: 'Medical exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @medical_exam }\n else\n format.html { render :edit }\n format.json { render json: @medical_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6adf7636e95dda14969e72e1d9684904", "score": "0.5878347", "text": "def update\n respond_to do |format|\n if @essential.update(essential_params)\n format.html { redirect_to @essential, notice: 'Essential was successfully updated.' }\n format.json { render :show, status: :ok, location: @essential }\n else\n format.html { render :edit }\n format.json { render json: @essential.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.58757377", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "5c9824a73062fca91f6ab76c18753d68", "score": "0.5875528", "text": "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\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\nend", "title": "" }, { "docid": "cf8ad12799b17dbda62c89e4a2e561a0", "score": "0.58692616", "text": "def update\n respond_to do |format|\n format.json do\n # this removes the current associated fos subjects, but doesn't delete subject entries from subjects table\n resource.subjects.permissive_fos.each do |subj|\n ResourcesSubjects.where(resource_id: resource, subject_id: subj).destroy_all\n end\n resource.subjects << make_or_get_subject(params[:fos_subjects]) unless params[:fos_subjects].blank?\n render json: resource.subjects.permissive_fos\n end\n end\n end", "title": "" }, { "docid": "6c50b9570ab82e95133977bfc82f5e1e", "score": "0.5862778", "text": "def update\n @slit_spec = SlitSpec.find(params[:id])\n\n respond_to do |format|\n if @slit_spec.update_attributes(params[:slit_spec])\n format.html { redirect_to @slit_spec, notice: 'Slit spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slit_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83c6bfbff4f0a0b41632926ca91ef75a", "score": "0.5860878", "text": "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to exams_url, notice: 'Exam was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "3a6c61bd2295447109fea482a8ef1edb", "score": "0.58508235", "text": "def update\n @patient_symptom = PatientSymptom.find(params[:id])\n\n respond_to do |format|\n if @patient_symptom.update_attributes(params[:patient_symptom])\n format.html { redirect_to @patient_symptom, :notice => 'Patient symptom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patient_symptom.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7485c80a577e0bec300e5764ff6a807", "score": "0.5848035", "text": "def update\n @espec = Espec.find(params[:id])\n\n respond_to do |format|\n if @espec.update_attributes(params[:espec])\n format.html { redirect_to especs_path, notice: 'Espec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @espec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e951b22643743865f3f0ff93d8c373bf", "score": "0.58313453", "text": "def update\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = 'Exam was successfully updated.'\n format.html { redirect_to(@exam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38441fa4c791015598c9574107ba9b27", "score": "0.58263034", "text": "def update\n @specimen = Specimen.find(params[:id])\n\n respond_to do |format|\n if @specimen.update_attributes(params[:specimen])\n format.html { redirect_to @specimen, notice: 'Specimen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specimen.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ea29adb5dde55022d8e45d43262de3f", "score": "0.5823513", "text": "def update\n @spectro = Spectro.find(params[:id])\n\n respond_to do |format|\n if @spectro.update_attributes(params[:spectro])\n format.html { redirect_to @spectro, notice: 'Spectro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spectro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cee6d8c51747fba17f61639eb11774e", "score": "0.582276", "text": "def update\n respond_to do |format|\n @experiment.steps.clear\n if @experiment.update(experiment_params)\n format.html { redirect_to @experiment, notice: t(:successful_updated, scope: :experiments) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbb9c30b9768473e5cd63eb4f4d0147d", "score": "0.5819507", "text": "def update\n @how_majestic = HowMajestic.find(params[:id])\n\n respond_to do |format|\n if @how_majestic.update_attributes(params[:how_majestic])\n format.html { redirect_to @how_majestic, notice: 'How majestic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @how_majestic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "796120fee694c70a5c06a73cf301f19f", "score": "0.58175", "text": "def updatepracticetest\n @practice_test = GlobalPracticeTest.find(params[:id])\n\n respond_to do |format|\n if @practice_test.update_attributes(params[:global_practice_test])\n format.html { redirect_to global_exam_root_url, notice: 'Practice test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "718354272b41ed91adea7fb6940ed1d2", "score": "0.58162045", "text": "def update\n @exam = Exam.find(params[:id])\n @exam.subject_id = params[:exam][:subject_id]\n @exam.year = params[:exam][:year]\n @exam.number = params[:exam][:number]\n if params[:exam][:q_a]==\"1\" then @exam.q_a=\"a\" else @exam.q_a=\"q\" end\n unless params[:exam][:file]==nil\n @exam.file = params[:exam][:file].read\n @exam.content_type = params[:exam][:file].content_type\n end\n case @exam.content_type\n when \"application/pdf\"\n ext = \"pdf\"\n else\n #TODO redirect_to \"new\" notice: \"invalid file type\"\n end\n @exam.file_name =\n \"#{Subject.find(@exam.subject_id).page_title}-past_exam-\" +\n \"#{@exam.year}-#{@exam.number}-#{@exam.q_a}.#{ext}\"\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9ecf64f08f7797b26abe2651068f658", "score": "0.5816163", "text": "def update\n respond_to do |format|\n if @examroom.update(examroom_params)\n format.html { redirect_to @examroom, notice: 'Examroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @examroom }\n else\n format.html { render :edit }\n format.json { render json: @examroom.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc2b547c2bc39cf37c5fd3b04aa2346e", "score": "0.58150536", "text": "def update\n authorize! :update, @sequence\n respond_to do |format|\n if @sequence.update_attributes(params[:sequence])\n format.html { redirect_to @sequence, notice: 'Sequence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sequence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc2b547c2bc39cf37c5fd3b04aa2346e", "score": "0.58150536", "text": "def update\n authorize! :update, @sequence\n respond_to do |format|\n if @sequence.update_attributes(params[:sequence])\n format.html { redirect_to @sequence, notice: 'Sequence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sequence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf8d0e6ecdce9b865c8758df2296e569", "score": "0.5810705", "text": "def update\n @examquestion = Examquestion.find(params[:id])\n\n respond_to do |format|\n if @examquestion.update_attributes(params[:examquestion])\n flash[:notice] = 'Examquestion was successfully updated.'\n format.html { redirect_to(@examquestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @examquestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b10e5b1dde0d64f311f87350b03746e", "score": "0.58097744", "text": "def update\n respond_to do |format|\n if @exm.update(exm_params)\n format.html { redirect_to @exm, notice: 'Exm was successfully updated.' }\n format.json { render :show, status: :ok, location: @exm }\n else\n format.html { render :edit }\n format.json { render json: @exm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c2530db1072ed68b09b72ad010ded0a", "score": "0.5803057", "text": "def update\n @exam_level = ExamLevel.find(params[:id])\n\n respond_to do |format|\n if @exam_level.update_attributes(params[:exam_level])\n format.html { redirect_to @exam_level, notice: 'Exam level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_level.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a486429663f65d5c4e2194d1027f41aa", "score": "0.58008057", "text": "def update\n respond_to do |format|\n if @regiment_exercise.update(regiment_exercise_params)\n format.html { redirect_to @regiment_exercise, notice: 'Regiment exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @regiment_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "608e6e4e2eb65a0a3133abcdefa877d3", "score": "0.57978326", "text": "def update\n @spec = Spec.find(params[:id])\n\n respond_to do |format|\n if @spec.update_attributes(params[:spec])\n format.html { redirect_to @spec, notice: 'Spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d33dab8b34dac9d2fe4abfd6f63a459", "score": "0.57892156", "text": "def update\n @exemplar = Exemplar.find(params[:id])\n\n respond_to do |format|\n if @exemplar.update_attributes(params[:exemplar])\n format.html { redirect_to @exemplar, notice: 'Exemplar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exemplar.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a338b4a4a78430de7b0fc836d444d4b", "score": "0.578738", "text": "def update\n @lsa_test_sentence = LsaTestSentence.find(params[:id])\n\n respond_to do |format|\n if @lsa_test_sentence.update_attributes(params[:lsa_test_sentence])\n format.html { redirect_to @lsa_test_sentence, notice: 'Lsa test sentence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_test_sentence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4027e86133a75f0439677ff2735a5041", "score": "0.5786985", "text": "def update\n respond_to do |format|\n if @fix_exam.update(fix_exam_params)\n format.html {redirect_to xmt_test_exams_path, notice: '编辑成功.'}\n format.json {render :show, status: :ok, location: @fix_exam}\n else\n format.html {render :edit}\n format.json {render json: @fix_exam.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "37bb181464f642508c933106d1666838", "score": "0.57832074", "text": "def update\n @exercise = Exercise.find(params[:id])\n @exercise.update_attributes(params[:exercise])\n respond_with(@exercise)\n end", "title": "" }, { "docid": "8f02d9e97ce3cc13947f00585d6ef29a", "score": "0.57824725", "text": "def update\n @system = System.find(params[:id])\n \n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html { redirect_to @system, notice: 'System was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "160a56098a71eb3d79f00761d9657cd5", "score": "0.57804674", "text": "def update\n @activity = Activity.find(params[:id])\n @exercise = Exercise.find(params[:exercise_id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @exercise, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.5779492", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "08d50f1bb26ae93e7ce035efa2caece3", "score": "0.57788527", "text": "def update\n respond_to do |format|\n if @second_exam.update(second_exam_params)\n format.html { redirect_to @second_exam, notice: 'Second exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @second_exam }\n else\n format.html { render :edit }\n format.json { render json: @second_exam.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf85b39b3a4c37f878e36c63df3e159c", "score": "0.57726043", "text": "def update\n respond_to do |format|\n if @meta_experiment.update(meta_experiment_params)\n format.html { redirect_to @meta_experiment, notice: 'Meta experiment was successfully updated.' }\n format.json { render :show, status: :ok, location: @meta_experiment }\n else\n format.html { render :edit }\n format.json { render json: @meta_experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b383a87c4b1b364740bec4893f57205", "score": "0.5772547", "text": "def update\n @exam_score = ExamScore.find(params[:id])\n\n respond_to do |format|\n if @exam_score.update_attributes(params[:exam_score])\n format.html { redirect_to @exam_score, notice: 'Exam score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_score.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "495e7982f522418f84353abf98c804f9", "score": "0.57697135", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.json { head :no_content }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8e9bfbc63837387003aabe3930dd80", "score": "0.57694966", "text": "def update\n respond_to do |format|\n if @example_lift_req.update(example_lift_req_params)\n format.html { redirect_to @example_lift_req, notice: 'Example lift req was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_lift_req }\n else\n format.html { render :edit }\n format.json { render json: @example_lift_req.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac6eb2dc76e32a0f663889d4d32cbc24", "score": "0.57654107", "text": "def update\n @lab_question = LabQuestion.find(params[:id])\n\n respond_to do |format|\n if @lab_question.update_attributes(params[:lab_question])\n format.html { redirect_to @lab_question, notice: 'Lab question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "966ff77a899158c3b83bfb3655562639", "score": "0.5760623", "text": "def update\n respond_to do |format|\n if @exam_attempt.update(exam_attempt_params)\n format.html { redirect_to @exam_attempt, notice: 'Exam attempt was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_attempt }\n else\n format.html { render :edit }\n format.json { render json: @exam_attempt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7543d396aeec2f098337ab4810080275", "score": "0.5754498", "text": "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7543d396aeec2f098337ab4810080275", "score": "0.5754498", "text": "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d42e17b6ad3130f8524fce4462442f2", "score": "0.57522196", "text": "def update\n respond_to do |format|\n if @superset_exercise.update(superset_exercise_params)\n format.html { redirect_to @superset_exercise, notice: 'Superset exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @superset_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f0f00b5259a361aea3822d596b8a486", "score": "0.5747733", "text": "def update\n @experience = Experience.find(params[:id])\n\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n # format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bbc2693e33f6bce3eb31defb41aa437", "score": "0.5744189", "text": "def update\n @violence_act = ViolenceAct.find(params[:id])\n\n if @violence_act.update(violence_act_params)\n head :no_content\n else\n render json: @violence_act.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3279d2f1ad6d318529eb86a32a2cca27", "score": "0.57428646", "text": "def update\n respond_to do |format|\n if @adminmatrixspec.update(adminmatrixspec_params)\n format.html { redirect_to @adminmatrixspec, notice: 'Adminmatrixspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @adminmatrixspec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c93dfde81cf2f637f8e7519d725b470", "score": "0.57419384", "text": "def update\n #raise params.inspect\n @examquestion = Examquestion.find(params[:id])\n #@subject_exams = @examquestions.group_by { |t| t.subject_details }\n\n respond_to do |format|\n if @examquestion.update_attributes(params[:examquestion])\n flash[:notice] = 'Examquestion was successfully updated.'\n format.html { redirect_to(@examquestion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @examquestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42e4d81ce0f91ce996dcbc347df2958d", "score": "0.57382727", "text": "def update\n @response = self.class.put(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\", :body => \"{'resource_form_name':#{JSON.generate(@opts)}}\")\n end", "title": "" }, { "docid": "7b5dac72548d8b7b10b541d822cc66b9", "score": "0.57345235", "text": "def update\n @experience = Experience.find(params[:id])\n\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
ed741d6227a650237fbc18577b1f999a
Is the name of the method a valid name for an association condition?
[ { "docid": "2db53761a63b299c2384afebea3be907", "score": "0.7292463", "text": "def association_condition?(name)\n !association_condition_details(name).nil?\n end", "title": "" } ]
[ { "docid": "fb4f13605357175a83e5f25460454690", "score": "0.73350465", "text": "def association?(method_name)\n self.class.has_one.include? method_name\n end", "title": "" }, { "docid": "55a8025c82814774c8a240fb9ab7ca99", "score": "0.7305342", "text": "def association? model_name, meth\n if call? model_name\n return association? model_name.target, meth\n elsif model_name? model_name\n model = tracker.models[class_name(model_name)]\n else\n return false\n end\n\n return false unless model\n\n model.association? meth\n end", "title": "" }, { "docid": "e23d3693cd541d721540638761217af3", "score": "0.728479", "text": "def association_condition?(name)\n !association_condition_details(name).nil?\n end", "title": "" }, { "docid": "ad778a7e7b3547a30c92b531a9019ed7", "score": "0.6875221", "text": "def association?(name)\n ! reflect_on_association(name.to_sym).nil?\n end", "title": "" }, { "docid": "cec408f109b98788099970e58f86ce1e", "score": "0.684608", "text": "def has_association?(attr_name)\n association_names.include? attr_name.to_sym\n end", "title": "" }, { "docid": "f990905ce8cecfc12b91571eae61322c", "score": "0.66075987", "text": "def attribute_method?(attr_name)\n keys.key?(attr_name) || !embedded_associations.detect {|a| a.name == attr_name }.nil?\n end", "title": "" }, { "docid": "104c0b899e9a783870e94b7f6d8a05cc", "score": "0.6535816", "text": "def respond_to?(method_name)\n return true if @associations.respond_to? method_name\n super\n end", "title": "" }, { "docid": "22df805473d1ddfa645c5b7ecac98c0b", "score": "0.6524249", "text": "def association_alias_condition?(name)\n !association_alias_condition_details(name).nil?\n end", "title": "" }, { "docid": "02fd3041d8a8a4d9f3791932968cf052", "score": "0.651711", "text": "def association_alias_condition?(name)\n !association_alias_condition_details(name).nil?\n end", "title": "" }, { "docid": "9f64c01bd28ea3c07b2436fa14e3913e", "score": "0.64756507", "text": "def method?\n !qualifier.is_a?(Namespace) && qualifier.respond_to?(@unqualified_name)\n end", "title": "" }, { "docid": "98676c3fdf875444174b08e6f29cb61b", "score": "0.64442205", "text": "def association? association_name\n self.class.associations.key?(association_name.intern)\n end", "title": "" }, { "docid": "803d1aeff1c45d9f53f7d6828442c4b0", "score": "0.6425839", "text": "def preconditions\n !association.polymorphic? &&\n association.through_reflection.nil? &&\n association.klass.present? &&\n association.macro != :has_and_belongs_to_many &&\n association.klass.table_exists?\n rescue NameError\n false\n end", "title": "" }, { "docid": "568d9b95b666539f19a3cf4af99fb463", "score": "0.635134", "text": "def method?(name); end", "title": "" }, { "docid": "568d9b95b666539f19a3cf4af99fb463", "score": "0.635134", "text": "def method?(name); end", "title": "" }, { "docid": "46cfedfc062d265e78c5221704d175f2", "score": "0.63402694", "text": "def association_of_macro?(name, macro)\n reflect_on_association(name.to_sym).try(:macro) == macro\n end", "title": "" }, { "docid": "049fc8a1f9d901f06dfa1a04fd4c58e4", "score": "0.6327379", "text": "def association? #nodoc\n att = @cls.associations[name]\n not (att.nil? or att.property?)\n end", "title": "" }, { "docid": "30d90819a605dafe391a3a24003ee247", "score": "0.6285768", "text": "def defined_by_model_class?(symbol, relation)\n method(symbol).owner == relation.generated_attribute_methods\n end", "title": "" }, { "docid": "f25a7f4f23e520809f1d6e0d8a0e8b0f", "score": "0.62633866", "text": "def association?\n is_association\n end", "title": "" }, { "docid": "3665335141e0e27eba279a015402b642", "score": "0.6251327", "text": "def foreign_key?\n @domain.relationships_by_entity_name(@model.name).map(&:associations).flatten.map { |associaton|\n associaton.send(Domain.foreign_key_method_name).to_sym\n }.include?(name.to_sym)\n end", "title": "" }, { "docid": "995f28d9c172260e6e7643c8e93da6ab", "score": "0.6230529", "text": "def has_method_name\n self.class.has_method_name\n end", "title": "" }, { "docid": "288d79d76f80451ba12c7151ea4e0658", "score": "0.62146294", "text": "def is_association_attr?(a)\n # maybe the check is too simplistic, but will do for now\n !!a[:name].to_s.index(\"__\")\n end", "title": "" }, { "docid": "9b4693e5f522ad056b83d2d15c5625c9", "score": "0.620715", "text": "def forwardable?(method)\n relation.respond_to?(method)\n end", "title": "" }, { "docid": "9b4693e5f522ad056b83d2d15c5625c9", "score": "0.620715", "text": "def forwardable?(method)\n relation.respond_to?(method)\n end", "title": "" }, { "docid": "6ffcec1869327ac4fad99a23a1497afb", "score": "0.618653", "text": "def association_type?\n ModelMethod.association_type?( operator_type )\n end", "title": "" }, { "docid": "265851c7faac02a282541c226620120d", "score": "0.61805266", "text": "def matches_convention?\n @method_name =~ /^[a-z]+(?:_[a-z]+){0,}(?:NS[a-z]+(?:_[a-z]+){0,})?$/\n end", "title": "" }, { "docid": "cb0975526ae65b1ca57c9ed3042cb02a", "score": "0.617624", "text": "def method_missing(method, *args, &block)\n prefix, *predicate = method.to_s.split(\"_\")\n predicate.shift if [\"a\", \"an\"].include?(predicate.first)\n return Inspector::Constraints::Predicate.new(predicate.join(\"_\"), *args, &block) if prefix == \"be\"\n # return Inspector::Constraints::Has.new(method, *args, &block) if method.to_s =~ /^have_/\n super\n end", "title": "" }, { "docid": "f2a1827fbd9e2f625abdd24c8152eab3", "score": "0.6162089", "text": "def defined_method?(name)\n instance_variable_get(\"@#{name}\").is_a?(Proc)\n end", "title": "" }, { "docid": "f2a1827fbd9e2f625abdd24c8152eab3", "score": "0.6162089", "text": "def defined_method?(name)\n instance_variable_get(\"@#{name}\").is_a?(Proc)\n end", "title": "" }, { "docid": "ef5c62120330f54df3fa184faa335996", "score": "0.6157505", "text": "def has_valid_association model, field\n (association = model.reflect_on_association(field)) &&\n association &&\n !association.options.has_key?(:through)\n end", "title": "" }, { "docid": "70c04472fbb5eb0678db730c478489b0", "score": "0.61535317", "text": "def any_belongs_to?(param0 = T.unsafe(nil), association:); end", "title": "" }, { "docid": "7fac75b9ce2ce02f90a88e8c8c83ebfa", "score": "0.61484975", "text": "def is_method\n @name.split(\".\").length == 2\n end", "title": "" }, { "docid": "7fb94c2cfd904d03a5e12f389c35f0f6", "score": "0.6127849", "text": "def preconditions\n supported? &&\n association.belongs_to? && !association.polymorphic? &&\n same_database?\n rescue NameError\n false\n end", "title": "" }, { "docid": "6efdd9b9e09125f28c5413fe7636bf78", "score": "0.6119606", "text": "def method_defined_within?(name, klass)\n klass.method_defined?(name) || klass.private_method_defined?(name)\n end", "title": "" }, { "docid": "78bcb7fc284b2311e346e9bbbcc46a43", "score": "0.61172694", "text": "def method_missing name, *args\r\n name = name.to_s\r\n # check for magic join\r\n if table_alias.model_class.reflect_on_association(name.intern)\r\n return join(name.intern)\r\n end\r\n case name\r\n when /(.*)_is_null/\r\n return expression_for(:is_null, $1)\r\n when /(.*)_is_not_null/\r\n return expression_for(:is_not_null, $1)\r\n when /(.*)_not_(.*)/\r\n return expression_for(:not).expression_for($2, $1.intern, *args)\r\n return self\r\n when /(.*)_(.*)/\r\n return expression_for($2, $1.intern, *args)\r\n else\r\n super\r\n end\r\n end", "title": "" }, { "docid": "83493f9e3b0a6c82d05b9f8c9729b630", "score": "0.61169344", "text": "def is_association?(key)\n key_sym = key.to_s.to_sym\n @record.class.reflect_on_all_associations.each { |assoc| return true if assoc.name == key_sym }\n false\n end", "title": "" }, { "docid": "ce8590b3f7fd1cdfd6a2edefb177afc7", "score": "0.60978276", "text": "def method_missing_with_has_associated(method_id, *arguments)\n if match = /has_([_a-zA-Z]*)\\?/.match(method_id.to_s)\n assoc = match[1].pluralize.to_sym\n if self.class.reflect_on_association(assoc)\n reload = arguments.last || false\n assoc_ids = send(assoc, reload).collect {|obj| obj.send(obj.class.primary_key)}\n id = arguments.first.is_a?(::ActiveRecord::Base) ? arguments.first.send(arguments.first.class.primary_key) : arguments.first\n return assoc_ids.include?(id)\n end\n end\n method_missing_without_has_associated(method_id, *arguments)\n end", "title": "" }, { "docid": "433356325ad3eaed3b6b838c81f05f35", "score": "0.6086083", "text": "def belongs_to?(name)\n association_of_macro?(name, :belongs_to)\n end", "title": "" }, { "docid": "8193d2c54814846582b1d12fb3d33a55", "score": "0.60797626", "text": "def dangerous_attribute_method?(name) # :nodoc:\n method_defined_within?(name, OptionsModel::Base)\n end", "title": "" }, { "docid": "b3b0fd95a63b74d3e034b7ffe6046ec2", "score": "0.6068739", "text": "def verify_association(expected, object, macro, options={})\n klass = object.is_a?(Class) ? object : object.class\n association = begin\n if expected.is_a?(Class)\n expected.to_s.downcase.to_sym\n elsif expected.is_a?(Symbol)\n expected\n else\n expected.to_sym\n end\n end\n klass.reflections.has_key?(association) and klass.reflections[association].macro == macro and (options.has_key?(:through) ? klass.reflections[association].options[:through] == options[:through] : true)\nend", "title": "" }, { "docid": "ece34040ec85ccffc6e570ac639042b5", "score": "0.6057021", "text": "def method_missing(method_sym, *args)\n\t\t\tif DOT_METHODS.include?(method_sym)\n\t\t\t\tCondition.new.from_key(method_sym, self, args)\n\t\t\telse\n\t\t\t\tsuper\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "adc4afc0b7cf66d6e22df3d1c77e68b2", "score": "0.60550076", "text": "def has_many?(name)\n association_of_macro?(name, :has_many)\n end", "title": "" }, { "docid": "6cee96086e13e2dd0a7aa8c18805411f", "score": "0.6045903", "text": "def detect_association_with_method(c)\n if c[:name].index('__')\n assoc_name, method = c[:name].split('__').map(&:to_sym)\n if method && assoc = data_class.reflect_on_association(assoc_name)\n assoc_column = assoc.klass.columns_hash[method.to_s]\n assoc_method_type = assoc_column.try(:type)\n if c[:nested_attribute]\n c[:xtype] ||= xtype_for_attr_type(assoc_method_type)\n else\n c[:xtype] ||= assoc_method_type == :boolean ? xtype_for_attr_type(assoc_method_type) : xtype_for_association\n end\n end\n end\n end", "title": "" }, { "docid": "cd4fa0cb55bca5ca7a1fe66c32455c3c", "score": "0.6042059", "text": "def has_and_belongs_to_many?(name)\n association_of_macro?(name, :has_and_belongs_to_many)\n end", "title": "" }, { "docid": "bbca0d8d33d997e7c4644ab9d2472d52", "score": "0.60418254", "text": "def respond_to?(method_sym, include_private = false)\n\n if method_sym.to_s =~ DECORATOR_METHOD_SIGNATURE\n actual_method_sym = method_sym.to_s[4..-1].to_sym\n if policy.respond_to? actual_method_sym or asset_type_rule.respond_to? actual_method_sym or asset_subtype_rule.respond_to? actual_method_sym\n true\n else\n @warnings << \"Method #{method_sym.to_s} not valid.\"\n end\n else\n # Pass it up the chain\n super\n end\n end", "title": "" }, { "docid": "51dd010e6e4aaa5f63893dd12a94620b", "score": "0.60412204", "text": "def attribute_method?(attribute); end", "title": "" }, { "docid": "ae431a87f28d6433875de1dad39ae2a8", "score": "0.603187", "text": "def check_builder_method? name\n name = name.to_sym\n name!=:subresource && name!=:operation && (@base.allowed_builder_methods.include?(name))\n end", "title": "" }, { "docid": "396040c3575aee908b156f95ec5ecaea", "score": "0.59924144", "text": "def attribute?(a)\n !(self.has_one + self.belongs_to).include?(a.name.to_sym) && !(self.has_many).include?(ActiveSupport::Inflector.pluralize(a.name.to_s).to_sym)\n end", "title": "" }, { "docid": "82cbab416040cdcfd4e56353aa452a5b", "score": "0.5992134", "text": "def method?(name)\n method_name == name.to_sym\n end", "title": "" }, { "docid": "86ac12679411cdbd55cdf22e43e692f6", "score": "0.598478", "text": "def respond_to_with_polymorphic_identity?(method, include_priv = false) #:nodoc:\n respond_to_without_polymorphic_identity?(method, include_priv) || !find_polymorphic_association_name(method).nil?\n end", "title": "" }, { "docid": "74b7e4b16abfb68501eac50bc395ae63", "score": "0.59763604", "text": "def additive_object_param?(name); end", "title": "" }, { "docid": "355c195b5b70c1b664242593412ee96e", "score": "0.59461504", "text": "def dangerous_attribute_method?(name)\n method_defined_within?(name, Base)\n end", "title": "" }, { "docid": "2d81269ef5099ac44dbe23b6ca02cf58", "score": "0.593278", "text": "def safe_method?( method )\n return true if attribute_names.include? method\n return true if ['full_title', 'print_url', 'forward_url', 'self_url'].include? method\n return false\n end", "title": "" }, { "docid": "0b5ba0ced42f09b8ca5e598d7e6c12fc", "score": "0.59227455", "text": "def dangerous_attribute_method?(name) # :nodoc:\n method_defined_within?(name, Base)\n end", "title": "" }, { "docid": "fd9525c044feeea5506173ad93c3edab", "score": "0.58982193", "text": "def respond_to?(method_name)\n return true if method_name.to_s =~ COLLECTION_METHOD_NAMES_PATTERN\n super\n end", "title": "" }, { "docid": "2069885091d55821e1d67cf18c25dfc6", "score": "0.5879092", "text": "def association?(inventory_collection_scope, key)\n # Is the key an association on inventory_collection_scope model class?\n !inventory_collection_scope.association_to_foreign_key_mapping[key].nil?\n end", "title": "" }, { "docid": "87618d4d202ecd10e55c94adabf28c38", "score": "0.5877995", "text": "def likely_model_attribute? exp\n return false unless call? exp\n\n method = exp.method\n\n if MODEL_METHODS.include? method or method.to_s.start_with? \"find_by_\"\n true\n else\n likely_model_attribute? exp.target\n end\n end", "title": "" }, { "docid": "c5655411ab15ccae426c043d5ac280e2", "score": "0.58588827", "text": "def is_association?(field)\n !!get_association_reflection(field)\n end", "title": "" }, { "docid": "d6a8309d4ac96a68618253680c847ff5", "score": "0.584758", "text": "def child_is_association(attr)\n\t\t\treturn !model_class.reflect_on_all_associations(:has_and_belongs_to_many).select{|a| a.name == attr.to_sym}.empty?\n\t\tend", "title": "" }, { "docid": "3bee754db95e9c7d5f947477591a3038", "score": "0.5846065", "text": "def respond_to?(method, include_private = false)\n super || model.respond_to?(method) || relationships.key?(method)\n end", "title": "" }, { "docid": "e6b54454b85c226a26d0e3e14eb8c975", "score": "0.58213395", "text": "def member_of_composite?(object, composite_name)\n object.respond_to?(\"parent_#{composite_name}\")\n end", "title": "" }, { "docid": "663b6afc1be5a2d57d8cc7bdaa60e93f", "score": "0.5819088", "text": "def method?(name)\n begin\n klass = Esi::Calls.const_get(method_to_class_name(name))\n rescue NameError\n return false\n end\n !klass.nil?\n end", "title": "" }, { "docid": "264da4532eac2f64127e9948c8607bf1", "score": "0.5805159", "text": "def attribute_method?(attribute)\n super || (table_exists? && column_names.include?(attribute.to_s.sub(/=$/, '')))\n end", "title": "" }, { "docid": "f3802cc09f905ec85bf04c2fd90d3b63", "score": "0.5798392", "text": "def attribute_method?(attribute)\n super || (table_exists? && column_names.include?(attribute.to_s.delete_suffix(\"=\")))\n end", "title": "" }, { "docid": "30ab77ed26af6dc4fad91f00623304c5", "score": "0.5786086", "text": "def is_association?\n true\n end", "title": "" }, { "docid": "26ed61b8c87f98f5eaa1c9c764fbae5f", "score": "0.578392", "text": "def _assert_association(association_model, association_name)\n association = association_model.reflect_on_association(association_name.to_sym)\n\n # Check the association exists\n unless association\n raise \"Bad selection path: #{@selection_path}. #{association_name} not found \"\\\n \"in model #{association_model} when filtering #{@model} objects\"\n end\n\n # Check the association is no a has-and belongs-to-many\n # These associations are discouraged by Rails Community\n if association.class == ActiveRecord::Reflection::HasAndBelongsToManyReflection\n raise \"Relationship #{association.name} is has_and_belongs_to_many. Convert it to has_many-through\"\n end\n\n # Valid association\n association\n end", "title": "" }, { "docid": "78a121c7580850b942a93fce0896cfd7", "score": "0.5781165", "text": "def method_missing(name, *args, &block)\n @conditions = case name.to_s\n when /^be_(an?_)?(.+)$/\n if $2 == \"true\" || $2 == \"false\"\n eval($2) ? Proc.new { |o| !!o } : Proc.new { |o| !o } # This line is cute.\n else\n Proc.new { |o| o.__send__(:\"#{$2}?\", *args) }\n end\n when /^have_(.+)$/\n Proc.new { |o| o.__send__(:\"has_#{$1}?\", *args) }\n else\n Proc.new { |o| o.__send__(:\"#{name}?\", *args) }\n end\n self\n end", "title": "" }, { "docid": "7cdf3d6c426982f4142270f134a6b715", "score": "0.5779391", "text": "def all_associations_exist?(association_names)\n\t\t\t\tassociation_names.all? do |name| \n\t\t\t\t\tfound_reflection = find_reflection( extract_association(name) )\n\t\t\t\t\t\n\t\t\t\t\tfound_reflection && !(name.to_s.include?(\"_id\") && (found_reflection.macro == :belong_to) )\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "fcbd5e481bc4cb44dea5c2b18811d830", "score": "0.5768652", "text": "def respond_to_missing?(method_name, _include_private)\n method_name.to_s =~ /\\Aon_./\n end", "title": "" }, { "docid": "febd238d9b1c46a9fbde21a72813534a", "score": "0.5750675", "text": "def reserved?(name)\n keyword?(name) || object_method?(name)\n end", "title": "" }, { "docid": "7a7318e2a6eadee8398c159cdf9a6257", "score": "0.57456774", "text": "def has_association?(association_name)\n associations = self.class.associations.values.flatten.map { |r| r[:name] }\n associations.include?(association_name)\n end", "title": "" }, { "docid": "7a7318e2a6eadee8398c159cdf9a6257", "score": "0.57456774", "text": "def has_association?(association_name)\n associations = self.class.associations.values.flatten.map { |r| r[:name] }\n associations.include?(association_name)\n end", "title": "" }, { "docid": "cb3b552f2c08275863e980997b318ff0", "score": "0.5742788", "text": "def extended_relationship? relationship\n self.public_methods(false).include? relationship.to_sym\n end", "title": "" }, { "docid": "3348608f7314f75764098e24e7d09c52", "score": "0.57426465", "text": "def link_exclusive_method(name)\r\n if has_exclusive? && @exclusive.has_key?(name) #??? WIP\r\n cache_exclusive_method(name, &@exclusive[name]) #??? WIP\r\n true\r\n else\r\n false\r\n end\r\n end", "title": "" }, { "docid": "871db78dde3eb3571949d189abfce7cb", "score": "0.5724719", "text": "def belongs_to_with_a_matching_fk?(param0 = T.unsafe(nil), param1); end", "title": "" }, { "docid": "18a81907b013bfe80c533700dad9599c", "score": "0.57194304", "text": "def declared?(klass, method_name)\n konstructor = get_factory(klass)\n if konstructor\n konstructor.declared?(method_name.to_sym)\n else\n false\n end\n end", "title": "" }, { "docid": "821f054616969b31d19c2806ae869fa8", "score": "0.5719343", "text": "def predicate?(method)\n method.match(/(#{@klass::ROLES.keys.join('|')})\\?/)\n end", "title": "" }, { "docid": "ede828fa26c445b0a92c592d821afcf1", "score": "0.57100993", "text": "def recognizes?(method)\n @elements.include? method.to_sym\n end", "title": "" }, { "docid": "80b24e3d564d86c3c60d029e17604ba7", "score": "0.57078433", "text": "def dangerous_class_method?(method_name); end", "title": "" }, { "docid": "59c9f29f048febf93fd4a2eaf65ebe92", "score": "0.570446", "text": "def scaffolded_method?(method_name)\n self.class.scaffolded_methods.include?(method_name)\n end", "title": "" }, { "docid": "1067d14cd3c38a7b5af443188d5b0eea", "score": "0.5699543", "text": "def owner_class_ancestor_has_method?(scope, method)\n scope == :instance && method == \"#{attribute}?\" ? owner_class : super\n end", "title": "" }, { "docid": "1c74d79776ea735473a9ee75b39bfb68", "score": "0.5690822", "text": "def respond_to?(name)\n _klass.instance_methods.map(&:to_sym).include?(name.to_sym)\n end", "title": "" }, { "docid": "8e758a0c2a5a195d26c4bf7a18fec20f", "score": "0.56884485", "text": "def defined?\n @object.respond_to?(@method_name, true)\n end", "title": "" }, { "docid": "699bc56e0ba8a4f55956a0fced574d45", "score": "0.5684871", "text": "def respond_to?(method, include_private = false)\n super || model.public_methods(false).map { |m| m.to_s }.include?(method.to_s) || relationships.has_key?(method)\n end", "title": "" }, { "docid": "e0ee8ce38608496dc023f5a404300b56", "score": "0.5682464", "text": "def relationship?(field)\n field =~ RELATIONSHIP_MATCHER\n end", "title": "" }, { "docid": "f39874f5f00a121aa2e9fdd30d1b761b", "score": "0.56797546", "text": "def cti_reciprocal_association_present_for?(association, type, class_name = nil)\n !cti_reciprocal_association_for(association, type, class_name).nil?\n end", "title": "" }, { "docid": "1e7c2b5e18c6ad304bdb4de667d90f26", "score": "0.5673374", "text": "def belongs_to_relationship?(dimension_name)\n dimension_relationships[dimension_name] and dimension_relationships[dimension_name].macro == :belongs_to \n end", "title": "" }, { "docid": "9e000f8953e970f2338700cdf41b3852", "score": "0.5669901", "text": "def define_event_query_method(name)\n define_method \"can_#{name}?\" do\n event = StateMachine::Event.new(name.to_sym, self.class)\n if self.class.events.include?(event)\n state_transition_table[[event, current_state]] ? true : false\n else\n false\n end\n end\n end", "title": "" }, { "docid": "368e6d3c74664bf75d69fd0f1bafcc2d", "score": "0.56686723", "text": "def method_missing(method, *args, &block)\n method.to_s =~ /(.+)\\?$/ ? is?(name: Regexp.last_match[1]) : super(method, *args, &block)\n end", "title": "" }, { "docid": "d53ae775a9906a383a0b1741db477b7d", "score": "0.56609845", "text": "def predicate_method?; end", "title": "" }, { "docid": "d53ae775a9906a383a0b1741db477b7d", "score": "0.56609845", "text": "def predicate_method?; end", "title": "" }, { "docid": "8b6c38e05a6eb885cb05ff2247fa296c", "score": "0.5657845", "text": "def existance_check?(method_name)\n method_name.to_s.end_with?('?')\n end", "title": "" }, { "docid": "61984d2e2d0c277967465f1f78ba2b07", "score": "0.56569904", "text": "def has_predicate?\n\n !!Ransack::Predicate.detect_from_string(method.to_s)\n\n end", "title": "" }, { "docid": "3a7a2535a319efd98f5cf9b7faa97777", "score": "0.565687", "text": "def has_or_inherits_method?(name)\n return true if has_method? name\n for ancestor_class in ancestors_classes!\n return true if ancestor_class.has_or_inherits_method? name\n end\n return false\n end", "title": "" }, { "docid": "95bc1a5fe9669e30fc3edebe0f556bd0", "score": "0.5654523", "text": "def method_defined?(name)\n return has_definition?(method_call_type, name)\n end", "title": "" }, { "docid": "c282ce3cb41f6d7a5924f23faf395190", "score": "0.564874", "text": "def should_visit?(association)\n !(association.is_a?(ActiveRecord::Reflection::ThroughReflection) ||\n association.macro == :belongs_to ||\n (@models_traversed.key?(association.klass.name) &&\n @models_traversed[association.klass.name].present?))\n end", "title": "" }, { "docid": "d7897224c68b8703418cbcffaeede16e", "score": "0.56469065", "text": "def method?(method_name, target: :self)\n MethodIntrospection.simple_lookup_chain_for(object, target).any?{ |lookup_class|\n if RUBY_VERSION >= \"2.6.0\"\n lookup_class.method_defined?(method_name, true) ||\n lookup_class.private_method_defined?(method_name, true)\n else\n lookup_class.method_defined?(method_name) ||\n lookup_class.private_method_defined?(method_name)\n end\n }\n end", "title": "" }, { "docid": "2ab6dc2ce7f939ed19c46d1aa0011e9d", "score": "0.564328", "text": "def related_to? some_object\n !!relation(some_object)\n end", "title": "" }, { "docid": "af02e70088055e3ac0cc2d5b2c5b8fe5", "score": "0.5641336", "text": "def has_n name = nil, remote_model = nil, through_model = nil, &proc\n\n if name && remote_model && configurable?\n\n # initializing relation\n @has_n[name] = Assoc.new(__method__, name, @controller, remote_model, through_model, &proc)\n\n # also trigger is_tree relations builder\n is_tree?\n end\n @has_n\n end", "title": "" }, { "docid": "993d45abcb1d96311106cbe79ca636f9", "score": "0.5630323", "text": "def complex_condition?(condition); end", "title": "" }, { "docid": "1c830556a973c6a910bf5826dbd11caf", "score": "0.5630323", "text": "def knows?(name)\n self.respond_to?(name.to_s.to_sym)\n end", "title": "" } ]
93c59bf31a34b3708a0ed9c4d1cb37db
TODO: Rename action to mapping and refactor the _action case statement. ++
[ { "docid": "a592f9b0f5a35961b17c1962d9c739a3", "score": "0.0", "text": "def can?(action, resource, options = {})\n\n # Sometimes we are getting a Class, so we need to convert it\n # to string.\n resource = resource.to_s\n\n return false if !resources.include?(resource)\n return true if resources[resource].include?(\"all\")\n\n _action = if options[:special]\n action\n else\n case action\n when \"new\", \"create\" then \"create\"\n when \"index\", \"show\" then \"read\"\n when \"edit\", \"update\",\n \"position\", \"toggle\",\n \"relate\", \"unrelate\", \"detach\" then \"update\"\n when \"destroy\" then \"delete\"\n else action\n end\n end\n\n resources[resource].extract_settings.include?(_action)\n\n end", "title": "" } ]
[ { "docid": "c40551ad7784fb76f10fff517c4cf5a7", "score": "0.7426733", "text": "def map_action(dict)\n map :action, dict\n end", "title": "" }, { "docid": "ba90b127ec9002374752b9acadb8616b", "score": "0.7360105", "text": "def map_api_action(requested_action) #:doc:\n requested_action\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.71005416", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.71005416", "text": "def action; end", "title": "" }, { "docid": "6aebd01ffda39ae6c470b9c7d74ca5c3", "score": "0.7100309", "text": "def action action\n @action = action\n end", "title": "" }, { "docid": "20e87467a1cc70deb30826655bbcf202", "score": "0.70523894", "text": "def action(act); data[:action] = act if act.present?; self; end", "title": "" }, { "docid": "014734053cd52d0eeb7bf791242808e7", "score": "0.69887114", "text": "def action_n(action_name)\n @action_name = action_name\n end", "title": "" }, { "docid": "73753ad7b4f6bb1ba8cb5a5c028d5779", "score": "0.6942633", "text": "def generate_action_code(action)\n case action\n when \"index\"\n options.ext_index_nav? ? draw_index_action : draw_get_items_for_index\n when \"edit\"\n %Q`@#{singular_table_name} = #{actual_class_name}.find(params[:id])`\n when \"new\"\n %Q`@#{singular_table_name} = #{actual_class_name}.new`\n when \"update\"\n redir_call = options.ext_form_submit? ? \"redir_url\" : \"edit_#{singular_table_name}_url(@#{singular_table_name})\"\n %Q`@#{singular_table_name} = #{actual_class_name}.find(params[:id])\n if @#{singular_table_name}.update_attributes(#{singular_table_name}_params)\n flash[:success] = \"Updated #{human_model_name} successfully\"\n redirect_to #{redir_call}\n else\n flash_alert(@#{singular_table_name})\n render :edit\n end`\n when \"create\"\n redir_call = options.ext_form_submit? ? \"redir_url\" : \"new_#{singular_table_name}_url(@#{singular_table_name})\"\n %Q`@#{singular_table_name} = #{actual_class_name}.new(#{singular_table_name}_params)\n if @#{singular_table_name}.save\n flash[:success] = \"Created #{human_model_name} successfully\"\n redirect_to #{redir_call}\n else\n flash_alert(@#{singular_table_name})\n render :new\n end`\n when \"destroy\"\n %Q`@#{singular_table_name} = #{actual_class_name}.find(params[:id])\n if @#{singular_table_name}.destroy\n flash[:success] = \"Deleted #{human_model_name} successfully\"\n else\n flash[:error] = \"Unable to delete #{human_model_name}\"\n end\n redirect_to #{plural_table_name}_url`\n end\n end", "title": "" }, { "docid": "c0c151724c7f102e50ef90c021b1ca58", "score": "0.6939515", "text": "def rework_action(action)\n action\n end", "title": "" }, { "docid": "740b5fc9a7dd6c344880ac84f1110dbf", "score": "0.69266474", "text": "def route; Map[current_action]; end", "title": "" }, { "docid": "d63f4f3155fe6688355b5b1b849dbcdc", "score": "0.69132406", "text": "def action\n self[:action].to_sym if self[:action]\n end", "title": "" }, { "docid": "b1d3a15b74f917f432d84798575486c8", "score": "0.6847589", "text": "def action\n @action\n end", "title": "" }, { "docid": "09bed2278a9d232ff044645225a0a08e", "score": "0.6838519", "text": "def action\n action_name.to_sym\n end", "title": "" }, { "docid": "2ad5733bd80d07dee8da736a248ba7ea", "score": "0.68376833", "text": "def action\n @action\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.6826296", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.6826296", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.6826296", "text": "def actions; end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.6807084", "text": "def register_action(action); end", "title": "" }, { "docid": "09f04fc9633abb1626d8fa61b20cca85", "score": "0.67867666", "text": "def _find_action_name(action_name); end", "title": "" }, { "docid": "dbe9c5c5ee0f4d34f1c37d6c8c502c53", "score": "0.6775479", "text": "def action\n action_name.to_sym\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.67740726", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.67740726", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.67740726", "text": "def action\n end", "title": "" }, { "docid": "d13dccc4e460cc7a7d63691415e9eaef", "score": "0.6733392", "text": "def process_action(res)\n if res.is_a?(Hash) && res[\"action\"].present?\n handle_action(res[\"action\"], res[\"arguments\"])\n end\n end", "title": "" }, { "docid": "8e551a05f9c848987b2290f0e7b4792b", "score": "0.6730944", "text": "def action\n @action ||= \"\"\n end", "title": "" }, { "docid": "a6f723d27b33276826f188849e263a7a", "score": "0.6727925", "text": "def lookup_action(act)\n return 'create' if act == 'new'\n return 'read' if act == 'show'\n return 'read' if act == 'index'\n return 'update' if act == 'edit'\n return act\n end", "title": "" }, { "docid": "5aba896e5a1ca82a8b967f0eeefcad0e", "score": "0.672102", "text": "def determine_action(action)\n case action\n when \"C\"\n create_person\n when \"L\"\n list\n when \"U\"\n method = \"Update\"\n find_person_requested(method)\n when \"D\"\n method = \"Delete\"\n find_person_requested(method)\n when \"E\"\n exit\n else\n invalid_entry\n start\n end\nend", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.670429", "text": "def actions\n\n end", "title": "" }, { "docid": "1abe6afaf8fb2daaf517c039b570e481", "score": "0.6673555", "text": "def action(action)\n actions[action.to_sym]\n end", "title": "" }, { "docid": "111174c2a09bf4412a910f3cb11194dd", "score": "0.6667027", "text": "def route_action(action)\n case action\n when pattern = /PLACE\\s(?<position_x>\\d+),(?<position_y>\\d+),(?<direction>NORTH|SOUTH|EAST|WEST)/\n then\n match_data = action.match(pattern)\n @controller.place(match_data[:position_x].to_i,\n match_data[:position_y].to_i, match_data[:direction])\n when 'MOVE' then @controller.move\n when 'LEFT' then @controller.rotate('left')\n when 'RIGHT' then @controller.rotate('right')\n when 'REPORT' then @controller.report\n when 'EXIT' then stop\n else\n puts \"Invalid command\"\n puts \"\"\n end\n end", "title": "" }, { "docid": "0298a83dca404ee7949c336a631241fb", "score": "0.66660136", "text": "def action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n type = ACTION\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 140:10: 'action'\n match( \"action\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 5 )\n\n end", "title": "" }, { "docid": "a7a322778591bc03e5df6aefb92c2e8d", "score": "0.66377777", "text": "def action=(_); end", "title": "" }, { "docid": "a7a322778591bc03e5df6aefb92c2e8d", "score": "0.66377777", "text": "def action=(_); end", "title": "" }, { "docid": "6eb5e0806d16d50c6e06e41db6866603", "score": "0.6624416", "text": "def action_translate action\n @action_map ||= {\n \"install\" => \"installed\",\n \"start\" => \"running\"\n }\n return @action_map[action.to_s] if @action_map[action.to_s]\n action.to_s\nend", "title": "" }, { "docid": "c639918225cda1eb6749706d47d1f5f1", "score": "0.66243607", "text": "def method_for_action(action_name); end", "title": "" }, { "docid": "9112b663db444ffd2dae0ded4720ae29", "score": "0.6623474", "text": "def action(action)\n\t\t\t\t@action = action\n\t\t\tend", "title": "" }, { "docid": "d305f33239c69bed1a68b26adba6976c", "score": "0.6616288", "text": "def action_name; end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.66112167", "text": "def pick_action; end", "title": "" }, { "docid": "110cea913b1021a5998ed579a9698691", "score": "0.65745723", "text": "def action_params\n @num = params[:action_name]\n # @action = IvrAction.find(:first, :conditions => [\"id = ?\", params[:id]])\n # params.each { |key, val|\n # MorLog.my_debug(\"#{key} -> #{val}\")\n # }\n @action.name = @num.to_s\n @action.clear_data_fields\n @action.update_action_data(current_user, $pos_variables[0])\n @action.save\n critical_update(@action)\n\n render(:layout => false)\n end", "title": "" }, { "docid": "fae3ca02be4e1ca06d993cf79289e106", "score": "0.6563149", "text": "def add_action_mapping\n @rules_rule = Rules::Rule.find(params[:id])\n action_id = params[:action_id]\n rule_field = params[:rule_field]\n action_field = params[:action_field]\n @action = @rules_rule.actions.detect{|a| a.id.to_s == action_id}\n @was_mapped = @action.context_mapping[action_field]\n @action_field_name = action_field.split(\":=>\").first\n @action_field_type = action_field.split(\":=>\").last\n @rule_field_name = rule_field.split(\":=>\").first\n @rule_field_type = rule_field.split(\":=>\").last\n if @action_field_type == :class_lookup \n klazz = @rule_field_type.constantize\n @action.context_mapping[action_field] = rule_field\n @action.save!\n @rules_rule.updated_actions << \"Added class lookup : #{rule_field}\"\n @rules_rule.save!\n elsif @rule_field_type == \"instance_lookup\"\n # In this case, the rule field name will be <className_underscored>[id]\n # The field type will be simple \"instance_lookup\" \n # It will have some additional information which will be used for display purposes - perhaps - still fuzzy on that\n #\n # First - check that this is valid lookup\n instance = @action.instance_lookup(@rule_field_name)\n if instance \n @action.context_mapping[action_field] = rule_field\n @action.save!\n @rules_rule.updated_actions << \"Added class lookup : #{rule_field}\"\n @rules_rule.save!\n else\n @error = \"Unable to resolve instance specified by #{@rule_field_name}\"\n end\n elsif @rule_field_type == \"free_form\" || @action_field_type == \"free_form\"\n begin\n config = @action.needs[@action_field_name.to_sym]\n check_value = @rule_field_name\n if config[:type] == :integer\n value = check_value.to_i\n raise \"#{check_value} is not an integer\" unless value.to_s == check_value\n if config[:min] && config[:min] > value \n raise \"You must enter a value that is #{config[:min]} or more\"\n elsif config[:max] && config[:max] < value \n raise \"You must enter a value that is #{config[:max]} or smaller\"\n end\n end\n @action.context_mapping[action_field] = rule_field\n @action.save!\n @rules_rule.updated_actions << \"Added freeform action mapping : #{rule_field}\"\n @rules_rule.save!\n rescue => e\n @error = \"Unable to update mapping: #{e.message}\"\n end\n elsif @rule_field_type == \"lambda_lookup\"\n @action.context_mapping[action_field] = rule_field\n @action.save!\n @rules_rule.updated_actions << \"Added predefined action mapping : #{rule_field}\"\n @rules_rule.save! \n else\n if Rules::Action.check_mapping_type?(@action_field_type, @rule_field_type)\n @action.context_mapping[action_field] = rule_field\n @action.save!\n @rules_rule.updated_actions << \"Added mapping : #{@rule_field_type} => #{action_field}\"\n @rules_rule.save!\n else\n @error = \"Illegal field type mapping from #{@rule_field_type} to #{@action_field_type}\"\n end\n end\n respond_to do |format|\n format.html { _smart_redirect(error: @error) }\n format.js {}\n end\n end", "title": "" }, { "docid": "52b6bf633a248889d7d209d690684385", "score": "0.65532506", "text": "def action\n data.action\n end", "title": "" }, { "docid": "26c3c7bc6142719cf0d898616468c627", "score": "0.6548465", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "a608eb5abe1ede458363e3024588aa89", "score": "0.6542237", "text": "def get_action(action)\r\n action.match {\r\n Si() { \"salva\" }\r\n No() { \"insert_match\" }\r\n Forse(where { s == true }) { |s| \"insert_match\" }\r\n Forse(where { s == false }) { |s| salvo_nome_in_db ? \"salva\" : \"insert_match\" }\r\n }\r\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.6526191", "text": "def performed(action)\n end", "title": "" }, { "docid": "4a3c334cd8be35e0715c5dbd30324195", "score": "0.6526136", "text": "def actions_mapping\n # Defaults to a duplicate of the standard mapping\n @actions_mapping ||= ACTIONS_MAPPING.dup\n end", "title": "" }, { "docid": "04dff28b61b66548621e4176d285decb", "score": "0.6523713", "text": "def attempted_action; end", "title": "" }, { "docid": "98787528a048c4fec55be3462018abbe", "score": "0.65077007", "text": "def route_action(action)\n @controller.display_list if action == 1\n @controller.add if action == 2\n @controller.destroy if action == 3\n @customers_controller.display_list if action == 4\n @customers_controller.add if action == 5\n @customers_controller.destroy if action == 6\n @user = nil if action == 7\n action == 8 ? stop : enter_num\n end", "title": "" }, { "docid": "61fb486e47690f37839c73b4f129fa66", "score": "0.65019906", "text": "def action=(_arg0); end", "title": "" }, { "docid": "628aedc2cf8daf4fa16aa28b53f98c78", "score": "0.6494291", "text": "def action_to_permission(action)\n\n\n\n if action && action = action.to_sym\n\n\n\n Authorization::ACTIONS_DICTIONARY[action] || action\n\n\n\n end\n\n\n\n end", "title": "" }, { "docid": "93737c7634b5e7ff70a5d64c1da78659", "score": "0.6491694", "text": "def action(name)\n @action_index[name.to_sym]\n end", "title": "" }, { "docid": "a1980c33e339061c19196f14b5551aea", "score": "0.6491198", "text": "def action\r\n raise NotImplementedError\r\n end", "title": "" }, { "docid": "f143b9ef830e050e3e600994923b0b32", "score": "0.64846", "text": "def action\n @action ||= REGEX_ACTION.match(@data) ? $1.to_sym : :unknown\n end", "title": "" }, { "docid": "9d8dd9837975c444037a2db2c03c602c", "score": "0.64822495", "text": "def postprocess(_action)\n end", "title": "" }, { "docid": "365bd0c4814de95e5416e6ba87301200", "score": "0.6471546", "text": "def action; @h['msg']['action']; end", "title": "" }, { "docid": "147850cb28f38c37ca3f4ba18ca08a96", "score": "0.64689523", "text": "def process_action(raw_action)\n temp = raw_action.delete(\"\\\"[] \").split(\",\")\n action = {\n \"source\": temp[0].split(\":\")[0],\n \"value\": temp[0].split(\":\")[1].to_i,\n \"action_type\": temp[1].split(\":\")[1]\n }\n\n action\nend", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.64642537", "text": "def inner_action; end", "title": "" }, { "docid": "e1e8bb045e77fb018ca1862581efc9bc", "score": "0.6462499", "text": "def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 141:11: 'actions'\n match( \"actions\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end", "title": "" }, { "docid": "cba249266e4a06740359c113ac0ed6d3", "score": "0.6455686", "text": "def handle_actions(hash)\n case hash['action']\n when \"create\" then handle_create(hash)\n when \"show\" then handle_show(hash)\n when \"delete\" then handle_delete(hash)\n when \"marmota\" then handle_close\n when \"status\" then status\n else self.send_line \"What? I cannot understand you, bro!\"\n end\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.64472437", "text": "def default_action; end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.64472437", "text": "def default_action; end", "title": "" }, { "docid": "b540ea76868c1ea9ca657b22bc89f9db", "score": "0.6447089", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "b540ea76868c1ea9ca657b22bc89f9db", "score": "0.6447089", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "b540ea76868c1ea9ca657b22bc89f9db", "score": "0.6447089", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "b540ea76868c1ea9ca657b22bc89f9db", "score": "0.6447089", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "b540ea76868c1ea9ca657b22bc89f9db", "score": "0.6447089", "text": "def action=(value)\n @action = value\n end", "title": "" }, { "docid": "5c0d4dc6f05373a3ec4960b2fae0257c", "score": "0.64280546", "text": "def route_manager_action(action)\n case action\n when 1 then @meals_controller.list\n when 2 then @meals_controller.add\n when 3 then @customers_controller.list\n when 4 then @customers_controller.add\n when 5 then @orders_controller.list_undelivered_orders\n when 6 then @orders_controller.add\n when 0 then destroy_session\n when 9 then stop\n else\n puts \"Please press 1, 2, 3, 4 or 9\"\n end\n end", "title": "" }, { "docid": "98ea86d154f93591b2430ea155281965", "score": "0.641311", "text": "def invoke_action(name)\n \n end", "title": "" }, { "docid": "a6a243b9d7f4d338fd546dce948948e6", "score": "0.641227", "text": "def translate_action(action)\n @translate_action ||= Hash.new do |h, key|\n h[key] = I18n.t(\"helpers.actions.#{key}\", raise: Translation.i18n_raise)\n end\n @translate_action[action]\n end", "title": "" }, { "docid": "d5e81740e5dd38fad014fadf2c2c6440", "score": "0.63931733", "text": "def action\n @action ||= calculate_action\n end", "title": "" }, { "docid": "347f4690c6d6d76e038f767223e54fa4", "score": "0.63834924", "text": "def custom_action\n @custom_action ||= \"#{action}_#{target.class.model_name.name.underscore}\".to_sym\n end", "title": "" }, { "docid": "347f4690c6d6d76e038f767223e54fa4", "score": "0.63834924", "text": "def custom_action\n @custom_action ||= \"#{action}_#{target.class.model_name.name.underscore}\".to_sym\n end", "title": "" }, { "docid": "461ee76afff6216d39eb448b1ce275f1", "score": "0.6360549", "text": "def action\n return @action\n end", "title": "" }, { "docid": "461ee76afff6216d39eb448b1ce275f1", "score": "0.6360549", "text": "def action\n return @action\n end", "title": "" }, { "docid": "461ee76afff6216d39eb448b1ce275f1", "score": "0.6360549", "text": "def action\n return @action\n end", "title": "" }, { "docid": "461ee76afff6216d39eb448b1ce275f1", "score": "0.6360549", "text": "def action\n return @action\n end", "title": "" }, { "docid": "461ee76afff6216d39eb448b1ce275f1", "score": "0.6360549", "text": "def action\n return @action\n end", "title": "" }, { "docid": "59f45301e484c687a8942101f10de3ca", "score": "0.63603985", "text": "def assign_action_parameters\n case params[:action]\n when 'edit'\n @header = 'Edit'\n @next_action = 'update'\n @response = Response.find(params[:id])\n @map = @response.map\n @contributor = @map.contributor\n when 'new'\n @header = 'New'\n @next_action = 'create'\n @feedback = params[:feedback]\n @map = ResponseMap.find(params[:id])\n @modified_object = @map.id\n end\n @return = params[:return]\n end", "title": "" }, { "docid": "941d3d009b211e3d8854a9a793f4bfd6", "score": "0.6354018", "text": "def updateAction\n\t\tunit = @actionUnits.pop\n\t\t@actionUnits.push(unit)\n\t\tcommand = unit.nextCommand\n\t\tputs command[0]\n\t\tcase command[0]\n\t\twhen \"Attack\"\n\t\t\tattack\n\t\twhen \"Run\"\n\t\t\trun\n\t\twhen \"Item\"\n\t\t\titem\n\t\twhen \"Magic\"\n\t\t\tmagic\n\t\tend\n\t\tactionLength = @actionLength\n\t\t@actionLength = @actionUnits.length\n\t\treturn actionLength == @actionLength\n\tend", "title": "" }, { "docid": "5b088bd4a4ca2aff02231995200491e1", "score": "0.634934", "text": "def exectute_action(action)\n ACTION_HANDLERS_ORDER.each do |name|\n if (data = action[name])\n instance_exec(data, &ACTION_HANDLERS[name])\n end\n end\n end", "title": "" }, { "docid": "d97e5da5cfd7e3718ff35e5df6d0b339", "score": "0.6340423", "text": "def get_action_id(action)\n @actionHash.index(action)\n end", "title": "" }, { "docid": "016ba962ae355e52e7bd8ae3fe9278c2", "score": "0.63379586", "text": "def respond_to_action(action)\n type = action[:type].to_sym\n state = action[:state].to_sym\n actions = []\n if type == :grid\n actions += responses[:\"grid#{action[:x]}#{action[:y]}\"][state]\n actions += responses[:\"grid#{action[:x]}-\"][state]\n actions += responses[:\"grid-#{action[:y]}\"][state]\n end\n actions += responses[type][state]\n actions += responses[:all][state]\n actions.compact.each {|block| block.call(self, action)}\n nil\n rescue Exception => e\n logger.error \"error when responding to action #{action.inspect}: #{e.inspect}\"\n raise e\n end", "title": "" }, { "docid": "e1a53d4635c1ad64584566b65983ca8f", "score": "0.6330025", "text": "def action\n data[:action]\n end", "title": "" }, { "docid": "37cd029d843c7ef2fcde49f1712dd75e", "score": "0.63019514", "text": "def action args = {}\n\t\tend", "title": "" }, { "docid": "e552df322fbd6a5aefff59de537d0fb0", "score": "0.6301788", "text": "def action act, add_args = {}\n '?action=' + act.to_s.strip + args(add_args)\n end", "title": "" }, { "docid": "3dbddfc634905609858958e5322be592", "score": "0.6293908", "text": "def process_action(*_arg0); end", "title": "" }, { "docid": "3dbddfc634905609858958e5322be592", "score": "0.6293908", "text": "def process_action(*_arg0); end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.62931716", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "8fb11fa79cefeef9a0ab1d0cec20d65b", "score": "0.628244", "text": "def action\n get_return_values('action')\n end", "title": "" }, { "docid": "60e2bdb4faadbb0c6372820d4041a326", "score": "0.6277457", "text": "def action\n (val = command[:action]) && val.to_sym\n end", "title": "" }, { "docid": "1acea1f9da7bc3e546fa1f73e07f26d5", "score": "0.6275523", "text": "def action( act )\n @action = act\n self\n end", "title": "" }, { "docid": "61a9f9cc441c02d96949186c13476fa5", "score": "0.62732357", "text": "def action(arg = nil)\n if arg\n arg = Array(arg).map(&:to_sym)\n arg.each do |action|\n validate(\n { action: action },\n { action: { kind_of: Symbol, equal_to: allowed_actions } }\n )\n end\n @action = arg\n else\n @action\n end\n end", "title": "" }, { "docid": "3870fc9244e9ec522298f95c93922978", "score": "0.62703305", "text": "def action_params\n @num = params[:action_name]\n @action.name = @num.to_s\n @action.clear_data_fields\n @action.update_action_data(current_user, $pos_variables[0])\n @action.save\n critical_update(@action)\n\n render(layout: false)\n end", "title": "" }, { "docid": "6c19db5234809f7b24ff87821b54fd3f", "score": "0.6263904", "text": "def [](action)\n actions[action]\n end", "title": "" }, { "docid": "233bee93c2167db94aa228acbf58f027", "score": "0.62606215", "text": "def code_action_kinds; end", "title": "" }, { "docid": "233bee93c2167db94aa228acbf58f027", "score": "0.62606215", "text": "def code_action_kinds; end", "title": "" }, { "docid": "d812c719da2f9b78c614329dd084e9bb", "score": "0.6258595", "text": "def route_manager_action(action)\n case action\n when 1 then @meals_controller.list\n when 2 then @meals_controller.add\n when 3 then @customers_controller.list\n when 4 then @customers_controller.add\n when 9 then destroy_session\n when 0 then stop\n else\n puts \"Please press 1, 2, 3, 4 or 9\"\n end\n end", "title": "" }, { "docid": "cd11903907a7847ba2a9a7ea79a44e17", "score": "0.6257394", "text": "def actions; @actions.to_enum; end", "title": "" }, { "docid": "0037bd801b858795732ba8ca9c18c3ce", "score": "0.62546104", "text": "def available_action?(action_name); end", "title": "" }, { "docid": "d73432aa70ff22301dcbc0f427b433d5", "score": "0.6243196", "text": "def translated_action_name(action)\n case action\n when :update\n :edit\n when :create\n :new\n else\n action\n end\n end", "title": "" }, { "docid": "28a853e60ca5a541c4f1ca678711f925", "score": "0.62425715", "text": "def map_command_to_action\n @run_description.action = Action2[ @args.first ]\n if @run_description.action.nil?\n @run_description.errors << \"Unrecognized keyword <#{@args.first}>. Quitting.\"\n end\n end", "title": "" }, { "docid": "f9e3c849ac06c574102c9e7ae7eee5e5", "score": "0.62407064", "text": "def action_defined(action)\n (action.eql? :default) || (actions.include? action.to_s.upcase)\n end", "title": "" } ]
5cbe01dca9006073af8df1850fcef3f2
Breakfast, Lunch, or Dinner? (Part 6) What will the following code print? Why? Don't run it until you've attempted to answer.
[ { "docid": "3257424a648dd289142c0aa81a189804", "score": "0.0", "text": "def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend", "title": "" } ]
[ { "docid": "da3f156aa3832eb73195b8bc12ceea65", "score": "0.68587655", "text": "def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend", "title": "" }, { "docid": "c21f053d008bcef9c8e8e7a250cbfed8", "score": "0.6802448", "text": "def explain_game\n\t\tputs \"In the Secret Number Game, you guess a number between 1 and 10 and, if you pick the right number, you win!\"\n\t\tputs \"Good luck #{@player}!\"\n\tend", "title": "" }, { "docid": "bcef7f0ac195deef4e41ef18b6eee9bf", "score": "0.6732973", "text": "def what_was_that?\n puts \"-\" * 70\n puts \"***** I didn't catch that *****\"\n puts \"\"\n puts \"Would you please try a different answer?\"\n puts \"-\" * 70\n end", "title": "" }, { "docid": "445249d4576594c64b9383662b424f16", "score": "0.66551065", "text": "def hero_downfall (super_power, weakness)\n p \"They may have #{super_power}, but they're no match for #{weakness}!\"\nend", "title": "" }, { "docid": "3495b61c9a425a6971bf8bf4ace66fa3", "score": "0.64303875", "text": "def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend", "title": "" }, { "docid": "6abeee77b0dc49fb37f618f9345abf69", "score": "0.6423977", "text": "def meal\n\treturn 'Breakfast'\n\t'Dinner'\n\tputs 'Dinner'\nend", "title": "" }, { "docid": "4ca066ad7e34b9d052f829bd8ccb1a05", "score": "0.6420138", "text": "def meal \n\treturn 'Breakfast'\n\t'Dinner'\n\tputs 'Dinner'\nend", "title": "" }, { "docid": "666dbabff6eeaf9f0f63c494902a8407", "score": "0.64066595", "text": "def encourage\n r = rand(4)\n if r == 0\n puts \"Watch out world, here comes the next great multiplier!\\n\"\n elsif r == 1\n puts \"I haven't seen these kind of skills since ancient Egypt!\\n\"\n elsif r == 2\n puts \"You're so good you could take on Einstein!\\n\"\n else\n puts\"You're really tearing it up now!\\n\"\n end\nend", "title": "" }, { "docid": "cfc13b18ef640cf7eacb0af4328a9541", "score": "0.634238", "text": "def meal(breakfast = \"frosted flakes\", lunch = \"grilled cheese\", dinner = \"salmon\")\n puts \"Morning is the best time for #{breakfast}!\"\n puts \"Noon is the best time for #{lunch}!\"\n puts \"Evening is the best time for #{dinner}!\"\nend", "title": "" }, { "docid": "3dc182125b31c34ff72800b8409c1f7a", "score": "0.6333002", "text": "def defeat\n @current_player = @players[\"plyr2\"]\n if @it == 12\n puts \" \"\n puts \" Code-breaker #{@current_player} loses!!\"\n puts \" \"\n puts \"Solution is #{@result}\"\n puts \" \"\n end\n end", "title": "" }, { "docid": "78a8ca35560b632f74c039fdc63afa17", "score": "0.63230205", "text": "def introduction\n system 'clear'\n prompt(\"Each match is 5 rounds. First to 5 wins!\")\n prompt(\"Who is going first? Player or Computer? (p or c)\")\nend", "title": "" }, { "docid": "29e56d83eca85a72aebe1bf04b2d72a3", "score": "0.63211536", "text": "def dig_power_at_bridge\n slowly do\n\"\"\"\nWhen is there a wrong time to dig? Duncan ignores the bridge for now, and starts digging happily here and there.\n\nWho knows where you'll find a bone?\n\nHe digs and digs...\n\"\"\"\n end\n if dice_roll > 3\n slowly do \n \"...And discovers a chache of burried bones! Max strength! Treasure + 3\"\n end\n $stats[:strength] = 5\n $ending += 3\n spacing\n start_bridge_quest\n prompt\n bridge_choice(STDIN.gets.chomp!)\n else\n puts \"...And finds nothing. \"\n spacing\n start_bridge_quest\n prompt\n bridge_choice(STDIN.gets.chomp!)\n end\n end", "title": "" }, { "docid": "00be5e22bd9ec6f1b357f5b02da716a6", "score": "0.6319011", "text": "def fortune\n rando_fortune = 1 + rand(20) ##Generate random number from 1-20\n\ncase rando_fortune ##Assign fortunes to case statement numbers\n when 1\n answer = \"It is certain\"\n when 2\n answer = \"It is decidedly so\"\n when 3 \n answer = \"Without a doubt\"\n when 4\n answer = \"Yes definitely\"\n when 5\n answer = \"You may rely on it\"\n when 6 \n answer = \"As I see it, yes\"\n when 7 \n answer = \"Most likely\"\n when 8 \n answer = \"Outlook good\"\n when 9 \n answer = \"Yes\"\n when 10 \n answer = \"Signs point to yes\"\n when 11\n answer = \"Reply hazy try again\"\n when 12\n answer = \"Ask again later\"\n when 13\n answer = \"Better not tell you now\"\n when 14 \n answer = \"Cannot predict now\"\n when 15 \n answer = \"Concentrate and ask again\"\n when 16 \n answer = \"Don't count on it\"\n when 17 \n answer = \"My reply is no\"\n when 18 \n answer = \"My sources say no\"\n when 19 \n answer = \"Outlook not so good\"\n when 20\n answer = \"Very doubtful\"\nend\n \nend", "title": "" }, { "docid": "5948690acc095f91e6bcf98468bbfcb8", "score": "0.63100946", "text": "def where_are_you_at?\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"We are going to ask you a few basic questions, and suggest an\"\n puts \"activity for you based on your answers. This won't take long.\"\n puts \"\"\n puts \"\"\n puts \"Where are you?\"\n puts \"\"\n puts \" 1. Home\"\n puts \" 2. Work\"\n puts \" 3. Somewhere else\"\n puts \"\"\n puts \"Please enter a number.\"\n puts \"\"\n user_response = gets.strip\n self.quit if user_response == \"quit\"\n if user_response == \"1\"\n self.limit_place = \"home\"\n elsif user_response == \"2\"\n self.limit_place = \"work\"\n elsif user_response == \"3\"\n self.limit_place = \"not work or home\"\n else\n self.what_was_that?\n self.where_are_you_at?\n end\n self.how_much_time?\n puts \"\"\n end", "title": "" }, { "docid": "91c13b0c627c6efaa97e6a7b16cc5cc0", "score": "0.6277228", "text": "def test_sad_low_end\n\t\tp = Print.new\n\t\tassert_output(\"Going home sad.\\n\") {p.print_game_win_or_lose(1)}\n\tend", "title": "" }, { "docid": "038a7fca9c25b1c23843fa0d56e5416d", "score": "0.6262912", "text": "def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend", "title": "" }, { "docid": "290ece5c56bd1fd1bf0892cc0c84f5a3", "score": "0.62373215", "text": "def test_sad\n\t\tp = Print.new\n\t\tassert_output(\"Going home sad.\\n\") {p.print_game_win_or_lose(3)}\n\tend", "title": "" }, { "docid": "dd42932467efa820a230f43daa0db830", "score": "0.6232708", "text": "def sophisticated_option? # TODO optionally \n puts %{\nSophisticated blackjack has options to \"split pairs\" and \"double \ndown.\" Do you want information on these (Y or N)? }\n\n loop do\n until %w(Y N).include? (answer = gets.chomp)\n print \"Incorrect answer - try again. \"\n end\n return if answer == \"N\"\n end\n\n puts %{\n\nSplitting Pairs\n---------------\nA player who starts out with two of any card (e.g. two 8's) may \n\"split\". Each card is split from the other into a new hand, an equal \nbet is added to the new hand, and a new card is dealt to each hand. \nEach hand is then played as normal from there, though no \n\"blackjacks\" occur.\n\nDoubling Down\n-------------\nA player may choose to \"double down\" as the first move on any new \nhand. This means the player doubles his/her bet, and will receive \na single dealt card (with no option to continue hitting). The dealer \ndraws as normal afterwards.\n\n }\n\n end", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "8ee055bfd48f93791fce1e4215289988", "score": "0.62010294", "text": "def meal\n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "7dde001c4c3e22dba8cdc10f249756a3", "score": "0.6192125", "text": "def determineWinner() \n\n end", "title": "" }, { "docid": "b567df89dee42f250660a8289d832027", "score": "0.6184828", "text": "def meal \n return 'Breakfast'\n 'Dinner'\n puts 'Dinner'\nend", "title": "" }, { "docid": "3f01c2853e30009b4c81991fdfa4cbb0", "score": "0.61823136", "text": "def fact\n puts ''\n puts '---Did you know?---'\n puts 'A pregnant goldfish is called a twit.'\n end", "title": "" }, { "docid": "426045ea189ce579f9cab6e8e2d6d189", "score": "0.61773413", "text": "def mothers_day\n puts \"Happy Mother's Day, Mom!\"\nend", "title": "" }, { "docid": "86c63550be73ffcde1012fbfacff610f", "score": "0.6169248", "text": "def meow\n puts \"My name is #{name} and i eat #{preferred_food} at #{eats_at}\"\n end", "title": "" }, { "docid": "0d1961b9a10bfd3fe5639e8a6197f1b6", "score": "0.6154073", "text": "def magiceightball\n\t\t answers = [\"outlook not so good\", \"cloudy, ask again later\", \"it is meant to be\", \"you may rely on it\"]\n\t\t @result = answers[Random.rand(4)]\n\tend", "title": "" }, { "docid": "4e5eb9d5e9f6cb5afd405f58910ddcaa", "score": "0.61402875", "text": "def adopted_cats(dumb_friends_league, from_friend, stray_cat)\n puts \"I have adopted #{dumb_friends_league} cat(s) from Dumb Friends League.\"\n puts \"I have adopted #{from_friend} cat(s) from a friend.\"\n puts \"I have adopted #{stray_cat} stray cat(s).\"\nend", "title": "" }, { "docid": "60e269b6be440b347908f6b647d3680d", "score": "0.6140164", "text": "def levitation_quiz\n loop do\n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\nend", "title": "" }, { "docid": "7d92459c9fa424abb736fd2c996371d0", "score": "0.613603", "text": "def magicEightball \n\tanswered = \n\t[\n\t\"Most def.\", \"No doubt\", \"Hell yes\", \n\t\"maybe...\", \"It's a possibility.\", \"It could happen.\",\n\t\"never eva eva!\", \"NO!\", \"Not in a thousand years.\"\n\t] \n\n\tputs \"Please ask me a question.\"\n\tquestion = gets.chomp\n\tputs \"So your question is #{question}\"\n\tputs answered[rand(8)]\nend", "title": "" }, { "docid": "3abc1883dd3681659f4a2d8ac963fff7", "score": "0.6135152", "text": "def fight\n return \"Punch to the chops!\"\n end", "title": "" }, { "docid": "fa12cc7f7900a5c514593fd8a2befb83", "score": "0.61319035", "text": "def printAskUserInstr(player,dealer,hand)\n puts dealer.printHands(true)\n puts player.printHands\n puts \"Player \" + player.getName + \", what would you like to do on Hand \" + hand.getName + \"?\"\n if hand.isFirstTurn and (player.getHands.length == 1)\n puts \"'dd'=doubledown 'split'=split 'surr'=surrender 'hit'=hit 'stay'=stay\"\n elsif hand.isFirstTurn and player.canSplit\n \tputs \"dd'=doubledown 'split'=split 'hit'=hit 'stay'=stay\"\n elsif hand.isFirstTurn\n puts \"dd'=doubledown 'hit'=hit 'stay'=stay\"\n else\n puts \"'hit'=hit 'stay'=stay\"\n end\nend", "title": "" }, { "docid": "860780952454699a9b2c1ede8517a80a", "score": "0.6131779", "text": "def win_?(one_two_ten) \n \n case one_two_ten\n when 0\n return \"\"\n\t\n delay(3)\n \n when 10\n 20.times{print \" \"};print \"Unsurprisingly, I've won this round.\\n\\n\"\n when 2\n 18.times{print \" \"};print \"A tie!? You won't be so lucky next time.\"\n when 1\n\tputs \"Hmm... you won this round. You seem a bit bored. Tired of me going easy on you?\\n\\n\"\n end\n \n end", "title": "" }, { "docid": "f1e863e325db8dc21cec0f3b02613152", "score": "0.6128699", "text": "def crash_landed(nap_drinks, airline_company)\n if airline_company.downcase == 'delta' and nap_drinks.downcase == 'drink'\n\n puts \" \n ////\\\\\\\\\n | |\n @ O O @\n | ~ | \\__\n \\ -- / |\\ |\n ___| |___ | \\|\n / \\ /|__|\n / \\ / /\n / /| . . |\\ \\ / /\n / / | | \\ \\/ /\n < < | | \\ /\n \\ \\ | . | \\_/\n \\ \\|______|\n \\_|______|\n | |\n | | |\n | | |\n |__|___|\n | | |\n ( ( |\n | | |\n | | |\n _| | |\n cccC_Cccc___)\n \n \"\n 'There was an emergency landing on a beautiful island. You get unlimited more drinks and you are Queen/King and Cher is your bestfriend'\n elsif airline_company.downcase == 'delta' and nap_drinks.downcase == 'nap'\n 'While you were napping, there was an emergency landing... A beatiful Queen/ King woke you up and now youre their Queen/King and unlimeted drinks!'\n elsif airline_company.downcase == 'spirit' and nap_drinks.downcase == 'drink'\n 'You spilled your drink while the plane was crashing so that $100 fee. And we need 30 business days, not including weekends or holidays, to rescue you from the island.'\n elsif airline_company.downcase == 'spirit' and nap_drinks.downcase == 'nap'\n 'you were napping while the plane was crashing, so you woke up dead on and island forever as a zombie!'\n else\n 'try again next year'\n end\n\nend", "title": "" }, { "docid": "e51e59eb5c2d1e7152bada1d703a9984", "score": "0.6121187", "text": "def meow\r\n\t\t# output: prints string of # of meows based on talkative-ness\r\n\t\t\t# IF mild (1 to 3) , meows once\r\n\t\t\tputs \"meowww\" if (1..3).include?(@meowiness)\r\n\t\t\t# IF medium (4 to 6), meows 3 times\r\n\t\t\t3.times { print \"meowww \"} if (4..6).include?(@meowiness)\r\n\t\t\t# IF high (7 to 8), meows 5 times,\r\n\t\t\t5.times { print \"meowwww \" } if (7..8).include?(@meowiness)\r\n\t\t\t# IF really high (9 to 10), meows 5 times, CAPS\r\n\t\t\t5.times { print \"meowwww \".upcase } if (9..10).include?(@meowiness)\r\n\t\tend", "title": "" }, { "docid": "b30bb3454ed0189025fe3632f82c1d28", "score": "0.61011183", "text": "def serve_dish\n puts \"You've added all ingredients in the correct way, well done!\"\n puts \"You can now enjoy your meal!\"\n puts \"Good bye!!\"\n sleep 2\n puts \"Do you want to try my other programme?\"\n puts \"Yes, no or restart\"\n answer = gets.chomp.downcase\n if answer.include? \"yes\"\n puts \"Welcome to Oracle\"\n question\n elsif answer.include? \"restart\"\n count = 0\n what_to_do(count)\n else\n exit\n end\nend", "title": "" }, { "docid": "4e68d0e6530ba5de8d652004836e3ebf", "score": "0.61009806", "text": "def levitation_quiz\n loop do \n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\n\t#your code here\nend", "title": "" }, { "docid": "19fe70258ffe3ebcb43ada910410c1d0", "score": "0.6091227", "text": "def meow\n puts \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}.\"\n end", "title": "" }, { "docid": "67403d03b8aed89d8ccc60246f0ffe06", "score": "0.60877764", "text": "def batten_hatches\n puts \"Batten the hatches\"\n end", "title": "" }, { "docid": "45d3df800b5642078a5ff15f02b41709", "score": "0.6085115", "text": "def help_players\n puts \"Greed is a dice game played among 2 or more players, using 5\"\n puts \"six-sided dice.\"\n pressToContinue\n end", "title": "" }, { "docid": "bd002ce0ac3b5e8b111dba061e08785f", "score": "0.607647", "text": "def complain\n # random number from 1 to 4\n (rand(4) + 1).times do\n excl = rand(3)\n rnd = [rand(5) - 1, 0].max\n if rnd == 0\n print \"GET ME OFF\"\n elsif rnd < 3\n print \"HOT\"\n else\n print \"OW\"\n end\n excl.times { print \"!\" }\n print \" \"\n end\n puts\n end", "title": "" }, { "docid": "0f828203f717e2be62a53873c3b5f9c6", "score": "0.60736", "text": "def breakfast(food = \"Granola\")\n puts \"Wake up with the best #{food} in the world!\"\nend", "title": "" }, { "docid": "385c963ce3773f5fa2ff24a522b206d6", "score": "0.60667247", "text": "def tell_fortune()\r\n print \"The answer is \" + $prediction + \". \\n\\n: \"\r\n end", "title": "" }, { "docid": "a4e4ab21d83bb6cab11d71afc77d1d69", "score": "0.60653895", "text": "def turnon()\n puts \"You put ingredients in the blender.\"\n puts \"Would you like to turn the blender on? If so type 'Yes'\"\n prompt = gets.chomp.downcase\n\n # Until loop prompts for correct \"Yes\"/\"yes\" answer or keeps asking\n until prompt == \"yes\"\n puts \"Sure you don't want to push 'Yes'?\"\n prompt = gets.chomp.to_s.downcase \n end\n # If until loop passed, run outcome method which then runs puts blend method\n outcome \n end", "title": "" }, { "docid": "8a0eb531e1cc331e3f897ae9bc01a4ee", "score": "0.6062874", "text": "def print_prompt_for_spoken_question\n puts \"-----------------------------------------------------------------\"\n puts \"Ask a YES/NO question aloud for the MAGIC 8-BALL and press enter \"\n puts \"\\n [[ SPEAK HERE ]] \\n\\n\"\n puts \"-----------------------------------------------------------------\"\nend", "title": "" }, { "docid": "2ae1fa20b08a414ecd82912d70a516ec", "score": "0.6061212", "text": "def what_to_do(count)\n puts \"What do you want to do?\"\n sleep 0.5\n puts \"Type help for available commands!\"\n answer = gets.chomp.downcase\n if answer.include? \"help\"\n help(count, answer)\n end\n if answer.include? \"scrape\" and count == 0\n scrape_potatoes(count)\n elsif answer.include? \"cut\" and count == 1\n cut_potatoes(count)\n elsif answer.include? \"add\" and count == 2 and answer.include? \"potatoes\"\n add_potatoes_to_pan(count)\n elsif answer.include? \"stir\" and count == 3\n stir(count)\n elsif answer.include? \"break\" and count == 4\n break_eggs(count)\n elsif answer.include? \"salt\" and count > 4\n add_salt(count)\n elsif answer.include? \"pepper\" and count > 4\n add_pepper(count)\n elsif answer.include? \"exit\"\n exit\n elsif answer.include? \"serve\" and count > 4\n serve_dish\n else\n puts \"Thats not the right order! Try again\"\n sleep 2\n try_again(count)\n end\nend", "title": "" }, { "docid": "ebf05eee70c8b190639e0c10ecc5c2ac", "score": "0.6061082", "text": "def deaf_aunty\n\n\tn = 0\n\t\n\twhile true\n\tputs \"What do you want to say to your aunty?\"\n\tsandra_speak = gets.chomp\n\n\tif sandra_speak == \"\"\n\tn +=1\n\tbreak if n ==2\n\telsif sandra_speak == \"I love ya, aunty, but I've got to go\"\n\texit\n\telsif sandra_speak == sandra_speak.downcase\t\n\tputs \"HUH?! SPEAK UP, SANDRA!\"\n\telse sandra_speak == sandra_speak.upcase\n\tputs \"NO, WE CAN'T DO THAT!\"\n\tend\n\tend\nend", "title": "" }, { "docid": "0398360ec2397691c67420c39b445242", "score": "0.6057582", "text": "def happy_birthday(birthday_kids)\n puts \"Happy Birthday Timmy! You are now 9 years old!\\nHappy Birthday Sarah! You are now 6 years old!\\nHappy Birthday Amanda! You are now 27 years old!\\n\"\nend", "title": "" }, { "docid": "2d64cfbed8365de891e7cded74afe8ff", "score": "0.60539836", "text": "def test_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(16)}\n\tend", "title": "" }, { "docid": "6419894e6dc03e0ab48e975137b05f89", "score": "0.60508645", "text": "def result(you, them, win_lose_or_draw)\n end", "title": "" }, { "docid": "49f8c9d0999906a2e42041e20d3288b8", "score": "0.60462075", "text": "def passage_of_time\n if @stuff_in_belly > 0\n # move food from belly to intestine\n @stuff_in_belly = @stuff_in_belly - 1\n @stuff_in_intestine = @stuff_in_intestine + 1\n else\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + ' is starving! In desperation, he ate YOU!'\n exit\n end\n \n if @stuff_in_intestine >= 10\n @stuff_in_intestine = 0\n puts 'Whoops! ' + @name + ' had an accident...'\n end\n \n if hungry?\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + '\\'s stomach grumbles...'\n end\n \n if poopy?\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + ' does the potty dance...'\n end\n end", "title": "" }, { "docid": "b4aaee9a15cf7b7076346c6dde41180d", "score": "0.60415405", "text": "def power\n puts \"Do you want to request the Gods assign #{@name} some special power?\"\n puts \"Warning!!! The Gods may spite you for asking for too much: Y or N?\"\n @power = gets.chomp\n if @power == \"Y\"\n @power = [\"a seer\", \"as dumb as a cow\", \"as strong as an ox\",\n \"as fragile as a bird\"].sample\n puts \"#{@name} shall be: #{@power}\"\n else\n puts \"While #{@name} shall have no special power #{@name} did not incur the\n wrath of the Gods and risk losing power\"\n end\n end", "title": "" }, { "docid": "8620396a7b86133271f13c2ba26709c7", "score": "0.6034751", "text": "def levitation_quiz\n\t#your code here\n\t\n\tloop do \n\t\tputs 'What is the spell that enacts levitation?'\n spell=gets.chomp\n\t\tbreak if spell=='Wingardium Leviosa'\n\tend\n\tputs 'You passed the quiz!'\nend", "title": "" }, { "docid": "cc312addb7a557171a4c5dbe3548857e", "score": "0.60345054", "text": "def wedding(husband, wife)\n puts \"#{husband} and #{wife} are getting married this summer!\"\nend", "title": "" }, { "docid": "b5049725e1c133619ca53aa7d4d48ff4", "score": "0.60344994", "text": "def test_sad_high_end\n\t\tp = Print.new\n\t\tassert_output(\"Going home sad.\\n\") {p.print_game_win_or_lose(9)}\n\tend", "title": "" }, { "docid": "1ceed20b31ff6a925a824d5f2e16e2ac", "score": "0.6028315", "text": "def greeting_random_drink(up_for_drink_input)\n if up_for_drink_input.to_s.downcase == \"y\"\n random_drink_value = random_drink\n puts \"\\nWhat a great choice! You are imbibing: #{random_drink_value}.\".colorize(:green)\n random_drink_value\n else\n puts \"\\nWe fail to believe that you are refusing to heal and confuse your soul. Please reconsider.\".colorize(:green)\n print \"\\nAre you up for a drink? [Y/n]: \"\n input = gets.chomp\n input.to_s.downcase\n greeting_random_drink(input)\n end\n end", "title": "" }, { "docid": "ac62bce8d97410d920263ab8cf5d986c", "score": "0.60235316", "text": "def are_you_up_for_drink(name)\n puts \"\\nIt is our utmost pleasere to host you here, #{name.capitalize}!\".colorize(:green)\n print \"\\nDare to tickle your sensory geisthavens? [Y/n]: \"\n input = gets.chomp\n input.to_s.downcase\n input\n end", "title": "" }, { "docid": "387f6a856b3469f4f9cf0be0b3625e04", "score": "0.60207796", "text": "def handle_typos_1(doors)\n\tputs \"Man you should make a proper decision or learn how to type!\".upcase\n\tputs \"Try again\"\n\tputs \"> \"\n\tdoor_choose(doors)\nend", "title": "" }, { "docid": "114d0e76744b417a2d7979004ca90eb3", "score": "0.60205144", "text": "def display_what_beats_what\n if human.choice == 'rock' && computer.choice == 'scissors' ||\n human.choice == 'scissors' && computer.choice == 'rock'\n puts 'Rock crushes scissors!'\n elsif human.choice == 'rock' && computer.choice == 'lizard' ||\n human.choice == 'lizard' && computer.choice == 'rock'\n puts 'Rock crushes lizard!'\n elsif human.choice == 'paper' && computer.choice == 'rock' ||\n human.choice == 'rock' && computer.choice == 'paper'\n puts 'Paper covers rock!'\n elsif human.choice == 'paper' && computer.choice == 'spock' ||\n human.choice == 'spock' && computer.choice == 'paper'\n puts 'Paper disproves Spock!'\n elsif human.choice == 'scissors' && computer.choice == 'paper' ||\n human.choice == 'paper' && computer.choice == 'scissors'\n puts 'Scissors cut paper!'\n elsif human.choice == 'scissors' && computer.choice == 'lizard' ||\n human.choice == 'sizard' && computer.choice == 'scissors'\n puts 'Scissors decapitates lizard!'\n elsif human.choice == 'lizard' && computer.choice == 'spock' ||\n human.choice == 'spock' && computer.choice == 'lizard'\n puts 'Lizard poisons Spock!'\n elsif human.choice == 'lizard' && computer.choice == 'paper' ||\n human.choice == 'paper' && computer.choice == 'lizard'\n puts 'Lizard eats paper!'\n elsif human.choice == 'spock' && computer.choice == 'rock' ||\n human.choice == 'rock' && computer.choice == 'spock'\n puts 'Spock vaporizes rock!'\n elsif human.choice == 'spock' && computer.choice == 'scissors' ||\n human.choice == 'scissors' && computer.choice == 'spock'\n puts 'Spock smashes scissors!'\n end\n end", "title": "" }, { "docid": "dfd09ead298904f84490f92c8b5c576c", "score": "0.60184807", "text": "def offer_rose(name)\n puts \"Would you take this rose, #{name}, in exchange for giving an old beggar woman shelter from the bitter cold?\"\nend", "title": "" }, { "docid": "a994478d565fd3e274f376261a2c3094", "score": "0.6014598", "text": "def hail_the_king\n\tputs \"hail king mark\"\nend", "title": "" }, { "docid": "a994478d565fd3e274f376261a2c3094", "score": "0.6014598", "text": "def hail_the_king\n\tputs \"hail king mark\"\nend", "title": "" }, { "docid": "5d948e74439ceff467c92d744bff6f05", "score": "0.60144967", "text": "def difficulty_intro\n print \"\\nWhat difficulty would you like to play? (e)asy, (m)edium, or (h)ard? \"\n end", "title": "" }, { "docid": "6ac4a2b0dd15e779c8f312cf62991346", "score": "0.6013828", "text": "def time_passed\n @food_in_belly -= 10\n @food_in_intestine += 10\n @hydration_level -= 10\n @liquid_in_bladder +=10\n\n if @hydration_level < 30\n puts \"#{@name} is thirsty!\"\n end\n\n if @liquid_in_bladder > 50\n if @awake != true\n @awake = true\n puts \"#{@name} suddenly awakes because she needs to pee!\"\n else\n puts \"#{@name} needs to go out to pee.\"\n end #end of conditonal if she wakes up to pee\n end\n\n if @food_in_belly < 30\n puts \"#{@name} is hungry!\"\n end #end of conditional to determine hunger\n\n if @food_in_belly <= 0\n if @awake != true\n @awake = true\n puts \"#{@name} suddenly awakes because she is hungry!\"\n else\n puts \"#{@name} was so hungry she ate you!\"\n exit #makes the program end\n end #end of conditional if she's so hungry she wakes up\n end #end of conditional if hunger drops to zero\n\n #what happens if drago is dehydrated to 0\n if @hydration_level <= 0\n if @awake != true\n @awake = true\n puts \"#{@name} suddenly awakes because she is thristy!\"\n else\n puts \"#{@name} was so thirsty she incinerates you!\"\n exit #makes the program end\n end\n end\n\n if @food_in_intestine > 80\n if @awake != true\n @awake = true\n puts \"#{@name} suddenly awakes because she needs to go out to poop!\"\n else\n puts \"#{@name} needs to go out to poop.\"\n end #end of conditonal if she wakes up to pee\n end#end of if statement for when she needs to go out\n\n if @awake != true\n puts \"#{@name}: zzzzzzzzzzz.....\"\n end #end of snooze comditional\n end", "title": "" }, { "docid": "08b4baab475eb1c7092d97a91c220e02", "score": "0.60112685", "text": "def bestplayer()\n puts (\"Do you think Yu is the best werewolves player in the world?\")\n while true\n input = gets().chomp\n if input == \"yes\"\n break\n end\n puts (\"The only acceptable answer is yes\")\n end\nend", "title": "" }, { "docid": "2bd5433627484c5660dc0e3d0d131aa9", "score": "0.60042953", "text": "def my_own_design(pants, style, reggies)\n puts \"\\nIt appears you #{pants} wearing pants. Good on you!\"\n puts \"They look like #{style}. Nice work. You carry it off.\"\n puts \"Oh, you #{reggies} wearing reggies. That's possibly too much \\\n information.\"\n puts \"You're going to stop traffic.\"\nend", "title": "" }, { "docid": "48015a0f5eafae792edc3afb3b4dc2d6", "score": "0.59994256", "text": "def who_starts?\n puts 'Do you want to make a first move (y/n)?'\n #puts(\"Who is going to make first move: 1-you, 2-computer?\") for test pass with puts()\n end", "title": "" }, { "docid": "5ed5cb94d5cfd10e9b00dd7488950560", "score": "0.59965265", "text": "def take_a_drink\n soda.drink_a_soda\n puts \"You drank your soda!\"\n end", "title": "" }, { "docid": "fb4930692c138be0cd52539ba8440654", "score": "0.59913", "text": "def get_fortune\r\n randomNo = 1 + rand(10)\r\n\r\n #Assign an answer based on the randomly generated number\r\n case randomNo\r\n when 1\r\n $prediction = \"It is certain\"\r\n when 2\r\n $prediction = \"Reply hazy, try again\"\r\n when 3\r\n $prediction = \"Don't count on it\"\r\n when 4\r\n $prediction = \"Without a doubt\"\r\n when 5\r\n $prediction = \"Concentrate and ask again\"\r\n when 6\r\n $prediction = \"My sources say no\"\r\n when 7\r\n $prediction = \"You may rely on it\"\r\n when 8\r\n $prediction = \"Ask again later\"\r\n when 9\r\n $prediction = \"Very doubtful\"\r\n when 10\r\n $prediction = \"Outlook is good\"\r\n end\r\n\r\n end", "title": "" }, { "docid": "cebd310f415b4544ec68fa67c1691ce4", "score": "0.5989029", "text": "def show_rush_result(day, number, total_ruby_found)\n puts \"After #{day} days, Rubyist #{number} found:\n #{total_ruby_found[0]} rubies.\n #{total_ruby_found[1]} fake rubies.\nGoing home #{mood?(total_ruby_found)}\"\n end", "title": "" }, { "docid": "bcd6d63d550b0cfbaae95cbdfdf12765", "score": "0.5982186", "text": "def announce_the_result\n if check_for_winner == \"Computer\"\n \"The Computer wins!\\n\"\n elsif check_for_winner == \"Player\"\n \"The Player wins!\\n\"\n elsif check_for_open_board == false\n \"It's a tie!\"\n end\n end", "title": "" }, { "docid": "8fae7b976e9e7fc70028fb2869b5c966", "score": "0.5981495", "text": "def eight_ball\n puts 'What is your question?'\n question = gets.strip\n # - Computer outputs random answer\n @array_answers = ['It is certain', 'It is decidedly so', 'Without a doubt', 'Yes, definitely', 'You may rely on it' 'As I see it, yes', 'Most likely', 'Outlook good', 'Yes', 'Signs point to yes' 'Reply hazy try again', 'Ask again later', 'Better not tell you now', 'Cannot predict now', 'Concentrate and ask again', \"Don't count on it\", 'My reply is no','My sources say no',\n 'Outlook not so good', 'Very doubtful']\n answer = @array_answers.sample(1)\n puts answer\n again_or_quit\nend", "title": "" }, { "docid": "a5151215c263a22927f4910e4c4d04c3", "score": "0.5971982", "text": "def test_dsl_6\n #--------------------------------------------\n show Rock + Paper + Scissors + Lizard + Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors cut Paper (winner Scissors)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Spock smashes Scissors (winner Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "155cc4741eb9112abe780960c90c1201", "score": "0.59650344", "text": "def good_boy\n puts \"Are you a good boy?! (Yes/No)\"\n input = gets.chomp\n if input == \"Yes\"\n puts \"Yes you are! Here's a treat!\"\n else\n puts \"That's right, you're a *great* boy!! Have a treat!!\"\n end\n end", "title": "" }, { "docid": "60dcb3d8e53e8fa8564c62cb1e2648cf", "score": "0.59648955", "text": "def meow\n puts \"My name is #{@name.capitalize} and I love eating #{@preferred_food} at #{eats_at}\"\n end", "title": "" }, { "docid": "e753619525068b872f5de168bdf72de5", "score": "0.5962115", "text": "def okay_to_drink age, drinking_age\n if is_of_age? age, drinking_age then\n puts \"Come on in\"\n else\n puts \"Im sorry \" + age + \" isn't old enough to drink. The minimum drinking age is \" + drinking_age\n end\nend", "title": "" }, { "docid": "ee1b7013c12f31f44d52751fddf3bd9e", "score": "0.5960345", "text": "def print_codebreaker_intro_easy\n puts 'Welcome to Mastermind! You are playing the role of the codebreaker.'\n puts 'The computer will choose a 4-color code that you will try to guess.'\n puts \"The valid letters/colors are #{'R'.red}, #{'O'.light_red}, #{'Y'.yellow}, #{'G'.green}, #{'B'.blue}, #{'I'.light_blue}, and #{'V'.magenta}.\"\n puts ''\n puts 'You will get feedback from the code master after each round in the locations corresponding to your guess.'\n puts 'A \"√\" means you have the right color in the right place.'\n puts 'An \"X\" means that the color is in the code but not in that place.'\n puts 'Finally, a \".\" means that color is not part of the code.'\n puts 'You have 6 rounds to guess correctly. Good luck!'\n puts ''\n end", "title": "" }, { "docid": "7f85bd802cea237544de1207b5d3f444", "score": "0.5958408", "text": "def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end", "title": "" }, { "docid": "9b09fa4ffbf33b07c88cbd25c2bfc828", "score": "0.5957794", "text": "def tell_fortunte()\n\t\tprint \"The answer is \" + $prediction + \". \\n\\n: \"\n\tend", "title": "" }, { "docid": "950eb7f554b8c202fb0d61604c8cc40f", "score": "0.595593", "text": "def whisper_family_secret\n puts \"shhh!\"\n end", "title": "" }, { "docid": "950eb7f554b8c202fb0d61604c8cc40f", "score": "0.595593", "text": "def whisper_family_secret\n puts \"shhh!\"\n end", "title": "" }, { "docid": "1b3b27b2694bd097c221ab33b425a3d4", "score": "0.59555036", "text": "def hate_steven?(name)\n if name == \"Steven\"\n \"OMG He's the worst\"\n else\n \"You cool\"\n end\n end", "title": "" }, { "docid": "da5a5e0795615e19d63828ee92c685c5", "score": "0.5945021", "text": "def print_codebreaker_intro_hard\n puts 'Welcome to Mastermind! You are playing the role of the codebreaker.'\n puts 'The computer will choose a 4-color code that you will try to guess.'\n puts \"The valid letters/colors are #{'R'.red}, #{'O'.light_red}, #{'Y'.yellow}, #{'G'.green}, #{'B'.blue}, #{'I'.light_blue}, and #{'V'.magenta}.\"\n puts 'You will get feedback from the code master after each round.'\n puts 'The location of the feedback is random and does not necessarily correspond to locations in your guess.'\n puts 'A \"√\" indicates that the right color in the right place somewhere.'\n puts 'An \"X\" indicates there is a color that is in the code but not in the right place.'\n puts 'Finally, a \".\" indicates a color is not part of the code.'\n puts 'You have 12 rounds to guess correctly. Good luck!'\n puts ''\n end", "title": "" }, { "docid": "8fea68f6624211aa5f3c8ec277c8579f", "score": "0.5943851", "text": "def student_talks\n return \"Could you explain that?\"\n end", "title": "" }, { "docid": "a2ea01a8b708d6db77b964e316c35cda", "score": "0.5943643", "text": "def start_greetings\n puts \"This is the castle of the Ice King. At the end of the corridor there are two doors\"\n puts \"Thau shall choose to go through one door, the Fire Door or the Snow Door\"\n puts \"Press 1 for Fire Door. Press 2 for Snow Door\"\nend", "title": "" }, { "docid": "3277c67609ad7aaef6bb7316780aa4e2", "score": "0.59410363", "text": "def fight()\n\tputs \"--------------------\"\n\tputs \"Let's fight, but first we go to the coffe shop.\"\n\tgo_to_coffee_shop()\n\tnumber_of_turns = 10 + rand(20)\n\tputs \"------------------\"\n\tputs \"TIME TO FIGHT! There are #{number_of_turns} rounds in this fight!\"\n\tnumber_of_turns.times do |x|\n\t\tputs \"------------------\"\n\t\tputs \"Round #{x+1}, FIGHT!\"\n\t\tcurrent_fighter = Person.person_array.sample\n\t\t\n\t\tif current_fighter.is_a?(PowerRanger)\n\t\t\trandom_roll = rand(10)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\t\tcurrent_fighter.punch() if random_roll >= 2 && random_roll <= 6\n\t\t\tcurrent_fighter.megazord() if random_roll >= 7 && random_roll <=9\n\t\telsif current_fighter.is_a?(EvilNinja)\n\t\t\trandom_roll = rand(10)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\t\tcurrent_fighter.punch() if random_roll >= 2 && random_roll <= 6\n\t\t\tcurrent_fighter.cause_mayhem() if random_roll >= 7 && random_roll <=9\n\t\telse\n\t\t\trandom_roll = rand(2)\n\t\t\tcurrent_fighter.run() if random_roll==0\n\t\t\tcurrent_fighter.scream() if random_roll==1\n\t\tend\n\tend\n\tputs \"-------------------\"\nend", "title": "" }, { "docid": "5fa5afc8ba1d35540efea5944a183fb0", "score": "0.5937195", "text": "def time_wasted\n user_input\n @yearly_playtime = ((@weekly_playtime * 4) * 12)\n puts \"Oh wow! So assuming you have sustained this average for the past year, you'd have played for somewhere around #{@yearly_playtime} hours!\"\n puts \"Are you interested in knowing what else you could have done with this time? (yes/no)\"\n print '> '\n interest = gets.chomp.downcase \n if interest == \"yes\"\n skills \n elsif interest == \"no\"\n puts \"Possibly a wise decision!\"\n puts \"Returning to main menu\"\n return\n else \n puts \"Error! Try again!\"\n end\n end", "title": "" }, { "docid": "333c94d5adedf336e86af92798b096c3", "score": "0.5936393", "text": "def print_winning_message(winning_choice)\n case\n when 'Rock'\n say('Rock smashes scissors!')\n when 'Paper'\n say('Paper covers rock!')\n when 'Scissors'\n say('Scissors cuts paper!')\n end\nend", "title": "" }, { "docid": "728bedd5de29b8e1e7c0c17c975fa006", "score": "0.5935848", "text": "def answer_prompt(answer)\n\tputs \"The answer to your problem is: #{answer}\"\nend", "title": "" }, { "docid": "d572da7de687de3ed1c6bcab938e3f8e", "score": "0.5935746", "text": "def whos_your_sidekick(sidekick)\n if sidekick == \"Robin\"\n say \"#{sidekick}: Holy rusted metal, Batman!\"\n elsif sidekick == \"Batgirl\"\n say \"#{sidekick}: Suit me up, Uncle Alfred.\"\n else\n say \"Fine, I'll pick one for you.\"\n sidekick = \"Robin\"\n end\n\n sidekick\nend", "title": "" }, { "docid": "5bede378f656e395cacdd1b6c7172ad6", "score": "0.593044", "text": "def frase\n option = 0\n loop do\n option = (rand * 5.5).to_i\n break if option > 0\n end\n case option\n when 1\n return \"Amazing! \"\n when 2\n return \"Good roll! \"\n when 3\n return \"Incredible! \"\n when 4\n return \"Good movement! \"\n when 5\n return \"Are you cheating? \"\n end\n end", "title": "" }, { "docid": "7599fd440cac14440b55bef2dabb3ff3", "score": "0.59274846", "text": "def how_many\r\n # single standalone puts for a line break to create a less cluttered terminal\r\n puts\r\n # Requesting user input for how many of that specific drink type that they would like\r\n puts \"How many of that drink would you like?:\"\r\n no_of_drinks = gets.chomp\r\n # Ensuring any silly users trying to get a bit wild a correctly dealt with\r\n if no_of_drinks == \"Inventory.length\" or no_of_drinks.to_i >= 15\r\n puts `clear`\r\n puts \"Security guard, he's had too much, gettem outta here!\"\r\n puts\r\n puts \"<boots you out of the door>\"\r\n puts\r\n exit\r\n # Data validation to ensure the user can't break the program using a negative number. If the user does not enter a positive number, they enter the\r\n # until block until \r\n elsif no_of_drinks.to_i < 0\r\n until no_of_drinks.to_i > 0 \r\n puts\r\n puts \"Please give me a real number\"\r\n puts\r\n puts \"How many of that drink would you like?:\"\r\n end\r\n end\r\n # Return a variable for the number of drinks request. Didn't end up needing this variable. Just called how_many.to_i, which I think would function\r\n # without this explicit return.\r\n return no_of_drinks\r\n end", "title": "" }, { "docid": "6d95cb3f9c57bc1b25b695883669489d", "score": "0.59262645", "text": "def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend", "title": "" }, { "docid": "7fbc2f47ac80106a9a49bdc7a15df85a", "score": "0.5925923", "text": "def intelligenceTest()\r\n puts \"Your intelligence is about to tested, let's see how you can do!\"\r\n if(@charPlaying.smarts == 5)\r\n puts\"Evaluate the expression: \"\r\n puts \"1^2 + 1^2 = \"\r\n @answer = gets()\r\n if (@answer.chomp == '2')\r\n @points += 1\r\n puts \"Good job smarty pants!\"\r\n else\r\n puts \"Really you don't know what 1 + 1 is!\"\r\n end\r\n elsif @charPlaying.smarts == 4\r\n puts\"Evaluate the expression: \"\r\n puts \"pi/0 = \"\r\n @answer = gets()\r\n if(@answer.chomp == '0')\r\n @points += 1\r\n puts \"Wow! You are smart!\"\r\n else\r\n puts \"You probably are not smarter than a 5th grader.\"\r\n end\r\n elsif @charPlaying.smarts == 3\r\n puts \"What is the square root of 4 * 16 = \"\r\n @answer = gets()\r\n if(@answer.chomp == '8')\r\n @points += 1\r\n puts \"Thats correct! One point for you!\"\r\n else\r\n puts \"Better luck next time!\"\r\n end\r\n elsif @charPlaying.smarts == 2\r\n puts \"How many minutes are in one year?\"\r\n @answer = gets()\r\n if(@answer.chomp == '525600')\r\n @points += 1\r\n puts \"That is a lot of minutes! 1 point for you #{@charPlaying.name}\"\r\n else\r\n puts \"I guess there's too many for you to count.\"\r\n end\r\n else\r\n puts \"What is the 50th digit of pi?\"\r\n @answer = gets()\r\n if(@answer.chomp == '1')\r\n @points += 1\r\n puts \"Thats correct and a point for you!\"\r\n else\r\n puts \"Well you only had a 1/10 chance to guess the right answer!\"\r\n end\r\n end\r\n end", "title": "" }, { "docid": "50bf951c41356f61a215b34bb2108a29", "score": "0.59243524", "text": "def print_instructions\r\n puts \"Welcome! Enter a letter to make a guess and if you're right, the correct letters will be revealed in the word. If you're wrong, your hangman will become more complete and you'll be one step closer to losing the game!\"\r\n puts \"Good luck!\"\r\n end", "title": "" } ]
8da8f0a645ced4ba47de19dc4fc7555e
Reduce a rectangle of pixels to a single pixel so we can find out the average black or whiteness of it. image:: ImageId of the image in question xpos, ypos, width, height:: Coords of the rectangle
[ { "docid": "138713944becaf5d95cbd861991fb130", "score": "0.60374177", "text": "def shrink_to_one image, xpos, ypos, width, height\n# if @intermediate_images\n# tmp_image = \"vo-#{xpos}-#{ypos}\".to_sym\n# copy_subimage image, xpos, ypos, width, height, tmp_image\n# d_write_image(tmp_image)\n# end\n img = get_image(image)\n checkbox_pixels = img.excerpt(xpos, ypos, width, height)\n shrink_to_one = checkbox_pixels.scale(1,1)\n return shrink_to_one.get_pixels(0,0,1,1)[0].red\n end", "title": "" } ]
[ { "docid": "2f9ff3093e82e968ea1b4610f87065ea", "score": "0.62054116", "text": "def optimized_image(image,x,y)\n return image.variant(resize_to_fill: [x,y]).processed\n end", "title": "" }, { "docid": "e07350cf3db989dd9d7b43ff7e9d476f", "score": "0.582906", "text": "def enhance_image(image)\n colors = image.get_pixels.flatten\n colors.map! { |color| color**2 / 255 }\n blob = colors.pack('C*') # Recreate the original image, credit to stackoverflow.com/questions/53764046\n image = MiniMagick::Image.import_pixels(blob, image.width, image.height, 8, 'rgb')\n image.statistic('mean', '6x6')\n image.threshold(threshold_percent)\n image.statistic('median', '9x9') # Replace with object discard below set size\n end", "title": "" }, { "docid": "e7f0cc8ddaf7b3fcfaddf3656e7d7e33", "score": "0.5748864", "text": "def blur_image(distance)\r\n @length = @image.length\r\n @width = 0\r\n @image.each do |x|\r\n x.each do |cell|\r\n @width += 1\r\n end\r\n end\r\n i = 0\r\n j = 0\r\n n = distance\r\n while n > 0\r\n i = 0\r\n j = 0 \r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 1\r\n\r\n # This looks down from the rows\r\n if i < @length - 1\r\n if @image[i+1][j] == 0\r\n @image[i+1][j] = 2\r\n end\r\n end\r\n\r\n # This looks up from the rows\r\n if i > 0 && @image[i-1][j] == 0\r\n @image[i-1][j] = 2 \r\n end\r\n\r\n # This looks to the right until it gets to the end.\r\n if @image[i][j+1] == 0\r\n @image[i][j+1] = 2\r\n end\r\n\r\n # This looks to te left. I tried to set this so it will never look over the side of the array.\r\n # I'm afraid of what might happen if my program does that too muc.\r\n if j > 0 && @image[i][j - 1] == 0\r\n @image[i][j - 1] = 2\r\n end\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n # This code goes back through the array and turns the temporary shade values into 1s for output.\r\n i = 0\r\n j = 0\r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 2\r\n @image[i][j] = 1\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n n -= 1\r\n puts n\r\n end\r\n \r\n puts \"Inside blur_image\\n\"\r\n puts \"\\n\"\r\n end", "title": "" }, { "docid": "71336aa0583618a04719b13eea831749", "score": "0.56162405", "text": "def detect_bandaid(image:, area: 2000)\n objects = detect_image(image: image)\n objects.each_with_index do |object, i|\n remove(i) if object.width * object.height > area\n end\n end", "title": "" }, { "docid": "fb28cf1cb2c9d9995c9926637430d4f0", "score": "0.5605113", "text": "def with_crop(left, top, right, bottom); end", "title": "" }, { "docid": "bd6b5fcbdfabffe41edd9e8e87fa670d", "score": "0.5582868", "text": "def validate_rect image, width, height, x1, x2, y1, y2\n begin\n assert x1 >= 0\n assert x2 >= 0\n assert x1 <= image.width\n assert x2 <= image.width\n assert x1 <= x2\n assert y1 >= 0\n assert y2 >= 0\n assert y1 <= image.height\n assert y2 <= image.height\n assert y1 <= y2\n rescue => e\n raise ManagedImage::InvalidCropError, \"Crop coordinates #{x1}, #{x2}, #{y1}, #{y2} is invalid for image with size #{image.width}x#{image.height}\"\n end\n end", "title": "" }, { "docid": "7cb1d03952772c4361c9fd4b789239a6", "score": "0.55492276", "text": "def magick_crop_rect\n [x1, y1, x2-x1, y2-y1]\n end", "title": "" }, { "docid": "7d357da493601d3e8c595c644bd990b7", "score": "0.5547402", "text": "def extract_image(coords)\n i = @image.crop(*coords, true)\n end", "title": "" }, { "docid": "e1a103bcc3c0ee517c08866eaf8838a6", "score": "0.55399203", "text": "def execute_crop(image, crop, x, y, width, height)\n require 'RMagick'\n # load in the original image\n old_image = Magick::Image::read(self.send(image).path).first\n # crop it at the desired position\n new_image = old_image.crop(x.to_i, y.to_i, width.to_i, height.to_i, true)\n # scale the image to the correct size if needed\n desired_width, desired_height = Image.detailed_dimensions(self.class, image, crop)\n if desired_width\n clean_desired_width = desired_width.gsub(/\\D/, '').to_f\n if desired_width.include?('>')\n new_image.scale!(clean_desired_width/width.to_f) if (width > clean_desired_width)\n elsif desired_width.include?('^')\n new_image.scale!(clean_desired_width/width.to_f) if (width < clean_desired_width)\n else\n new_image.scale!(clean_desired_width/width.to_f)\n end\n elsif desired_height\n clean_desired_height = desired_height.gsub(/\\D/, '').to_f\n if desired_height.include?('>')\n new_image.scale!(clean_desired_height/height.to_f) if (height > clean_desired_height)\n elsif desired_height.include?('^')\n new_image.scale!(clean_desired_height/height.to_f) if (height < clean_desired_height)\n else\n new_image.scale!(clean_desired_height/height.to_f)\n end\n end\n \n # need to make sure the image is the size it wanted to be in the first place as a pixel or 2 can b lost in the maths from the views\n # only do this if the requested dims allow it.\n if desired_width.to_i != 0 && desired_height.to_i != 0\n new_image.scale!(desired_width.to_i, desired_height.to_i)\n end\n \n FileUtils.mkdir_p(File.dirname(self.send(image).path(crop).to_s))\n new_image.write(self.send(image).path(crop).to_s)\n end", "title": "" }, { "docid": "f5ae7fc273a9c1028cc5e774ddec8792", "score": "0.55304754", "text": "def crop!(image, width, height, x_offset = 0, y_offset = 0, gravity: \"NorthWest\")\n with_minimagick(image) do |img|\n img.combine_options do |cmd|\n yield cmd if block_given?\n cmd.gravity gravity\n cmd.crop \"#{width}x#{height}+#{x_offset}+#{y_offset}\"\n end\n end\n end", "title": "" }, { "docid": "2eab36e8b6e4948d62f51d604fb22c9b", "score": "0.5492848", "text": "def crop image, x0 = 0, y0 = 0, w = 100, h = 100, scale = 1\n x0 = (x0.to_f * scale).to_i\n y0 = (y0.to_f * scale).to_i\n\n w = (w.to_f * scale).to_i\n h = (h.to_f * scale).to_i\n\n image.crop \"#{ w }x#{ h }+#{ x0 }+#{ y0 }\"\n image\n end", "title": "" }, { "docid": "0a55a665fd68bd3966a153833b51ce6f", "score": "0.5458914", "text": "def rect\n Image.run_cmplx(self) { |x| x.complex :rect }\n end", "title": "" }, { "docid": "384b0e19e88563c1f61450c3f94d53ee", "score": "0.5433656", "text": "def cut\n rmagick_img.crop_resized!(@x, @y, gravity)\n end", "title": "" }, { "docid": "c2a2bc2614f8581253bf50cd64dcfbe2", "score": "0.54330295", "text": "def draw_image(image, x1, y1, c)\n end", "title": "" }, { "docid": "7ea8aaac4278b81d55b88c6de571154f", "score": "0.54265594", "text": "def scan(img)\n num_images = 0\n img_height,img_width = img.length,img.width\n coords = coordinates(img.data)\n\n for x in 0..(@size - img_width-1) do\n for y in 0..(@size - img_height-1) do\n match = coords.map do |x1,y1|\n break [false] if @data[x+x1][y+y1] != @char\n true\n end\n num_images+=1 if match.all?\n end\n end\n num_images\n end", "title": "" }, { "docid": "06c0faba7f2e5c1991a0081f9795d17b", "score": "0.5361145", "text": "def blur_image\r\n\r\n#define new image array with identical length to old array\r\n image1 = Array.new(@image.length){\r\n Array.new(@image[0].length){}}\r\n\r\n#start indexing through each cell and define values for rows and columns\r\n @image.each_with_index { |val, rowindex|\r\n val.each_with_index {|val1, colindex| \r\n\r\n#hardcoding 'nil' index values into zeroes \r\n if image1 [rowindex][colindex] != 1 \r\n then image1 [rowindex][colindex] = 0 \r\n end\r\n\r\n#if currently indexed cell has a value of 1 in original array, cell value in new array will be 1\r\n if val1 > 0 \r\n then image1 [rowindex][colindex] = 1\r\n\r\n#define value of cell directly below currently indexed cell as 1, unless it is the last cell in a column.\r\n if colindex != val.length-1\r\n then image1 [rowindex][colindex +1] = 1\r\n end\r\n\r\n#if the currently indexed cell is 1, then define value of cell directly above it as 1.\r\n if colindex != 0 then\r\n image1 [rowindex][colindex -1] = 1\r\n end\r\n\r\n#define value of the cell to the RIGHT of the currently indexed cell as 1, unless it is the last cell in a row.\r\n if rowindex != @image.length-1 then\r\n image1 [rowindex +1][colindex] = 1\r\n end\r\n\r\n#if the currently indexed cell is 1, then define the value of the cell to the LEFT of it as 1.\r\n if rowindex != 0 then\r\n image1 [rowindex -1][colindex] = 1\r\n end\r\n\r\n end\r\n\r\n }} \r\n\r\n#show blurred image array\r\n image1.each do |cell|\r\n puts cell.join\r\n end\r\n end", "title": "" }, { "docid": "9103155c13505dd3a68ba62fbf1d87e4", "score": "0.53452104", "text": "def blur!\r\n ones = get_ones\r\n ones.each do |found_row_number, found_col_number| \r\n @picture[found_row_number -1][found_col_number] = 1 unless found_row_number == 0 #up\r\n @picture[found_row_number +1][found_col_number] = 1 unless found_row_number == @picture.length-1 #down\r\n @picture[found_row_number][found_col_number -1] = 1 unless found_col_number == 0 #left\r\n @picture[found_row_number][found_col_number +1] = 1 unless found_col_number == @picture[found_row_number].length-1 #right\r\n end\r\n end", "title": "" }, { "docid": "5e41124cfc585404579c58d29d63163e", "score": "0.5334728", "text": "def change_bitmap_color(rect, x, y)\n xx = x + rect.x\n xy = y + rect.y\n xw = xx + rect.width\n xh = xy + rect.height\n (xx..xw).each { |i|\n (xy..xh).each { |j|\n change_pixel_color(i, j)\n }\n }\n end", "title": "" }, { "docid": "4d19a382a17edd86411d003e0c66302a", "score": "0.5333914", "text": "def draw\n @image.draw(@x - @width / 2, @y - @height / 2, 1)\n end", "title": "" }, { "docid": "e9e66eeb04b1853b2f45d0879770532c", "score": "0.532486", "text": "def computeProjection\n w,h = @type==:vertical ? [@image.width, @image.height] : [@image.height, @image.width]\n mw,mh = @type==:vertical ? [@image.width, @image.height-@image.borders.bottom] : [@image.height, @image.width-@image.borders.right]\n content_mask = Array.new(w){[false, 0]}\n\n w.times do |a|\n obj_height = 0\n gap = 0\n (h-mh).times do |b|\n x,y = @type==:vertical ? [a,b] : [b,a]\n idx = @image.index(x, y)\n #p [idx, w, h, mh, a, b, x, y, @image.width, @image.height]\n if @data[idx] <= @threshold\n obj_height += 1\n obj_height += gap if gap <= @image.min_obj_size\n gap = 0\n else\n gap += 1\n content_mask[a] = [true, b] if obj_height > @image.min_obj_size\n obj_height = 0\n end\n end\n end\n\n content_mask\n end", "title": "" }, { "docid": "826447b7a2af81d5b35b2beb91dd994c", "score": "0.5323036", "text": "def pixels; end", "title": "" }, { "docid": "f726ff3c487ff067ba9d3bd091ef8801", "score": "0.5317887", "text": "def fill\n fit\n rounding_error\n border_x = (@x - rmagick_img.columns)/2\n border_y = (@y - rmagick_img.rows)/2\n\n rmagick_img.border!(border_x,border_y,\"white\")\n end", "title": "" }, { "docid": "a9495feddf269415aafd382587acb71a", "score": "0.53018457", "text": "def extract_image(coords)\n @image.crop(*coords, true)\n end", "title": "" }, { "docid": "9518ec968a53d19c75df7edb554e6c8d", "score": "0.530059", "text": "def calulatePercentArea(image,min,max)\n height = image.size.height\n width = image.size.width\n shorter_side = width < height ? width : height\n max_side=shorter_side*max\n min_side= shorter_side * min\n return {\n min: min_side**2,\n max: max_side**2\n }\n end", "title": "" }, { "docid": "f8c87531c9e7c827d048870751a10e55", "score": "0.528385", "text": "def pad_image(image)\n\t\tdim = calc_side_length(image)\n\t\n\t\timage.background_color = @bg_color\n\t\t\n\t\tputs \"padding image\"\n\t\timage.extent(dim, dim)\n\tend", "title": "" }, { "docid": "77dbc955e7315e8055c38b656b17c535", "score": "0.52777195", "text": "def setup\n size 200, 200 \n no_stroke\n background 0 \n c = load_image \"cait.jpg\" \n xoff, yoff = 0, 0\n p = 2\n pix = p * 3 \n (c.width * c.height).times do |i| \n pixel = c.pixels[i] \n fill red( pixel ), 0, 0\n rect xoff, yoff, p, pix \n fill 0, green( pixel ), 0\n rect xoff+p, yoff, p, pix \n fill 0, 0, blue( pixel )\n rect xoff+p*2, yoff, p, pix \n xoff += pix\n if xoff >= (width-pix)\n xoff = 0\n yoff += pix\n end\n end \nend", "title": "" }, { "docid": "da7123cc0a4201679e3a90184a514578", "score": "0.52741766", "text": "def locator2(image)\n result = []\n how_wide = image.first.length\n how_long = image.length\n\n image.each_with_index do |e, i|\n e.each_with_index do |e2, i2|\n next unless e2.zero? && no_overlaps?(result, i, i2)\n answer = {\n corner: [i, i2],\n height: 1,\n width: 1\n }\n result << answer\n\n lookahead = i2 + 1\n until lookahead >= how_wide || e[lookahead] == 1\n answer[:width] += 1\n lookahead += 1\n end\n\n lookdown = i + 1\n until lookdown >= how_long || image[lookdown][i2] == 1\n answer[:height] += 1\n lookdown += 1\n end\n end\n end\n p result\n result\nend", "title": "" }, { "docid": "e2a9f57b85f30b626b560942dac140ba", "score": "0.527106", "text": "def draw \n\t\t@image.draw(@x, @y, 1)\n\tend", "title": "" }, { "docid": "1fe403d9adf686fd1d95bf898e1f8dfd", "score": "0.52700245", "text": "def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2, dimensions[1] / 2]\n edits[:rgb_array] = sharp_pixels\n ImageManip::draw_2D_object(@image_path, './new_staff.gif', edits)\n edits[:lower_left] = [dimensions[0] / 3, dimensions[1] / 3]\n edits[:rgb_array] = flat_pixels\n ImageManip::draw_2D_object('./new_staff.gif', './new_staff.gif', edits)\n end", "title": "" }, { "docid": "715b371c16a7c1d14f5d5e679d186c28", "score": "0.5238064", "text": "def find_lonely_pixel(picture)\n height = picture.length\n width = picture[0].length\n lonely_counter = 0\n row = {}\n column = {}\n i = 0\n j = 0\n \n while i < height\n while j < width\n if picture[i][j] == \"B\"\n column[i] ? column[i] += 1 : column[i] = 1\n row[j] ? row[j] += 1 : row[j] = 1\n end\n j += 1\n end\n j = 0\n i += 1\n end\n \n i = 0\n j = 0\n\n while i < height\n while j < width\n lonely_counter += 1 if picture[i][j] == \"B\" && row[j] == 1 && column[i] == 1\n j += 1\n end\n j = 0\n i += 1\n end\n \n lonely_counter\nend", "title": "" }, { "docid": "8e4ec3cca6618ddb39ac668734c21934", "score": "0.52379966", "text": "def redify(file, range, off)\n \n Magick::Image.read(file)[0].each_pixel do |pixel|\n pixel.each do |r,g,b|\n ary.bsearch {|x| block } → elem # find matching X in array, apply block...\n \n end\n end \nend", "title": "" }, { "docid": "7d1256f0e58d12dc5f680f6d6dae1e25", "score": "0.5221729", "text": "def crop(image)\n if image.columns != LETTERPRESS_EXPECTED_WIDTH || image.rows != LETTERPRESS_EXPECTED_HEIGHT\n image = image.resize(LETTERPRESS_EXPECTED_WIDTH, LETTERPRESS_EXPECTED_HEIGHT)\n end\n\n image = quantize_image(image)\n\n y_offset = LETTERPRESS_HEIGHT_OFFSET\n\n rows = [ ]\n\n border = 1\n\n 0.upto(LETTERPRESS_TILES_DOWN - 1) do\n x_offset = 0\n row = [ ]\n\n 0.upto(LETTERPRESS_TILES_ACROSS - 1) do\n\n tile = image.crop(x_offset - border, y_offset + border, LETTERPRESS_TILE_PIXELS - border, LETTERPRESS_TILE_PIXELS - border, true)\n box = tile.bounding_box\n min_bound_width = 0.75 * @config.char_width\n if box.width > min_bound_width\n tile = tile.crop(box.x - border, box.y - border, box.width + 2 * border, box.height + 2 * border, true)\n end\n\n tile.resize!(@config.char_width, @config.char_height)\n row << tile\n x_offset += LETTERPRESS_TILE_PIXELS\n\n end\n rows << row\n\n y_offset += LETTERPRESS_TILE_PIXELS\n end\n\n rows\n end", "title": "" }, { "docid": "4cb570d1ee8a725a874da62a23c50ca0", "score": "0.52139145", "text": "def image_pixels(image_path)\n image = Magick::Image.from_blob(File.read(image_path)).first\n sx, sy = image.columns, image.rows\n \n grid = Array.new(sy) { Array.new }\n x, y = 0, 0\n image.each_pixel do |pixel|\n grid[y].concat [pixel.red, pixel.green, pixel.blue].map { |channel|\n ((255 * channel) / Magick::QuantumRange).to_i\n }\n x += 1\n if x == sx\n x = 0\n y += 1\n end\n end\n grid\nend", "title": "" }, { "docid": "3a94f2da47a3df3952d646601728053d", "score": "0.5202582", "text": "def draw\n @image.draw(@x, @y, 1)\n end", "title": "" }, { "docid": "1a176743a242ff562dc068ae7b970be3", "score": "0.51806396", "text": "def project_image image, leftup\n img = get_image(image)\n if leftup == :left\n img.change_geometry('1!') { |cols, rows, geo_image| geo_image.scale!(cols, rows) }\n elsif leftup == :up\n width = img.columns\n img.change_geometry(\"#{width}x1!\") { |cols, rows, geo_image| geo_image.scale!(cols, rows) }\n elsif\n raise \"project_image: invalid leftup parameter\"\n end\n end", "title": "" }, { "docid": "71a92b85b5f17dc5e14ecfa9617ccd50", "score": "0.5170046", "text": "def bounding_box\n Rectangle[position, Point[@image.width, @image.height]]\n end", "title": "" }, { "docid": "3947c57c2f0369aefc86bebdd2c2ed6b", "score": "0.515669", "text": "def crop!(left: 0, top: 0, width: nil, height: nil)\n manipulate! do |image|\n begin\n do_crop image, left, top, width, height\n rescue VIPS::Error => e\n e.message =~ /extract_area/ ? image : raise(e)\n end\n end\n end", "title": "" }, { "docid": "fe05f3f7b9dfe04798dfd4e83a3bd4b6", "score": "0.5143265", "text": "def square_image_crop\n if (self.crops)\n if !(self.crop_x.nil? || self.crop_y.nil? || self.crop_w.nil? || self.crop_h.nil?)\n @image = MiniMagick::Image.open(self.photo.url)\n # if image is larger than our max screen size, the cropped image will be incorrect (resizing)\n @image.sample(((700/@image[:width].to_f) * 100).to_s + \"%\") if @image[:width] > 700\n @image.crop(\"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\")\n @image.set(\"page\", \"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\") \n self.square_image = @image\n end\n end\n end", "title": "" }, { "docid": "401f15c0080e35ec1a55976b4ababe66", "score": "0.51297307", "text": "def cleanup image\n m_begin \"cleanup\"\n img = get_image(image)\n img = img.gaussian_blur(8)\n img = img.threshold((QuantumRange * 0.999).to_int)\n img = img.gaussian_blur(14)\n img = img.threshold(0)\n m_end \"cleanup\"\n set_variable(image, img)\n end", "title": "" }, { "docid": "879ee05ce0c93090097b683da168854a", "score": "0.51296854", "text": "def area\n image_new(face_width, face_height)\n end", "title": "" }, { "docid": "0e5841fa912de362e895951942e3a306", "score": "0.5124682", "text": "def draw\n\t\t@image.draw(@x, @y, 1)\n\tend", "title": "" }, { "docid": "4ea4a81118e62bf099bc894e332cd79f", "score": "0.5103218", "text": "def edit_crop_rectangle(left, top, width, height, image_file, opts = {})\n data, _status_code, _headers = edit_crop_rectangle_with_http_info(left, top, width, height, image_file, opts)\n data\n end", "title": "" }, { "docid": "bf234b3f3cfa0ddb9398105b0d0f18bb", "score": "0.5097304", "text": "def pixel(x, y)\n validate_coordinates!(x, y)\n\n area.pixel(x, y).color\n end", "title": "" }, { "docid": "1907aceb8d7000f00a448d0a1a76187f", "score": "0.5087819", "text": "def execute(image:, x:, y:, colour:)\n unless image\n Log.instance.error 'There is no image present'\n return\n end\n\n image.colour(x, y, colour)\n image\n end", "title": "" }, { "docid": "a25ab422ae6b29d297ccd6af03d0743f", "score": "0.5084886", "text": "def draw\r\n @image.bmp.draw(@x - @radius, @y- @radius, 1)\r\n end", "title": "" }, { "docid": "5f1a985bb0fd12ab8d2b65e48b62e414", "score": "0.5084591", "text": "def rectangle(x1, y1, x2, y2)\n return nil if x1 > x2 || y1 > y2 || x1 < 0 || y1 < 0 || x2 > @width || y2 > @height\n pixels = []\n\n @height.times do |x|\n row = Array.new(@width, 0)\n @width.times do |y|\n row[y] = y >= y1 && y <= y2 && x >= x1 && x <= x2 ? 1 : 0 \n end\n pixels << row\n end\n \n PNM.create(pixels, {:type => :pbm})\n end", "title": "" }, { "docid": "eefe6ddb588cf27439c413ae9a69ec90", "score": "0.508089", "text": "def blur(distance)\n row_max = @image[0].length() - 1\n column_max = @image.length() - 1\n\n ones = self.get_ones\n\n while distance > 0\n ones.each do |one|\n vert = one[1]\n horiz = one[0]\n \n # down \n @image[vert + distance][horiz] = 1 unless vert + distance > column_max\n\n # up\n @image[vert - distance][horiz] = 1 unless vert - distance < 0\n\n # right\n @image[vert][horiz + distance] = 1 unless horiz + distance > row_max\n\n # left\n @image[vert][horiz - distance] = 1 unless horiz - distance < 0\n\n sub_distance = distance\n diag = 1\n while sub_distance > 1\n\n # bottom sides\n unless vert + sub_distance - 1 > column_max || horiz - diag < 0 || horiz + diag > row_max\n @image[vert + sub_distance - 1][horiz - diag] = 1\n @image[vert + sub_distance - 1][horiz + diag] = 1 \n end\n\n # top\n unless vert - sub_distance + 1 < 0 || horiz - diag < 0 || horiz + diag > row_max\n @image[vert - sub_distance + 1][horiz - diag] = 1\n @image[vert - sub_distance + 1][horiz + diag] = 1\n end\n\n # right sides\n unless vert - diag < 0 || vert + diag > column_max || horiz + sub_distance - 1 > column_max\n @image[vert - 1][horiz + sub_distance - diag] = 1\n @image[vert + 1][horiz + sub_distance - diag] = 1\n end\n\n # left sides\n unless vert - diag < 0 || vert + diag > column_max || horiz + sub_distance - 1 < 0\n @image[vert - 1][horiz - sub_distance + diag] = 1\n @image[vert + 1][horiz - sub_distance + diag] = 1\n end\n\n sub_distance -= 1\n diag += 1\n\n end\n end\n\n distance -= 1\n end\n\n end", "title": "" }, { "docid": "4a45a06e8bff22aac9ae16c4be5aaabc", "score": "0.5064335", "text": "def resize_to_fill(new_width, new_height)\n manipulate! do |image|\n\n image = resize_image image, new_width, new_height, :max\n\n if image.x_size > new_width\n top = 0\n left = (image.x_size - new_width) / 2\n elsif image.y_size > new_height\n left = 0\n top = (image.y_size - new_height) / 2\n else\n left = 0\n top = 0\n end\n\n image.extract_area(left, top, new_width, new_height)\n\n end\n end", "title": "" }, { "docid": "0460a5c7ac0a51594d91b7bce029ecb4", "score": "0.506416", "text": "def detect_marks inimage, x, y, width, height, direction, threshold, rowcol, minsize, outimage, segments, comment \n copy_subimage inimage, x, y, width, height, outimage\n d_write_image outimage, comment+\"_subimage\"\n project_image outimage, direction\n d_write_image outimage, comment+\"_projected\"\n threshold outimage, threshold\n d_write_image outimage, comment+\"_thresholded\"\n find_black_segments rowcol, outimage, segments, minsize\n end", "title": "" }, { "docid": "d364c5c68d24028396e49d786352bb77", "score": "0.505068", "text": "def scan\n\t\t\t(1..MAX_Y_AXIS).each do |y|\n\t\t\t\treset_values\n\t\t\t\t(1..MAX_X_AXIS).each do |x|\n\n\t\t\t\t\timg_pixel_color = @image.pixel_color(x, y)\n\t\t\t\t\t\n\t\t\t\t\tif img_pixel_color.red <= COLOR_THRESHOLD\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t@left_eye_width = @left_eye_width + 1 if @glabella_width < 1\n\t\t\t\t\t\twrite_to_image(x, y, 'purple')\n\n\t\t\t\t\t\tif @left_eye_width >= MIN_EYE_WIDTH and @left_eye_width < MAX_EYE_WIDTH and @glabella_width > @left_eye_width and @glabella_width < (@left_eye_width * 2) and @left_eye_width >= MIN_EYE_WIDTH\n\t\t\t\t\t\t\treturn true if check_glabella(x, y)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@glabella_width = 0\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# we've encountered a white pixel but cannot assume that it is a glabella\n\t\t\t\t\t\t# so we do a count of white pixels across before it encounters another black pixel\n\t\t\t\t\t\t@glabella_start_x_position = x if @glabella_width == 0\n\t\t\t\t\t\t@glabella_start_y_position = y if @glabella_width == 0\n\t\t\t\t\t\t@glabella_width = @glabella_width + 1\n\t\t\t\t\t\twrite_to_image(x, y, '#eee')\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn false\n\t\tend", "title": "" }, { "docid": "10ce5f5464c28c88367bf408d5bccf66", "score": "0.5049309", "text": "def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end", "title": "" }, { "docid": "505eefe085ac5bcab7576c9f6ff39a3c", "score": "0.5031513", "text": "def blur(image, r, c, distance)\n\n # Set the column length and row length\n image_height = image.length\n image_width = image[0].length\n\n # start looking at the rows at index[0]\n start_row = r - distance # number \n if start_row < 0\n start_row = 0\n end\n\n # start column all the way to the left\n start_col = c - distance\n if start_col < 0\n start_col\n end\n\n end_row = r + distance\n if end_row > image_height - 1\n end_row = image_height - 1\n end\n\n end_col = c + distance\n if end_col > image_width - 1\n end_col = image_width - 1\n end\n\n for i in (start_row..end_row)\n for j in (start_col..end_col)\n if within_manhatten_distance?(i, j, r, c, distance)\n image[i][j] = 2\n end\n end\n end\nend", "title": "" }, { "docid": "eed44bf2c8ede98a991273ede2f0df0f", "score": "0.5021771", "text": "def blurred\r\n unos = []\r\n # nested loops for rows and columns\r\n @paint.each_with_index do |row, rownum| # iterating over elements in the main array for rows \r\n row.each_with_index do |element, colnum| # iterating over elements in each subarray for columns\r\n if element == 1\r\n unos << [rownum, colnum]\r\n end\r\n end\r\n end\r\n\r\n unos.each do |rownum, colnum| \r\n # assigning \"1\" above \"1\"s, except for first row\r\n @paint[rownum -1][colnum] = 1 unless rownum == 0\r\n # assigning \"1\" below \"1\"s, except for last row\r\n @paint[rownum +1][colnum] = 1 unless rownum >= @paint.length-1\r\n # assigning \"1\" to the left of \"1\"s, except for first column\r\n @paint[rownum][colnum -1] = 1 unless colnum == 0\r\n # assigning \"1\" to the right of \"1\"s, except for last column\r\n @paint[rownum][colnum +1] = 1 unless colnum >= @paint[rownum].length-1\r\n end\r\n end", "title": "" }, { "docid": "423e2ffcf614fca2c0a3b58876ede4eb", "score": "0.5011051", "text": "def rango?(x, y)\r\n izq = @x - (@image.width / 2) + 5\r\n der = @x + (@image.width / 2) - 5\r\n arriba = @y - (@image.height / 2) + 5\r\n abajo = @y + (@image.height / 2) - 5\r\n\r\n return x > izq && x < der && y > arriba && y < abajo\r\n end", "title": "" }, { "docid": "96824dc11c0610bf67e1447309330244", "score": "0.5009449", "text": "def apply(image)\n image.view(0,0,image.columns,image.rows) do |view|\n eyes.each { |eye| do_redeye(eye,view) }\n end\n end", "title": "" }, { "docid": "c39ca1a9be05150ac3080cf3c355a60c", "score": "0.500666", "text": "def pixel_size; size.x * size.y; end", "title": "" }, { "docid": "91851579f6398e3ae0fef1a6beeee389", "score": "0.5003036", "text": "def trim!(border = pixels.first)\n x1 = [*0...width].index { |c| column(c).uniq != [border] }\n x2 = [*0...width].rindex { |c| column(c).uniq != [border] }\n y1 = [*0...height].index { |r| row(r).uniq != [border] }\n y2 = [*0...height].rindex { |r| row(r).uniq != [border] }\n\n crop! x1, y1, x2 - x1 + 1, y2 - y1 + 1\n end", "title": "" }, { "docid": "2aaffa8b120d4b8e502264c4524c456b", "score": "0.500112", "text": "def draw_image_stretch(image, x1, y1, x2, y2, x3, y3, x4, y4, color)\n end", "title": "" }, { "docid": "8c0a1e83a8cb319ff0e9a851d5754621", "score": "0.49912062", "text": "def _minimap_autotile\n b = Bitmap.new(24, 32)\n c1 = Color.new(191, 191, 191)\n c2 = Color.new(255, 255, 255)\n b.fill_rect(2, 0, 4, 1, c2)\n b.set_pixel(1, 1, c2)\n b.fill_rect(2, 1, 4, 6, c1)\n b.set_pixel(6, 1, c2)\n b.fill_rect(0, 2, 1, 4, c2)\n b.fill_rect(1, 2, 1, 4, c1)\n b.fill_rect(6, 2, 1, 4, c1)\n b.fill_rect(7, 2, 1, 4, c2)\n b.set_pixel(1, 6, c2)\n b.set_pixel(6, 6, c2)\n b.fill_rect(2, 7, 4, 1, c2)\n b.fill_rect(7, 8, 10, 1, c2)\n b.set_pixel(6, 9, c2)\n b.fill_rect(7, 9, 10, 22, c1)\n b.set_pixel(17, 9, c2)\n b.set_pixel(5, 10, c2)\n b.fill_rect(6, 10, 1, 20, c1)\n b.fill_rect(17, 10, 1, 20, c1)\n b.set_pixel(18, 10, c2)\n b.set_pixel(4, 11, c2)\n b.fill_rect(5, 11, 1, 18, c1)\n b.fill_rect(18, 11, 1, 18, c1)\n b.set_pixel(19, 11, c2)\n b.set_pixel(3, 12, c2)\n b.fill_rect(4, 12, 1, 16, c1)\n b.fill_rect(19, 12, 1, 16, c1)\n b.set_pixel(20, 12, c2)\n b.set_pixel(2, 13, c2)\n b.fill_rect(3, 13, 1, 14, c1)\n b.fill_rect(20, 13, 1, 14, c1)\n b.set_pixel(21, 13, c2)\n b.set_pixel(1, 14, c2)\n b.fill_rect(2, 14, 1, 12, c1)\n b.fill_rect(21, 14, 1, 12, c1)\n b.set_pixel(22, 14, c2)\n b.fill_rect(0, 15, 1, 10, c2)\n b.fill_rect(1, 15, 1, 10, c1)\n b.fill_rect(22, 15, 1, 10, c1)\n b.fill_rect(23, 15, 1, 10, c2)\n b.set_pixel(1, 25, c2)\n b.set_pixel(22, 25, c2)\n b.set_pixel(2, 26, c2)\n b.set_pixel(21, 26, c2)\n b.set_pixel(3, 27, c2)\n b.set_pixel(20, 27, c2)\n b.set_pixel(4, 28, c2)\n b.set_pixel(19, 28, c2)\n b.set_pixel(5, 29, c2)\n b.set_pixel(18, 29, c2)\n b.set_pixel(6, 30, c2)\n b.set_pixel(17, 30, c2)\n b.fill_rect(7, 31, 10, 1, c2)\n return b\n end", "title": "" }, { "docid": "1f1e9153ca5b4f003ec753d47149aa20", "score": "0.4977569", "text": "def count_sea_monsters_in_image(img)\n\t\tll = @size * 8\n\t\tseamonster = /..................#..{#{ll-20}}#....##....##....###.{#{ll-20}}.#..#..#..#..#..#.../\n\t\timg.flatten.join('').scan(seamonster).size\n\tend", "title": "" }, { "docid": "a57d11b29f0c8cc4d54875cd1ad62e6b", "score": "0.4977104", "text": "def calculate_image_score(image, position)\n alt_score = calculate_alt_score(image)\n return -1 if alt_score < 0\n\n img_dim_score = calculate_img_dim_score(image)\n return -1 if img_dim_score < 0\n\n positional_score = IMAGE_DECAY ** position\n\n Rails.logger.debug(\"#{image} has img_dim #{img_dim_score}, alt_score = #{alt_score}, \" +\n \"positional score = #{positional_score}\")\n\n total_score = img_dim_score + alt_score + positional_score\n total_score\n end", "title": "" }, { "docid": "78346ccc75d02f3104751f0b183c6283", "score": "0.4977025", "text": "def pixel\n image_name_list = get_image_name_list ELEMENTS_PATH\n image_name_list.each { |image_name| minimize(image_name) }\n end", "title": "" }, { "docid": "932235123c7e6db5a0c8c3728680f51d", "score": "0.49738577", "text": "def clips?(x, y)\n ::GD2::GD2FFI.send(:gdImageBoundsSafe, image_ptr, x.to_i, y.to_i).zero?\n end", "title": "" }, { "docid": "e58bd22973153d4795053a0045842bfc", "score": "0.49730298", "text": "def blur_pixel(ones_array)\n ones_array.each do |point_array|\n # => breaks the point_array inner arrays into its two parts --\n # => wouldn't work if there was stuff in the middle\n row = point_array.first\n col = point_array.last\n # => this is where the transformation happens\n @image_array[row - 1][col] = 1\n @image_array[row][col - 1] = 1 unless col == 0\n @image_array[row + 1][col] = 1 unless row >= @num_row - 1\n @image_array[row][col + 1] = 1 unless col >= @num_col - 1 \n\n end\n end", "title": "" }, { "docid": "7f566fd3b01ef73902ba260285e55cc4", "score": "0.49706122", "text": "def blur_pixel(ones_array)\n ones_array.each do |point_array|\n # => breaks the point_array inner arrays into its two parts --\n # => wouldn't work if there was stuff in the middle\n row = point_array.first\n col = point_array.last\n # => this is where the transformation happens\n @image_array[row - 1][col] = 1\n @image_array[row][col - 1] = 1 unless col == 0\n @image_array[row + 1][col] = 1 unless row >= @num_row - 1\n @image_array[row][col + 1] = 1 unless col >= @num_col - 1 \n end\n end", "title": "" }, { "docid": "dab241a738c02db80cd89120cc29f84d", "score": "0.49672365", "text": "def rectangle_area(width, height)\n area = width * height\nend", "title": "" }, { "docid": "d388eeae0a5f7fb2f0ef9106d30b3452", "score": "0.49669307", "text": "def slice_rect(slice, image_width, image_height)\n left = slice[:left]\n top = slice[:top]\n bottom = slice[:bottom]\n right = slice[:right]\n width = slice[:width]\n height = slice[:height]\n\n rect = {}\n\n if not left.nil?\n rect[:left] = left\n\n # in this case, it must be left+width or left+right, or left-to-end\n if not right.nil?\n rect[:width] = image_width - right - left\n elsif not width.nil?\n rect[:width] = width\n else\n # then this is left-to-end\n rect[:width] = image_width - left\n end\n elsif not right.nil?\n # in this case it must be right+width or right-to-end\n if not width.nil?\n rect[:left] = image_width - width - right\n rect[:width] = width\n else\n rect[:left] = image_width - right\n rect[:width] = right\n end\n else\n rect[:left] = 0\n rect[:width] = image_width\n end\n\n if not top.nil?\n rect[:top] = top\n\n # in this case, it must be top+height or top+bottom or top-to-bottom\n if not bottom.nil?\n rect[:height] = image_height - bottom - top\n elsif not height.nil?\n rect[:height] = height\n else\n rect[:height] = image_height - top\n end\n elsif not bottom.nil?\n # in this case it must be bottom+height\n if not height.nil?\n rect[:top] = image_height - height - bottom\n rect[:height] = height\n else\n rect[:top] = image_height - bottom\n rect[:height] = bottom\n end\n else\n rect[:top] = 0\n rect[:height] = image_height\n end\n\n if rect[:left] == 0 and rect[:top] == 0 and rect[:width] == image_width and rect[:height] == image_height\n return nil\n end\n\n return rect\n end", "title": "" }, { "docid": "fdbd11cbf8800b976141accbcf29429e", "score": "0.4965071", "text": "def rounding_error\n dif = (@y-rmagick_img.rows) + (@x-rmagick_img.columns)\n\n if dif > 0 && dif < 10 then\n rmagick_img.resize!(@x, @y)\n end\n end", "title": "" }, { "docid": "7d45197b09055dd3028f3df96c02eff7", "score": "0.49614003", "text": "def reduce\n @y += 1; @height -= 2\n update_position\n end", "title": "" }, { "docid": "22055cc2d289a91ab3fa582d95d67243", "score": "0.49598914", "text": "def uncrop!(x1, y1 = x1, x2 = x1, y2 = y1)\n ptr = self.class.create_image_ptr(x1 + width + x2, y1 + height + y2, alpha_blending?)\n ::GD2::GD2FFI.send(:gdImageCopy, ptr, image_ptr, x1.to_i, y1.to_i, 0, 0, width.to_i, height.to_i)\n init_with_image(ptr)\n end", "title": "" }, { "docid": "204d4ba301f11a9ea413b0c7d437ce0b", "score": "0.49593872", "text": "def draw\n @image.drawAtPoint( @location,\n :fromRect, @image_rect,\n :operation, OSX::NSCompositeSourceOver,\n :fraction, 1.0\n )\n end", "title": "" }, { "docid": "22fa3eacaa924bc304288afea50aa8ce", "score": "0.49526238", "text": "def area; rect size; end", "title": "" }, { "docid": "13ea0b131ac17f0f655f1818850f5433", "score": "0.4952126", "text": "def do_set_height(image, hash)\n i = Magick::Image.new(TILE_WIDTH, hash[:height]) {\n self.background_color = \"none\"\n }\n i = i.composite(image, 0, hash[:height]-image.rows, Magick::OverCompositeOp)\n end", "title": "" }, { "docid": "0bff94c742bffddf6675a0a4a6c7cb1d", "score": "0.4951203", "text": "def blur\n things_to_blur = []\n # looking for 1s to blur going through each array\n @grid.each_with_index do |or_row, row_index|\n or_row.each_with_index do |cell, cell_index|\n #is this current cell a 1?\n if cell == 1\n #run function on code\n recursive_blur(Point.new(cell_index, row_index), things_to_blur)\n end\n end\n end\n things_to_blur.each do |point|\n @grid[point.y][point.x] = 1\n end\n output_image\n end", "title": "" }, { "docid": "e8672a1968503b787477320242fd8f5c", "score": "0.49505436", "text": "def restricted?(x, y)\n out_of_bounds?(x, y) || @image.color(x, y) == 0\n end", "title": "" }, { "docid": "f039497556a0bdafd702fa6f4bad995a", "score": "0.49496135", "text": "def rectangular\n [re, im]\n end", "title": "" }, { "docid": "df98ef755021c0113258a65fa3ccc6f5", "score": "0.4945739", "text": "def clipping\n x1 = FFI::MemoryPointer.new(:pointer)\n y1 = FFI::MemoryPointer.new(:pointer)\n x2 = FFI::MemoryPointer.new(:pointer)\n y2 = FFI::MemoryPointer.new(:pointer)\n\n ::GD2::GD2FFI.send(:gdImageGetClip, image_ptr, x1, y1, x2, y2)\n [x1.read_int, y1.read_int, x2.read_int, y2.read_int]\n end", "title": "" }, { "docid": "c7c39e35a7b78316d63f3f874375f1ee", "score": "0.49409437", "text": "def rect; end", "title": "" }, { "docid": "c7c39e35a7b78316d63f3f874375f1ee", "score": "0.49409437", "text": "def rect; end", "title": "" }, { "docid": "3b820b83946597ee273f197a25eef589", "score": "0.49370208", "text": "def add_blur_to_image\n r = 0\n c = 0\n rc = 0\n n = 1\n z = []\n u = @y.size.to_i\n while n <= u\n @ary.each_index do |r|\n @ary[r].each_index do |c|\n if ((c.to_i - y[rc][1].to_i).abs + (r.to_i - y[rc][0].to_i).abs).between?(1, @distance.to_i);\n z << [r.to_i, c.to_i]\n end\n end\n end\n r = 0\n c = 0\n rc += 1\n n += 1\n end\n zz=[]\n r1 = 0\n c1 = 0\n z.each do |r|\n r1 = r[0].to_i\n c1 = r[1].to_i\n @ary[r1][c1] = 1\n end\n end", "title": "" }, { "docid": "0339e8e8f5353f96a5f7740b2a5276a2", "score": "0.49261272", "text": "def area_of_rect(l, w)\n return l * w\nend", "title": "" }, { "docid": "a5812f834f050a95386052c5eadffc95", "score": "0.49075606", "text": "def rect=(rectangle); end", "title": "" }, { "docid": "1ac7571b870b6b5436cc8afaf9af183c", "score": "0.48886928", "text": "def paper_white_area() barcode_bit_area -1 end", "title": "" }, { "docid": "1ff0e5db86a7e3df5d82f1fa1004755b", "score": "0.48880956", "text": "def rect(col, row)\n row.times do |row_index|\n col.times do |col_index|\n @data[row_index][col_index] = true\n end\n end\n end", "title": "" }, { "docid": "7b3e61469310717f5fe5068f2d015818", "score": "0.48873934", "text": "def selectionRectChanged(imageView)\n if imageBrowserView.selectionIndexes.count == 1\n index = imageBrowserView.selectionIndexes.firstIndex\n images[index].crop = NSStringFromRect( imageView.selectionRect )\n end\n end", "title": "" }, { "docid": "f15a04cfcf79a040f381efc225b23149", "score": "0.48854846", "text": "def do_draw(canvas, data)\n draw = Magick::Draw.new\n draw.fill('green')\n \n data.size.times do |y|\n data[y].size.times do |x|\n if data[y][x] == 1\n draw.rectangle(\n x * @x_map, y * @y_map,\n x * @x_map + @x_map, y * @y_map + @y_map)\n end\n end\n end\n \n draw.draw(canvas)\n end", "title": "" }, { "docid": "61303874984e1d79a03171d0daee0fba", "score": "0.48810658", "text": "def tile_crop_resize(image, dpi)\n size = {\n 'x' => image.columns,\n 'y' => image.rows\n }\n\n resize = false\n\n ['x', 'y'].each do |a|\n if (@field['size' + a])\n size[a] = @field['size' + a]*dpi\n resize = true\n end\n end\n\n if (@field['tile'])\n image = tile_image(image, dpi) if @field['tile']\n elsif (resize)\n scaleX = size['x']/image.columns\n scaleY = size['y']/image.rows\n\n scale = scaleX\n scale = scaleY if scaleY > scaleX\n\n image.resize!(image.columns*scale, image.rows*scale, Magick::LanczosFilter, 0.7)\n end\n\n image.crop!(Magick::CenterGravity, size['x'], size['y']) if (@field['crop'])\n\n return image\n end", "title": "" }, { "docid": "b523b4cdf84177e5378e95fe5c06d6d0", "score": "0.48745954", "text": "def crop(rect)\n if self.scale > 1.0\n rect = CGRectMake(rect.origin.x * self.scale,\n rect.origin.y * self.scale,\n rect.size.width * self.scale,\n rect.size.height * self.scale)\n end\n\n cgimage = CGImageCreateWithImageInRect(self.CGImage, rect)\n result = UIImage.imageWithCGImage(cgimage, scale:self.scale, orientation:self.imageOrientation)\n\n return result\n end", "title": "" }, { "docid": "90f1b5b8a8175c2ee56b2c14b11e7683", "score": "0.48681563", "text": "def side_crop side, rowcol, image, starting, outimage=nil\n m_begin \"side_crop\"\n raise \"number expected\" unless starting.class == Fixnum\n raise \"side wrong: #{side}\" unless [:top, :bottom, :left, :right].member? side\n raise \"rowcol wrong: #{rowcol}\" unless [:row, :column].member? rowcol\n img = get_image(image)\n case [side, rowcol]\n when [:left, :column]\n cropped = img.excerpt(starting, 0, img.columns-starting, img.rows)\n when [:right, :column]\n cropped = img.excerpt(0, 0, img.columns-starting, img.rows)\n when [:top, :row]\n cropped = img.excerpt(0, starting, img.columns, img.rows-starting)\n when [:bottom, :row]\n cropped = img.excerpt(0, 0, img.columns, img.rows-starting)\n else\n raise \"invalid rowcol and side combination\"\n end\n outimage = image if outimage.nil?\n put_image(outimage, cropped)\n m_end \"side_crop\"\n end", "title": "" }, { "docid": "820323cca941146c822c5c4b2231abe3", "score": "0.4863259", "text": "def draw x, y, imageMagick\n imageMagick.drawSquare(x,y)\nend", "title": "" }, { "docid": "3760dea0418655464ecb801926eef7b8", "score": "0.48585346", "text": "def scale_down(image, geometry)\n image.change_geometry(geometry) do |cols, rows, img|\n next if cols >= img.columns || rows >= img.rows\n img.resize!(cols, rows)\n end\n end", "title": "" }, { "docid": "e8a999c1b0b874611e44b662f396fcc0", "score": "0.4851058", "text": "def in_image(row, column)\n\t\treturn (0<=row and row<@height and 0<=column and column<@width)\n\tend", "title": "" }, { "docid": "21558fc73bb206ec2bd4d8f0f748b7d6", "score": "0.48266628", "text": "def crops(image)\n image = image.to_sym\n if images[image][:styles].blank?\n {}\n else\n images[image][:styles].delete_if{|k,v| k == :sample}\n end\n end", "title": "" }, { "docid": "01647240b937704b5e0c6d79fe2ce7b9", "score": "0.48253816", "text": "def image_by_cropping_to_rect(aRect)\n if aRect.is_a? CGRect\n cropped = CGImageCreateWithImageInRect(self.CGImage, [[aRect.origin.x*self.scale, aRect.origin.y*self.scale], [aRect.size.width*self.scale, aRect.size.height*self.scale]])\n else\n cropped = CGImageCreateWithImageInRect(self.CGImage, [[aRect[0][0]*self.scale, aRect[0][1]*self.scale], [aRect[1][0]*self.scale, aRect[1][1]*self.scale]])\n end\n UIImage.imageWithCGImage(cropped, scale:self.scale, orientation:self.imageOrientation)\n end", "title": "" }, { "docid": "bfdea2153d789175c77fe552eac20862", "score": "0.48248678", "text": "def new_from_image value\n pixel = (Vips::Image.black(1, 1) + value).cast(format)\n image = pixel.embed 0, 0, width, height, extend: :copy\n image.copy interpretation: interpretation, xres: xres, yres: yres,\n xoffset: xoffset, yoffset: yoffset\n end", "title": "" }, { "docid": "86753a6c3b3448585214de1036dbe7d5", "score": "0.4813516", "text": "def tile_image(image, dpi)\n tilex = @field['tilex']*dpi\n tiley = @field['tiley']*dpi\n\n tiledImage = ImageList.new\n\n temp = image.scale(tilex, tiley)\n\n timesX = (@field['sizex'].to_f/@field['tilex']).ceil\n timesY = (@field['sizey'].to_f/@field['tiley']).ceil\n\n (1..timesX).each do |x|\n (1..timesY).each do |y|\n tiledImage << temp\n end\n end\n\n montage = tiledImage.montage() do |image|\n image.geometry = \"#{tilex}x#{tiley}+0+0\"\n image.background_color = 'transparent'\n image.tile = \"#{timesX}x#{timesY}\"\n end\n tiledImage.clear()\n\n return montage\n end", "title": "" }, { "docid": "0d224aa1eb8c2d519f989bbc57ae68d4", "score": "0.48126912", "text": "def sqInRect(x, y)\n\tif x == y\n\t\treturn nil\n\tend\n\tresult = []\n\n while y != x do\n if y > x\n y -= x\n result.append(x)\n elsif x > y\n x -= y\n result.append(y)\n end \n end\n \n result.append(y)\n \n return result\nend", "title": "" }, { "docid": "0d0f2b464a76ee6b277c160924503dba", "score": "0.48096442", "text": "def pixelate\n\t\t\tmax_level = @post.resolution_level - 1\n\t\t\tmax_resolution = 2**max_level;\n\n\t\t\timg = Magick::ImageList.new(@post.image.path(:medium))\n\t\t\tstep = img.columns / max_resolution\n\t\t\ttemplate = Magick::Image.new(step, step)\n\t\t\tpixel_matrices = Array.new(max_level + 1)\n\n\t\t\t# Initialize 3D array: [level][row][col]\n\t\t\tfor level in 0..max_level do\n\t\t\t\tpixel_matrices[level] = level == max_level ? Array.new(2**level) { Array.new(2**level) } : nil\n\t\t\tend\n\n\t\t\tfor r in 0...max_resolution do\n\t\t\t\tfor c in 0...max_resolution do\n\t\t\t\t\t# Cut image into blocks\n\t\t\t\t\tblock = img.export_pixels_to_str( c * step, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t r * step,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t step,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t step )\n\t\t\t\t\taverage_pixel = template.import_pixels(0,0,step, step, \"RGB\", block).scale(1,1).pixel_color(0,0)\n\n\t\t\t\t\t# Translate red,green,blue value into 8-bit depth from 16-bit depth (default RMagick)\n\t\t\t\t\tpixel_matrices[max_level][r][c] = [average_pixel.red, average_pixel.green, average_pixel.blue].map! { |x| convert_16bit_to_8bit_with_damping(x) }\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Compute the remaining levels\n\t\t\tfor level in max_level.downto(1) do\n\t\t\t\taverage = Array.new(2**(level-1)) { Array.new(2**(level-1)) { Array.new(3, 0.0) } }\n\t\t\t\tfor r in 0...2**level do\n\t\t\t\t\tfor c in 0...2**level do\n\t\t\t\t\t\taverage[r / 2][c / 2][0] += pixel_matrices[level][r][c][0] / 4\n\t\t\t\t\t\taverage[r / 2][c / 2][1] += pixel_matrices[level][r][c][1] / 4\n\t\t\t\t\t\taverage[r / 2][c / 2][2] += pixel_matrices[level][r][c][2] / 4\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tpixel_matrices[level-1] = Array.new(average)\n\t\t\tend\n\t\t\t@post.pixel_matrices = pixel_matrices\n\t\t\t@post.save\n\t\tend", "title": "" }, { "docid": "f8c9fcd70bfba1e1a6fcb7bd494d928c", "score": "0.48069763", "text": "def check_for_black_and_white\n checker = true\n self.exam_images.each do |image|\n if image.image_black_and_white == nil\n checker = false\n end\n end\n\n self.update(processed_black_and_white: checker)\n end", "title": "" }, { "docid": "a2ea76ebcdf726f67201edba1ba22de5", "score": "0.48063922", "text": "def rectangleArea(width, height)\n # return width * height\n width * height\n # set end of rectangleArea function\nend", "title": "" } ]
2fe164526e13b6409e6b954ce0ce480c
Returns true if the file record contains any services which need to be run
[ { "docid": "c943fbd9279bfd294245a2d5ec36d00b", "score": "0.7520488", "text": "def needs_run?(file_rec)\n md_rec = file_rec.metadata_record\n storage_loc = file_rec.storage_location\n service_manager = @app_config.service_manager\n\n # File is not a valid candidate for services if it is deregistered, unless performing cleanup\n if @event != EventNames::CLEANUP && md_rec.deregistered?\n logger.debug(\"Skipping deregistered file: #{file_rec.path}\")\n return false\n end\n\n expected_services = service_manager.list_services(\n location: storage_loc.name,\n event: @event)\n\n # When in force mode, candidate needs a run as long as there are any services configured for it.\n if @force && !expected_services.empty?\n logger.debug(\"Forcing run needed for file: #{file_rec.path}\")\n return true\n end\n\n expected_services.each do |service_name|\n if service_manager.service_needed?(service_name, md_rec)\n logger.debug(\"Service #{service_name} needed for file: #{file_rec.path}\")\n return true\n end\n end\n\n logger.debug(\"Run not needed for file: #{file_rec.path}\")\n # No services needed to be run for this file\n false\n end", "title": "" } ]
[ { "docid": "28e3128873c542f0ae4cf91482986703", "score": "0.67144334", "text": "def service_running?(service)\n !service[\"Service\"][\"Status\"].nil? && service[\"Service\"][\"Status\"] == 4\n end", "title": "" }, { "docid": "62df6db90c8130a73572b51084e5160f", "score": "0.66631204", "text": "def service_needed?(service_name, md_rec)\n service_rec = md_rec.service(service_name)\n return true if !service_rec.nil? && service_rec.run_needed\n\n definition = @definition_manager.services[service_name]\n\n next_run = ServiceDateHelper.next_run_needed(md_rec, definition)\n\n return false if next_run.nil?\n\n # If next run timestamp has passed then service is needed\n now = ServiceDateHelper.formatted_timestamp\n now >= next_run\n end", "title": "" }, { "docid": "2f6c81411cc9d4d27fd64778442a2825", "score": "0.65379333", "text": "def has_services?\n !get_services.empty?\n end", "title": "" }, { "docid": "f38630983885a8295bc8353bad60ba62", "score": "0.64440644", "text": "def service_discovery_enabled?\n return false if Gitlab::Runtime.rake?\n\n service_discovery[:record].present?\n end", "title": "" }, { "docid": "01c05b1d26328cd432bd301d7e1012e7", "score": "0.6394843", "text": "def loaded?\n ServicesCli.running.include? label\n end", "title": "" }, { "docid": "cdbad63648f5bc2d3b0bc9c5c90f7180", "score": "0.63128465", "text": "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", "title": "" }, { "docid": "a14d03463765bded5df90d9e156a0e99", "score": "0.6291295", "text": "def contains_found?\n\t\t\tFile.exist? @contains\n\t\tend", "title": "" }, { "docid": "e074afb3dd91e1434d0f01c6bcd881d0", "score": "0.6268543", "text": "def service_should_be_started(file_name)\n # The existence of this file indicates that the service was started.\n expect(File.exist?(\"#{Dir.tmpdir}/#{file_name}\")).to be_truthy\n end", "title": "" }, { "docid": "e074afb3dd91e1434d0f01c6bcd881d0", "score": "0.6268543", "text": "def service_should_be_started(file_name)\n # The existence of this file indicates that the service was started.\n expect(File.exist?(\"#{Dir.tmpdir}/#{file_name}\")).to be_truthy\n end", "title": "" }, { "docid": "255781e1e0e74699f7b0558480b08811", "score": "0.6208517", "text": "def nr_service_exist?\n @services.one_service?(NR_SERVICE_NAME, LICENSE_KEY)\n end", "title": "" }, { "docid": "9c24952a3a896c3e82fb0678788da153", "score": "0.61465746", "text": "def monit_service_registered?(service_name)\n get_monit_summary.include?(service_name)\n end", "title": "" }, { "docid": "e67c89ca2079075f1ff8cfc7adc1eb1d", "score": "0.6120887", "text": "def service?\n @options.has_key?(:all) || @command == 'install'\n end", "title": "" }, { "docid": "150d653b338ce021774ac36b33a156c3", "score": "0.6115056", "text": "def service_exists?(service)\n srv_info = service_info(service)\n\n if srv_info.nil?\n vprint_error('Unable to enumerate Windows services')\n return false\n end\n\n if srv_info && srv_info[:display].empty?\n return false\n end\n\n true\n end", "title": "" }, { "docid": "3557ed07371e8ce3990a716a87324602", "score": "0.61044043", "text": "def running?(name)\n status = File.read(\"|service #{name} status 2>&1\")\n status[/is running/] ? true : status[/is not running/] ? false : status.empty? ? false : nil;\n end", "title": "" }, { "docid": "bc609100162d58317d4a4403dfee7aff", "score": "0.61015266", "text": "def available?\n self.services\n end", "title": "" }, { "docid": "d6018573e0d151248ef46a7aa2d37501", "score": "0.6097235", "text": "def running?\n return false unless @service.process\n\n test = `pgrep #{@service.process} | wc -l 2>/dev/null`.strip.to_i\n test > 0\n end", "title": "" }, { "docid": "a6e40675fb92f307f045e92a41cc2d2e", "score": "0.60892075", "text": "def complete_service?\n unless supports_incomplete_services?\n raise Puppet::Error, _(\"Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.\") % { service: @resource[:name], release: Facter.value(:operatingsystemrelease) }\n end\n\n return @complete_service if @complete_service\n\n # We need to use the service's FMRI when querying its config. because\n # general/complete is an instance-specific property.\n fmri = service_fmri\n\n # Check if the general/complete property is defined. If it is undefined,\n # then svccfg will not print anything to the console.\n property_defn = svccfg(\"-s\", fmri, \"listprop\", \"general/complete\").chomp\n @complete_service = ! property_defn.empty?\n end", "title": "" }, { "docid": "79623344143198edaf59a131583c7309", "score": "0.6083497", "text": "def running?\n cmd = shell_out(\"#{sv_bin} status #{service_dir_name}\")\n (cmd.stdout.match(/^run:/) && cmd.exitstatus == 0) ? true : false\n end", "title": "" }, { "docid": "4c9c4e3905e2e7dddcdc187a36c5486c", "score": "0.60651916", "text": "def check_xinetd_files(service)\n val = Facter::Core::Execution.exec(\"grep 'disable.*= /etc/xinetd.d/#{service}\")\n if val.nil? || val.empty?\n ret = false\n else\n ret = true\n lines = val.split(\"\\n\")\n lines.each do |line|\n m = line.match(%r{disable\\s*=\\s*(?<status>\\w)})\n status = m[:status].strip.downcase\n if status == 'yes'\n ret = false\n end\n end\n end\n\n ret\nend", "title": "" }, { "docid": "36932b1967cc0e4e725d9388e0515244", "score": "0.6050913", "text": "def check_service_file(path)\n check_file(service_path(path))\n end", "title": "" }, { "docid": "6bd59ebd642ae680ce92bbf584f95fc9", "score": "0.60410863", "text": "def complete?\n return false if empty?\n return true if last.line =~ /Finished catalog run/\n return true if last.line =~ /Puppet \\(info\\): \\(end\\)/\n return true if last.line =~ /Puppet \\(debug\\): Finishing transaction/\n end", "title": "" }, { "docid": "4860cc69c578418f2eb8309671cfe1db", "score": "0.60356796", "text": "def will_run?\n file_tasks = self.dependencies.select { |name| self.class[name] }\n file_tasks.any? do |path|\n\n end\n end", "title": "" }, { "docid": "8a03e095edc1f4e06e8b69223178bc8f", "score": "0.60353404", "text": "def is_service_running?(service, cache=false)\n services = self.get_services(cache)\n\n if services.has_key?(service)\n services[service].eql?('running').true?\n else\n false\n end\n end", "title": "" }, { "docid": "b394f5afbbf5b1cbf6ea5fbf4aba4162", "score": "0.6024621", "text": "def processings?\n @processings.any?\n end", "title": "" }, { "docid": "8bc164681bc068d52fc35b4974226d5b", "score": "0.59780025", "text": "def support?(service_flag)\n (services & service_flag) != 0\n end", "title": "" }, { "docid": "1883a1ae454498ba7abc42fd101585cd", "score": "0.59779215", "text": "def has_systemd_service_unit?(svc_name)\n %w{ /etc /usr/lib /lib /run }.any? do |load_path|\n file_exist?(\n \"#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, \"@\")}.service\"\n )\n end\n end", "title": "" }, { "docid": "1160097c85cda5fbefa1a5abbe01a851", "score": "0.5960829", "text": "def installed?\n success = false\n @install_indicators.each do |ii|\n if ii.include?(' ')\n root, pattern, exclusions = ii.split(' ')\n success = findfile(root, pattern, exclusions) ? true : false\n else\n success = FileTest::exists?(ii)\n end\n break if success\n end\n success\n end", "title": "" }, { "docid": "1160097c85cda5fbefa1a5abbe01a851", "score": "0.5960829", "text": "def installed?\n success = false\n @install_indicators.each do |ii|\n if ii.include?(' ')\n root, pattern, exclusions = ii.split(' ')\n success = findfile(root, pattern, exclusions) ? true : false\n else\n success = FileTest::exists?(ii)\n end\n break if success\n end\n success\n end", "title": "" }, { "docid": "71f95be64389b9fae6d5388f51a3bc62", "score": "0.59496975", "text": "def service_running?\n raise \"service name not set for #{self}\" unless service_name\n\n host_sudo \"service #{Shellwords.escape service_name} \" +\n \"status >/dev/null 2>&1\", :fail_on_error => false\n end", "title": "" }, { "docid": "bf71461d69e1512a7c8154d77e03f9a4", "score": "0.59443146", "text": "def runLoopCheck\n\t\t#We check to see if we should continue to run\n\t\tinput = File.open('faxService.txt','rt') \n\t\tfaxrecord = input.read() \n\t\tinput.close \n\n\t\tif faxrecord.chop == \"true\"\n\t\t\trv = true\n\t\telse\n\t\t\trv = false\n\t\tend\n\t\t\n\t\treturn rv\t\t\n\tend", "title": "" }, { "docid": "13058b7fc58695e8496ee9b5811e9962", "score": "0.5939393", "text": "def processing?\n File.exist?(\"#{@path}/processing\")\n end", "title": "" }, { "docid": "2426ea9dad3898c862670ded0b38745b", "score": "0.59313506", "text": "def appdynamics_service_exist?\n @services.one_service?(FILTER, 'host-name')\n end", "title": "" }, { "docid": "bf265b59a2a6d275361485e8d016333f", "score": "0.5921987", "text": "def all_processed?\n query_service.custom_queries.find_deep_children_with_property(resource: resource, model: FileSet, property: :processing_status, value: \"in process\", count: true).zero?\n end", "title": "" }, { "docid": "4020cc36661a6a3565363ecff28d00b4", "score": "0.5916344", "text": "def used?\n files.any?\n end", "title": "" }, { "docid": "4a7a1d3c56c587ab015310c74021abcd", "score": "0.591194", "text": "def service_type_in_progress?(svc_type)\n return service_types_in_progress?( [svc_type] )\n end", "title": "" }, { "docid": "0b2ffa9375cca32d007b574b0f567952", "score": "0.588626", "text": "def enabled?\n rcfile = File.join(rcconf_dir, @resource[:name])\n if Puppet::FileSystem.exist?(rcfile)\n File.open(rcfile).readlines.each do |line|\n # Now look for something that looks like \"service=${service:=YES}\" or \"service=YES\"\n if line =~ /^\\s*#{@resource[:name]}=(?:YES|\\${#{@resource[:name]}:=YES})/\n return :true\n end\n end\n end\n\n :false\n end", "title": "" }, { "docid": "a32b39e5f5a5c677d44ced6b2118db75", "score": "0.5871202", "text": "def complete?\n (@completed.count >= @service_count and @service_count > 0) or @no_services_available\n end", "title": "" }, { "docid": "74c684c4e62555d5b05f58d4e9ed5cbb", "score": "0.58641785", "text": "def has_delivery_service?\n services.include?(Service.find_by_name(\"delivery_service\"))\n end", "title": "" }, { "docid": "c8be3231a8e51a6ac942beda269cd43d", "score": "0.58504784", "text": "def service_available?\n true\n end", "title": "" }, { "docid": "b9042db3765f34a35d108c5d46f7592f", "score": "0.58460903", "text": "def started?\n @_service_state == :started\n end", "title": "" }, { "docid": "47f2d7c39abcce96dcb1a42688fa4a36", "score": "0.58437514", "text": "def requires_liberty_extensions?\n @services_full_autoconfig.each do |service|\n return true if service[INSTANCE].requires_liberty_extensions?\n end\n @services_no_xml_updates.each do |service|\n return true if service[INSTANCE].requires_liberty_extensions?\n end\n false\n end", "title": "" }, { "docid": "2ea2d387f91e2d6367a52a60b4563515", "score": "0.5825621", "text": "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "title": "" }, { "docid": "22dcfea0ad08de30fd535c95318b15ed", "score": "0.5820147", "text": "def has_paying_customers?\n\t\tcustomer_files.present?\n\tend", "title": "" }, { "docid": "4b99b15ab19cca4d55393d5595b02fcb", "score": "0.5819098", "text": "def supports_incomplete_services?\n Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.1') >= 0\n end", "title": "" }, { "docid": "89d5f04005e149664ce084d494f7041e", "score": "0.58158094", "text": "def instruments_running?\n instruments_pids.count > 0\n end", "title": "" }, { "docid": "89d5f04005e149664ce084d494f7041e", "score": "0.58158094", "text": "def instruments_running?\n instruments_pids.count > 0\n end", "title": "" }, { "docid": "7cd42008ef84b454fb79a62081f9c3cd", "score": "0.5808436", "text": "def loaded?\n if System.launchctl?\n # TODO: find replacement for deprecated \"list\"\n quiet_system System.launchctl, \"list\", service_name\n elsif System.systemctl?\n quiet_system System.systemctl, System.systemctl_scope, \"status\", service_file.basename\n end\n end", "title": "" }, { "docid": "eb75c862b81a6f1c17ccacddfdee35ea", "score": "0.58057", "text": "def processing?\n hash = status\n return false unless hash\n [\"incomplete\", \"ready\", \"shutting_down\"].include? hash[:ensure]\n end", "title": "" }, { "docid": "df33feb0a9073f366257f1a123f30696", "score": "0.58006406", "text": "def isIssaMachine()\n if Dir.getwd.include? \"services-dev\"\n return true\n end\n\n return false\nend", "title": "" }, { "docid": "6985327ed70e6bc8fc353a1cfb446acd", "score": "0.5798207", "text": "def verify_service?\n service_type_info.service? && verify?\n end", "title": "" }, { "docid": "d13f00854e115c5f9abfd307ccc38d19", "score": "0.57700026", "text": "def ruxit_service_exist?\n @services.one_service?(RUXIT_SERVICE_NAME, TENANT, TENANTTOKEN)\n end", "title": "" }, { "docid": "0487e3614adf1ba8f5d7c49df6404cbd", "score": "0.5769094", "text": "def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end", "title": "" }, { "docid": "3898c1ce48c51c37b665488107455bf0", "score": "0.57614386", "text": "def AnyRPCServiceInConfiguration\n ret = false\n\n Builtins.foreach(GetKnownFirewallZones()) do |fw_zone|\n fw_rule = Builtins.sformat(\"FW_SERVICES_%1_RPC\", fw_zone)\n listed_services = Ops.get_string(@SETTINGS, fw_rule) do\n GetDefaultValue(fw_rule)\n end\n # easy case\n next if listed_services == nil || listed_services == \"\"\n # something listed but it still might be empty definition\n services_list = Builtins.splitstring(listed_services, \" \\n\\t\")\n services_list = Builtins.filter(services_list) do |service|\n service != \"\"\n end\n if Ops.greater_than(Builtins.size(listed_services), 0)\n ret = true\n raise Break\n end\n end\n\n Builtins.y2milestone(\"Some RPC service found: %1\", ret)\n ret\n end", "title": "" }, { "docid": "2a0fbe1383dd8148e04b7d68a2b7d289", "score": "0.57574004", "text": "def services_available?(*services)\n api_status = self.api_status\n if api_status.is_a?(Hash)\n api_ok = true\n services.each do |service|\n if api_status['systems'].present? && api_status['systems'][service].present? && api_status['systems'][service]['ok']\n next\n else\n api_ok = false\n break\n end\n end\n api_ok\n else\n false\n end\n end", "title": "" }, { "docid": "b2b7cde4b4aac3a4621b5c36e24efaec", "score": "0.5752448", "text": "def service_library?\n @service_library.nil? ? false : !!@service_library\n end", "title": "" }, { "docid": "113dc90cbc5d9884c00ac400328857e1", "score": "0.5751498", "text": "def service_types_in_progress?(type_array)\n # convert strings to ServiceTypeValues\n type_array = type_array.collect {|s| s.kind_of?(ServiceTypeValue)? s : ServiceTypeValue[s] }\n \n self.services_in_progress.each do |s|\n # array intersection\n return true unless (s.service_types_generated & type_array).empty? \n end\n return false;\n end", "title": "" }, { "docid": "e9e04bf592dec8c5f3f4dbb1456d5aed", "score": "0.5747107", "text": "def in_service_class?(node)\n in_directory?(node, 'services')\n end", "title": "" }, { "docid": "25ca6651c2e53fa2063149173178536f", "score": "0.5740487", "text": "def has_xml_file?(entries_array)\n return_value = false\n\n entries_array.each do |entry|\n #logger.debug(entry)\n if (entry.match('slideshow.xml'))\n #logger.debug(\"HAS XML\")\n return_value = true\n end\n end\n\n return_value\nend", "title": "" }, { "docid": "07578fcbdbe8600abb8e2f38628c6d4b", "score": "0.57392436", "text": "def is_running?(service)\n query = \"SELECT Name, State FROM Win32_Service WHERE Name='#{service}' AND State='Running'\"\n\n result = false\n service_label = \"#{@name}->#{service}\"\n\n @log.debug \"Checking services #{service_label}...\"\n get_wmi.ExecQuery(query).each do |result|\n @log.debug \"#{service_label}.State == #{result.State}\"\n result = true if result.State = 'Running'\n end\n\n return result\n end", "title": "" }, { "docid": "989b094626f4a282fd2f2daf040fafed", "score": "0.5736781", "text": "def service_startup?\n if service?\n @service_startup ||= load_service.requires_root?\n return @service_startup\n end\n\n @service_startup ||= formula.plist_startup.present?\n end", "title": "" }, { "docid": "79032a6e4212bc43cf777b18b45b1ed4", "score": "0.57362044", "text": "def running?\n [SERVICE_RUNNING, SERVICE_PAUSED, 0].include?(@@dwServiceState)\n end", "title": "" }, { "docid": "979c5c0e7490b9b6098eb4b9b3071455", "score": "0.57317007", "text": "def contains_data?\n @resource.data_files.present_files.count.positive?\n end", "title": "" }, { "docid": "024719ebee55677bea111d1757bd09ef", "score": "0.57306165", "text": "def has_test\n\t\treturn @t_cpp_files.length > 0\n\tend", "title": "" }, { "docid": "4ec0384f9ca06710de05d450497bee98", "score": "0.5724729", "text": "def running?\n logs = Log.where(:file => file, \n :job_type => job_type, \n :state => \"running\",\n :export_id => export_id,\n :hostname => hostname)\n \n if logs.count > 0\n logs.each do |log|\n begin\n Process.getpgid(log.pid)\n puts \"still running #{filepath}\"\n return true\n rescue Errno::ESRCH\n log.mark_dead\n end\n end\n end\n \n return false\n end", "title": "" }, { "docid": "95dd55d992d78dffb810eb7d54055d25", "score": "0.5721024", "text": "def running?\n\t\t\t\t@running.any?\n\t\t\tend", "title": "" }, { "docid": "c5ce87cc457282f654971250ad1eb090", "score": "0.57204133", "text": "def is_recording?\n @_recorders.empty? ? false : @_recorders.each.all? { |r| r.pid > -1 }\n end", "title": "" }, { "docid": "34baf2e92a2db7650066973d162ff546", "score": "0.5719174", "text": "def service_file_present?(opts = { for: false })\n if opts[:for] && opts[:for] == :root\n boot_path_service_file_present?\n elsif opts[:for] && opts[:for] == :user\n user_path_service_file_present?\n else\n boot_path_service_file_present? || user_path_service_file_present?\n end\n end", "title": "" }, { "docid": "c8b4f984abae47422e668001844894b0", "score": "0.5718806", "text": "def has_binary\n\t\treturn @b_cpp_files.length > 0\n\tend", "title": "" }, { "docid": "945e47d04e86cd85eeda8b71a6684496", "score": "0.57165176", "text": "def has_start_record\n start_address unless @start_address\n @start_record_found = false if @start_record_found.nil?\n @start_record_found\n end", "title": "" }, { "docid": "1ddf54e19c29f8464999a5fc6f875b69", "score": "0.571567", "text": "def has_library\n\t\treturn @cpp_files.length > 0\n\tend", "title": "" }, { "docid": "7baf39fbcbb466d8344ebd28d47383cf", "score": "0.5711921", "text": "def main_record_exists?\n \n unchecked_files = [\"grfp_grad_stdy_stts.txt\", \"grfp_cntc.txt\", \n \"grfp_maj_spec_fld.txt\", \"grfp_panl_name.txt\", \"ctry.txt\",\n \"ctzn.txt\", \"ethn.txt\", \"pi_degr.txt\", \"pr_rno_code.txt\", \"grfp_appl_cert_txt.txt\",\n \"grfp_appl_oth_fwsp_offr.txt\", \"grfp_appl_stts.txt\", \"grfp_oth_fwsp_offr.txt\",\n \"grfp_pgm_ack_srce.txt\", \"grfp_prop_inst.txt\"]\n \n return true if unchecked_files.include?(self.fastlane_file.file_name)\n \n key = self.fastlane_key\n case self.fastlane_file.file_name\n when \"grfp_appl_cert_dnld.txt\" \n cert_exists?(key)\n when \"grfp_appl.txt\"\n applicant_exists?(key)\n when \"grfp_gre_test.txt\"\n gre_exists?(key)\n when \"grfp_prev_expr.txt\"\n job_exists?(key)\n when \"grfp_prsn.txt\"\n applicant_exists?(key)\n when \"grfp_ref.txt\"\n reference_exists?(key)\n when \"grfp_univ_attn.txt\"\n school_exists?(key)\n when \"grfp_upld_file_loc.txt\"\n essays_exists?(key)\n when \"prsn_hdcp.txt\"\n disability_exists?(key)\n when \"prsn_race.txt\"\n race_exists?(key)\n else\n raise \"Couldn't determine if file exists for #{self.fastlane_file.file_name}\"\n end\n \n end", "title": "" }, { "docid": "e70b9f10365f69bdbd03ae9a17a4e0d0", "score": "0.57021", "text": "def service_listening?\n cmd = shell_out!('netstat -lnt')\n cmd.stdout.each_line.select do |l|\n l.split[3] =~ /#{new_resource.port}/\n end.any?\n end", "title": "" }, { "docid": "e70b9f10365f69bdbd03ae9a17a4e0d0", "score": "0.57021", "text": "def service_listening?\n cmd = shell_out!('netstat -lnt')\n cmd.stdout.each_line.select do |l|\n l.split[3] =~ /#{new_resource.port}/\n end.any?\n end", "title": "" }, { "docid": "fc0ace72991f8e7ccda5d32b80fb0e05", "score": "0.5697132", "text": "def completed?\n header_found, footer_found = false, false\n @lines.each do |line| \n line_def = file_format.line_definitions[line[:line_type]]\n header_found = true if line_def.header\n footer_found = true if line_def.footer \n end\n header_found && footer_found \n end", "title": "" }, { "docid": "dcc166aa056cd551ed40cc458297c9d7", "score": "0.5693173", "text": "def is_complete?\n trigger_file.present? && display_file.present?\n end", "title": "" }, { "docid": "68704edeb83477e866c46f6f8afe58f4", "score": "0.56928134", "text": "def status\n File.exist?(@filename)\n end", "title": "" }, { "docid": "10506decfda0c309054afcc1de28a078", "score": "0.5687154", "text": "def ServiceAvailable(service_name)\n Convert.to_boolean(SCR.Read(path(\".init.scripts.exists\"), service_name))\n end", "title": "" }, { "docid": "471f5a8685fa4e64c6114ec9ea323b63", "score": "0.56809795", "text": "def running?\n case\n when pid_file\n running_via_pid_file?\n when port\n TCPSocket.listening_service?(:port => port, :host => host || \"127.0.0.1\")\n else raise \"Service Manager needs to be able to tell if the service is already running or not. You'll need to specify a pid file or a TCP port to check.\"\n end\n end", "title": "" }, { "docid": "471f5a8685fa4e64c6114ec9ea323b63", "score": "0.56809795", "text": "def running?\n case\n when pid_file\n running_via_pid_file?\n when port\n TCPSocket.listening_service?(:port => port, :host => host || \"127.0.0.1\")\n else raise \"Service Manager needs to be able to tell if the service is already running or not. You'll need to specify a pid file or a TCP port to check.\"\n end\n end", "title": "" }, { "docid": "c3bf4c1b44ee4e856091fbce80114539", "score": "0.56799805", "text": "def already_processing?(spec)\n @lock.synchronize do\n return true if @list.include?(spec.full_name)\n @list << spec.full_name\n end\n false\n end", "title": "" }, { "docid": "f3383bca1066aff9abcbd7b618e6fde1", "score": "0.56743807", "text": "def enabled?\n if Facter.value(:operatingsystem) != 'Ubuntu'\n if Puppet::FileSystem.exist?(\"/etc/systemd/system/#{resource[:pattern]}.service\")\n current_conf = File.read(\"/etc/systemd/system/#{resource[:pattern]}.service\")\n if !current_conf.eql? systemd_template\n return :false\n end\n if systemctl_run('is-enabled', [resource[:pattern]], false).exitstatus == 0\n return :true\n end\n else\n return :false\n end\n elsif Facter.value(:operatingsystem) == 'Ubuntu'\n if Puppet::FileSystem.exist?(\"/etc/init/#{resource[:pattern]}.conf\")\n current_conf = File.read(\"/etc/init/#{resource[:pattern]}.conf\")\n if current_conf.eql? upstart_template\n return :true\n end\n else\n return :false\n end\n end\n end", "title": "" }, { "docid": "b8ad798edc77bf9b3f08896efd006eb6", "score": "0.56740373", "text": "def plist?\n return false unless installed?\n return true if service_file.file?\n return true unless formula.plist.nil?\n return false unless formula.opt_prefix.exist?\n return true if Keg.for(formula.opt_prefix).plist_installed?\n rescue NotAKegError\n false\n end", "title": "" }, { "docid": "f66fdef1bface826f5e09c1a9d0962b5", "score": "0.5672999", "text": "def service_exists?\n @services.one_service?(FILTER, 'agent_manager_url')\n end", "title": "" }, { "docid": "33ddee42af3a4e4e8af7c80374840c59", "score": "0.5658365", "text": "def is_service?(service, cache=true)\n services = self.get_services(cache)\n services.has_key?(service)\n end", "title": "" }, { "docid": "8a1889b713be2f6bd70951c4f7602bf9", "score": "0.5653992", "text": "def accessible?\n services rescue (return false)\n true\n end", "title": "" }, { "docid": "f51e483290ce496921a0797259a51a61", "score": "0.56511366", "text": "def systemd_unit_file?(comm, name)\n comm.test(\"systemctl -q list-unit-files | grep \\\"#{name}\\\"\")\n end", "title": "" }, { "docid": "7ac2d31f733dadfb9e567399c6d0b731", "score": "0.5646254", "text": "def ready?\n running_services = launchctl.list.reject { |service| service.pid.to_i == 0 }.map(&:name)\n (required_services_for_ready - running_services).empty?\n end", "title": "" }, { "docid": "6d90afeea7131f97a071dd8c336373fc", "score": "0.56453025", "text": "def include?(file)\n return @dev if file.dev?\n return @wip_list.include?(file.basename) if file.wip?\n\n true\n end", "title": "" }, { "docid": "c426b340b4f473c9ed0006bd1b928696", "score": "0.563877", "text": "def use_service?\n !!@use_service\n end", "title": "" }, { "docid": "d6cf45a1e70251337fd7eed851016986", "score": "0.5637126", "text": "def is_app_running?(app_name)\n found = select_apps_by_line do |line|\n line.start_with?(\"#{app_name} \") && line.include?('started')\n end\n return found.count > 0\n end", "title": "" }, { "docid": "57da49710503526a234f187e8f576bc2", "score": "0.5632001", "text": "def running?\n\t\t\t@running.size > 0\n\t\tend", "title": "" }, { "docid": "aef4f6008a5a3e932b8c504cb667a560", "score": "0.56287247", "text": "def already_processed? path\n file_state[path.to_s] == true\n end", "title": "" }, { "docid": "2ecadac15cc0d50b47d5c75b288e7986", "score": "0.5627473", "text": "def from_service?(node)\n @services.include?(node.from.stripped.to_s.downcase)\n end", "title": "" }, { "docid": "2ecadac15cc0d50b47d5c75b288e7986", "score": "0.5627473", "text": "def from_service?(node)\n @services.include?(node.from.stripped.to_s.downcase)\n end", "title": "" }, { "docid": "3095e9ba46ad5670f03286eed0077a7a", "score": "0.56248945", "text": "def complete?\n return false if empty?\n return true if last.line =~ /handlers complete/\n return false if size < 2\n self[size - 2].line =~ /handlers complete/ ? true : false\n end", "title": "" }, { "docid": "b878b75ac3d8edc5dcf769dac40c9767", "score": "0.56232303", "text": "def physical_access?(_rec, libraries = [])\n libraries.any? { |x| x != 'ONLINE' }\n end", "title": "" }, { "docid": "fd610c9186a2f53d328ddec40a57edfc", "score": "0.56201744", "text": "def running?\n logs = Log.where(:file => file, \n :job_type => job_type, \n :state => \"running\",\n :export_id => export_id,\n :hostname => hostname)\n \n if logs.count > 0\n logs.each do |log|\n begin\n Process.getpgid(log.pid)\n puts \"still running #{log.file}\"\n return true\n rescue Errno::ESRCH\n log.mark_dead\n end\n end\n end\n \n return false\n end", "title": "" }, { "docid": "a3c6184f185e5e3f8ba0b28c32daa4d4", "score": "0.56176776", "text": "def can_generate_service_types\n if ServiceStore.service_definition_for( self.service_id ) \n service.service_types_generated\n else\n []\n end\n end", "title": "" }, { "docid": "e142a63ad6f80f09a1f76b9df74cabac", "score": "0.5608316", "text": "def has_service?(service)\n @service.key?(_uuid_service(service))\n end", "title": "" }, { "docid": "4a3d40fde727e73cbc664da1b66ebf84", "score": "0.5605649", "text": "def has_content?\n dsLocation.present? && File.exists?(filename)\n end", "title": "" } ]
c2e56c79672519d5f60b38189f655b11
Gets the total exp plus extra
[ { "docid": "ab82d6c13f4ea79f4f185d035ff3ce3a", "score": "0.8171573", "text": "def exp_total\n [h87_d_exp_total + @extra_exp, 0].max\n end", "title": "" } ]
[ { "docid": "15b531d7df7861d06214cb6f774a9182", "score": "0.74891216", "text": "def total_exp\n @minion + @creep + @structure + @hero + @trickle\n end", "title": "" }, { "docid": "a520ee1350f0f24c537ae26adfb3c873", "score": "0.6674053", "text": "def total_expenses\n self.dig_for_decimal(\"totalExpenses\")\n end", "title": "" }, { "docid": "4936a17f51a1d56bfdda7c459b823287", "score": "0.6594416", "text": "def get_exp(item)\n return BASE_EXP * item.synthesis_level / synthesis_level\n end", "title": "" }, { "docid": "cef4c29c58f3e55dcee0b9b974dfe2e9", "score": "0.65648514", "text": "def get_total_hours\n (self.std_hours.to_f + self.ext_hours.to_f)\n end", "title": "" }, { "docid": "344e6998e466cd78f3a1c7250cdfb47d", "score": "0.64222", "text": "def total_price_with_extra_costs\n total_price + extra_costs\n end", "title": "" }, { "docid": "fb21994eb9ae5d65e4a531eba287c004", "score": "0.6421582", "text": "def now_exp\r\n return @exp - @exp_list[@level]\r\n end", "title": "" }, { "docid": "2e9f5011e89ebe76410586e49e49c7b7", "score": "0.64195466", "text": "def now_exp\n return (@exp - @exp_list[@level])\n end", "title": "" }, { "docid": "2e9f5011e89ebe76410586e49e49c7b7", "score": "0.64195466", "text": "def now_exp\n return (@exp - @exp_list[@level])\n end", "title": "" }, { "docid": "350cd2c4182d9dc63c60928a8087bf7d", "score": "0.6416611", "text": "def calc_total\r\n String((@total_gold * 20.67 + @total_silver * 1.31).round(2))\r\n end", "title": "" }, { "docid": "4969bc98e478b7d92a205880f2c13926", "score": "0.63549757", "text": "def now_exp\n return @exp - @exp_list[@level]\n end", "title": "" }, { "docid": "4969bc98e478b7d92a205880f2c13926", "score": "0.63549757", "text": "def now_exp\n return @exp - @exp_list[@level]\n end", "title": "" }, { "docid": "99ba479fd8cdc5993db7d643576db670", "score": "0.6288886", "text": "def total_exp(expenses)\n total = 0\n expenses.each do |price|\n total = total + price\n end\n return total\nend", "title": "" }, { "docid": "e7ca81f50bb769e3babf57f5c3b57138", "score": "0.6281281", "text": "def energia\n\t\tresultado = 0;\n\t\t@alimentos.each {|i| resultado = resultado + i.kcal_total}\n\t\treturn resultado\n\tend", "title": "" }, { "docid": "9cb50dc715c044ad14dc32fe54c2491f", "score": "0.62709874", "text": "def getOrderPrice\n\t\treturn @extra_cost.to_d\n\t end", "title": "" }, { "docid": "1636c4af17dff23cdf88170c2e53d92a", "score": "0.6268495", "text": "def total_expenses\n sum_expenses(self.expenses)\n end", "title": "" }, { "docid": "08c46c0bc4686fa3c1e33c1d4c5c8c02", "score": "0.6239586", "text": "def cost \n return @extra_cost + @basic_med.cost\n end", "title": "" }, { "docid": "613a25cd985c1817cbf322cda3d09faf", "score": "0.62043047", "text": "def now_exp\n @exp - @exp_list[@level];\n end", "title": "" }, { "docid": "cd843612a28436c5fbde8e2ce3ecdd52", "score": "0.6183941", "text": "def estimated_total\n quantity * last_price\n end", "title": "" }, { "docid": "96d261016cacb4da060f8216dfb0e1ee", "score": "0.6182185", "text": "def gold_total\n [h87_d_gold_total + @extra_gold, 0].max\n end", "title": "" }, { "docid": "a1016cf73538d6c781be6b6ee7d0f6cc", "score": "0.61512375", "text": "def grace_payment_extra_savings_amount\n extra_savings_entries = self.transaction_entries.where( :transaction_entry_code => TRANSACTION_ENTRY_CODE[:grace_period_payment_extra_savings] )\n total_amount = BigDecimal(\"0\")\n \n extra_savings_entries.each do |te|\n total_amount += te.amount\n end\n return total_amount\n end", "title": "" }, { "docid": "144d1ac071f322b861935f6f8416af75", "score": "0.61489946", "text": "def formatted_total_expenses()\n self.total_expenses.to_s + ' ' + get_currency_symbol()\n end", "title": "" }, { "docid": "7adc6f89736a86e6cc84734408c5b6fd", "score": "0.6142017", "text": "def getOrderPrice\n\t\treturn @extra_cost.to_d\n\tend", "title": "" }, { "docid": "7adc6f89736a86e6cc84734408c5b6fd", "score": "0.6142017", "text": "def getOrderPrice\n\t\treturn @extra_cost.to_d\n\tend", "title": "" }, { "docid": "3c1fd2eae4001892b5b6fca06b5dc5e5", "score": "0.6139158", "text": "def avg_exp\n results = 0\n Mechanic.all.each do |mechanic|\n mechanic.years_experience += results\n end\n (results/Mechanic.count)\n end", "title": "" }, { "docid": "b79c06d4241cfed0ea530c282deebda1", "score": "0.6123797", "text": "def total_exp_pts\n total_exp = 0 \n self.user_skills.each do |user_skill|\n total_exp += user_skill.experience_pts\n end\n return total_exp\n end", "title": "" }, { "docid": "f875c6f1cdae5d35c82e731db2cc26f5", "score": "0.61003506", "text": "def independent_payment_extra_savings_amount\n \n extra_savings_entries = self.transaction_entries.where( :transaction_entry_code => [\n TRANSACTION_ENTRY_CODE[:extra_weekly_saving],\n TRANSACTION_ENTRY_CODE[:only_savings_independent_payment] \n ] )\n total_amount = BigDecimal(\"0\")\n \n extra_savings_entries.each do |te|\n total_amount += te.amount\n end\n return total_amount\n \n \n end", "title": "" }, { "docid": "6a627f027ed514a942ff258906612ca3", "score": "0.6088666", "text": "def exp\n only_numerics(clone: false).recode(&:exp)\n end", "title": "" }, { "docid": "182c58cc2152540c18b5148efe09a8dd", "score": "0.608042", "text": "def gastoEnergeticoTotal()\n \t(self.gastoEnergeticoBasal() + self.efectoTermogeno() + self.gastoActividadFisica()).round(2)\n \tend", "title": "" }, { "docid": "65d6b49db5c2f3896c33edfff59f78f5", "score": "0.6077345", "text": "def total_ev\n return @ev_hp+@ev_atk+@ev_dfe+@ev_spd+@ev_ats+@ev_dfs\n end", "title": "" }, { "docid": "13a14c3a6e5faec5a151f74356fb58cd", "score": "0.6058968", "text": "def total\n @base+@karma\n end", "title": "" }, { "docid": "100a0f0cfdf60c194548c9dac62e006e", "score": "0.6046589", "text": "def gastoEnergeticoTotal()\n (self.gastoEnergeticoBasal() + self.efectoTermogeno() + self.gastoActividadFisica()).round(2)\n end", "title": "" }, { "docid": "ca78535307b26e78065ac401a9988c13", "score": "0.6035857", "text": "def calculate_exp(targets)\n exp = 0\n if GTBS::EXP_PER_HIT\n for target in targets\n pre_exp = 0\n amount = target.level - self.level\n if amount <= -10\n pre_exp += 1\n else\n pre_exp += 10 + amount\n end\n if target.death_state?\n pre_exp *= 2\n end\n exp += pre_exp\n end\n else\n for target in targets.uniq\n if target.enemy? && target.death_state?\n exp += target.exp \n end\n end\n end\n return exp\n end", "title": "" }, { "docid": "c2d77891432c1396b24edca943228eae", "score": "0.60027516", "text": "def total_price\n res = prd_price\n res += afp_markup if afp_markup\n res\n end", "title": "" }, { "docid": "ebd6f8522471cc48eca9f60b0f68afe9", "score": "0.5997087", "text": "def total\n total = items_total\n return ('%.2f' % (total - total_discount(total))).to_f\n end", "title": "" }, { "docid": "47660d0c1f5a83824cdee35da1a2a519", "score": "0.5977465", "text": "def getredeemamount()\r\n return getvalueasfloat(SVTags::REDEEM_AMOUNT)\r\n end", "title": "" }, { "docid": "abe2f38b764c8a3558522eac18864899", "score": "0.59763235", "text": "def pi_exp exp\n 3.1416 ** exp\nend", "title": "" }, { "docid": "54e766a5364b50f45d4ad88f2c746f21", "score": "0.5945977", "text": "def total\n calculate_gold_worth + calculate_silver_worth\n end", "title": "" }, { "docid": "594987ee5280d2f6a618ecece1ae93fb", "score": "0.5941052", "text": "def money\n tot = @money\n tot += subenvelopes_money\n tot\n end", "title": "" }, { "docid": "4e8bbcb3bed9735f857193b213511ef0", "score": "0.59337693", "text": "def total_actual_effort\n self.effort_logs.inject(0){|sum, ef| sum + ef.effort}\n end", "title": "" }, { "docid": "70dd1ff95634f22b99468b70feb99639", "score": "0.59057313", "text": "def total_total\n remb_depense_total + net_total\n end", "title": "" }, { "docid": "eb890653069d53961910bc37da4f87b0", "score": "0.5903844", "text": "def calc_total\r\n @sell_price + @qty_ordered\r\n end", "title": "" }, { "docid": "7ae721d51d88549ab81477b1a87185ad", "score": "0.58955324", "text": "def total_amount\n grn_items.collect(&:total_amount).inject(:+) + other_charges.to_f\n end", "title": "" }, { "docid": "5993227ebce39e307d218d93932211f6", "score": "0.5893639", "text": "def added_price\n price = self.added_tipster * self.plan.adding_price\n price.round(2)\n end", "title": "" }, { "docid": "c39f94cceeebdcf873ecaefbdfdddd4e", "score": "0.5892425", "text": "def getredeemamount\r\n return getvalue(SVTags::REDEEM_AMOUNT)\r\n end", "title": "" }, { "docid": "34b5f5e6c933bd3441e4f58de141e566", "score": "0.5885527", "text": "def exp\n return @battler.exp\n end", "title": "" }, { "docid": "34b5f5e6c933bd3441e4f58de141e566", "score": "0.5885527", "text": "def exp\n return @battler.exp\n end", "title": "" }, { "docid": "34b5f5e6c933bd3441e4f58de141e566", "score": "0.5885527", "text": "def exp\n return @battler.exp\n end", "title": "" }, { "docid": "665ad9decb78f331e85747f7e4a0c6da", "score": "0.58830214", "text": "def exp_gain(exps)\n self.update_attribute(:exp,\"#{self.exp + exps}\")\n if self.exp >= self.exp_next\n self.update_attribute(:exp_next,\"#{self.exp_next + (10 * 2**(self.lvl))}\")\n self.update_attribute(:lvl,\"#{self.lvl + 1}\")\n self.update_attribute(:total_points,\"#{self.total_points + 1}\")\n end\n end", "title": "" }, { "docid": "0392294f6a8ad0d51a07124925a3e7a8", "score": "0.5880783", "text": "def etiny\n emin - precision + 1\n end", "title": "" }, { "docid": "a3777fc65c8317ee40f918e76ef6199f", "score": "0.5870139", "text": "def get_total_extra_points\n extra_marks.points.map(&:extra_mark).reduce(0, :+).round(2)\n end", "title": "" }, { "docid": "7010173b0855763918ae7df5f085b4e0", "score": "0.5860497", "text": "def etop\n emax - precision + 1\n end", "title": "" }, { "docid": "d9750a0dd6dc7193469460f4ca3818d2", "score": "0.5851688", "text": "def extra_charges\n @fare_response[\"extra_charges\"].reduce(0.0) {|sum, c| sum += c[\"charge\"]}\n end", "title": "" }, { "docid": "73d3b73411862fd09248d0864c274578", "score": "0.58507687", "text": "def total_logged_effort\n self.effort_logs.inject (0){|sum, ef| sum + ef.effort}\n end", "title": "" }, { "docid": "b363736d0729023b68adc68b8f2cdf6c", "score": "0.5850003", "text": "def calc_ener\n\t\treturn @alimentos.energia\n\tend", "title": "" }, { "docid": "7c46c5561164d28674e945a9e683b5d5", "score": "0.5844797", "text": "def total_amount_after_discount\n spend_amount_after_discount + @tip_returned_from_levelup\n end", "title": "" }, { "docid": "6f22a75c842064ae9dd674c5a6d5d6c3", "score": "0.5844141", "text": "def get_total_extra_points\n extra_marks.points.map(&:extra_mark).reduce(0, :+).round(1)\n end", "title": "" }, { "docid": "66ca1ee8ce06a624351ba47940258e2a", "score": "0.5842632", "text": "def cost \n return @extra_cost + @basic_shift.cost\n end", "title": "" }, { "docid": "4af467667c8b0436d6db7de4494a6729", "score": "0.58415663", "text": "def calculate_exp(submission)\n assessment = submission.assessment\n assessment_time = assessment.time_for(submission.course_user)\n\n end_at = assessment_time.end_at\n bonus_end_at = assessment_time.bonus_end_at\n total_exp = assessment.base_exp\n\n return 0 if end_at && submission.submitted_at > end_at\n\n total_exp += assessment.time_bonus_exp if bonus_end_at && submission.submitted_at <= bonus_end_at\n\n maximum_grade = submission.questions.sum(:maximum_grade).to_f\n\n (maximum_grade == 0) ? total_exp : (submission.grade.to_f / maximum_grade * total_exp)\n end", "title": "" }, { "docid": "d57eff17c88a494a4bbb3c8e70247d3c", "score": "0.5830143", "text": "def additional_dollars\n self.additional_cost.to_f/100\n end", "title": "" }, { "docid": "389d0c7e69f530ca36e25e757207c109", "score": "0.58262056", "text": "def gasto_energetico_total\n \n gasto_energetico_basal + efecto_termogeno + gasto_actividad_fisica\n \n end", "title": "" }, { "docid": "f54e4dc8f029d8fd965317f8ff26e0f2", "score": "0.5820771", "text": "def total\n sub_total + order_total_calculators.total\n end", "title": "" }, { "docid": "4332e671df437fe80483b2bcd3b1a2ba", "score": "0.581579", "text": "def add_em_up\n total = @stregnth + @speed + @wisdom +@alertness + @magic + @health\n end", "title": "" }, { "docid": "41ba2206267a1a0602530debc9a34f82", "score": "0.58099246", "text": "def total_cost\n meal_cost + tip\n end", "title": "" }, { "docid": "3cc3385cdeb5cc9935f93e7037a43fc1", "score": "0.58048546", "text": "def total_price_calc(final_price)\n\t\tprices = []\n\t\tprices << final_price\n\t\ttotal_amount = prices.inject(:+)\n\n\t\tputs \"Total amount: #{total_amount}\"\n\tend", "title": "" }, { "docid": "41f37bb01dc5299093c07b9399edece9", "score": "0.58039165", "text": "def total_amount\r\n quantity * unit_price\r\n end", "title": "" }, { "docid": "e07af0425c2d6acc028d9d47f11c8663", "score": "0.5796341", "text": "def exp_for_level(level)\n return (DND::EXP_FOR_LEVEL[level] * 1000).to_i\n end", "title": "" }, { "docid": "e07af0425c2d6acc028d9d47f11c8663", "score": "0.5796341", "text": "def exp_for_level(level)\n return (DND::EXP_FOR_LEVEL[level] * 1000).to_i\n end", "title": "" }, { "docid": "e07af0425c2d6acc028d9d47f11c8663", "score": "0.5796341", "text": "def exp_for_level(level)\n return (DND::EXP_FOR_LEVEL[level] * 1000).to_i\n end", "title": "" }, { "docid": "56a3e2df2139cf93f877b2286fc0187d", "score": "0.5794009", "text": "def total\n add_product = 0\n @products.each_value do |cost|\n add_product += cost\n end\n total = (add_product + (add_product * 0.075))\n return total.round(2)\n end", "title": "" }, { "docid": "ee022d773844caadde1f9ad79cb6d4ca", "score": "0.5789949", "text": "def get_totalPrice() #get_totalPrice method is used to calculate the total price.\n final_total = 0; # initialising final_total variable to 0\n final_total = orderItems[0]+orderItems[1]+orderItems[2]# since all the prices are pushed in to an array, each index of the array is added to the next one, to display the total price.\n end", "title": "" }, { "docid": "b91db1bfa458ec0a1d43438a83403933", "score": "0.57833356", "text": "def efEner\n self.alim_total.emisiones+self.alim_total.terreno\n end", "title": "" }, { "docid": "a438fdef961e8db0a17757d6fca8efff", "score": "0.5773098", "text": "def total_cost\n @total_cost ||= expenses.sum(:cost)\n end", "title": "" }, { "docid": "da1871e56b35d345d219e9f35c7f5ffa", "score": "0.5763609", "text": "def money()\n return @money\n end", "title": "" }, { "docid": "900e5bd7fed1fd13ab0969fb57455f97", "score": "0.5760545", "text": "def order_total_amount\n $tracer.trace(__method__)\n return ToolTag.new(td.className(create_ats_regex_string(\"ats-wis-ordertotal\")), __method__)\n end", "title": "" }, { "docid": "0465a6029a1efab44e904936b7e7510c", "score": "0.5757751", "text": "def total_price\n (subtotal + adjustments_total).round(2)\n end", "title": "" }, { "docid": "0672dfca4d05cd8c663c862b88393e31", "score": "0.57519937", "text": "def total\n sum = 0\n total = 0\n @products.each_value do |price|\n sum += price\n end\n return total = sum + (sum * 0.075).round(2)\n end", "title": "" }, { "docid": "14a51e4712b1f16871155be4184fba68", "score": "0.5749366", "text": "def total\n total = 0\n @products.each do |key, value|\n total += value\n end\n grand_total = (total * 1.075).round(2)\n return grand_total\n end", "title": "" }, { "docid": "4d35f06b3b8105fbd5f8478ad9fea66e", "score": "0.57491356", "text": "def grand_total\n 10000\n end", "title": "" }, { "docid": "fc9fc30a2c56a7e2f46b8b2e2e62d4a4", "score": "0.57460123", "text": "def total\n unless (valid?)\n raise \"Cannot total an invalid Earning: r: #{rate}, h: #{hours}\"\n end\n\n if (has_valid_amount)\n return amount\n else\n return hours * rate\n end\n end", "title": "" }, { "docid": "7f3e477e58515c010591e8f2622e102e", "score": "0.57453245", "text": "def extras_billing_total(year)\n result = query_strategy.extras_billing_total(year)\n if result.nil?\n value = 0\n else\n value = (result.first || 0)\n if result.size == 2\n value += (result.last || 0)\n end\n end\n return value\n end", "title": "" }, { "docid": "1044820716d612626e1809f09f270e47", "score": "0.5739829", "text": "def total\n check_promos\n Utils.show_price( total_price )\n end", "title": "" }, { "docid": "b5e759a734e659af0a8e9f5ad5cb041e", "score": "0.5737148", "text": "def calculated_total\n sub_total + adjustment_total\n end", "title": "" }, { "docid": "91f3588c434b43cff8c50f9bc3fa2f0f", "score": "0.5734203", "text": "def total\n total = 0\n products.each do |item, cost|\n total += cost + (cost * 0.075)\n end\n return total.round(2)\n end", "title": "" }, { "docid": "573cd1dd375819d2b59367b4a5854b96", "score": "0.5730886", "text": "def total\n tax = 0.075\n prices = products.values.sum\n grand_total = (prices * (1+tax)).round(2)\n return grand_total\n end", "title": "" }, { "docid": "dfba97a7366d1ad3b19fef80cf4f5867", "score": "0.57298887", "text": "def tot_reg\n tot_reg = 0\n tot_reg = (totall - tot_pay ).round(2)\n end", "title": "" }, { "docid": "02f6e81adc3d9223a1779d2ed7734e66", "score": "0.5726468", "text": "def total\n ret = 0\n ret += basket_items_total\n ret -= discount_total\n ret += self.booking_fee\n ret = sprintf('%.2f', ret).to_f\n return ret\n end", "title": "" }, { "docid": "33fe26cc9efdcddd10e18d0ca696dc44", "score": "0.5725873", "text": "def total()\n total_amount = 0.0\n @products.each do |product, price|\n if @products.empty?\n total_amount = 0.0\n else total_amount += price.to_f \n end\n end\n total_amount = (total_amount * 1.075)\n return (sprintf(\"%.2f\", total_amount).to_f)\n end", "title": "" }, { "docid": "0d3086f4d47eaa765fd77a58fc95c9ba", "score": "0.5725425", "text": "def total\n t = Money.new(0)\n self.items.each do |ii| \n t += ii.cost \n end \n t\n end", "title": "" }, { "docid": "ca670372fe5a2c8d9258fbba29bef8f2", "score": "0.5725142", "text": "def total\n \"%.2f\" % @total\n end", "title": "" }, { "docid": "5db9e277bd3b4efa4037997d224b17f4", "score": "0.5723986", "text": "def total\n sum = @products.values.inject(0) { |a, b| a + b }\n total = (sum + (sum * 0.075)).round(2)\n return total\n end", "title": "" }, { "docid": "5aeeb67f10f9d904f781c5272d034583", "score": "0.571965", "text": "def total\n self.items.sum(&:total) + self.tip + self.fee\n end", "title": "" }, { "docid": "a41fb29f4652ad8fe1f496c5a73f0cff", "score": "0.5718976", "text": "def total_money\n self\n end", "title": "" }, { "docid": "9ef2649e51cdf857233a071ab93a8b47", "score": "0.5718591", "text": "def total_reg\n total_reg = tax_calc + sub_totls + inv_fee + inv_delivery - inv_dicount\n end", "title": "" }, { "docid": "b4bb2b14a4421e6bb29bc1006f661d60", "score": "0.5718536", "text": "def total\n cart = Cart.find(self.cart_id)\n total = (cart.subtotal * TAXRATE) + cart.subtotal\n return total\n end", "title": "" }, { "docid": "a351acd7656d5b952ed9a212a643479c", "score": "0.5715131", "text": "def total\n amount\n # net #+ net_tax\n end", "title": "" }, { "docid": "bb1317d0ef48b1c35796a4a167f1169d", "score": "0.57123315", "text": "def total_amount\n total_amount = extract_base_amount + # from all still active member \n extract_run_away_weekly_bail_out_amount + # amount used to bail out the run_away weekly_resolution\n extract_premature_clearance_payment_amount - #premature clearance for that week \n extract_uncollectible_weekly_payment_amount\n \n return total_amount \n end", "title": "" }, { "docid": "a99fc6cece96b632d81c92ea5083bb18", "score": "0.5710219", "text": "def supplement_price\n\t\t\treturn self.final_price - self.basic_price\n\t\tend", "title": "" }, { "docid": "0ff815eeecfe02055bb99612423c2a04", "score": "0.57098", "text": "def GEI_total\n\t\tr = 0\n n = @alimentos.head\n i = @gramos.head\n\n while !n.nil?\n\n r += ((n.value.gei)*(i.value/100))\n n = n.next\n i = i.next\n end\n\n\t\t\n\n return (r).round(2)\n\tend", "title": "" }, { "docid": "e9f8ad853c73a06362bdb54c5999f4e7", "score": "0.57096803", "text": "def total\n @total = 0\n @products.each_value do |cost|\n @total += cost\n end\n #0.075 represents the sales tax \n @total += @total *= 0.075\n return @total.round(2)\n end", "title": "" }, { "docid": "4d96271282eed05465c52bccc1f11b37", "score": "0.57073855", "text": "def total_cost\n @total_cost = 0\n expenses.each do |expense|\n @total_cost += expense.cost\n end\n @total_cost\n end", "title": "" } ]
cc0b156fb5539c96b258ed0cd3a910a2
Verify the host is resolvable
[ { "docid": "2e5a784dd0875b2b5a298c50e417be23", "score": "0.7343679", "text": "def hibp_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(\"haveibeenpwned.com\")\n rescue RuntimeError, SocketError\n return false\n end\n\n true\n end", "title": "" } ]
[ { "docid": "2bcf2c1ca1ea2915a4c4d80285ff3747", "score": "0.8332332", "text": "def is_resolvable(host=self.host)\n begin\n Resolv.getaddress(host.hostname)\n true\n rescue Resolv::ResolvError\n false\n end\n end", "title": "" }, { "docid": "cdd41676a44e316fe8ecc8fd16facd7c", "score": "0.78055793", "text": "def resolvable?\n return true if hostname.blank?\n hostname_is_ip_address? || Resolv.getaddresses(hostname).any?\n end", "title": "" }, { "docid": "cc9a7141d5f74f763cf5789c7a0419ec", "score": "0.7326917", "text": "def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n resources = dns.getresources(host, Resolv::DNS::Resource::IN::A)\n debug(\"Checking for #{host} from Resolv::DNS: #{resources.inspect}\") if debug?\n resources.present?\n # :nocov:\n end", "title": "" }, { "docid": "fe5b5187c361cb98c2a4c03cf3b5c68e", "score": "0.73032486", "text": "def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n dns.getresources(host, Resolv::DNS::Resource::IN::A).any?\n # :nocov:\n end", "title": "" }, { "docid": "2c94d74e4ef1e3b9fdc8345fe9e787bb", "score": "0.7249832", "text": "def valid_remote_host?(host)\n false\n end", "title": "" }, { "docid": "2c94d74e4ef1e3b9fdc8345fe9e787bb", "score": "0.7249832", "text": "def valid_remote_host?(host)\n false\n end", "title": "" }, { "docid": "6b824de64ce95208d110ba87a85b6410", "score": "0.7218081", "text": "def has_required_host?\n true\n end", "title": "" }, { "docid": "6b824de64ce95208d110ba87a85b6410", "score": "0.7218081", "text": "def has_required_host?\n true\n end", "title": "" }, { "docid": "18bed184b5d56f39d73cbef71ab527dd", "score": "0.71331066", "text": "def sentry_resolve (sentry_host)\n begin\n Resolv::getaddress(sentry_host)\n return true\n rescue\n return false\n end\nend", "title": "" }, { "docid": "4259326ec702a2457d6de830f4eb167b", "score": "0.7075273", "text": "def check_host host\n !!HOST_RE.match(host)\n end", "title": "" }, { "docid": "796f0678fa5695ba0db77479c22eb860", "score": "0.705915", "text": "def resolvable?(type = nil)\n warn \"The `host` resource ignores #{type} parameters. Continue to resolve host.\" if !type.nil?\n resolve.nil? || resolve.empty? ? false : true\n end", "title": "" }, { "docid": "ee495d2bbf10f22fdde3607df5dc9cb5", "score": "0.7013813", "text": "def hostname?\r\n ResolverFactory.resolve ip?\r\n end", "title": "" }, { "docid": "4a2aeaa56a08dd4a86331b55c915c7cf", "score": "0.699986", "text": "def internal_host?(host)\n Resolv.getaddresses(host).all? { |ip| internal_ip?(ip) }\n rescue URI::Error\n false\n end", "title": "" }, { "docid": "a8e046cf26a99d187a769d947621cf10", "score": "0.69850117", "text": "def ensure_host\n end", "title": "" }, { "docid": "5a8bb65bed386f92c8e8547272dcb755", "score": "0.69587624", "text": "def hard_verify\n if !@connection || !cx_correct?\n refind_correct_host!\n end\n end", "title": "" }, { "docid": "825ef0a9ea7cd72a73585ede09af4259", "score": "0.69490016", "text": "def require_host?\n true\n end", "title": "" }, { "docid": "9e215e4c911ea1d20f403b9d40846ea3", "score": "0.68717456", "text": "def valid_host?(host)\n host == request.host\n end", "title": "" }, { "docid": "69b101d9e2ce31f06764b223dff1b3a6", "score": "0.6805884", "text": "def visit_host?(host)\n @host_rules.accept?(host)\n end", "title": "" }, { "docid": "ef7d2f05549d431895af07d86b15999c", "score": "0.67741907", "text": "def resolvable?\n record = resolver.getresource(name, Resolv::DNS::Resource::IN::A)\n\n record && !record.address.to_s.empty?\n rescue Resolv::ResolvError\n false\n end", "title": "" }, { "docid": "e0e8cb98d2e9b8169d7f9959d0c471bb", "score": "0.6771491", "text": "def host_known?(host)\n\t\ttracker=Wmap::HostTracker.instance\n if @data_dir\n tracker.data_dir = data_dir\n tracker.hosts_file = tracker.data_dir + \"/\" + \"hosts\"\n tracker.load_known_hosts_from_file(tracker.hosts_file)\n end\n tracker.host_known?(host)\n\tend", "title": "" }, { "docid": "c379856efec515b95fb1b4b9df84c63d", "score": "0.6768248", "text": "def is_host_exists(arg_host_name)\n url = '/host/' + arg_host_name\n output = get_rest_call(url)\n\n if output['pure_err_key'].nil?\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "7dc3b6fda7ab1290add1a1ba4b914426", "score": "0.67423874", "text": "def resolvconf_systemd_resolved_stub?\n !!ssh.file('/etc/resolv.conf').readlink && resolvconf_nameservers.include?('127.0.0.53')\n end", "title": "" }, { "docid": "5a3681270af0f5683b001fad573655ec", "score": "0.6734338", "text": "def host_found(host)\n nil\n end", "title": "" }, { "docid": "12d46771bf153aca848538619d4e8a44", "score": "0.6720583", "text": "def host_available?\n HostLookup.available? @host, @options[:host_timeout]\n end", "title": "" }, { "docid": "e63429422115a671d7f771ca21a00965", "score": "0.6653814", "text": "def validate_host_sanity\n info('Validating that the hostname is a FQDN', 'cyan')\n # Need to have a domain on the system\n if get_hostname.strip.split('.')[1..-1].empty?\n fail('Your system must have a fully qualified hostname of the form \"<hostname>.<domain>\"')\n end\n end", "title": "" }, { "docid": "a73c3025f165fce1fc722f644f3780ac", "score": "0.66465163", "text": "def resolve_hostname; end", "title": "" }, { "docid": "9f21561664bfca83f83dd6aa1b570763", "score": "0.66361827", "text": "def handled_host?(host)\n @hosts.include? host\n end", "title": "" }, { "docid": "7cfa8c42764076585048b6db907d92cd", "score": "0.6627306", "text": "def check_host(host)\n zbx.query(\n method: 'host.get',\n params: {\n filter: {\n 'host' => [host]\n },\n selectParentTemplates: ['host'],\n output: ['host']\n }\n )\n rescue Puppet::ExecutionFailure\n false\n end", "title": "" }, { "docid": "509dc370a93056f166017ed9375760ae", "score": "0.6624788", "text": "def prereq_dns_server_available\n verbose \"checking that the first server in /etc/resolv.conf responds\"\n server = nil\n File.open('/etc/resolv.conf').each_line do |line|\n next unless line =~ /^\\s*nameserver\\s+(\\S+)/\n server = $1\n break\n end\n if server.nil?\n do_fail <<-\"FAIL\"\n Your /etc/resolv.conf does not define any nameservers.\n Not much is going to work without DNS resolution.\n FAIL\n abort_tests\n end\n # just looking for a nameserver response. at this point we\n # don't much care if resolution is correct; what we want\n # is to avoid running a bunch more tests when the nameserver\n # is obviously broken.\n command = \"host -W 1 do-not-expect-to-resolve. #{server}\"\n # IPSocket.getaddress goes through /etc/hosts;\n # \"host\" uses DNS which is what we want.\n output = `#{command} 2>&1`\n unless output =~ /NXDOMAIN/\n do_fail <<-\"FAIL\"\n #{server} doesn't appear to respond to DNS requests.\n This command:\n #{command}\n should have returned NXDOMAIN to the request.\n Instead, it returned:\n #{output}\n Please check the following to resolve this issue:\n * Does /etc/resolv.conf have your correct nameserver?\n * Is your nameserver running?\n * Is the firewall on your nameserver open (udp:53)?\n * Can you connect to your nameserver?\n Not much is going to work without DNS resolution.\n FAIL\n abort_tests\n end\n end", "title": "" }, { "docid": "16ee2d391f63194938cc8055f9938159", "score": "0.6617433", "text": "def host_address_must_be_valid\n if host.kind_of? String\n begin\n resolved_host = ::Rex::Socket.getaddress(host, true)\n if host =~ /^\\d{1,3}(\\.\\d{1,3}){1,3}$/\n unless host =~ Rex::Socket::MATCH_IPV4\n errors.add(:host, \"could not be resolved\")\n end\n end\n self.host = resolved_host\n rescue\n errors.add(:host, \"could not be resolved\")\n end\n else\n errors.add(:host, \"must be a string\")\n end\n end", "title": "" }, { "docid": "6b89d4c298c221c59bb8f3ecc1fcf964", "score": "0.6616496", "text": "def check_host(host, options = { required: true })\n return true if hostname == host\n\n fail \"Error: #{hostname} does not match #{host}\" if options[:required]\n return nil\n end", "title": "" }, { "docid": "0e71fda54a3fe5998b6b025ecd5dca74", "score": "0.660711", "text": "def host_is_legal\n if host.blank?\n return\n end\n if /[a-z]/i.match host # alphanumeric\n test = /\\A((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/.match host\n else # ip address\n test = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/.match host\n end\n errors.add(:host, \"bad format\") unless test\n end", "title": "" }, { "docid": "0e71fda54a3fe5998b6b025ecd5dca74", "score": "0.660711", "text": "def host_is_legal\n if host.blank?\n return\n end\n if /[a-z]/i.match host # alphanumeric\n test = /\\A((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/.match host\n else # ip address\n test = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/.match host\n end\n errors.add(:host, \"bad format\") unless test\n end", "title": "" }, { "docid": "4a38c784118a3dc000b6dcc6e7f43f2a", "score": "0.65832627", "text": "def lookup_ok?\n return true unless self.usable?\n return true if self.name.empty?\n lookup == self.ip_address\n end", "title": "" }, { "docid": "f6c229f0107c90ed1da12b40ef0a8516", "score": "0.65774447", "text": "def isHostExists(arg_host_name, arg_host_iqnlist)\n url = \"/host/\"+arg_host_name\n output = getRestCall(url)\n \n if(output[\"pure_err_key\"]==nil)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "c5abf16fe4ab96eccb58471692a38df8", "score": "0.655508", "text": "def host?\n self.host\n end", "title": "" }, { "docid": "9ab0bb4d56660039f990d79021e4c299", "score": "0.65365547", "text": "def valid_vcenter_host?(address)\n # Net::HTTP.new(address).head('/').kind_of? Net::HTTPOK\n _result = `ping -q -c 3 #{address}`\n $CHILD_STATUS.exitstatus == 0 ? true : false\n end", "title": "" }, { "docid": "fc673307095d155ad2949fd5bc8ccb48", "score": "0.65245897", "text": "def host?\n hosts[host]\n end", "title": "" }, { "docid": "c3e6e7e7aec61c50c15ec680887892ef", "score": "0.65199095", "text": "def resolve_address(hostname)\n ::Resolv.getaddress hostname\nrescue\n 'localhost'\nend", "title": "" }, { "docid": "8990b6860bec177ef425d606069c90ee", "score": "0.65169317", "text": "def host_exists?(uri = '', redirects = 0)\n uri = URI.parse(uri == '' ? self.uri : uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 10 # seconds\n if uri.scheme == 'https'\n http.use_ssl = true\n if Rails.env == 'development'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE # TODO: IMPORTANT!! read into this\n end\n end\n path = \"/\"\n params = { }\n\n full_path = encode_path_params(path, params)\n request = Net::HTTP::Get.new(full_path) # try and load the front page\n\n request.body = params.to_json\n res = http.request(request)\n if res && res.kind_of?(Net::HTTPRedirection)\n logger.debug \"\\n host redirected #{self.uri} #{redirects} times\"\n if redirects<5\n host_exists?(res['location'], redirects+1) # Go after any redirect and make sure you can access the redirected URL\n else\n logger.error \"\\n host redirected too many times #{self.uri} (#{redirects} times)\"\n false\n end\n else\n logger.error \"\\n return code #{res.code} #{self.uri}\"\n !%W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families\n end\n rescue Errno::ENOENT\n logger.error \"\\nENOENT: error #{self.uri}\"\n false #false if can't find the server\n rescue Errno::ECONNREFUSED\n logger.error \"\\nECONNREFUSED: error #{self.uri}\"\n false # connection refused\n rescue Exception => e\n logger.error \"\\nException: #{self.uri} - #{e}\\n\"\n false\n end", "title": "" }, { "docid": "eafcf096ce6dc4987450c6b0b4715d1f", "score": "0.65028447", "text": "def check_host(url)\n if url.scheme !~ /^https?$/\n [422, {}, \"Invalid url: #{url}\"]\n else\n @options.host_checker.call url\n end\n end", "title": "" }, { "docid": "c6b4f0cf5ef9012851225d18192e9dae", "score": "0.6496625", "text": "def up?(host) #Method to test the Routers availabillity\n http = Net::HTTP.start(host, {open_timeout: 5, read_timeout: 5})\n response = http.head(\"/\")\n response.code == \"200\"\nrescue Timeout::Error, SocketError\n false\nend", "title": "" }, { "docid": "3102c780fd50fab089a46e92675ee988", "score": "0.6480079", "text": "def domain_resolves?(domain)\n domain = Addressable::URI.new(:host => domain).normalize.host\n resolve_without_errors { resolver.getaddress(domain) } ||\n resolve_without_errors { resolver.getresource(domain, Resolv::DNS::Resource::IN::NS) } ||\n resolve_without_errors { resolver.getresource(domain, Resolv::DNS::Resource::IN::MX) }\n end", "title": "" }, { "docid": "2f4630dddf59e2a662a2b884be6ddf1d", "score": "0.646926", "text": "def valid_host?(host)\n return false if host.nil?\n host = host.host if host.is_a?(URI)\n host == tenancy_host || tenancy_host_aliases.include?(host)\n end", "title": "" }, { "docid": "266d56997a2a35abe73cd8909cd61170", "score": "0.64664894", "text": "def resolve( hostname )\n raise NotImplementedError\n end", "title": "" }, { "docid": "6e9511cc6f3bfaa47d9fce098cbf6be0", "score": "0.64599663", "text": "def valid?(host)\n # TODO: replace with /\\.artsy.net$/\n # (it's stricter for now to generate test data)\n return true if host =~ /^www.artsy.net$/\n\n # TODO: uncomment after this is verified working, to ignore dev requests\n # return true if host == 'localhost'\n # return true if host == '127.0.0.1'\n\n false\nend", "title": "" }, { "docid": "a6082152b7fdec8d6437056ff5efac38", "score": "0.64361894", "text": "def match_internal_domain?(host)\n internal_domain == host\n end", "title": "" }, { "docid": "bb71c39698ef8c9f0d7d52fdfd248cca", "score": "0.6430626", "text": "def resolving?\n @status == :resolving\n end", "title": "" }, { "docid": "9d8c4bbe57856ebd2cbe0368f17dce46", "score": "0.64124966", "text": "def try_next_host\n DECISION_TRY_NEXT_HOST\n end", "title": "" }, { "docid": "8be89c4441d2994c31f2e2b16d6a48ee", "score": "0.6411184", "text": "def verify_target_dns(target_dns)\n # Seems like this is the only place that we are using the ServerApi--can we remove this or make the server API its\n # own gem?\n server_api = OpenStudio::Analysis::ServerApi.new(hostname: target_dns)\n unless server_api.alive?\n $logger.error \"ERROR: Server at #{server_api.hostname} is not alive\"\n return 1\n end\n $logger.info \"Found target_dns #{target_dns} alive\"\n $logger.debug \"Returned target_dns status: #{server_api.machine_status}\"\n target_dns\nend", "title": "" }, { "docid": "e318bab180e7d55e2c19d5ef6e9ddbb1", "score": "0.6399893", "text": "def registered?(host)\n !!registered_as(host)\n end", "title": "" }, { "docid": "5080f4748e214dd32f2361a0dfe17dde", "score": "0.6396339", "text": "def resolve( hostname )\n ::Resolv.getaddress hostname\n end", "title": "" }, { "docid": "bb262cc98e95567d4e8acd307354f864", "score": "0.6380638", "text": "def sv_resolves?\n responded = identifier.present? && (Utilities::Net.resolves?(identifier) rescue false)\n soft_validations.add(:identifier, \"Identifier '#{identifier}' does not resolve.\") unless responded\n responded\n end", "title": "" }, { "docid": "89f6b8f325d57b7a1ab44bf0896163f4", "score": "0.63772094", "text": "def check_config(require_host: false, &notify)\n config = cartage.config(for_plugin: :remote)\n\n puts \"#{__method__}: verify_hosts(#{config.hosts.inspect})\"\n verify_hosts(config.hosts, &notify)\n\n if require_host\n name = config.host || 'default'\n fail \"No host #{name} present\" unless config.hosts.dig(name)\n end\n\n true\n end", "title": "" }, { "docid": "8e48b82ecd3a4d8621d24a798801aa31", "score": "0.6355886", "text": "def check_host_results\n self.host_results.each do |hresult|\n if (!self.service.host_ids.include?(hresult.host_id))\n errors.add(:host_results, 'has a host_result with an unlinked host')\n return false\n end\n end\n\n return true\n end", "title": "" }, { "docid": "8d4dab3f2d88835dcb28f305c034dfef", "score": "0.6349375", "text": "def verify_googlebot_domain\n hostname = Resolv.getname(request.remote_ip)\n # Structure of lookup return is:\n # [\"AF_INET\", 80, \"66.249.66.1\", \"66.249.66.1\", 2, 2, 17]\n ip = Socket.getaddrinfo(hostname, \"http\").first[2]\n\n hostname =~ /.googlebot.com\\Z/ && ip == request.remote_ip\n end", "title": "" }, { "docid": "75b513b5074c18a570d8c9318fbd442b", "score": "0.63457656", "text": "def valid_remote?\n self.class.valid_remote? url\n end", "title": "" }, { "docid": "83220bc40eb07799094e8c69cebefb7a", "score": "0.6339235", "text": "def do_ssl_verify?\n if target_hostname == \"localhost\" ||\n target_hostname == \"a2-dev.test\" ||\n target_hostname =~ /\\d+\\.\\d+\\.\\d+\\.\\d+/\n return false\n end\n return true\n end", "title": "" }, { "docid": "534a4fe7165fea4bee60ecc7b9edd32b", "score": "0.63170797", "text": "def validate\n return unless @options[:validate]\n\n validate_host(@hosts, @options)\n end", "title": "" }, { "docid": "be5e5ffdf6625b7ca2f525b8be0e7205", "score": "0.6301498", "text": "def be_a_host\n end", "title": "" }, { "docid": "4d2f6f15bf0598a82d040af64a5075b5", "score": "0.629664", "text": "def wait_until_host_is_available(host, get_ip=false)\n resolved_host = Resolv.getaddresses(host).first\n if resolved_host.nil?\n print(\"Waiting for #{host} to resolve\")\n wait_until('ready!') { resolved_host = Resolv.getaddresses(host).first }\n end\n host = resolved_host if get_ip\n unless remote_is_available?(host)\n print(\"Waiting for #{host} to accept connections\")\n wait_until('ready!') { remote_is_available?(host) }\n end\n return host\n end", "title": "" }, { "docid": "64ca55433df1856e7b6c8558fefed604", "score": "0.62957686", "text": "def host_found(host)\n @policy.host_found(host) if @ips.include?(host.ip)\n end", "title": "" }, { "docid": "8be17a5260cd17ac99e0fad6348a0670", "score": "0.62920004", "text": "def domain_resolves?(domain)\n resolver.search(domain).header.anCount > 0 ||\n resolver.search(domain, Net::DNS::NS).header.anCount > 0 ||\n resolver.search(domain, Net::DNS::MX).header.anCount > 0\n end", "title": "" }, { "docid": "7ac2a4ea37979fbf8f914a5d7ece3de3", "score": "0.6283074", "text": "def check_host\n @account = Account.factory params[:type]\n begin\n @url = UrlChecker.check_url( params[:host] )\n rescue Exception => e\n @e = e\n end\n render( :layout => false )\n end", "title": "" }, { "docid": "727589cff5b303d695eee5b457afbe44", "score": "0.6282345", "text": "def host?\n _hostmask == 0\n end", "title": "" }, { "docid": "93c1cc9f4f5999db23e0ba5a1d24cbbc", "score": "0.6253987", "text": "def net_service_discovery?\n original_host =~ /_[-a-z0-9]+._[-a-z0-9]+./\n end", "title": "" }, { "docid": "54fa8eb02a2a0753c1b3729b928525c0", "score": "0.62518615", "text": "def check_address\n begin\n # Try to resolve the address\n ip = Resolv.getaddress(self.address)\n return true\n rescue Resolv::ResolvError\n # If an error raises, add it to the response\n errors.add(:address, 'invalid address')\n return false\n end\n end", "title": "" }, { "docid": "ed09071c3f19909bdde6fa76288843eb", "score": "0.621435", "text": "def sub_domain_known?(host)\n\t\ttracker=Wmap::HostTracker.instance\n if @data_dir\n tracker.data_dir = data_dir\n tracker.hosts_file = tracker.data_dir + \"/\" + \"hosts\"\n tracker.load_known_hosts_from_file(tracker.hosts_file)\n end\n tracker.sub_domain_known?(host)\n\tend", "title": "" }, { "docid": "d7add45840aa9f1de0055ebbd8133206", "score": "0.6207646", "text": "def host_reachable?(target='www.google.com', timeout=10, service=80)\n Ping.pingecho(target, timeout, service)\n end", "title": "" }, { "docid": "c2e50547cabd65700a2748c71962de6b", "score": "0.62069523", "text": "def domain_exists?(domain)\n begin\n Socket.gethostbyname(domain)\n rescue SocketError\n return false\n end\n return true\nend", "title": "" }, { "docid": "95638dde09310bb39794a4755d36c241", "score": "0.620472", "text": "def domain_resolves?(domain)\n resolver.search(domain).header.anCount > 0 ||\n resolver.search(domain, Net::DNS::NS).header.anCount > 0 ||\n resolver.search(domain, Net::DNS::MX).header.anCount > 0\n end", "title": "" }, { "docid": "f7191d43932ff3de6ac8a8cd62940737", "score": "0.6203948", "text": "def reachable?(hostname = 'www.google.com', &block); end", "title": "" }, { "docid": "24b11b0509d3de0993537827ac79a104", "score": "0.61608785", "text": "def reachable?\n validate\n true\n rescue\n false\n end", "title": "" }, { "docid": "95f724c775e90d646c861844c36058f4", "score": "0.6151682", "text": "def external_collision_check\n existing = used_ports\n @env.env.config.vm.forwarded_ports.each do |name, options|\n if existing.include?(options[:hostport].to_i)\n handle_collision(name, options, existing)\n end\n end\n end", "title": "" }, { "docid": "975d177731e98638d2656a6ca27f4fca", "score": "0.614814", "text": "def local_address?(host)\n host =~ /\\A127\\.0\\.0\\.1\\Z|\\A(10|172\\.(1[6-9]|2[0-9]|30|31)|192\\.168)\\.|\\A::1\\Z|\\Afd[0-9a-f]{2}:.+|\\Alocalhost\\Z|\\Aunix\\Z|\\Aunix:/i\n end", "title": "" }, { "docid": "5f8f9fd44d95c558bf58aaf3af020a1c", "score": "0.61418074", "text": "def resolve(node)\n begin\n resolve! unless valid?\n valid?\n rescue Resolv::ResolvError, SocketError => e\n node.instrument(Node::WARN, prefix: \" BONES-RPC:\", message: \"Could not resolve IP or UNIX path for: #{original}\")\n node.down and false\n end\n end", "title": "" }, { "docid": "215d1140fde062f08bbafe88184c5285", "score": "0.61176467", "text": "def determine_hosts; end", "title": "" }, { "docid": "6b6304f74871a68e92b129e2fb3129a1", "score": "0.6116344", "text": "def host?\n return @type == 'host'\n end", "title": "" }, { "docid": "0062aef555f17f47ea04855b3ae94e67", "score": "0.6108914", "text": "def includes?(host)\n #\n # Pick out hostnames from URIs.\n #\n if host =~ /^[a-z][a-z0-9+-]+:\\/\\//\n begin \n uri = URI.parse(host)\n host = uri.host unless uri.host.nil?\n host = $1 if host =~ /^\\[([0-9a-f:]+)\\]$/i\n rescue URI::InvalidURIError => ex\n # ugh\n logger.warn \"Did not recognise URI #{host}\"\n end\n end\n\n host_as_ip = nil\n\n begin\n host_as_ip = IPAddress.parse(host)\n rescue ArgumentError\n # Rescue IPAddress argument errors, i.e. host is not an IP address.\n end\n\n return true if self.list.any? do |l|\n case l\n when String\n host == l\n when Regexp\n host =~ l\n when IPAddress \n host_as_ip.is_a?(l.class) and l.include?(host_as_ip)\n else\n false\n end\n end\n\n #\n # To cut down the amount of DNS queries, we'll bail out at this point.\n #\n return false if true == Configuration.current.minimal_dns_lookups\n\n return false unless self.list.any?{|l| l.is_a?(IPAddress)}\n\n ips = MauveResolv.get_ips_for(host).collect{|i| IPAddress.parse(i)}\n\n return false if ips.empty?\n\n return self.list.select{|i| i.is_a?(IPAddress)}.any? do |list_ip|\n ips.any?{|ip| ip.is_a?(list_ip.class) and list_ip.include?(ip) }\n end\n \n return false\n end", "title": "" }, { "docid": "3efe563334b4171c569e8757488e2b66", "score": "0.6107038", "text": "def resolve(node)\n return super_resolve(node) unless EventMachine.reactor_thread?\n em_each_address(host).each do |ip|\n if ip =~ Resolv::IPv4::Regex\n @ip ||= ip\n break\n end\n end\n raise Resolv::ResolvError unless @ip\n @resolved ||= \"#{ip}:#{port}\"\n rescue Timeout::Error, Resolv::ResolvError, SocketError\n Loggable.warn(\" MOPED:\", \"Could not resolve IP for: #{original}\", \"n/a\")\n node.down! and false\n end", "title": "" }, { "docid": "85ae630b578314eed4c63308ef24ad07", "score": "0.6102359", "text": "def do_dns_lookup\n self.host = Socket.getaddrinfo(self.ip, nil)[0][2] if SERVER_REVERSE_DNS_LOOKUP\n end", "title": "" }, { "docid": "37121723eede756011213779e1efdeb2", "score": "0.6100151", "text": "def ensure_reachable!(server_url, server_display_name)\n unless server_reachable?(server_url)\n abort \"FAIL: Unable to connect to #{server_display_name} at #{server_url} \"\n end\n end", "title": "" }, { "docid": "f80279270b1926e88a3b908f09c77107", "score": "0.6098202", "text": "def host_exist?(hostname)\n get_host_id(hostname) ? true : false\n end", "title": "" }, { "docid": "c9888553dfbfaa6dfd786f24ca0b616c", "score": "0.6090264", "text": "def host_range?(host_ip)\n ! IPAddr.new(\"#{host_ip}/32\").ipv4?\n rescue StandardError\n true\n end", "title": "" }, { "docid": "e1ae65c110c3a6355b70f240a2c0925d", "score": "0.60882056", "text": "def check_connection?\n require 'net/ping/external'\n\n # URI library cannot handle git urls, so just convert it to a standard url.\n temp_url = url.dup.to_s\n temp_url = temp_url.sub(':', '/').sub('git@', 'https://') if temp_url.start_with?('git@')\n\n host = URI.parse(temp_url).hostname\n\n $log.debug(\"pinging '#{host}' to verify network connection\")\n ext_ping = Net::Ping::External.new(host)\n\n result = ext_ping.ping?\n $log.debug(\"ping failed: #{ext_ping.exception}\") unless result\n\n result\n end", "title": "" }, { "docid": "65a6d866f964f466de39f9dd9c56fac5", "score": "0.60851294", "text": "def preflight_check\n @client_hosts.all? { |client_host| test_client(client_host) }\n end", "title": "" }, { "docid": "e7eb77dde95ba6a0d7fefb953de6b7af", "score": "0.6082111", "text": "def resolve?\n \tresolved?\n end", "title": "" }, { "docid": "8c7e034f8ec87d7214dd0b1966f639de", "score": "0.60791236", "text": "def hosted?\n @host.hosted?(@external_id) ? true : false\n end", "title": "" }, { "docid": "b96c69652df4f76bb707c75b1dd15d43", "score": "0.6075061", "text": "def reverse_host\n @reverse_host ||= Resolv.getname(host)\n rescue Resolv::ResolvError => e\n 'unknown'\n end", "title": "" }, { "docid": "a03fdd7da9c712cb84f78ad05d9d5158", "score": "0.60694146", "text": "def verify_ssl_host\n @opts.has_key?(:verify_ssl_host) ? @opts[:verify_ssl_host] : $setting.dig(:triglav, :verify_ssl_host)\n end", "title": "" }, { "docid": "d1412471874b27d2bbfa7884dd7d1d51", "score": "0.60651195", "text": "def valid?\n begin\n @host = Rex::Socket.getaddress(@host, true)\n rescue\n return false\n end\n @port.kind_of?(Integer) && @port >= 0 && @port <= 65535 && @timeout.kind_of?(Integer)\n end", "title": "" }, { "docid": "fe59a45f72f150f488087dd137d46b2d", "score": "0.6061748", "text": "def ssl_verify_host?\n ssl_verify_host.nil? ? false : (ssl_verify_host > 0)\n end", "title": "" }, { "docid": "516788561bf76173964379b2ad99c5e6", "score": "0.60542357", "text": "def faulty?(hostname)\n faulty_host_cache_get(hostname).first >= 3\n end", "title": "" }, { "docid": "c421b941161b076347cd384e04c268ed", "score": "0.60492545", "text": "def check_host(hostname)\n params.symbolize_keys!\n domain = Onlinenic::Domain.new(hostname)\n @response = @wrapper.check_host({ :domaintype => domain.type, :hostname => hostname })\n logout if @opts[:auto_logout]\n @response.try(:success?) ? @response.get_data(\"avail\").eql?(\"1\") ? true : false : nil\n end", "title": "" }, { "docid": "7139a6b862d436dc58277663a6f85395", "score": "0.6046709", "text": "def link_local?(ip)\n IPAddr.new(ip).link_local?\nrescue IPAddr::Error\n false\nend", "title": "" }, { "docid": "70709aee24489d9bda2b9d4b25890b78", "score": "0.6046145", "text": "def check\n Utils.fail('Not a valid bare metal host') if @provider.nil?\n end", "title": "" }, { "docid": "72945965a44bf31adfad1f46beec61ea", "score": "0.6043681", "text": "def up?(host)\n check = Net::Ping::External.new(host)\n check.ping?\n end", "title": "" }, { "docid": "0f099de68ae2f14284d1f74a537dc54c", "score": "0.6041222", "text": "def ensure_reachable!(server_url, server_display_name = nil)\n unless server_reachable?(server_url)\n failure_message = server_display_name ? \"#{server_display_name} at #{server_url}\" : server_url\n puts \"FAIL: Unable to connect to #{failure_message}\"\n exit 1\n end\n end", "title": "" }, { "docid": "fb85af0696e487facc3868f3fc60c461", "score": "0.6037355", "text": "def coalescable?(connection)\n if @io.protocol == \"h2\" &&\n @origin.scheme == \"https\" &&\n connection.origin.scheme == \"https\" &&\n @io.can_verify_peer?\n @io.verify_hostname(connection.origin.host)\n else\n @origin == connection.origin\n end\n end", "title": "" }, { "docid": "d65b669821ed8d5963aafae293b11ee9", "score": "0.60304636", "text": "def resolvable?\n sha1\n true\n rescue R10K::Git::UnresolvableRefError\n false\n end", "title": "" } ]
5fe3a6a67276d5332008c10765b318ed
The default log format.
[ { "docid": "7fa724cb713cd600f1583c5d9552cb6d", "score": "0.0", "text": "def default(options = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "0a5df103da3c021585b08f857192f3d6", "score": "0.8049831", "text": "def log_format\n if configuration.log_format.nil? || configuration.log_format.empty?\n format = '%{KIND}: %{message} on line %{line}'\n format.prepend('%{path} - ') if configuration.with_filename\n format.concat(' (check: %{check})')\n configuration.log_format = format\n end\n\n configuration.log_format\n end", "title": "" }, { "docid": "5ddc73e44babd648fd0855af857cd306", "score": "0.7844659", "text": "def default_formatter\n if protocol == :syslog\n # Format is text output without the time\n SemanticLogger::Formatters::Default.new(time_format: nil)\n else\n SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)\n end\n end", "title": "" }, { "docid": "edeae8db01fc52af57d31be0d3f4ea65", "score": "0.7661886", "text": "def log_formatter; end", "title": "" }, { "docid": "edeae8db01fc52af57d31be0d3f4ea65", "score": "0.7661886", "text": "def log_formatter; end", "title": "" }, { "docid": "82108c12f5101710fb1f0ffd7595ec4c", "score": "0.7596713", "text": "def default_formatter\n SemanticLogger::Formatters::Default.new\n end", "title": "" }, { "docid": "219c24172b047d6175aa8a5c24624054", "score": "0.7334304", "text": "def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end", "title": "" }, { "docid": "79ed55f0eef9eaf19419a223de48bd70", "score": "0.71524215", "text": "def log_formatter=(_arg0); end", "title": "" }, { "docid": "79ed55f0eef9eaf19419a223de48bd70", "score": "0.71524215", "text": "def log_formatter=(_arg0); end", "title": "" }, { "docid": "a4b4aee7802f53d9e430dbaf1cafced2", "score": "0.71180606", "text": "def default_formatter\n SemanticLogger::Formatters::Raw.new\n end", "title": "" }, { "docid": "9a2be044166b8ff5fd5081cd0654c930", "score": "0.6880825", "text": "def datetime_format\n @logger.first.datetime_format\n end", "title": "" }, { "docid": "6e58f885b25703a1fbba20aad14bcb6e", "score": "0.6824798", "text": "def to_log_format\n @log_format ||= begin\n attributes = []\n attributes << \"#{LOG_ATTR_ENV}=#{env}\" unless env.nil?\n attributes << \"#{LOG_ATTR_SERVICE}=#{service}\"\n attributes << \"#{LOG_ATTR_VERSION}=#{version}\" unless version.nil?\n attributes << \"#{LOG_ATTR_TRACE_ID}=#{trace_id}\"\n attributes << \"#{LOG_ATTR_SPAN_ID}=#{span_id}\"\n attributes << \"#{LOG_ATTR_SOURCE}=#{Core::Logging::Ext::DD_SOURCE}\"\n attributes.join(' ')\n end\n end", "title": "" }, { "docid": "5378504b0ab0bcc5b3d34a5b4acd920e", "score": "0.6811701", "text": "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "title": "" }, { "docid": "5378504b0ab0bcc5b3d34a5b4acd920e", "score": "0.6811701", "text": "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "title": "" }, { "docid": "5378504b0ab0bcc5b3d34a5b4acd920e", "score": "0.6811701", "text": "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "title": "" }, { "docid": "e301557d31005341bfd03bbc1df049cc", "score": "0.6766961", "text": "def default_format=(format)\n @default_format = format\n end", "title": "" }, { "docid": "9cbf1fe15b1249c005b0118a8c92d631", "score": "0.67632854", "text": "def format\n @format ||= self._format_default\n end", "title": "" }, { "docid": "ff4cdc63e729b79eb798d430b35f20ca", "score": "0.6550425", "text": "def default_format\n @default_format ||= :html\n end", "title": "" }, { "docid": "d190d7045e1ee751e43273e21586ca24", "score": "0.64534765", "text": "def datetime_format\n @loggers.each do |logger|\n return logger.datetime_format if logger.respond_to?(:datetime_format)\n end\n end", "title": "" }, { "docid": "68769dfc89fc2cbc24ed3d7a7d828719", "score": "0.6387984", "text": "def default_formatter\n Sapience::Formatters::Default.new\n end", "title": "" }, { "docid": "f947e4f1ccdee1006908cb742d0e9e6e", "score": "0.63833725", "text": "def default_format(*value)\n set_format(@entry_format_default, *value)\n end", "title": "" }, { "docid": "06607c9319127fcd5b06667cee2e3e31", "score": "0.6376057", "text": "def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "5ec6679e82149b3ffad65bbd20291f73", "score": "0.6306496", "text": "def set_loggers_format\n [@logger, @logger_stderr].each do |logger|\n logger.formatter = proc do |severity, _datetime, progname, msg|\n # If the message already has control characters, don't colorize it\n keep_original_color = msg.include? \"\\u001b\"\n message = \"[#{Time.now.utc.strftime('%F %T')} (PID #{$PROCESS_ID} / TID #{Thread.current.object_id})] #{severity.rjust(5)} - [ #{progname} ] - \"\n message << \"#{msg}\\n\" unless keep_original_color\n LEVELS_MODIFIERS[severity.downcase.to_sym].each do |modifier|\n message = message.send(modifier)\n end\n message << \"#{msg}\\n\" if keep_original_color\n message\n end\n end\n end", "title": "" }, { "docid": "c78dbebb3d2a324e5bcc345d33e3137a", "score": "0.62810254", "text": "def formatter\n @formatter ||= Formatters::Default.new\n end", "title": "" }, { "docid": "ea353f8b8aff6eedb62523af27261bca", "score": "0.62266797", "text": "def default_options_date_format(format)\n format || '%Y-%m-%d - %l:%M:%S%p'\n end", "title": "" }, { "docid": "b5d0fcd99c777fff33e1c2a063aebbf9", "score": "0.6206122", "text": "def default_log_file_name\n @options['log_file_name'] || \"#{@name}.log\"\n end", "title": "" }, { "docid": "a1fa002dbbbe55c9eb2d638f8bad0bf7", "score": "0.6184819", "text": "def format\n @format ||= {}\n end", "title": "" }, { "docid": "7ea3160793df5ad6e729e9acb91955cc", "score": "0.618013", "text": "def log(s, type = :info)\n\t\tcolor = :gray\n\t\tcase type\n\t\twhen :error\n\t\t\tcolor = :red\n\t\twhen :warning\n\t\t\tcolor = :yellow\n\t\twhen :debug\n\t\t\tcolor = :purple\n\t\tend\n\t\tsuper _fmt(color, s), type\n\tend", "title": "" }, { "docid": "9c4c651f745008c6f5283309695a0d27", "score": "0.6154767", "text": "def configure_logging(logger)\n logger.level = LOG_LEVEL\n logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n logger.formatter = proc do |severity, datetime, progname, msg|\n color = case severity\n when \"DEBUG\" then :light_white\n when \"INFO\" then :light_yellow\n when \"WARN\" then :light_red\n when \"ERROR\" then :blue\n when \"FATAL\" then :magenta\n when \"UNKNOWN\" then :cyan\n end\n \"#{datetime}: #{msg.colorize(color)}\\n\"\n end\n logger\nend", "title": "" }, { "docid": "c45605dbf18da959b2a9f297bda92e97", "score": "0.608477", "text": "def format(name=nil)\n @format = name.to_s if name\n @format || DEFAULT_FORMAT\n end", "title": "" }, { "docid": "9cb34f8aa139fa8842881d3bb242667a", "score": "0.6082504", "text": "def default_format\n case input_type\n when :bootstrap_date\n I18n.t('date.formats.default')\n when :bootstrap_date_time\n I18n.t('time.formats.default')\n end\n end", "title": "" }, { "docid": "05a83788cfdcee93808488c69cd542f0", "score": "0.60734695", "text": "def default_format= format\n @worksheet.add_format format if @worksheet\n @default_format = format\n end", "title": "" }, { "docid": "2ccb492dbcfb77061c2bb480bf33e4c1", "score": "0.6070425", "text": "def log_level; end", "title": "" }, { "docid": "2ccb492dbcfb77061c2bb480bf33e4c1", "score": "0.6070425", "text": "def log_level; end", "title": "" }, { "docid": "6c031e07d4dbada67a5835d43ce9ab5b", "score": "0.60651124", "text": "def datetime_format\n @default_formatter.datetime_format\n end", "title": "" }, { "docid": "686d8e9248b638b3047e3329a1fa765f", "score": "0.60622597", "text": "def defaultLogger(opts=nil, parser=nil)\n if opts && parser\n #noinspection RubyArgCount\n result = Logger.new(opts[:logFile] || 'dataMetaXtra.log', 'daily', 10*1024*1024)\n result.level = case opts[:level] ? opts[:level].downcase[0] : 'i'\n when 'd'\n Logger::DEBUG\n when 'i'\n Logger::INFO\n when 'w'\n Logger::WARN\n when 'e'\n Logger::ERROR\n else\n parser.educate\n raise \"Invalid log level #{opts[:level]}\"\n end\n result.datetime_format = '%Y-%m-%d %H:%M:%S'\n result\n else\n result = Logger.new($stdout)\n result.level = Logger::WARN\n result\n end\n end", "title": "" }, { "docid": "e785c058d423784219302c3a2adf6c08", "score": "0.60541725", "text": "def datetime_format\n @default_formatter.datetime_format\n end", "title": "" }, { "docid": "9d64d699b322c7dcc0a11ed2cd8392c1", "score": "0.6052895", "text": "def set_format *args\n global, format = args.fetch_opts [nil], :type => :console, :time => [\"%H:%M:%S\", \"%03d\"] \n format = if format[:type] == :html; {\n :caller => \"<a class='l'>%f:%l</a> <a class='m'>:%m</a>\", \n :format => \"<div class='line'><a class='t'>%time</a> <a class='%mode'>%mode</m> [%caller]: <p>%text</p>%att</div>\",\n :att =>\"<div class='att'><div class='hide'>+</div><pre>%s</pre></div>\",\n :serializer => RMTools::RMLogger::HTML\n }; else {\n :caller => \"#{@c.gray('%f:%l')} #{@c.red_bold(':%m')}\", \n :format => \"%time %mode [%caller]: %text\"\n } end.merge format\n if global\n _set_format @default_format, format\n else\n _set_format(file_format={}, format)\n @file_formats[File.expand_path(caller[0].till ':')] = file_format\n end\n end", "title": "" }, { "docid": "7baf49bdbf6b82c3cba2543a04c987b5", "score": "0.60361135", "text": "def logger\n @logger ||= Logger.new(@log_file_name)\n\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"%s, [%s #%d] (%s) %5s -- %s: %s\\n\" % [severity[0..0], datetime, $$, Conf.global_conf[:hostname], severity, progname, msg]\n end\n\n if Conf.global_conf[:debug]\n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::INFO\n end\n @logger\n end", "title": "" }, { "docid": "3f68fdd1b009d4d8fe602e973ab4837a", "score": "0.6018966", "text": "def colorize_logging; end", "title": "" }, { "docid": "1ae24558998fc23dac909cff58cf7aef", "score": "0.60167396", "text": "def formatter=(_arg0); end", "title": "" }, { "docid": "1ae24558998fc23dac909cff58cf7aef", "score": "0.60167396", "text": "def formatter=(_arg0); end", "title": "" }, { "docid": "1ae24558998fc23dac909cff58cf7aef", "score": "0.60167396", "text": "def formatter=(_arg0); end", "title": "" }, { "docid": "45ba7437301bd3eb294888f7416b6734", "score": "0.6012227", "text": "def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n \"#{progname}##{caller_method}\",\n msg.dump)\n end\n end", "title": "" }, { "docid": "772bc6702414037ac361bf9cc7791b2f", "score": "0.599389", "text": "def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end", "title": "" }, { "docid": "fe89a9ca24e22416dbc7814376cb44cc", "score": "0.5988815", "text": "def default_format\n @default_format || @worksheet.default_format || @workbook.default_format\n end", "title": "" }, { "docid": "4ef96e097d7de27afecb8a3cb9995c2d", "score": "0.59539753", "text": "def format!(logger)\n logger.formatter = proc { |severity, datetime, progname, msg| \"#{msg}\" }\n end", "title": "" }, { "docid": "f7ef3183507c2c6cd793ee999f89e0bf", "score": "0.5944471", "text": "def format\n @_format\n end", "title": "" }, { "docid": "43aca604ded9846bee28172a42a0f959", "score": "0.5937374", "text": "def format_log(msg)\n msg = colorize_log(msg)\n msg = remove_prefix(msg)\n \"#{msg}\\n\"\n end", "title": "" }, { "docid": "45cb8c0810214262ad4f5911a588dfc3", "score": "0.5928984", "text": "def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end", "title": "" }, { "docid": "b226d78bc4336097802b6efe88442bbc", "score": "0.59281355", "text": "def formatter; end", "title": "" }, { "docid": "b226d78bc4336097802b6efe88442bbc", "score": "0.59281355", "text": "def formatter; end", "title": "" }, { "docid": "b226d78bc4336097802b6efe88442bbc", "score": "0.59281355", "text": "def formatter; end", "title": "" }, { "docid": "c695500424c1c47b2fbaf76a590b4dbc", "score": "0.59206885", "text": "def formatter fmt\n @formatter = fmt\n end", "title": "" }, { "docid": "333aafd07436880f9baf9449caf51b09", "score": "0.5919928", "text": "def textLogFormat _args\n \"textLogFormat _args;\" \n end", "title": "" }, { "docid": "6f9d385f04bfa360f467f1b84d4e08d7", "score": "0.59059966", "text": "def datetime_format=(datetime_format)\n @loggers.each do |logger|\n logger.datetime_format = datetime_format\n end\n end", "title": "" }, { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.5894752", "text": "def formats; end", "title": "" }, { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.5894752", "text": "def formats; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "bf77a777425f979cea802eca29bf8316", "score": "0.5893516", "text": "def format; end", "title": "" }, { "docid": "afd87a7b4c0e3d40a7a36cd5a77ee611", "score": "0.5889276", "text": "def log\n @options[:log] || DEFAULT_LOG_FILE\n end", "title": "" }, { "docid": "71064aca3b7df97492b77418f2dbbb73", "score": "0.5865401", "text": "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "title": "" }, { "docid": "4d2c2a21b4942d50967d97ceeb26e035", "score": "0.58591187", "text": "def format_log(sev, _time, _prog, msg); end", "title": "" }, { "docid": "482dca8cd64271e7383d17004f2045ab", "score": "0.58419687", "text": "def set_default_format\n @default_format=\"pdf\"\n end", "title": "" }, { "docid": "49501c1b2cc0707fc7772039505af2eb", "score": "0.58093446", "text": "def set_date_format(format) \n unless format.nil?\n return format\n else\n return @@db_format\n end\n end", "title": "" }, { "docid": "260a40733c076fab85869c15938a29dc", "score": "0.58072144", "text": "def log\n out.sync = true\n @log ||= Logger.new(out)\n\n @log.formatter = proc do |severity, datetime, progname, msg|\n if verbose\n string = \"#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: \"\n else\n string = \"[#{datetime.strftime('%H:%M:%S')}]: \"\n end\n\n string += \"#{msg}\\n\"\n\n string\n end\n @log\n end", "title": "" }, { "docid": "c3d926cf3b17a9e1128ca74ea7661591", "score": "0.5803377", "text": "def initialize\n @formatter = method(:default_formatter)\n end", "title": "" }, { "docid": "83daddb1225b630989285586fed69268", "score": "0.5790036", "text": "def format_log(sev, _time, _prog, msg)\n \"[#{sev.downcase}]: #{msg}\\n\"\n end", "title": "" }, { "docid": "ddc552eb851ec188754bae11a0646884", "score": "0.5783787", "text": "def yellow_log_formatter()\n orig_formatter = ::Logger::Formatter.new\n\n proc do |s,dt,pn,msg|\n \"#{CLEAR}#{YELLOW}#{orig_formatter.call(s,dt,pn,msg)}#{CLEAR}\"\n end\n end", "title": "" }, { "docid": "84436629e5cb97232f169023aa06acc1", "score": "0.57726395", "text": "def formatter\n @loggers.each do |logger|\n return logger.formatter if logger.respond_to?(:formatter)\n end\n end", "title": "" }, { "docid": "a91ce18020f338d561f2a469bf7df66e", "score": "0.57713014", "text": "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "title": "" }, { "docid": "a91ce18020f338d561f2a469bf7df66e", "score": "0.57713014", "text": "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "title": "" }, { "docid": "b7dbdd5db8fd25862780f4169848aafc", "score": "0.577086", "text": "def log(format: nil)\n format_pattern =\n case format\n when :author\n '%aN'\n when :message\n '%B'\n end\n\n cmd = %w[log --topo-order]\n cmd << \"--format='#{format_pattern}'\" if format_pattern\n\n output, = run_git(cmd)\n output&.squeeze!(\"\\n\") if format_pattern == :message\n\n output\n end", "title": "" }, { "docid": "34d70ef0e133334bd1ff94c320021eb6", "score": "0.57702386", "text": "def format\n params.fetch(:format, default_format)\n end", "title": "" }, { "docid": "c5048695c9999fd083c7f4e79e09b0a6", "score": "0.57663196", "text": "def setup_default_logger(logger)\n progname = 'Expectacle'\n @logger = if logger == :syslog\n Syslog::Logger.new(progname)\n else\n default_io_logger(logger, progname)\n end\n @logger.level = Logger::INFO\n @logger.formatter = proc do |severity, datetime, pname, msg|\n \"#{datetime} #{pname} [#{severity}] #{msg}\\n\"\n end\n end", "title": "" }, { "docid": "635cf544f0068ae6acf0b76fc67c8e85", "score": "0.57620174", "text": "def format\n @format\n end", "title": "" }, { "docid": "bd66de5c995347edc4e1def7617604c0", "score": "0.5759894", "text": "def default_logger\n Logger.new(debug? ? STDOUT : nil)\n end", "title": "" }, { "docid": "5edbfd0e02a658dca3340d109a62ec9e", "score": "0.57545197", "text": "def reset_format!\n self.format = @default_format\n end", "title": "" }, { "docid": "8bb3e90bc232ec0110ca3ddc63fd388d", "score": "0.5738753", "text": "def default_level\n ENV.key?(ENV_FLAG) ? ::Logger::DEBUG : ::Logger::WARN\n end", "title": "" }, { "docid": "a32fae7da500cce2b8ced23a0a40c249", "score": "0.57383764", "text": "def default_logger\n log = ::Logger.new(STDOUT)\n log.level = ::Logger::INFO\n log\n end", "title": "" }, { "docid": "ba39a696ad2fb8ba15c400a31487490f", "score": "0.57339466", "text": "def log_level\n @log_level ||= \"Log4r::#{@options[:log_level].upcase}\".constantize\n end", "title": "" }, { "docid": "d177336ce3be2611ec9b413396f98c4c", "score": "0.57170326", "text": "def colorize_logging=(_arg0); end", "title": "" }, { "docid": "848959144fab2b7e89c6c9ff72e3e65c", "score": "0.57058907", "text": "def logger_level; end", "title": "" }, { "docid": "5e6e593db5a991fa68d34efbe5aa5a5d", "score": "0.56988317", "text": "def default_log_path\n if @config.log_root\n File.join(@config.log_root, default_log_file_name)\n else\n nil\n end\n end", "title": "" }, { "docid": "fa04d8b9010e2155c283703002faff3e", "score": "0.5695791", "text": "def datetime_format=(datetime_format)\n @loggers.each do |logger|\n logger.datetime_format = datetime_format if logger.respond_to?(:datetime_format=)\n end\n end", "title": "" }, { "docid": "ceb53d07d3f366fef567c8c9c565dd5d", "score": "0.5682032", "text": "def format\n raise '#format must be implemented in child class'\n end", "title": "" }, { "docid": "9213219ac2f6c464aa0c2cfbb999e1f2", "score": "0.56806463", "text": "def setup_logger(log_name)\n date = Time.new.localtime.strftime('%F %H.%M.%S%L')\n logger = Logger.new(\"#{$VALUE}/test_logs/#{log_name}_#{date}.log\")\n logger.formatter = proc do |severity, datetime, _progname, msg|\n date_format = datetime.strftime('%Y-%m-%d %H:%M:%S%L')\n if (severity == 'INFO') || (severity == 'WARN')\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n else\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n end\n end\n logger\nend", "title": "" }, { "docid": "2406a3ef013f0fd1893138149e58d3ad", "score": "0.5678217", "text": "def format\n @format ||= properties.format.new self\n end", "title": "" }, { "docid": "31e022e64fed2e3dcd49222584fcb587", "score": "0.56756693", "text": "def format_log_entry(message, dump = nil)\n if Rails.application.config.colorize_logging\n if @@row_even\n @@row_even = false\n message_color, dump_color = \"4;36;1\", \"0;1\"\n else\n @@row_even = true\n message_color, dump_color = \"4;35;1\", \"0\"\n end\n\n log_entry = \" \\e[#{message_color}m#{message}\\e[0m \"\n log_entry << \"\\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\\e[0m\" % dump if dump\n log_entry\n else\n \"%s %s\" % [message, dump]\n end\n end", "title": "" }, { "docid": "07f254602571bba2a026036e56cba7d1", "score": "0.56613505", "text": "def output_format\n settings[:output_format]\n end", "title": "" }, { "docid": "f6a2840643d2260609b9bb5207d4eaf3", "score": "0.5656662", "text": "def formatters; end", "title": "" }, { "docid": "ef016be70763bce892f5a8884d490687", "score": "0.56501824", "text": "def format\n return @format\n end", "title": "" }, { "docid": "ef016be70763bce892f5a8884d490687", "score": "0.56501824", "text": "def format\n return @format\n end", "title": "" }, { "docid": "ef016be70763bce892f5a8884d490687", "score": "0.56501824", "text": "def format\n return @format\n end", "title": "" }, { "docid": "a96b9c2ebf51541543860cd3084ef333", "score": "0.56478584", "text": "def default_logger\n logger = Logger.new(STDOUT)\n logger.level = Logger::INFO\n logger\n end", "title": "" }, { "docid": "ec0f01cd368150cf86919e6962d28d12", "score": "0.56457067", "text": "def set_default_format\n if request.format.symbol.nil? || request.format.to_s == '*/*'\n logger.debug \"[ApplicationController] Request format set to #{request.format.to_s.inspect}, forcing 'text/plain'\"\n request.format = :text\n end\n end", "title": "" } ]
d11fbee2af75c28cd68953ce100663ee
Todo: Add description for test test_boolean_in_exception
[ { "docid": "688e166d593e7f959bd741c7bc544352", "score": "0.72476125", "text": "def test_boolean_in_exception()\n\n # Perform the API call through the SDK function\n assert_raises('ExceptionWithBooleanException'){ \n result = @controller.boolean_in_exception()\n }\n\n # Test response code\n assert_equal(444, @response_catcher.response.status_code)\n end", "title": "" } ]
[ { "docid": "e5a97bfb3b9c5323060b6405db418b57", "score": "0.74924177", "text": "def test_boolean_in_exception()\r\n\r\n # Perform the API call through the SDK function\r\n assert_raise('ExceptionWithBooleanException'){ \r\n result = self.class.controller.get_boolean_in_exception()\r\n }\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 444)\r\n end", "title": "" }, { "docid": "87063e02163212d0360da04836704ce8", "score": "0.69254184", "text": "def boolean_in_exception\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/error/booleanInException'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n if _response.status_code == 444\n raise ExceptionWithBooleanException.new(\n 'Boolean in Exception',\n _response\n )\n end\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body) unless\n _response.raw_body.nil? ||\n _response.raw_body.to_s.strip.empty?\n decoded\n end", "title": "" }, { "docid": "0f3fc2d7fde43c913c4ed33ac73e2bb5", "score": "0.60299426", "text": "def __in_workaround(args, *other_args)\n if other_args.length > 0\n raise \"The varargs form of `Object#in?` has been removed. Use an array instead.\"\n end\n args.include?(self)\n rescue NoMethodError\n raise ArgumentError.new(\"The parameter passed to #in? must respond to #include?\")\n end", "title": "" }, { "docid": "17ce886116a216a0d5420d0e9e317b44", "score": "0.6020673", "text": "def it_should_validate_inclusion_of(attribute, options = {}, message = default_error_message(:inclusion))\n it \"should validate #{attribute} is in #{options[:in].to_s}\" do\n # We specifically do not try to go below the range on String and character ranges because that problem set is unpredictable. \n lower = options[:in].first.respond_to?(:-) ? options[:in].first - 0.0001 : nil\n higher = options[:in].last.succ \n \n instance.send \"#{attribute}=\", lower\n instance.errors_on(attribute).should include(message)\n\n instance.send \"#{attribute}=\", higher\n instance.errors_on(attribute).should include(message)\n\n instance.send \"#{attribute}=\", (lower+higher)/2\n instance.errors_on(attribute).should_not include(message)\n end\n end", "title": "" }, { "docid": "01cc637c02b98ba9a007acc3d34c8715", "score": "0.6006498", "text": "def test_contains\n assert(@fdb.contains?(\"Orange\")==true,\"Food items not checked correclty\")\n assert(@fdb.contains?(\"Chicken Sandwich\")==true,\"Recipe items not checked correclty\")\n end", "title": "" }, { "docid": "b61f69134d24b36b7734e17b6b4cec06", "score": "0.5984062", "text": "def test_in_condition\n condition = Dynamicloud::API::Criteria::INCondition.new 'age', [1, 2, 3]\n\n assert_equal '\"age\": {\"$in\": [1,2,3]}', (condition.to_record_string Dynamicloud::API::Criteria::Condition::ROOT), 'Wrong condition'\n\n condition = Dynamicloud::API::Criteria::INCondition.new 'age', %w(1 2 3)\n\n assert_equal '\"age\": {\"$in\": [\"1\",\"2\",\"3\"]}', (condition.to_record_string Dynamicloud::API::Criteria::Condition::ROOT), 'Wrong condition'\n\n condition = Dynamicloud::API::Criteria::INCondition.new 'age', [1, 2, 3], true\n\n assert_equal '\"age\": {\"$nin\": [1,2,3]}', (condition.to_record_string Dynamicloud::API::Criteria::Condition::ROOT), 'Wrong condition'\n\n condition = Dynamicloud::API::Criteria::INCondition.new 'age', %w(1 2 3), true\n\n assert_equal '\"age\": {\"$nin\": [\"1\",\"2\",\"3\"]}', (condition.to_record_string Dynamicloud::API::Criteria::Condition::ROOT), 'Wrong condition'\n end", "title": "" }, { "docid": "20016ad4878e00c625f19d98cc693ca0", "score": "0.59419143", "text": "def test_contains_bad_params\n assert_nothing_raised do\n set = Set.new\n set.contains? nil\n set.contains? false\n end\n end", "title": "" }, { "docid": "8094be13ba1fa88d6d0285c12d19f11c", "score": "0.59369004", "text": "def within?(value)\n if in? && value\n if @in.include?(value)\n else\n fail InvalidArgument, \"Value #{value} is not included in the range #{@in}\"\n end\n end\n end", "title": "" }, { "docid": "a215c98ebf8282979dc7c4220d8df82c", "score": "0.58902645", "text": "def test_contains(list, value, expect_found)\n puts \"\\n___test_contains___\"\n puts \"List contains '#{value}'? #{list.contains?(value)}\"\n puts \"Expected: #{expect_found}\"\n puts \"\\n>>>> ERROR <<<< (section above) \" unless list.contains?(value) == expect_found\nend", "title": "" }, { "docid": "91ebac3b96527c2c39bd6c756c631253", "score": "0.5782248", "text": "def test_in_clause\n# mms = MyModel.find(:all)\n\n# mms2 = MyModel.find(:all, :conditions=>[\"id in ?\"])\n\n end", "title": "" }, { "docid": "3ab4ad82cd4fb7fd01bb9e9213c25e54", "score": "0.5738442", "text": "def test_include_false\n assert !(@triple.include? 7)\n end", "title": "" }, { "docid": "2546addcbd47780fb0f417af1c9ae801", "score": "0.56357247", "text": "def test_truth\r\n end", "title": "" }, { "docid": "2546addcbd47780fb0f417af1c9ae801", "score": "0.56357247", "text": "def test_truth\r\n end", "title": "" }, { "docid": "2546addcbd47780fb0f417af1c9ae801", "score": "0.56357247", "text": "def test_truth\r\n end", "title": "" }, { "docid": "2546addcbd47780fb0f417af1c9ae801", "score": "0.56357247", "text": "def test_truth\r\n end", "title": "" }, { "docid": "244e0b45842b80409945a7cab1705b49", "score": "0.56234366", "text": "def number_in_set_pattern\n /\\d+\\s+in\\s+((true|false)[\\,\\s]*)+/\n end", "title": "" }, { "docid": "ce8fa6b1dccdab019c3457c1da99a060", "score": "0.5621897", "text": "def contains\t\n\tend", "title": "" }, { "docid": "5aa34f9f721124739971f9b02411e309", "score": "0.5606019", "text": "def handle_in (namespace, field, operator_arg)\n result = []\n elems_no = operator_arg.count\n if elems_no > MAX_IN_ARRAY then\n result << EvaluationResult.new(\n \"$in operator with a large array (#{elems_no}) is inefficient\",\n EvaluationResult::CRITICAL)\n end\n return result\n end", "title": "" }, { "docid": "cc1799801ada036b87fdcd38bdd85b74", "score": "0.5599547", "text": "def in_array (needle, haystack)\r\n haystack.include?(needle) #Use built-in include? Array method\r\n\r\nrescue Exception => e \r\n p e\r\n return e\r\nend", "title": "" }, { "docid": "b97d1aad13fbce317977377e4c90f6cf", "score": "0.55925226", "text": "def is_in index_name,*args\n index=@indices[index_name.to_sym]\n raise InvalidQuery,\"Could not find index '#{index_name}'\" if index.nil?\n if index[:match]\n raise InvalidQuery,\"No parameter provided to index when one was expected\" if args.size!=1\n else\n raise InvalidQuery,\"Parameter provided to index when not expected\" if args.size!=0\n end\n @is_in_list<<{:index_name=>index_name,:index=>index,:args=>args}\n self\n end", "title": "" }, { "docid": "32e2e725676230a8ba470af7f2c9d7ab", "score": "0.5588653", "text": "def test_contains_food\n assert(@fdb.contains_food?(\"Orange\")==true,\"Food items not checked correclty\")\n end", "title": "" }, { "docid": "97b11a0c989521695fd02eba30b46655", "score": "0.55825675", "text": "def check_true_false(input)\r\n if ![true, false].include?(input)\r\n raise Exception.new(\"Specified input must be true or false. '#{input}' value was provided.\")\r\n end\r\n end", "title": "" }, { "docid": "c0c0479bc55a04908a7dd301e1d11d46", "score": "0.5560302", "text": "def test_include_true\n assert @triple.include? 2\n end", "title": "" }, { "docid": "32a84981930e996e55a67d7770290ed3", "score": "0.5554118", "text": "def assert_inclusion(a, b, description='inclusion assertion failed')\n\t\treturn if a.include?(b) \n\t\n\t\tfailure = ::FTest::Failure.new(description)\n\t\tfailure.extra_details << \"assert_inclusion failure: \"\\\n\t\t\t\"#{a.inspect}.include? #{b.inspect} == false\"\n\t\traise failure\n\tend", "title": "" }, { "docid": "99be321c6b46e85a234dea9eb6e72fbd", "score": "0.5527828", "text": "def test_all_allTrue\n assert @triple.all? { |e| e < 10 }\n end", "title": "" }, { "docid": "f5d9316983db039304598a2bc031069c", "score": "0.55229366", "text": "def test_invalid_val\n set_rule = Rules.new\n actual = set_rule.pos_int? 'quack'\n expected = false\n assert_equal expected, actual\n end", "title": "" }, { "docid": "d1d96a698dbdf7871326597bc41163b6", "score": "0.55183816", "text": "def run_validator(value)\n return true if value.nil?\n\n if @params[:not_in].include? value\n if @params[:not_in].is_a?(::Range)\n set_error :in_range, @params[:not_in].min, @params[:not_in].max\n else\n set_error :in_set, @params[:not_in].to_a.join(', ')\n end\n\n false\n else\n true\n end\n end", "title": "" }, { "docid": "affbfc43e25fcfd720139eec94b68b13", "score": "0.55077565", "text": "def test_include_returns_false_for_empty_exclusive_end\n assert_not((1..5).include?(3...3))\n end", "title": "" }, { "docid": "540b0c435fb4f0bda27ac7db9254c417", "score": "0.55000526", "text": "def contains(value)\n end", "title": "" }, { "docid": "5a21ceafe7992802f8b9df91b1b531f3", "score": "0.5496967", "text": "def test_any_withFalse\n assert @triple_bool.any?\n end", "title": "" }, { "docid": "59b05a9c45763133cedd1d231024d9f3", "score": "0.5494408", "text": "def in?\n !!@in\n end", "title": "" }, { "docid": "61a0a998b87da0c59487b1ce73484cca", "score": "0.54884213", "text": "def run_validator(value)\n return true if value.nil?\n\n if @params[:in].include? value\n true\n else\n if @params[:in].is_a?(::Range)\n set_error :not_in_range, @params[:in].min, @params[:in].max\n else\n set_error :not_in_set, @params[:in].to_a.join(', ')\n end\n\n false\n end\n end", "title": "" }, { "docid": "26f31b9ec818bed1f03bc41c11b727f4", "score": "0.54825795", "text": "def verifyInResults(expected, *results)\n\tresults.include?(expected)\nend", "title": "" }, { "docid": "7d3e9412c43bc9df18a7aef61fc1b8b1", "score": "0.5482029", "text": "def in(left, right)\n case right\n when Range\n return contradiction if right.size == 0\n rl = gte(left, right.begin)\n rr = right.exclude_end? ? lt(left, right.end) : lte(left, right.end)\n self.and(rl, rr)\n else\n left, right = sexpr(left), sexpr(right)\n if right.literal? && right.empty_value?\n contradiction\n else\n _factor_predicate([:in, left, right])\n end\n end\n end", "title": "" }, { "docid": "6342b9e5d8760a9bbac4cd799c7b73af", "score": "0.54630375", "text": "def test_in_clause\n# mms = MyModel.find(:all,:consistent_read=>true)\n\n# mms2 = MyModel.find(:all, :conditions=>[\"id in ?\"],:consistent_read=>true)\n\n end", "title": "" }, { "docid": "eb0f46f249fef09407e6b713a0532c9c", "score": "0.54547316", "text": "def test_any_allTrue\n assert @triple.any? { |e| e < 10 }\n end", "title": "" }, { "docid": "ae16631b0a965b134af78bc2b4ecab15", "score": "0.54519314", "text": "def test_assert_includes\n array = [1, 18, 4, 9, 15, 3]\n found_2 = false\n array.each do |num|\n found_2 = true if num == 2\n end\n raise \"Expected #{array.inspect} to include 2.\" unless found_2\n end", "title": "" }, { "docid": "d5a2068def2a176c88003b5835bdfadb", "score": "0.5442494", "text": "def test_AND_works\n assert_includes [9,3], 9 && 3\n end", "title": "" }, { "docid": "6da3f08b5a9bfabf788c6b49941082a9", "score": "0.54424846", "text": "def test_assert_includes\n array = [1, 18, 4, 9, 15, 3]\n assert_includes array, 2\n # found_2 = false\n # array.each do |num|\n # found_2 = true if num == 2\n # end\n # raise \"Expected #{array.inspect} to include 2.\" unless found_2\n end", "title": "" }, { "docid": "e5356596919147f2b75bd00a923f3510", "score": "0.5418979", "text": "def test_valid(value)\n end", "title": "" }, { "docid": "b7a9a4cc7488752e44f68905e7ea1d94", "score": "0.54185027", "text": "def test_detect_success\n # Test Args\n assert_nil @norm_int_enum.detect { |a| a == 0 }\n assert_equal \"!\", @norm_string_enum.detect { |a| a.length < 3 }\n end", "title": "" }, { "docid": "3be8b58762d20855919f1f1091b1a29f", "score": "0.54167944", "text": "def one_in(_num = nil)\n #This is a stub, used for indexing\nend", "title": "" }, { "docid": "4848e8baa18b71d19618898a35180145", "score": "0.5411666", "text": "def value_in(value, *args)\n args.each do |arg|\n return true if value == value_of(arg)\n end\n false\n end", "title": "" }, { "docid": "bf59c7cda4d4eaa795f1015f0bdfc429", "score": "0.53782034", "text": "def test_range_calculator_non_integers_in_exclusion\n assert_raises TypeError do\n @range_calculator.calculate_range(1, 10, ['3', '5', '7'])\n end\n end", "title": "" }, { "docid": "bc8f08b3ed4e8f18e0e413f8d6fcf96c", "score": "0.53713727", "text": "def test_that_the_list_contains_a_number\n skip \"Waiting to be implemented\"\n array = [1,6,3,9,1,1,2,3]\n number = 9\n included = false # replace false with the logic to check if 'number' is in the 'array' \n assert(included) \n end", "title": "" }, { "docid": "d99b5a7c711b3dee8a7897a75e8f4b33", "score": "0.5364321", "text": "def test_OR_works\n assert_includes [9,3], 9 || 3\n end", "title": "" }, { "docid": "ecc0231b08528a857c172c69490d1adf", "score": "0.5363591", "text": "def test_all_withFalse\n assert !@triple_bool.all?\n end", "title": "" }, { "docid": "7c3adc775f827f79759a335b74a9f934", "score": "0.53593206", "text": "def test_is_value_in_array\n hogwarts = [ 'Hufflepuff', 'Slytherin', 'Gryffindor', 'Ravenclaw' ]\n result = is_value_in_array('Ravenclaw',hogwarts)\n assert_equal(true,result)\nend", "title": "" }, { "docid": "ec78484e7aecbf4570de6a67b0c543d7", "score": "0.53557813", "text": "def avail_in(*) end", "title": "" }, { "docid": "9c81e9fdd405108ca8ca6f2c1fa1310e", "score": "0.53554094", "text": "def test_check_ints_all_nonint\n \targs = [true, \"foo\", \"bar\"]\n \tac = ArgChecker.new\n \trefute ac.check_ints(args)\n end", "title": "" }, { "docid": "1f95d1a232059dd8562e64fc5cc9252f", "score": "0.5350046", "text": "def test_lower_bound\n # assert_equal \"Number must be between 0 and 99, inclusive. (ArgumentError)\", Say.new(-1).in_english\n assert_raises ArgumentError do\n Say.new(-1).in_english\n end\n end", "title": "" }, { "docid": "1998ad27d26c62b7f8c0c5cfe6ec618c", "score": "0.5346468", "text": "def test_array_must_isec_with_array\n assert_raises ArgumentError do\n [1,2,3].isec(3)\n end \n end", "title": "" }, { "docid": "2d540e2a939e19fa164ee1b941cd724b", "score": "0.5344195", "text": "def test_false\n\t\tfalse\n\tend", "title": "" }, { "docid": "dcc8edc1e3a143f23ea159ddd143c34e", "score": "0.5340496", "text": "def check_in(id); end", "title": "" }, { "docid": "dcc8edc1e3a143f23ea159ddd143c34e", "score": "0.5340496", "text": "def check_in(id); end", "title": "" }, { "docid": "547ee570d570e6f32fbb1834aadcf1bd", "score": "0.5339379", "text": "def test_neg_seed_neg_pros\n set_rule = Rules.new\n actual = set_rule.valid_input? '-123', '-453'\n expected = false\n assert_equal expected, actual\n end", "title": "" }, { "docid": "5ffe33db92e6208b2aefc4a8557cbf93", "score": "0.5334499", "text": "def test_contains_recipe\n assert(@fdb.contains_recipe?(\"Chicken Sandwich\")==true,\"Recipe items not checked correclty\")\n end", "title": "" }, { "docid": "2ff6136f374488269a85ecfd2d5e9a1a", "score": "0.5329118", "text": "def in?(point)\n check_pre(point.int?)\n (self.first..self.last).include?(point)\n end", "title": "" }, { "docid": "043ad954fb2af50f46ed981d03446da6", "score": "0.5326257", "text": "def test_return\n rs = 5.random_in(1,6,false)\n assert_equal(5, rs.length)\n assert_equal(Array, rs.class)\n end", "title": "" }, { "docid": "7d1d60901a22bbfdb35eaa681822316c", "score": "0.5305046", "text": "def test_contains\n \tassert(@fdb.contains?(\"Chicken Sandwich\"), \"no chicken sandwhich?\")\n\tassert(@fdb.contains?(\"Apple\"), \"no apers\")\n end", "title": "" }, { "docid": "b91859c6f602a8fa492870e9a2716176", "score": "0.53036445", "text": "def test_includes_is_false\n list = LinkedList.new\n refute list.includes?(\"Brown\")\n end", "title": "" }, { "docid": "fa1738e0957e52c8e9ae33b818343f35", "score": "0.5294555", "text": "def test_valid?\n ex = assert_raise( RuntimeError ) { Tui::Model::Boolean.new( 'lab1', 'x' ); }\n base = Tui::Model::Boolean.new( 'lab1' )\n assert_false base.valid?( 'a' )\n assert_true base.valid?( false )\n ex = assert_raise( RuntimeError ) { base.value = 'a'; }\n assert_equal( 'Invalid value for model type Tui::Model::Boolean!', ex.message )\n end", "title": "" }, { "docid": "70605e0765c603b4807339aef3946812", "score": "0.52742904", "text": "def test_in_map\n\t\tmars_map = MarsMap.new(5,3)\n\t\tassert_equal(false,mars_map.is_off_map?(1,2))\n\tend", "title": "" }, { "docid": "1dd351470be887c35a54d6d642f35966", "score": "0.5271976", "text": "def test_contains?\n @table.add(IntHash.new(2))\n @table.add(StringHash.new(\"a\"))\n @table.add(KeyValueHash.new(StringHash.new(\"b\"), 25))\n assert_equal(@table.contains?(IntHash.new(2)), true)\n assert_equal(@table.contains?(StringHash.new(\"a\")), true)\n assert_equal(@table.contains?(KeyValueHash.new(StringHash.new(\"b\"), 25)), true)\n assert_equal(@table.contains?(StringHash.new(\"m\")), false)\n assert_equal(@table.contains?(KeyValueHash.new(StringHash.new(\"m\"), 25)), false)\n assert_equal(@table.contains?(KeyValueHash.new(StringHash.new(\"b\"), 20)), true)\n end", "title": "" }, { "docid": "ab67f56f58cc356c7e1ecd65d924650c", "score": "0.5266355", "text": "def test_include\n assert @s11.include?(@ib)\n assert @s11.include?(@ie)\n assert @s12.include?(@ib)\n assert !@s12.include?(@ie)\n assert @s12.include?(@ie-1)\n assert !@s21.include?(@ib)\n assert @s21.include?(@ib+1)\n assert @s21.include?(@ie)\n assert !@s22.include?(@ib)\n assert !@s22.include?(@ie)\n assert (@s11 === @ib)\n assert !(@s21 === @ib)\n assert (@s21 === @ib+1)\n assert !(@s22 === @ie)\n\n assert (RangeExtd.new(\"a\", \"z\") === \"c\")\n assert !(RangeExtd.new(\"a\", \"z\") === \"cc\")\t# Key! (see cover?)\n assert (@s22 === (@ib+@ie)/2.0+0.1)\t# Key! (see cover?)\n assert (RangeExtd.new(\"a\", \"z\").member?(\"c\"))\n assert !(RangeExtd.new(\"a\", \"z\").member?(\"cc\"))\n assert !(RangeExtd.new(\"a\", \"z\", 777) === \"a\")\n assert (RangeExtd.new(\"a\", \"z\", nil) === \"a\")\n assert (RangeExtd.new(\"a\", \"z\", 777) === \"b\")\n\n assert (RaE(..nil, true) === \"b\")\n assert (RaE(..nil, true) === nil)\n assert (RangeExtd::ALL === ?b)\n refute (RangeExtd::NONE === ?b)\n refute (RangeExtd::NONE === nil) # NONE includes nothing\n refute (RangeExtd::NONE === NOWHERE) # NONE includes nothing, even NOWHERE (because of exclude_begin/end)\n end", "title": "" }, { "docid": "f51197c10d5b0915e555a3c7fe6d3cba", "score": "0.5249674", "text": "def validates_inclusion_of(*atts)\n opts = extract_options!(atts)\n n = opts[:in]\n unless n && (n.respond_to?(:cover?) || n.respond_to?(:include?))\n raise ArgumentError, \"The :in parameter is required, and must respond to cover? or include?\"\n end\n opts[:message] ||= \"is not in range or set: #{n.inspect}\"\n reflect_validation(:inclusion, opts, atts)\n atts << opts\n validates_each(*atts) do |o, a, v|\n o.errors.add(a, opts[:message]) unless n.send(n.respond_to?(:cover?) ? :cover? : :include?, v)\n end\n end", "title": "" }, { "docid": "efa43a3910432a36552d1336803fadfa", "score": "0.52490056", "text": "def test_all_allFalse\n assert !@triple.all? { |e| e > 10 }\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "40198eea5846f44a3e00ab2743b45786", "score": "0.52451885", "text": "def test_truth\n end", "title": "" }, { "docid": "9a21b888b6e5c54ae7f073ec92d84782", "score": "0.5234363", "text": "def contains?(object)\n raise UnsupportedOperation\n end", "title": "" }, { "docid": "7e9a0677f53d14e3d9a0914bcc2a29f5", "score": "0.52319324", "text": "def test_for_contains\n assert( @db.contains( \"Gum\" ),\n\t \"Database does not contain 'Gum'.\" )\n\tassert( !@db.contains( \"Paper\" ),\n\t \"Database contains 'Paper'.\" )\n\tassert( @db.contains( \"PB&J Sandwich\" ),\n\t \"Database does not contain 'PB&J Sandwich'.\" )\n\tassert( @db.contains( \"bread Slice\" ),\n\t \"Database does not contain 'bread Slice'.\" )\n end", "title": "" }, { "docid": "18c1184b9b2721a8d683527853623fa7", "score": "0.52249146", "text": "def test_all_someFalse\n assert !@triple.all? { |e| e > 3 }\n end", "title": "" }, { "docid": "83dfa9c0df91bcd1049e83f0c86e30bc", "score": "0.5219733", "text": "def is_excuse?\n # XXX: TODO\n return true\n #[MISSING].include? status\n end", "title": "" }, { "docid": "c675d10a09788c62454019070681cddc", "score": "0.52147335", "text": "def test_member_false\n assert !(@triple.member? 7)\n end", "title": "" }, { "docid": "7a9f5da97555effcd0195a16f1ce2101", "score": "0.5213083", "text": "def verifyIterInd(expr)\n\tsymbol = expr.get_symbol\n\tvalues = expr.get_values\n\ttype_expr = verifyExpression(values[0])\n\t# Los identificadores unicamente pueden ser booleanos o numeros\n\tif type_expr[0] == :BOOLEAN\n\telsif type_expr[0] ==:UNKNOW\n\t\t$error = true\n\telse\n\t\tputs \"Instrucción `ITERIND` expresion tipo #{type_expr[0]} encontrada, se espera tipo `BOOLEAN`\"\n\t\t$error = true\n\tend\n\tverifyInstr(values[1])\n\tif values[2] != nil\n\t\tverifyInstr(values[2])\n\tend\nend", "title": "" }, { "docid": "7d49da563ae3e8ef7069c913c82e6238", "score": "0.5213015", "text": "def in(expected, options = nil)\n defaultize_options(options)\n\n @expected = expected\n\n @affirmation = \"#{h_sujet} est contenu dans #{h_expected}\"\n @ok = is_contained_by(sujet, expected, h_sujet, h_expected)\n evaluate\n\nend", "title": "" }, { "docid": "e6aa24b5271b0f0dc0f74c0786194927", "score": "0.5206188", "text": "def compose_not_in(table, column_name, allowed, values)\n compose_in(table, column_name, allowed, values).not\n end", "title": "" }, { "docid": "2060b1b2caf83031bb39330d2722c1a5", "score": "0.52050877", "text": "def test_all_success\n assert @norm_int_enum.all? { |a| a >= 1 }\n assert @norm_string_enum.all? { |a| a.length * 3 > 2}\n assert @norm_mix_enum.all? { |a| a != 2 }\n\n refute @norm_int_enum.all? { |a| a == 1}\n refute @norm_string_enum.all? { |a| a == \"Hello\"}\n refute @norm_mix_enum.all? { |a| a + a != 6 }\n end", "title": "" }, { "docid": "bd50d97dad381c6248d6d4b2034d43a2", "score": "0.5200957", "text": "def transform_in(value)\n\n end", "title": "" }, { "docid": "00593b5db8a26f15e9d5629ddc6e329f", "score": "0.5199896", "text": "def test_neg_val\n set_rules = Rules.new\n input = '-11'\n actual = set_rules.pos_neg_int? input\n expected = true\n assert_equal expected, actual\n end", "title": "" }, { "docid": "5c709dad18b9489f43351f89e35bf990", "score": "0.51997083", "text": "def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end", "title": "" }, { "docid": "363d69110151d8ef610359771465a0bc", "score": "0.51975113", "text": "def test_neg_seed_pos_pros\n set_rule = Rules.new\n actual = set_rule.valid_input? '-123', '453'\n expected = true\n assert_equal expected, actual\n end", "title": "" }, { "docid": "6be86a56beca76569e6cbd25ffdae797", "score": "0.51959056", "text": "def compose_not_in(table, column_name, allowed, values)\n compose_in(table, column_name, allowed, values).not\n end", "title": "" }, { "docid": "9675f692c3417e7c46c9eb3e76fcba03", "score": "0.51954114", "text": "def test_any_allFalse\n assert !@triple.any? { |e| e > 10 }\n end", "title": "" }, { "docid": "8d6544dc31fb8df15fd54dc6b7e31f56", "score": "0.519501", "text": "def test_number_is_in_array\n\t\tassert_equal(true,win_number(10,[1,2,8,10,20]))\n\tend", "title": "" }, { "docid": "3958309527e098437c0b5db7b68455ed", "score": "0.5191439", "text": "def test_check_leaving_true\n\t\tassert_equal true, @test_iter.check_leaving(\"Hospital\")\n\tend", "title": "" }, { "docid": "76ed4ad37e9fb9b10e97d53941af3354", "score": "0.51889396", "text": "def test_verify_user_input_false_nil\n assert_equal [false, nil], verify_user_input([])\n end", "title": "" }, { "docid": "a2ea6c7c18be7739d273f3b71a2d27f5", "score": "0.5174087", "text": "def in *args\n if args.size == 1 && (args.first.is_a?(Enumerable) || args.first.is_a?(String))\n args = args.first\n end\n case args\n when Enumerable\n args.include? self\n when String\n !!args[self] \n end\n false \n end", "title": "" }, { "docid": "4335fc5a5a11253c61302e511f11139d", "score": "0.5173861", "text": "def test_Add_Should_ThrowException_When_CalledWithInputContainingNegativeNumber8\n # Arrange.\n @inputValue = '-1\\n-2;-1'\n @errorMessage = 'Negatives not allowed : -1, -2, -1'\n\n # Act.\n @error = assert_raises Exception do\n self.act_Add(@inputValue)\n end\n\n # Assert.\n assert_equal(@errorMessage, @error.message)\n end", "title": "" }, { "docid": "01c2e293ec435777bf6b001bb748708a", "score": "0.51734966", "text": "def assert_includes(range, value)\n assert range.first <= value, \"assert_includes failed\"\n assert range.last >= value, \"assert_includes failed\"\n end", "title": "" }, { "docid": "e0b2c7ccdf0dac98f52a5f035866ebf6", "score": "0.5169063", "text": "def supports_intersect_except?\n true\n end", "title": "" }, { "docid": "e0b2c7ccdf0dac98f52a5f035866ebf6", "score": "0.5169063", "text": "def supports_intersect_except?\n true\n end", "title": "" }, { "docid": "e50234f135a43b78816a311f0d6c2fe0", "score": "0.51606053", "text": "def test_valid_choice_false_6\n user_input = \"2ba\"\n assert_equal false, valid_choice?(user_input)\n end", "title": "" }, { "docid": "4f0b2791247fad69e1c4b95bf953331e", "score": "0.5160221", "text": "def test_verify_args_one_string_one_int\n assert_equal false, @v.verify_args([1, 'b'])\n end", "title": "" } ]
e7eb0f6c72461be83041f4c95027021a
Spawns a subprocess to monitor the parent. The watchdog process' parent is the original parent. The watchdog works by waiting for a pipe also held by the parent to break. When it does, it will issue a signal to the child process.
[ { "docid": "c628b904153271a349341cd11f0f9caf", "score": "0.7275031", "text": "def spawn_watchdog_process\n Process.fork do\n # If we don't close the write end, the read might never end since the OS doesn't\n # generate EOFs if there is a write end still open. We use EOF to signal a failure\n # or abrupt termination of the signaling process.\n @writer.close\n\n val = @reader.sysread(1) rescue nil\n @reader.close\n\n Process.kill(@signal, @pid) if val.nil?\n\n # Don't run any at_exit functions; the parent process will take care of all that.\n Kernel.exit!\n end\n end", "title": "" } ]
[ { "docid": "92bbcf87e21168c359413f83daf3c845", "score": "0.7437609", "text": "def fork(&block)\n raise RuntimeError, \"already in use\" unless @pid.nil?\n @pid = Process.fork do\n # The child doesn't need the pipe, and leaving it open\n # will keep the pipe alive even after the parent dies.\n @reader.close\n @writer.close\n block.call\n end\n spawn_watchdog_process\n \n # The parent of the watchdog process (the original parent)\n # doesn't need to use the pipe. Let's close the other end now.\n @reader.close\n\n @pid\n end", "title": "" }, { "docid": "1a12633e27079acd186d81f46a16942c", "score": "0.66356087", "text": "def signal_parent\n\t\tparent = Process.ppid\n\n\t\t# Check to make sure we weren't orphaned.\n\t\t#\n\t\tif parent == 1\n\t\t\tself.log.error \"Lost my parent process? Exiting.\"\n\t\t\texit 1\n\t\tend\n\n\t\tProcess.kill( 'HUP', parent )\n\tend", "title": "" }, { "docid": "2a44866a9d7bcd969719875bf3bb9f52", "score": "0.6374926", "text": "def watch_for_parent_exit\n Thread.new do\n loop do\n if @writer.closed?\n puts 'Parent process died'\n exit\n end\n\n sleep 3\n end\n end\n end", "title": "" }, { "docid": "1479b76539866862f75dc7c090e0e4c4", "score": "0.6374015", "text": "def start_process # :nodoc:\n # Open a pipe to monitor the child startup\n r, w = IO.pipe\n\n @pid = fork do\n # Open the redirection outputs\n stdout, stderr = nil\n begin\n if redirection.respond_to?(:to_str)\n stdout = stderr = File.open(redirection_path(redirection), \"w\")\n elsif redirection\n if stdout_file = redirection[:stdout]\n stdout = File.open(redirection_path(stdout_file), \"w\")\n end\n if stderr_file = redirection[:stderr]\n stderr = File.open(redirection_path(stderr_file), \"w\")\n end\n end\n rescue Exception => e\n Roby.log_exception_with_backtrace(e, Roby, :error)\n w.write(\"#{KO_REDIRECTION}\")\n return\n end\n\n STDOUT.reopen(stdout) if stdout\n STDERR.reopen(stderr) if stderr\n\n r.close\n w.fcntl(Fcntl::F_SETFD, 1) # set close on exit\n ::Process.setpgrp\n begin\n exec(*command_line)\n rescue Errno::ENOENT\n w.write(\"#{KO_NO_SUCH_FILE}\")\n rescue Exception => e\n Roby.log_exception_with_backtrace(e, Roby, :error)\n w.write(\"#{KO_EXEC}\")\n end\n end\n\n ExternalProcess.processes[pid] = self\n\n w.close\n begin\n read, _ = select([r], nil, nil, 5)\n rescue IOError\n Process.kill(\"SIGKILL\", pid)\n retry\n end\n\n if read && (control = r.read(1))\n case Integer(control)\n when KO_REDIRECTION\n raise \"could not start #{command_line.first}: cannot establish output redirections\"\n when KO_NO_SUCH_FILE\n raise \"could not start #{command_line.first}: provided command does not exist\"\n when KO_EXEC\n raise \"could not start #{command_line.first}: exec() call failed\"\n end\n end\n\n # This block is needed as there is a race condition between the fork\n # and the assignation to ExternalProcess.processes (which is\n # required for the SIGCHLD handler to work).\n begin\n if Process.waitpid(pid, ::Process::WNOHANG)\n if exit_status = $?\n exit_status = exit_status.dup\n end\n engine.once { dead!(pid, exit_status) }\n return\n end\n rescue Errno::ECHILD\n end\n\n rescue Exception => e\n ExternalProcess.processes.delete(pid)\n raise e\n end", "title": "" }, { "docid": "63f0d715a8bec120577eb516b315b3ea", "score": "0.6174618", "text": "def new_kill_child\n if @child\n unless child_already_exited?\n if pre_shutdown_timeout && pre_shutdown_timeout > 0.0\n log_with_severity :debug, \"Waiting #{pre_shutdown_timeout.to_f}s for child process to exit\"\n return if wait_for_child_exit(pre_shutdown_timeout)\n end\n\n log_with_severity :debug, \"Sending TERM signal to child #{@child}\"\n Process.kill(\"TERM\", @child)\n\n if wait_for_child_exit(term_timeout)\n return\n else\n log_with_severity :debug, \"Sending KILL signal to child #{@child}\"\n Process.kill(\"KILL\", @child)\n end\n else\n log_with_severity :debug, \"Child #{@child} already quit.\"\n end\n end\n rescue SystemCallError\n log_with_severity :error, \"Child #{@child} already quit and reaped.\"\n end", "title": "" }, { "docid": "ddaeadaec30ec9f1644bf1ea7e274979", "score": "0.6101568", "text": "def spawn\n fail \"worker already running\" if running?\n @status = nil\n\n if (@pid = fork).nil?\n @pid = $$\n yield\n install_signal_traps\n main\n exit 0\n end\n\n @pid\n end", "title": "" }, { "docid": "f4db03fa1a691188bfb10344de60aeb7", "score": "0.6026247", "text": "def spawn\n Log::Debug.system('process \"%{name}\" is spawned with arguments %{argv}' % {name: @name, argv: @argv})\n\n # create a new process and watch it\n @pid = Process.spawn(@name, *@argv)\n\n # keep to watch child process\n @thread = Process.detach(@pid)\n\n # fail to spawn if the monitor thread is nil\n unless @thread\n return self\n end\n\n # find child front while child process is alive\n Timeout.timeout(10) do\n while @thread.alive? do\n # find front and save its uri and pid\n if child_front = find_child_front(@pid)\n @child_front = child_front\n\n return self\n else\n sleep 0.1\n end\n end\n\n # error if the process has failed\n unless not(@thread.alive?) and @thread.value.success?\n raise SpawnError.child_process_is_dead(@model[:scenario_name], @name, @argv)\n end\n\n return self\n end\n rescue Timeout::Error\n raise SpawnError.new(@model[:scenario_name], @name, @argv, \"timed out\")\n rescue Object => e\n if e.kind_of?(SpawnError)\n raise\n else\n raise SpawnError.new(@model[:scenario_name], @name, @argv, e.message)\n end\n end", "title": "" }, { "docid": "9d39bce4a09a8191af34385d349f2530", "score": "0.60240334", "text": "def wait_child\n begin\n Process.wait\n\n # Return child's exit code\n if $?.exited?\n exit $?.exitstatus\n else\n exit 1\n end\n rescue SignalException => e\n Process.kill e.signo, $cpid\n wait_child\n end\nend", "title": "" }, { "docid": "9a9d3b2795da1cd086b05c75fe4a401c", "score": "0.59982514", "text": "def spawn\n if @command.is_a? String\n @pid = fork do\n # Doesn't work\n # $0 = 'daemon_from_file'\n exec @command\n end\n elsif @command.is_a? Proc\n @pid = fork do\n # Character limited to 13?\n # $0 = 'daemon_from_proc'\n $DEBUG = false\n $RUNNING = true\n\n Signal.trap(\"TERM\") { $RUNNING = false }\n Signal.trap(\"USR1\") { $DEBUG = !$DEBUG }\n\n # exec @command\n while $RUNNING\n @command.call\n end\n puts \"Exited loop!\"\n exit\n end\n else\n raise \"What?\"\n end\n\n puts \"Forked #{self.name} : #{self.pid}\"\n self.started_at = Time.now\n self.spawn_count = self.spawn_count ? self.spawn_count + 1 : 1\n exit_status = ::Process.waitpid2(pid, 0)\n # ::Process.detach(@pid)\n puts \"Exited : #{exit_status.inspect}\"\n self.pid = nil\n self.started_at = nil\n end", "title": "" }, { "docid": "6d45900046496b669941f5e40ae71cd5", "score": "0.5971936", "text": "def launch!(&after_fork)\n @tmp = Utils.tmpio\n @wpid = fork do\n\n # the prep work\n Utils.proc_name(name)\n\n after_fork.call if after_fork\n\n @tmp.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)\n [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } }\n alive = @tmp\n m = 0\n @handler = @handler.new if @handler.respond_to?(:new)\n logger.info \"worker=#{name} ready\"\n\n # the actual loop\n while Process.ppid && alive\n alive.chmod(m = 0 == m ? 1 : 0)\n @handler.call\n end\n\n end\n end", "title": "" }, { "docid": "cc94bcf55d132dd7a8ac65ddecd0933f", "score": "0.59313995", "text": "def execute\n ctrl_read, ctrl_write, fork_read, parent_write, parent_read, fork_write = nil\n\n fork_read, parent_write = binary_pipe if @flags[:to_fork]\n parent_read, fork_write = binary_pipe if @flags[:from_fork]\n ctrl_read, ctrl_write = binary_pipe if @flags[:ctrl]\n\n @alive = true\n\n pid = Process.fork do\n @parent = false\n parent_write.close if parent_write\n parent_read.close if parent_read\n ctrl_read.close if ctrl_read\n complete!(Process.pid, fork_read, fork_write, ctrl_write)\n\n child_process\n end\n\n fork_write.close if fork_write\n fork_read.close if fork_read\n ctrl_write.close if ctrl_write\n complete!(pid, parent_read, parent_write, ctrl_read)\n\n self\n end", "title": "" }, { "docid": "89a9cf56c0a086bc32cf0cf696d2fbb8", "score": "0.59245175", "text": "def child\n\n # if we get a HUP signal, then tell the parent process to stop this\n # child process and start a new one to replace it\n Signal.trap('HUP') {\n @piper.timeout = 0.5\n @piper.puts START rescue nil\n hup if self.respond_to? :hup\n }\n\n Signal.trap('TERM') {\n @piper.close\n term if self.respond_to? :term\n }\n\n @thread = Thread.new {\n begin\n :wait until @piper.gets == START\n before_executing if self.respond_to? :before_executing\n child_loop\n rescue Exception => err\n @piper.puts err rescue nil\n ensure\n after_executing if self.respond_to? :after_executing\n @piper.close\n end\n }\n @thread.join\n ensure\n exit!\n end", "title": "" }, { "docid": "fce29c9cc7b0010280cafd4ebb18367a", "score": "0.5859476", "text": "def start_child\n # Aquire the write lock, so we prevent anyone from using the child until\n # its setup or recreated.\n unless @drb_object\n # Get the id of the parent process, so we can wait for exit in the child\n # so the child can exit if the parent closes.\n @parent_id = Process.pid\n\n @reader, @writer = IO.pipe\n\n if @child_id = fork\n # running as parent\n @writer.close\n\n # Read the url from the child\n uri = @reader.gets.strip\n\n # Setup a drb object to the child\n DRb.start_service\n\n @drb_object = DRbObject.new_with_uri(uri)\n @server_proxy = @drb_object[0]\n @dispatcher_proxy = @drb_object[1]\n\n SocketConnectionHandler.dispatcher = @dispatcher_proxy\n\n start_change_listener\n else\n # Running as child\n @reader.close\n\n watch_for_parent_exit\n\n begin\n volt_app = @server.boot_volt\n @rack_app = volt_app.middleware\n\n # Set the drb object locally\n @dispatcher = Dispatcher.new(volt_app)\n rescue Exception => error\n boot_error(error)\n end\n\n\n drb_object = DRb.start_service('drbunix:', [self, @dispatcher])\n\n @writer.puts(drb_object.uri)\n\n begin\n DRb.thread.join\n rescue Interrupt => e\n # Ignore interrupt\n exit\n end\n end\n end\n end", "title": "" }, { "docid": "fd6affe131352a8aa8382233bd6d928d", "score": "0.5788425", "text": "def do_fork(arg)\n r, w = IO.pipe\n pid = Process.spawn(arg, out: w)\n Process.detach pid\n puts 'spawned process under pid: ' + pid.to_s\n w.close\n r.close\n false\n end", "title": "" }, { "docid": "753e56542459fea46cb7d7aa7a682008", "score": "0.5769644", "text": "def blocking_popen(command)\n POSIX::Spawn::Child.new(command)\n end", "title": "" }, { "docid": "1f78f7339215635fc50eeebf6d8b1f19", "score": "0.57610595", "text": "def start_root_parent\n $root_parent = $$\n child_pid = fork\n if child_pid\n Signal.trap('INT') do\n dlog(\"Root-parent: Got INT, ignoring\")\n end\n Signal.trap('USR1') do\n dlog(\"Root-parent: Got USR1, exiting\")\n cleanup_global_timetravel_state\n Kernel.exit! true\n end\n dlog \"Root parent: Waiting on child pid #{child_pid}\"\n Process.waitpid child_pid\n dlog \"Root parent: Exiting after wait\"\n cleanup_global_timetravel_state\n FileUtils.rm(\"/tmp/timetravel_#{$root_parent}.json\")\n Kernel.exit! true\n end\n end", "title": "" }, { "docid": "999c34054e3e32c407abe0eef6690aec", "score": "0.57498515", "text": "def start\n @restarts += 1 if @run_once\n r, w = IO.pipe\n begin\n outside_pid = fork do\n STDOUT.reopen(w)\n r.close\n pid = fork do\n #Process.setsid\n #Dir.chdir '/'\n $0 = @cmd\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(\"/dev/null\")\n STDERR.reopen(STDOUT)\n 3.upto(256){|fd| IO.new(fd).close rescue nil}\n exec cmd\n end\n puts pid.to_s\n end\n Process.waitpid(outside_pid, 0)\n w.close\n pid = r.gets.chomp.to_i\n puts \"Parent: #{pid}\"\n ensure\n r.close rescue nil\n w.close rescue nil\n end\n @run_once = true\n @pid = @get_child ? child_pids(pid)[0].to_i : pid\n end", "title": "" }, { "docid": "93368c3338bb29a17c4031e5aa11bda3", "score": "0.5726899", "text": "def fork_child\n Thread.start do\n pid = fork do\n DRb.stop_service\n\n DRb.start_service\n\n processor\n end\n\n Process.wait pid\n end\n end", "title": "" }, { "docid": "2634e5fe501faf30553405b9814fae21", "score": "0.57173413", "text": "def spawn\n\t\t\t\t@daemon.prefork\n\t\t\t\t@daemon.mark_log\n\n\t\t\t\tfork do\n\t\t\t\t\tProcess.setsid\n\t\t\t\t\texit if fork\n\n\t\t\t\t\tProcessFile.store(@daemon, Process.pid)\n\n\t\t\t\t\tFile.umask 0000\n\t\t\t\t\tDir.chdir @daemon.working_directory\n\n\t\t\t\t\t$stdin.reopen '/dev/null'\n\t\t\t\t\t$stdout.reopen @daemon.log_file_path, 'a'\n\t\t\t\t\t$stdout.sync = true\n\t\t\t\t\n\t\t\t\t\t$stderr.reopen $stdout\n\t\t\t\t\t$stderr.sync = true\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@daemon.spawn\n\t\t\t\t\trescue Exception => error\n\t\t\t\t\t\t$stderr.puts \"=== Daemon Exception Backtrace @ #{Time.now.to_s} ===\"\n\t\t\t\t\t\t$stderr.puts \"#{error.class}: #{error.message}\"\n\t\t\t\t\t\t$!.backtrace.each { |at| $stderr.puts at }\n\t\t\t\t\t\t$stderr.puts \"=== Daemon Crashed ===\"\n\t\t\t\t\t\t$stderr.flush\n\t\t\t\t\tensure\n\t\t\t\t\t\t$stderr.puts \"=== Daemon Stopping @ #{Time.now.to_s} ===\"\n\t\t\t\t\t\t$stderr.flush\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "7efff6b2bb1624de198d48a2c1158ab8", "score": "0.5714646", "text": "def attach_and_monitor(parent)\n @parent.remove_child(self)\n @parent = parent\n parent.add_child(self)\n monitor(parent)\n self\n end", "title": "" }, { "docid": "7369f5cc34757a2a8ccfa402512eddff", "score": "0.5701224", "text": "def spawn *cmd\n pid = Process.spawn *cmd\n\n switch = true\n Signal.trap 'SIGINT' do\n Process.kill( :QUIT, pid ) && Process.wait\n switch = false\n end\n while switch do sleep 1 end\nend", "title": "" }, { "docid": "6726f505319fcc17586020aca46453bc", "score": "0.56706285", "text": "def wait_and_capture(pid, timeout)\n started_waiting_at = Time.now\n status = nil\n signals = [:TERM, :KILL]\n loop do\n # Use wait2 to recover the status without the global variable (we might\n # be threaded), use WNOHANG so that we do not have to block while waiting\n # for the process to complete. If we block (without WNOHANG), MRI will still\n # be able to do other work _but_ we might be waiting indefinitely. If we use\n # a non-blocking option we can supply a timeout and force-quit the process\n # without using the Timeout module (and conversely having an overhead of 1\n # watcher thread per child spawned).\n if wait_res = Process.wait2(pid, Process::WNOHANG | Process::WUNTRACED)\n _, status = wait_res\n return status.exitstatus || DEFAULT_ERROR_STATUS\n else\n # If the process is still busy and didn't quit,\n # we have to undertake Measures. Send progressively\n # harsher signals to the child\n Process.kill(signals.shift, pid) if (Time.now - started_waiting_at) > timeout\n if signals.empty? # If we exhausted our force-quit powers, do a blocking wait. KILL _will_ work.\n _, status = Process.wait2(pid)\n return status.exitstatus || DEFAULT_ERROR_STATUS # For killed processes this will be nil\n end\n end\n Thread.pass\n end\n rescue Errno::ECHILD, Errno::ESRCH, Errno::EPERM => e# The child already quit\n # Assume the process finished correctly. If there was an error, we will discover\n # that from a zero-size output file. There may of course be a thing where the\n # file gets written incompletely and the child crashes but hey - computers!\n return 0\n end", "title": "" }, { "docid": "81e9537d80e23cac27d170a337f684c1", "score": "0.5669655", "text": "def fork\r\n last_arg = ARGV.last\r\n \r\n # Look for the 'child#xxx' tag\r\n if last_arg =~ /child#\\d+/\r\n @i += 1\r\n num = last_arg.split('#').last.to_i\r\n if num == @i\r\n if block_given?\r\n status = 0\r\n begin\r\n yield\r\n rescue Exception\r\n status = -1 # Any non-zero result is failure\r\n ensure\r\n return status\r\n end\r\n end\r\n return nil\r\n else\r\n return false\r\n end\r\n end\r\n \r\n # Tag the command with the word 'child#xxx' to distinguish it\r\n # from the calling process.\r\n cmd = 'ruby -I \"' + $LOAD_PATH.join(File::PATH_SEPARATOR) << '\" \"'\r\n cmd << File.expand_path($PROGRAM_NAME) << '\" ' << ARGV.join(' ')\r\n cmd << ' child#' << @child_pids.length.to_s\r\n \r\n startinfo = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\r\n startinfo = startinfo.pack('LLLLLLLLLLLLSSLLLL')\r\n procinfo = [0,0,0,0].pack('LLLL')\r\n \r\n rv = CreateProcess(0, cmd, 0, 0, 1, 0, 0, 0, startinfo, procinfo)\r\n \r\n if rv == 0\r\n raise ProcessError, get_last_error\r\n end\r\n \r\n pid = procinfo[8,4].unpack('L').first\r\n @child_pids.push(pid)\r\n \r\n pid \r\n end", "title": "" }, { "docid": "fd48844935e6a41e63735d7d7a40c4f2", "score": "0.5656516", "text": "def wait(opts = 0)\n r = Ragweed::Wraptux::waitpid(@pid,opts)\n status = r[1]\n wstatus = wtermsig(status)\n signal = wexitstatus(status)\n event_code = (status >> 16)\n found = false\n\n if r[0] != 0 ## Check the ret\n case ## FIXME - I need better logic (use Signal module)\n when wstatus == 0 ##WIFEXITED\n @exited = true\n self.on_exit\n when wstatus != 0x7f ##WIFSIGNALED\n @exited = false\n self.on_signal\n when signal == Ragweed::Wraptux::Signal::SIGINT\n self.continue\n when signal == Ragweed::Wraptux::Signal::SIGSEGV\n self.on_segv\n when signal == Ragweed::Wraptux::Signal::SIGILL\n self.on_illegalinst\n when signal == Ragweed::Wraptux::Signal::SIGTRAP\n self.on_sigtrap\n r = self.get_registers\n eip = r[:eip]\n eip -= 1\n case\n when @breakpoints.has_key?(eip)\n found = true\n self.on_breakpoint\n self.continue\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::FORK\n p = Array.new(1)\n p = p.to_ptr\n p.struct!('L', :pid)\n Ragweed::Wraptux::ptrace(Ragweed::Wraptux::Ptrace::GETEVENTMSG, @pid, 0, p.to_i)\n ## Fix up the PID in each breakpoint\n if (1..65535) === p[:pid] && @opts[:fork] == true\n @breakpoints.each_pair do |k,v|\n v.each do |b|\n b.bpid = p[:pid];\n b.bppid = p[:pid];\n end\n end\n\n @pid = p[:pid]\n self.on_fork_child(@pid)\n end\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::EXEC\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::CLONE\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::VFORK\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::EXIT\n ## Not done yet\n else\n self.continue\n end\n when signal == Ragweed::Wraptux::Signal::SIGCHLD\n self.on_sigchild\n when signal == Ragweed::Wraptux::Signal::SIGTERM\n self.on_sigterm\n when signal == Ragweed::Wraptux::Signal::SIGCONT\n self.continue\n when signal == Ragweed::Wraptux::Signal::SIGSTOP\n self.on_sigstop\n Ragweed::Wraptux::kill(@pid, Ragweed::Wraptux::Signal::SIGCONT)\n self.continue\n\t when signal == Ragweed::Wraptux::Signal::SIGWINCH\n\t\tself.continue\n else\n raise \"Add more signal handlers (##{signal})\"\n end\n end\n end", "title": "" }, { "docid": "495cfcd52cdf884b3c2025e0473eb7d0", "score": "0.5646794", "text": "def capture_process(time)\n # Create child process to send Signal for interrupt.\n read, write = IO.pipe\n pid = fork do\n load '.simplecov'\n read.close\n output = capture(:stdout, true) { yield }\n Marshal.dump(output, write)\n exit 0\n end\n write.close\n puts \"Sleeping #{time} sec...\"\n sleep time\n # Send SIGINT and wait it finishes\n Process.kill :INT, pid\n Process.waitpid(pid)\n # Get output\n Marshal.load(read.read)\nend", "title": "" }, { "docid": "b8c0611cbc31d6dbe10255e2d9b41c03", "score": "0.5645452", "text": "def kill_child\n if @child\n log_with_severity :debug, \"Killing child at #{@child}\"\n if `ps -o pid,state -p #{@child}`\n Process.kill(\"KILL\", @child) rescue nil\n else\n log_with_severity :debug, \"Child #{@child} not found, restarting.\"\n shutdown\n end\n end\n end", "title": "" }, { "docid": "78fa14829732a757d5a4d816357aa595", "score": "0.5623522", "text": "def add_child\n process_is :running do\n Process.kill('TTIN', pid)\n end\n end", "title": "" }, { "docid": "32ca0d59b001f09a32e88dc7764af55b", "score": "0.56179", "text": "def start_new_child(child_spec)\n @child_specs[child_spec.child_id] = child_spec\n self.start_process(child_spec.child_id)\n end", "title": "" }, { "docid": "2629994405dc2d83c4234e5f3e621102", "score": "0.5596389", "text": "def fork_and_work\n # If the limiter is full, then we will block until space permits.\n @limiter.enq(1)\n Thread.new do\n begin\n cpid = fork {setup_child; work}\n log(:at => :fork, :pid => cpid)\n Process.wait(cpid)\n ensure\n # Once we are done with our work and our process has exited,\n # we can allow another process to run.\n @limiter.deq\n end\n end\n end", "title": "" }, { "docid": "1538a5084b28bafe90a2b9031d74fdf4", "score": "0.55872977", "text": "def wait_for_child(child_pid)\n begin\n\n p = nil\n Timeout.timeout(60) do\n\n # wait for SocketPasser to finish its job (means new proc started up)\n # AND wait for the pid file to get updated with the new pid id\n # AND for the startup lock to be cleared\n while true do\n if !Pid.running?(child_pid) && @socket_passer.join(1).nil? then\n # new process died but SocketPasser is still waiting/working, bail out\n # (pid changes when daemonizing so we need to do the extra check)\n raise Timeout::Error\n end\n p = @pid.read\n if @socket_passer.join(0.1) && !p.nil? && Process.pid != p && !@daemon_starter.starting? then\n break\n end\n sleep 1\n end\n end\n\n if Process.pid != @pid.read && @pid.running? then\n # pid file changed and daemon is running\n return true\n end\n\n rescue Timeout::Error\n # if we got here, kill the child process and try again\n log \"* replacement startup timed out\"\n if Pid.running?(child_pid) then\n Process.kill(9, child_pid) # kill!\n else\n log \"* child process seems to have died\"\n end\n @daemon_starter.cleanup! # nuke locks so we can try again\n end\n\n false\n end", "title": "" }, { "docid": "fb797fb00638d655dfbc954c32608bd7", "score": "0.55712503", "text": "def wait(opts = 0)\n r, status = Ragweed::Wraptux::waitpid(@pid, opts)\n wstatus = wtermsig(status)\n @signal = wexitstatus(status)\n event_code = (status >> 16)\n found = false\n\n if r[0] != -1 ## Check the ret\n case ## FIXME - I need better logic (use Signal module)\n when wstatus == 0 ##WIFEXITED\n @exited = true\n try(:on_exit)\n when wstatus != 0x7f ##WIFSIGNALED\n @exited = false\n try(:on_signal)\n when @signal == Ragweed::Wraptux::Signal::SIGINT\n try(:on_sigint)\n self.continue\n when @signal == Ragweed::Wraptux::Signal::SIGSEGV\n try(:on_segv)\n when @signal == Ragweed::Wraptux::Signal::SIGILL\n try(:on_illegal_instruction)\n when @signal == Ragweed::Wraptux::Signal::SIGIOT\n try(:on_iot_trap)\n self.continue\n when @signal == Ragweed::Wraptux::Signal::SIGTRAP\n try(:on_sigtrap)\n r = self.get_registers\n eip = r.eip\n eip -= 1\n case\n when @breakpoints.has_key?(eip)\n found = true\n try(:on_breakpoint)\n self.continue\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::FORK\n p = FFI::MemoryPointer.new(:int, 1)\n Ragweed::Wraptux::ptrace(Ragweed::Wraptux::Ptrace::GETEVENTMSG, @pid, 0, p.to_i)\n ## Fix up the PID in each breakpoint\n if (1..65535) === p.get_int32(0) && @opts[:fork] == true\n @breakpoints.each_pair do |k,v|\n v.each do |b|\n b.bppid = p[:pid]\n end\n end\n\n @pid = p[:pid]\n try(:on_fork_child, @pid)\n end\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::EXEC\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::CLONE\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::VFORK\n when event_code == Ragweed::Wraptux::Ptrace::EventCodes::EXIT\n ## Not done yet\n else\n self.continue\n end\n when @signal == Ragweed::Wraptux::Signal::SIGCHLD\n try(:on_sigchild)\n when @signal == Ragweed::Wraptux::Signal::SIGTERM\n try(:on_sigterm)\n when @signal == Ragweed::Wraptux::Signal::SIGCONT\n try(:on_continue)\n self.continue\n when @signal == Ragweed::Wraptux::Signal::SIGSTOP\n try(:on_sigstop)\n Ragweed::Wraptux::kill(@pid, Ragweed::Wraptux::Signal::SIGCONT)\n self.continue\n when @signal == Ragweed::Wraptux::Signal::SIGWINCH\n self.continue\n else\n raise \"Add more signal handlers (##{@signal})\"\n end\n end\n end", "title": "" }, { "docid": "d4a1b846f16a938ff2b90746fab5788d", "score": "0.5567164", "text": "def daemonize\n if pid = fork\n Process.detach(pid)\n exit(0)\n end\n\n create_pidfile\n\n # Get rid of console logging\n Puppet::Util::Log.close(:console)\n\n Process.setsid\n Dir.chdir(\"/\")\n begin\n $stdin.reopen \"/dev/null\"\n $stdout.reopen \"/dev/null\", \"a\"\n $stderr.reopen $stdout\n Puppet::Util::Log.reopen\n rescue => detail\n Puppet.err \"Could not start #{Puppet[:name]}: #{detail}\"\n Puppet::Util::replace_file(\"/tmp/daemonout\", 0644) do |f|\n f.puts \"Could not start #{Puppet[:name]}: #{detail}\"\n end\n exit(12)\n end\n end", "title": "" }, { "docid": "292eb6fc56bd7c8653b18e09be25dbe6", "score": "0.55659884", "text": "def daemonize\n fork do\n Process.setsid\n exit if fork\n store_pid(Process.pid)\n # Dir.chdir \"/\" # Mucks up logs\n File.umask 0000\n STDIN.reopen \"/dev/null\"\n STDOUT.reopen \"/dev/null\", \"a\"\n STDERR.reopen STDOUT\n start\n end\n end", "title": "" }, { "docid": "40de5aa99feb99059d6227015635a877", "score": "0.5554645", "text": "def fork\n send_cmd(:fork)\n if wait('for fork', 30){ !!@forked_pid }\n @forked_pid\n else\n STDERR.puts '*** timed out waiting for fork'\n end\n end", "title": "" }, { "docid": "40de5aa99feb99059d6227015635a877", "score": "0.5554645", "text": "def fork\n send_cmd(:fork)\n if wait('for fork', 30){ !!@forked_pid }\n @forked_pid\n else\n STDERR.puts '*** timed out waiting for fork'\n end\n end", "title": "" }, { "docid": "3a9033e9c78bae9e4e6f8fb18c9f132f", "score": "0.5552747", "text": "def pause_before_fork_in_parent\n end", "title": "" }, { "docid": "030aae2be7e8e242d7b346694ba54670", "score": "0.55479604", "text": "def spawn\n # TODO(sissel): Do this in a platform-safe way (ruby, jruby, etc)\n @pid = ::Process.fork do\n begin\n run \n rescue => e\n puts :CHILDERR => e\n end\n exit 0\n end\n end", "title": "" }, { "docid": "9e9f47bcf3648805c5c2674302432dee", "score": "0.55425274", "text": "def respawn_child_fork\n cmd = File.join(self.rails_root, \"script\", \"puma\") + \" server\"\n redirects = export_fds()\n child_pid = fork { Dir.chdir(self.rails_root); exec(cmd, redirects) }\n Process.detach(child_pid)\n\n log \"* started server process #{child_pid}\"\n\n return child_pid\n end", "title": "" }, { "docid": "82c1854f0602c2bcf977a99631dac97d", "score": "0.55406773", "text": "def daemonize\n if pid = fork\n Process.detach(pid)\n exit(0)\n end\n\n # Get rid of console logging\n Puppet::Util::Log.close(:console)\n\n Process.setsid\n Dir.chdir(\"/\")\n begin\n $stdin.reopen \"/dev/null\"\n $stdout.reopen \"/dev/null\", \"a\"\n $stderr.reopen $stdout\n Puppet::Util::Log.reopen\n rescue => detail\n Puppet::Util.replace_file(\"/tmp/daemonout\", 0644) { |f|\n f.puts \"Could not start #{Puppet[:name]}: #{detail}\"\n }\n raise \"Could not start #{Puppet[:name]}: #{detail}\"\n end\n end", "title": "" }, { "docid": "374fc09338cedbf8d7901da5571cab39", "score": "0.55357164", "text": "def runfork(ps=false)\n logger = Logger.new(STDERR) # Log everything to STDERR\n logger.debug \"Forking: Parent ID = #{Process.pid}\"\n DB.disconnect\n child = fork do\n begin\n start = Time.now\n logger.debug \"Child PID = #{Process.pid}\"\n yield\n rescue => ex\n ps.update(:status => \"done\") if ps\n logger.error \"Child returned an exception: - #{ex.class}: #{ex.message}\"\n ensure\n logger.info \"Child #{Process.pid} took #{Time.now - start} sec\"\n exit!(0)\n end\n end\n Process.detach(child)\n return child\n\n end", "title": "" }, { "docid": "b68f91fba615cfe03fa86a245013c809", "score": "0.5530855", "text": "def start_process(child_id)\n child_spec = @child_specs[child_id]\n pid = Process.fork do\n child_spec.start_func.call(*(child_spec.args))\n end\n\n child_spec.pid = pid\n Sleepier.logger.info(\"Started #{child_spec.child_id} with pid #{pid}\")\n end", "title": "" }, { "docid": "f4df929f3f3db1a9223595ea94d772f3", "score": "0.5530405", "text": "def daemonize\n fork do\n Process.setsid\n exit if fork\n Dir.chdir('/tmp')\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen('/dev/null', 'a')\n\n yield\n end\nend", "title": "" }, { "docid": "253d5c4b4115356a17325b9b1d577123", "score": "0.55173266", "text": "def call_as_daemon(block, logfile_name = nil, app_name = nil)\n # we use a pipe to return the PID of the daemon\n rd, wr = IO.pipe\n\n if tmppid = safefork\n # in the parent\n\n wr.close\n pid = rd.read.to_i\n rd.close\n\n Process.waitpid(tmppid)\n\n return pid\n else\n # in the child\n\n rd.close\n\n # Detach from the controlling terminal\n unless Process.setsid\n fail Daemons.RuntimeException.new('cannot detach from controlling terminal')\n end\n\n # Prevent the possibility of acquiring a controlling terminal\n trap 'SIGHUP', 'IGNORE'\n exit if pid = safefork\n\n wr.write Process.pid\n wr.close\n\n $0 = app_name if app_name\n\n # Release old working directory\n Dir.chdir '/'\n\n close_io\n\n redirect_io(logfile_name)\n\n # Split rand streams between spawning and daemonized process\n srand\n\n block.call\n\n exit\n end\n end", "title": "" }, { "docid": "78474e3b483eaec2bdc779b228065966", "score": "0.5514394", "text": "def start\n @pid_list << @piper.pid if @piper\n @error = nil\n @piper = ::Servolux::Piper.new('rw', :timeout => @timeout)\n @piper.parent? ? parent : child\n self\n end", "title": "" }, { "docid": "95d28e498871e5b9531fc85b3f2d71eb", "score": "0.5514063", "text": "def daemonize\n exit if fork\n Process.setsid\n exit if fork\n Dir.chdir('/')\n $stdin.reopen(@stdin)\n $stdout.reopen(@stdout, 'a').sync = true\n $stderr.reopen(@stderr, 'a').sync = true\n File.open(@pid, 'w') {|f| f.write(Process.pid) }\n at_exit { delete_pid }\n trap('TERM') { exit }\n end", "title": "" }, { "docid": "07ac2d1576c049fe6ba7eae591875406", "score": "0.551274", "text": "def monitor\n while true\n begin\n pid, status = Process.wait2\n rescue Errno::ECHILD\n if @started\n Sleepier.logger.warn(\"No children, exiting\")\n break\n end\n end\n\n self.handle_finished_process(pid, status)\n end\n end", "title": "" }, { "docid": "4ce0caea2b7ef7a35fa8956c6d3ffa76", "score": "0.55040246", "text": "def popen command, &block\n @pid = fork_child( command )\n # Parent process\n @parent.close\n begin\n yield @child.stdout, @child.stderr\n ensure\n @child.close\n end\n self\n end", "title": "" }, { "docid": "27db4309995b8602c9917579d845b9df", "score": "0.5486528", "text": "def fork\n # make a port for receiving message from child\n port = Mach::Port.new\n port.insert_right(:make_send)\n Mach::Task.self.set_bootstrap_port(port)\n \n if block_given?\n pid = __mach_original_fork__ do\n ProcessShared::Mach.after_fork_child\n yield\n end\n\n ProcessShared::Mach.after_fork_parent(port)\n pid\n else\n if pid = __mach_original_fork__\n ProcessShared::Mach.after_fork_parent(port)\n pid\n else\n ProcessShared::Mach.after_fork_child\n nil\n end\n end\n end", "title": "" }, { "docid": "68530615b027a85e511ef2690e2cf6ca", "score": "0.54798275", "text": "def spawn_proc(file_name, log_config)\n if File.exists? file_name\n puts file_name\n pid = Process.fork\n if pid.nil?\n logwatch(file_name, log_config)\n else\n #TODO: $pids[pid] = {:file_name => file_name, :log_config => log_config}\n $pids[pid] = [file_name, log_config]\n end\n else\n puts \"#{file_name} dne\"\n end\nend", "title": "" }, { "docid": "ef9541d0c88ba8c9edba4029e07ae0ef", "score": "0.5458751", "text": "def restart_stopped_children\n loop do\n break unless pid = Process.wait(-1, Process::WNOHANG)\n #puts \"received sigchild, pid #{pid}\"\n mutex.synchronize do\n if socket = config[:children].delete(pid)\n start_child(socket)\n end\n end\n end rescue nil\n end", "title": "" }, { "docid": "402deec3edbeab41894363c63ec72db4", "score": "0.5456581", "text": "def daemonise\n unlink_pid_file\n\n if @daemonise\n fork && exit\n\n unless Process.setsid\n raise RuntimeException, 'cannot detach from controlling terminal'\n end\n\n $0 = @name\n\n # Be nice to unmount.\n Dir.chdir \"/\"\n\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(\"/dev/null\")\n STDERR.reopen(STDOUT)\n end\n\n $0 = @name\n\n @pid.pid = Process.pid\n logger.debug { \"Pid file: #{@pid.filename}\" }\n end", "title": "" }, { "docid": "ea488d07269a26e195f502e7a1b8c6b3", "score": "0.5447599", "text": "def run_command\n @child_pid = fork_subprocess\n @reaped = false\n\n configure_parent_process_file_descriptors\n\n # Ruby 1.8.7 and 1.8.6 from mid 2009 try to allocate objects during GC\n # when calling IO.select and IO#read. Disabling GC works around the\n # segfault, but obviously it's a bad workaround. We no longer support\n # 1.8.6 so we only need this hack for 1.8.7.\n GC.disable if RUBY_VERSION == ONE_DOT_EIGHT_DOT_SEVEN\n\n # CHEF-3390: Marshall.load on Ruby < 1.8.7p369 also has a GC bug related\n # to Marshall.load, so try disabling GC first.\n propagate_pre_exec_failure\n\n @status = nil\n @result = nil\n @execution_time = 0\n\n write_to_child_stdin\n\n until @status\n ready_buffers = attempt_buffer_read\n unless ready_buffers\n @execution_time += READ_WAIT_TIME\n if @execution_time >= timeout && !@result\n # kill the bad proccess\n reap_errant_child\n # read anything it wrote when we killed it\n attempt_buffer_read\n # raise\n raise CommandTimeout, \"Command timed out after #{@execution_time.to_i}s:\\n#{format_for_exception}\"\n end\n end\n\n attempt_reap\n end\n\n self\n rescue Errno::ENOENT\n # When ENOENT happens, we can be reasonably sure that the child process\n # is going to exit quickly, so we use the blocking variant of waitpid2\n reap\n raise\n ensure\n reap_errant_child if should_reap?\n # make one more pass to get the last of the output after the\n # child process dies\n attempt_buffer_read\n # no matter what happens, turn the GC back on, and hope whatever busted\n # version of ruby we're on doesn't allocate some objects during the next\n # GC run.\n GC.enable\n close_all_pipes\n end", "title": "" }, { "docid": "bb6e097eef4b74f6d4d0ec123d0db300", "score": "0.54474574", "text": "def spawn(*cmd)\n puts cmd.join(' ')\n pid = Process.spawn(*cmd)\n switch = true\n Signal.trap 'SIGINT' do\n Process.kill(:QUIT, pid) && Process.wait\n switch = false\n end\n sleep 0.1 while switch\nend", "title": "" }, { "docid": "936956d9d0d859c9b8c4f52fecf415bd", "score": "0.54380256", "text": "def safefork\n tryagain = true\n\n while tryagain\n tryagain = false\n begin\n if pid = fork\n return pid\n end\n rescue Errno::EWOULDBLOCK\n sleep 5\n tryagain = true\n end\n end\n end", "title": "" }, { "docid": "4d64eb03c87cd5210c73dada0558813a", "score": "0.5430155", "text": "def respawn_child\n cmd = File.join(self.rails_root, \"script\", \"puma\") + \" server\"\n redirects = export_fds()\n child_pid = fork { Dir.chdir(self.rails_root); exec(cmd, redirects) }\n Process.detach(child_pid)\n\n log \"* started server process #{child_pid}\"\n\n return child_pid\n end", "title": "" }, { "docid": "c4369c0888ebb2d005293c81704955fd", "score": "0.54113734", "text": "def safefork\n tryagain = true\n\n while tryagain\n tryagain = false\n begin\n if pid = fork\n return pid\n end\n rescue Errno::EWOULDBLOCK\n sleep 5\n tryagain = true\n end\n end\n end", "title": "" }, { "docid": "e27ec60aa1dd24931f16008d9043d943", "score": "0.5408599", "text": "def reap_old_pings\n loop { Process.waitpid(-1, Process::WNOHANG) }\n rescue Errno::ECHILD\n end", "title": "" }, { "docid": "5b63cabcc13d713a6bbd5730e676834d", "score": "0.5401157", "text": "def request_work\n write_message(@child_write, Process.pid.to_s) unless ready?\n @ready = true\n end", "title": "" }, { "docid": "74e932ed43e5aae774d32542a952ff7e", "score": "0.5393727", "text": "def spawn(*args, &block)\n if @sigchld_source.nil?\n @sigchld_source = add_unix_signal(\"CHLD\") {\n reap_children\n }\n end\n\n pid = Process.spawn(*args)\n @children << {:pid => pid, :block => block}\n pid\n end", "title": "" }, { "docid": "e561ac5264d69a77bc8a297c98c852d9", "score": "0.53922486", "text": "def start_child(socket)\n return if config[:shutdown]\n pid = fork do\n $STYLE_SOCKET = socket\n [:HUP, :INT, :TERM, :USR1, :USR2].each{|signal| trap(signal, 'DEFAULT')}\n config[:sockets].keys.each{|sock| sock.close unless sock == socket}\n $0 = \"#{process_name} port:#{config[:sockets][socket]}\"\n run_child\n end\n #puts \"started pid #{pid}\"\n config[:children][pid] = socket\n end", "title": "" }, { "docid": "2f60d02460236f3ddc4a6b50fae01edf", "score": "0.5380897", "text": "def fork_child(block)\n child = Verneuil::Process.new(@program, nil)\n child.run_block(block)\n \n @children << child\n \n return child\n end", "title": "" }, { "docid": "d4d54d1b2b99451e4534f889cbe74f67", "score": "0.5379218", "text": "def fork_and_watch(name)\n create_thread(name) do |tube_name|\n until self.class.shutdown\n pid = fork_tube(tube_name)\n _, status = wait_for_process(pid)\n\n # 99 = garbaged\n if status.exitstatus != 99\n log_error(\"Catastrophic failure: tube #{tube_name} exited with code #{status.exitstatus}.\")\n end\n end\n end\n end", "title": "" }, { "docid": "2744dc5744a87c81e4e2fd9ac1a19aa0", "score": "0.5367822", "text": "def daemonize(foreground = false)\n ['SIGINT', 'SIGTERM', 'SIGHUP'].each do |sig|\n Signal.trap(sig) { shutdown }\n end\n return yield if $DEBUG || foreground\n Process.fork do\n Process.setsid\n Dir.chdir '/' \n File.open('/dev/null', 'r+') do |fd|\n STDIN.reopen fd\n STDOUT.reopen fd\n STDERR.reopen fd\n end\n File.open(@pidfile, 'w') {|fd| fd.puts Process.pid } if !@pidfile.nil?\n yield\n end \n exit! 0\n end", "title": "" }, { "docid": "8ca409b6526767ce9b8b649506dd7595", "score": "0.5366923", "text": "def shallow_sleep(secs, parent_pid)\n start = Time.now\n loop do\n wakeup = (Time.now - start) > secs\n @terminating = true unless alive?(parent_pid)\n return if wakeup or @terminating \n sleep 1\n end\n end", "title": "" }, { "docid": "b027c225daa1257a57eee8a4dfdd340c", "score": "0.5350801", "text": "def new_thread\n this = self\n Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n cleanup = lambda{}\n\n IO.popen command, \"r+\" do |pipe|\n this.pid = pid = pipe.pid\n cleanup = lambda do\n cleanup = lambda{}\n begin; Process.kill(Runner.kill_signal, pid); rescue Exception; 42; end\n end\n at_exit &cleanup\n Process.wait\n end\n\n Bj.logger.error{ \"#{ command } failed with #{ $?.inspect }\" } unless\n [0, 42].include?($?.exitstatus)\n\n cleanup.call\n\n sleep 42\n end\n end\n end", "title": "" }, { "docid": "e8375ee13fa35a79dee814537370b02a", "score": "0.53382707", "text": "def daemonize()\n exit if fork\n Process.setsid\n exit if fork\n Dir.chdir \"/\"\n STDIN.reopen \"/dev/null\"\n STDOUT.reopen \"/dev/null\"\n STDERR.reopen \"/dev/null\"\n \n write_pid_and_messages()\n \n Signal.trap(\"TERM\") do\n exit if @connections == 0\n @running = false\n @mutex.synchronize do\n @config.log.debug(\"Received interrupt; stopping...\")\n end\n end\n end", "title": "" }, { "docid": "90bbb2194aaaa8ad6ce6ce12516baf2b", "score": "0.5329624", "text": "def reopen_after_fork!\n # ok, we know that only the child process calls this, right?\n return false unless (@state == :running) or (@state == :paused)\n logger.debug { \"#{self.class}##{__method__}\" }\n\n @state = :running\n @mutex = Mutex.new\n @cond = ConditionVariable.new\n @queue = []\n prune_dead_threads\n spawn_threadpool\n end", "title": "" }, { "docid": "c8cebb4a08f7e66c72c84a6f3d0eb9a9", "score": "0.53120315", "text": "def fork_and_unshare\n io_in, io_out = IO.pipe\n\n LibC.prctl(FrrCliFuzzer::LibC::PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0)\n\n pid = Kernel.fork do\n LibC.unshare(LibC::CLONE_NEWNS | LibC::CLONE_NEWPID | LibC::CLONE_NEWNET)\n\n # Fork again to use the new PID namespace.\n # Need to supress a warning that is irrelevant for us.\n warn_level = $VERBOSE\n $VERBOSE = nil\n pid = Kernel.fork do\n # HACK: kill when parent dies.\n trap(:SIGUSR1) do\n LibC.prctl(LibC::PR_SET_PDEATHSIG, 15, 0, 0, 0)\n trap(:SIGUSR1, :IGNORE)\n end\n LibC.prctl(LibC::PR_SET_PDEATHSIG, 10, 0, 0, 0)\n\n mount_propagation(LibC::MS_REC | LibC::MS_PRIVATE)\n mount_proc\n yield\n end\n $VERBOSE = warn_level\n io_out.puts(pid)\n exit(0)\n end\n\n @pid = io_in.gets.to_i\n Process.waitpid(pid)\n rescue SystemCallError => e\n warn \"System call error:: #{e.message}\"\n warn e.backtrace\n exit(1)\n end", "title": "" }, { "docid": "6efb0144b6526693bc9b967bd6b99bdc", "score": "0.530641", "text": "def start\n Process.daemon(true) # <-- true means stay in the current directory\n # Note that you must write the pid to file AFTER creating the daemon, or else you won't\n # have the daemon's pid.\n if write_pid\n File.open(\"./status\", \"w\") { |f| f.write \"So tasty.\\n\" }\n tasty = TastyNoodles.new\n tasty.work\n else\n my_puts \"TastyNoodles daemon might not be operating correctly. Please kill it with a kill -9 pid\"\n end\n\nend", "title": "" }, { "docid": "44948b3ee166ba227019cc83749dd71a", "score": "0.52975386", "text": "def daemonize\n check_pid\n ::Process.daemon\n write_pid\n end", "title": "" }, { "docid": "7e69ef6247995c36453e6e9470bc8b79", "score": "0.5296384", "text": "def start(&block)\n if pid\n STDERR.puts \"pidfile #{self.pidpath} with pid #{@pid} already exists. \" +\n \"Make sure this daemon is not already running.\"\n exit!\n end\n\n #----- Fork off from the calling process -----#\n begin\n fork do\n Process.setsid #----- make forked process session leader\n fork && exit!\n\n at_exit do\n remove_pidfile\n end\n\n Dir::chdir(@workingdir) #----- chdir to working directory\n File::umask(0) #----- clear out file mode creation mask\n\n create_pidfile\n\n STDIN.reopen(\"/dev/null\", 'r')\n STDOUT.reopen(\"/dev/null\", \"w\")\n STDERR.reopen(\"/dev/null\", \"w\")\n\n if block_given?\n block.call\n else\n self.run\n end\n end\n rescue => e\n STDERR.puts \"Error: Failed to fork properly: \\n\\t: \" +\n \"(#{e.class}) #{e.message}\"\n exit!\n end\n end", "title": "" }, { "docid": "c75ba3f96bb86d7d4a677c4c0057fb07", "score": "0.52901006", "text": "def daemonize\n exit if fork\n Process.setsid\n exit if fork\n Dir.chdir \"/\"\n end", "title": "" }, { "docid": "6634d7dea49879e3a236af0ae82bbb44", "score": "0.5286629", "text": "def spawn(command)\n fork do\n ::Process.setsid\n\n dir = @working_dir || '/'\n Dir.chdir dir\n \n #$0 = command\n $0 = \"Magistrate Worker: #{@name}\"\n STDIN.reopen \"/dev/null\"\n \n STDOUT.reopen '/dev/null'\n STDERR.reopen STDOUT\n \n # if self.log_cmd\n # STDOUT.reopen IO.popen(self.log_cmd, \"a\") \n # else\n # STDOUT.reopen file_in_chroot(self.log), \"a\" \n # end\n # \n # if err_log_cmd\n # STDERR.reopen IO.popen(err_log_cmd, \"a\") \n # elsif err_log && (log_cmd || err_log != log)\n # STDERR.reopen file_in_chroot(err_log), \"a\" \n # else\n # STDERR.reopen STDOUT\n # end\n \n # close any other file descriptors\n 3.upto(256){|fd| IO::new(fd).close rescue nil}\n\n if @env && @env.is_a?(Hash)\n @env.each do |key, value|\n ENV[key] = value.to_s\n end\n end\n\n exec command unless command.empty?\n end\n end", "title": "" }, { "docid": "30308812eab11c26c306db24eefea470", "score": "0.52738756", "text": "def fire!\n # safely get a fork and fire the scan\n return nil unless should_fire?\n tryagain = true\n pid = nil\n @path = lock(self.targets)\n while tryagain\n begin\n if pid = fork(&self)\n tryagain = false\n end\n rescue Errno::EWOULDBLOCK\n sleep 5\n tryagain = true\n end\n end\n Process.detach(pid)\n end", "title": "" }, { "docid": "ab2bfafd6403a2a53541fbac0c974840", "score": "0.5264305", "text": "def spawn(cmd, target)\n super(cmd, target)\n\n # garbage collect any open file descriptors from past executions before\n # forking to prevent them being inherited. also reduces memory footprint\n # since forking will duplicate everything in memory for child process.\n ::GC.start\n\n # create pipes.\n stdin_r, stdin_w = IO.pipe\n stdout_r, stdout_w = IO.pipe\n stderr_r, stderr_w = IO.pipe\n status_r, status_w = IO.pipe\n\n [stdin_r, stdin_w, stdout_r, stdout_w,\n stderr_r, stderr_w, status_r, status_w].each {|fdes| fdes.sync = true}\n\n @pid = ::Kernel::fork do\n begin\n stdin_w.close\n ::STDIN.reopen stdin_r\n\n stdout_r.close\n ::STDOUT.reopen stdout_w\n\n stderr_r.close\n ::STDERR.reopen stderr_w\n\n status_r.close\n status_w.fcntl(::Fcntl::F_SETFD, ::Fcntl::FD_CLOEXEC)\n\n unless @options[:inherit_io]\n ::ObjectSpace.each_object(IO) do |io|\n if ![::STDIN, ::STDOUT, ::STDERR, status_w].include?(io)\n # be careful to not allow streams in a bad state from the\n # parent process to prevent child process running.\n (io.close rescue nil) unless (io.closed? rescue true)\n end\n end\n end\n\n if group = get_group\n ::Process.egid = group\n ::Process.gid = group\n end\n\n if user = get_user\n ::Process.euid = user\n ::Process.uid = user\n end\n\n if umask = get_umask\n ::File.umask(umask)\n end\n\n # avoid chdir when pwd is already correct due to asinine printed\n # warning from chdir block for what is basically a no-op.\n working_directory = @options[:directory]\n if working_directory &&\n ::File.expand_path(working_directory) != ::File.expand_path(::Dir.pwd)\n ::Dir.chdir(working_directory)\n end\n\n environment_hash = {}\n environment_hash['LC_ALL'] = 'C' if @options[:locale]\n environment_hash.merge!(@options[:environment]) if @options[:environment]\n environment_hash.each do |key, value|\n ::ENV[key.to_s] = value.nil? ? nil: value.to_s\n end\n\n if cmd.kind_of?(Array)\n cmd = cmd.map { |c| c.to_s } #exec only likes string arguments\n exec(*cmd)\n else\n exec('sh', '-c', cmd.to_s) # allows shell commands for cmd string\n end\n raise 'Unreachable code'\n rescue ::Exception => e\n # note that Marshal.dump/load isn't reliable for all kinds of\n # exceptions or else can be truncated by I/O buffering.\n error_data = {\n 'class' => e.class.name,\n 'message' => e.message,\n 'backtrace' => e.backtrace\n }\n status_w.puts(::YAML.dump(error_data))\n end\n status_w.close\n exit!\n end\n\n stdin_r.close\n stdout_w.close\n stderr_w.close\n status_w.close\n @stdin = stdin_w\n @stdout = stdout_r\n @stderr = stderr_r\n @status_fd = status_r\n start_timer\n true\n rescue\n # catch-all for failure to spawn process ensuring a non-nil status. the\n # PID most likely is nil but the exit handler can be invoked for async.\n safe_close_io\n @status = ::RightScale::RightPopen::ProcessStatus.new(@pid, 1)\n raise\n end", "title": "" }, { "docid": "80b24e8b82c146a7cbe4b4b74331fd76", "score": "0.52592033", "text": "def monitor_child_processes\n loop do\n pid = ::Process.wait\n @mutex.synchronize { @pids.delete(pid) }\n\n log_info(\"Sidekiq process #{pid} exited\")\n\n # If there are not enough processes running, start a replacement one.\n if @process_count > @pids.size\n start_child_process!\n end\n\n set_program_name!\n\n if @pids.empty?\n break\n end\n end\n end", "title": "" }, { "docid": "d10f26df843216a090cc6cbda8d6ffeb", "score": "0.525338", "text": "def kill_process(process, signal)\n within \"#{shared_path}/pids\" do\n pid = capture_remote_file(\"#{process}.pid\")\n\n execute :kill, \"-#{signal}\", pid, raise_on_non_zero_exit: false unless pid.blank?\n end\nend", "title": "" }, { "docid": "b2180856b55d0203b4d17993aa52000d", "score": "0.52431786", "text": "def timeout_system(timeout, *args)\n pid = fork\n if pid\n # parent process\n success = false\n begin\n success = Timeout::timeout(timeout) do\n Process.waitpid(pid)\n $? == 0\n end\n rescue Timeout::Error\n Process.detach(pid)\n Process.kill(\"KILL\", pid)\n end\n success\n else\n # child process\n exec(*args)\n end\nend", "title": "" }, { "docid": "062b69daa4d66abcb0212e44d36c4fda", "score": "0.5240965", "text": "def start_daemon\n log \"Starting daemon ##{@options[:id]}...\"\n\n # some process magic\n exit if fork # Parent exits, child continues.\n Process.setsid # Become session leader.\n exit if fork # Zap session leader. \n Dir.chdir \"/\" # Release old working directory.\n File.umask 0000 # Ensure sensible umask. Adjust as needed.\n\n # Free file descriptors and point them somewhere sensible.\n STDIN.reopen \"/dev/null\"\n STDOUT.reopen File.join(RAILS_ROOT, \"log/poller.log\"), \"a\"\n STDERR.reopen STDOUT\n\n # don't start up until the previous poller is dead\n while (previous_pid = File.read(pid_filename).to_i rescue nil) do\n break unless File.exists?(\"/proc/#{previous_pid}\")\n log \"Waiting for previous poller to finish...\"\n Process.kill('TERM', previous_pid) \n sleep(5)\n end\n \n # record pid\n File.open(pid_filename, 'w') { |f| f << Process.pid }\n end", "title": "" }, { "docid": "d201299f49e00a07508bf2e42e17440b", "score": "0.52392334", "text": "def wait_on_children()\n until exit_signaled?\n child_pid = Process.wait(-1)\n child_status = $?\n unless exit_signaled?\n if @wader && @wader.pid == child_pid\n handle_wader_exit(child_status)\n elsif @web_server.pid == child_pid\n @web_server = start_new_web_server\n elsif (to_delete = @dispatchers.find{|d| d.pid == child_pid})\n @dispatchers.delete(to_delete)\n @dispatchers << start_new_dispatcher\n else\n Flamingo.logger.info \"Received exit from unknown child #{child_pid}\"\n end\n end\n end\n end", "title": "" }, { "docid": "353c2f8dda98fe1bd177afa56fd60468", "score": "0.5233134", "text": "def timeout_system(timeout, *args)\n pid = fork\n if pid\n # parent process\n success = false\n begin\n success = Timeout::timeout(timeout) do\n Process.waitpid(pid)\n $? == 0\n end\n rescue Timeout::Error\n Process.detach(pid)\n Process.kill(\"KILL\", pid)\n raise Timeout::Error\n end\n success\n else\n # child process\n exec(*args)\n end\nend", "title": "" }, { "docid": "fd76ebc285ab8d949cce1c59932ec9ab", "score": "0.52268916", "text": "def fork_and_work\n cpid = fork {setup_child; work}\n log(:at => :fork, :pid => cpid)\n Process.wait(cpid)\n end", "title": "" }, { "docid": "2484191c753797444159986a1a000dea", "score": "0.5222287", "text": "def monitor_child_processes\n loop do\n pid = ::Process.wait\n @pids.delete(pid)\n log_info(\"Sidekiq process #{pid} exited\")\n\n # If there are not enough processes running, start a replacement one.\n if @process_count > @pids.size\n start_child_process! if @pids.size < @process_count\n end\n\n set_program_name!\n\n if @pids.empty?\n break\n end\n end\n end", "title": "" }, { "docid": "a39638c126759fd2f4cb5f2c1c71a25a", "score": "0.5203793", "text": "def daemonize!\n Process.daemon true, (@stdin || @stdout || @stderr)\n end", "title": "" }, { "docid": "a39638c126759fd2f4cb5f2c1c71a25a", "score": "0.5203793", "text": "def daemonize!\n Process.daemon true, (@stdin || @stdout || @stderr)\n end", "title": "" }, { "docid": "417afab65e115ebd8612bd5046afcf24", "score": "0.51979816", "text": "def fork_and_work\n @cpid = fork {setup_child; work}\n log(:at => :fork, :pid => @cpid)\n Process.wait(@cpid)\n end", "title": "" }, { "docid": "313fcff9cd6e9a4bf38225495f291535", "score": "0.51952046", "text": "def daemonize(logpath)\n exit if fork\n Process.setsid\n exit if fork\n\n Dir.chdir \"/\"\n File.umask 0000\n STDIN.reopen \"/dev/null\"\n STDOUT.reopen logpath\n STDERR.reopen STDOUT\n\n yield\nend", "title": "" }, { "docid": "5cffd5dfa99ae399bb4a06d4c4cd7321", "score": "0.5189888", "text": "def initialize options = {}, &work\n @child, @parent = IO.pipe\n @try_in_child = options[:try_in_child] != false\n @work = work\n start_master_process_thread\n end", "title": "" }, { "docid": "1cc48e28838b31db527dcb772e8a1634", "score": "0.5181068", "text": "def daemon(nochdir, noclose)\n pid = fork\n if pid == -1\n return -1\n elsif pid != nil\n exit 0\n end\n\n Process.setsid()\n\n Dir.chdir('/') if (nochdir == 0)\n if noclose == 0\n devnull = open(\"/dev/null\", \"r+\")\n $stdin.reopen(devnull)\n $stdout.reopen(devnull)\n p = IO::pipe\n pid = fork\n if pid == -1\n $stderr.reopen(devnull)\n elsif pid == nil\n p[1].close\n STDIN.reopen(p[0])\n p[0].close\n else\n p[0].close\n $stderr.reopen(p[1])\n p[1].close\n end\n end\n return 0\nend", "title": "" }, { "docid": "9ed347c4cfdd4008478bfca01c67289a", "score": "0.5180883", "text": "def notify_result\n result.process_died if result\n\n # The child is now officially dead, so we don't need these anymore: \n @master_pipe.close\n @child_pipe.close\n end", "title": "" }, { "docid": "8930462e7218f642f415a9ff1941da09", "score": "0.5174523", "text": "def handle_bloated_process(pid)\n kill(pid)\n wait\n kill!(pid) if process_running?(pid)\n end", "title": "" }, { "docid": "d4dd185b6a5ea7a2a80ed2d2935043de", "score": "0.5170796", "text": "def parent\n @thread = Thread.new {\n begin\n @piper.puts START\n Thread.current[:stop] = false\n response = parent_loop\n rescue StandardError => err\n @error = err\n ensure\n close_parent\n start if START == response and !Thread.current[:stop]\n end\n }\n Thread.pass until @thread[:stop] == false\n end", "title": "" }, { "docid": "30b020c34762ad9111255047490abc0e", "score": "0.5165766", "text": "def daemonize(args)\n top_pid = Process.pid\n\n pipe_read, pipe_write = IO.pipe\n\n middle_pid = Process.fork\n if middle_pid\n # This if-branch is in the top process.\n pipe_write.close\n\n daemon_pid = pipe_read.read.to_i\n pipe_read.close\n\n Process.wait(middle_pid)\n\n return daemon_pid\n end\n\n pipe_read.close\n\n STDIN.reopen '/dev/null'\n\n # Become session leader (standard part of daemonizing).\n Process.setsid\n\n daemon_pid = Process.fork\n unless daemon_pid\n # This is the daemon process.\n\n pipe_write.close\n exec(*args)\n\n # This line is never reached.\n end\n\n # Still in the middle process.\n pipe_write.write(daemon_pid.to_s)\n pipe_write.close\n\n Process.fork do\n # This is our watchdog\n watch_pids(top_pid, daemon_pid)\n exit\n end\n\n # The middle process is only used during startup.\n exit\nend", "title": "" }, { "docid": "47601466eb1bb36ad3a349eaf33f4845", "score": "0.51516116", "text": "def run_with_timeout(cmd, myTimeout)\n # run process, kill it if exceeds specified timeout in seconds\n sleepInterval = 0.5 #seconds\n if ( (cpid = fork) == nil)\n exec(cmd)\n else\n before = Time.now\n while (true)\n\tpid, status = Process.wait2(cpid,Process::WNOHANG)\n if pid == cpid\n return status.exitstatus\n end\n if ( (Time.now - before) > myTimeout)\n killAllDescendantsOf(cpid) # kill any descendents of this child first.\n Process.kill(\"ABRT\",cpid) # kill this child\n\t pid, status = Process.wait2(cpid) # clean up zombies\n return -1\n end\n sleep(sleepInterval)\n end\n end\n end", "title": "" }, { "docid": "6ebf4a8dc31d3d7024c7a22524d01b34", "score": "0.51247084", "text": "def run_fork()\n begin\n #stdin\n STDIN.reopen(@child_io[0] || '/dev/null')\n\n #stdout\n STDOUT.reopen(@child_io[1] || '/dev/null')\n\n #stderr\n STDERR.reopen(@child_io[2] || '/dev/null')\n\n\n # Close useless file descriptors.\n # Since ruby 2.0, FD_CLOEXEC is set when ruby opens a descriptor.\n # After performing exec(), all file descriptors are closed excepted 0,1,2\n # https://bugs.ruby-lang.org/issues/5041\n if RUBY_VERSION < \"2.0\"\n Dir.foreach('/proc/self/fd') do |opened_fd|\n begin\n fd=opened_fd.to_i\n if fd>2\n f_IO=IO.new(fd)\n f_IO.close if !f_IO.closed?\n end\n rescue StandardError\n #Some file descriptor are reserved for the rubyVM.\n #So the function 'IO.new' raises an exception. We ignore that.\n end\n end\n end\n exec(*@command)\n rescue SystemCallError => e\n STDERR.puts \"Fork Error: #{e.message} (#{e.class.name})\"\n STDERR.puts e.backtrace\n rescue StandardError => e\n STDERR.puts \"Fork Error: #{e.message} (#{e.class.name})\"\n STDERR.puts e.backtrace\n end\n exit! 1\n end", "title": "" }, { "docid": "eda0e2cd78e1b947d34cbe9cbf4dc583", "score": "0.51212376", "text": "def daemonize\n fork and exit\n Process.setsid\n Dir.chdir '/'\n File.umask 0000\n STDIN.reopen \"/dev/null\"\n STDOUT.reopen \"/dev/null\", \"a\"\n STDERR.reopen STDOUT\n end", "title": "" }, { "docid": "9e358c401feb23268b7376bb9989d9e3", "score": "0.51071495", "text": "def daemonize\n exit if fork\n ::Process.setsid\n exit if fork\n Dir.chdir '/'\n end", "title": "" }, { "docid": "b7824f3c3d74e6d1fe5a361e84d4f239", "score": "0.50971496", "text": "def waitpid(flags=Process::WNOHANG)\n raise \"cannot call waitpid() before spawn()\" unless @pid\n\n pid, @status = Process.waitpid2(@pid, flags)\n\n if @status and pid == @pid\n @ended = Time.now\n end\n\n pid\n end", "title": "" }, { "docid": "a6ed0a8ce1fd2ae456e503bebd3876fc", "score": "0.50906795", "text": "def runcommand\n opts = {\"env\" => @environment,\n \"stdout\" => @stdout,\n \"stderr\" => @stderr,\n \"cwd\" => @cwd}\n\n opts[\"stdin\"] = @stdin if @stdin\n\n thread = Thread.current\n # Start a double fork and exec with systemu which implies a guard thread.\n # If a valid timeout is configured the guard thread will terminate the\n # executing process and reap the pid.\n # If no timeout is specified the process will run to completion with the\n # guard thread reaping the pid on completion.\n @status = systemu(@command, opts) do |cid|\n begin\n if timeout.is_a?(Integer)\n # wait for the specified timeout\n sleep timeout\n else\n # sleep while the agent thread is still alive\n sleep 0.1 while thread.alive?\n end\n\n # if the process is still running\n if Process.kill(0, cid)\n # and a timeout was specified\n if timeout\n if Util.windows?\n Process.kill(\"KILL\", cid)\n else\n # Kill the process\n Process.kill(\"TERM\", cid)\n sleep 2\n Process.kill(\"KILL\", cid) if Process.kill(0, cid) # rubocop:disable Metrics/BlockNesting\n end\n end\n # only wait if the parent thread is dead\n Process.waitpid(cid) unless thread.alive?\n end\n rescue SystemExit # rubocop:disable Lint/SuppressedException\n rescue Errno::ESRCH # rubocop:disable Lint/SuppressedException\n rescue Errno::ECHILD\n Log.warn(\"Could not reap process '#{cid}'.\")\n rescue Exception => e # rubocop:disable Lint/RescueException\n Log.info(\"Unexpected exception received while waiting for child process: #{e.class}: #{e}\")\n end\n end\n @status.thread.kill\n @status\n end", "title": "" }, { "docid": "09a2cf148991f0b29ea7af3248db914c", "score": "0.50891453", "text": "def daemonize\n handle_existing_process\n Process.daemon(true)\n File.open(@pid_path, \"w\") { |f| f.write(Process.pid) }\n set_up_logs\n at_exit { FileUtils.rm(@pid_path) if File.exist?(@pid_path) }\n end", "title": "" } ]
7213b5a7ccb762ba5417762bd0329d14
PUT /store_categories/1 PUT /store_categories/1.json
[ { "docid": "ea3c677bd05f1d1aa503b572e017ce5a", "score": "0.69621474", "text": "def update\n @store_category = StoreCategory.find(params[:id])\n\n respond_to do |format|\n if @store_category.update_attributes(params[:store_category])\n format.html { redirect_to api_v1_store_category_path(@store_category), notice: 'Store category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "92b0ced024af9702675ff24c01775602", "score": "0.6833846", "text": "def update\n @category = Category.find(params[:category_id])\n @store = @category.stores.find(params[:id])\n @store.update(store_params)\n redirect_to category_path(@category)\n end", "title": "" }, { "docid": "66cc5d54248d99656f40e64df79f44c9", "score": "0.6656636", "text": "def set_store_category\n @store_category = StoreCategory.find(params[:id])\n authorized_category\n end", "title": "" }, { "docid": "96eb9646da5b99c5a73e76a72f2462cc", "score": "0.6574323", "text": "def set_store_categories(params = {})\n commit(Ebay::Requests::SetStoreCategories, params)\n end", "title": "" }, { "docid": "12a0eccd0808b5abcd3cf56f8e63686a", "score": "0.65733325", "text": "def set_store_category\n @store_category = StoreCategory.find(params[:id])\n end", "title": "" }, { "docid": "1f141a246aa253a09d4c2d644cda62d4", "score": "0.65649647", "text": "def update\n @admins_store_category = Admins::StoreCategory.find(params[:id])\n\n respond_to do |format|\n if @admins_store_category.update_attributes(params[:admins_store_category])\n format.html { redirect_to @admins_store_category, :notice => 'Store category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admins_store_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c955636862c4cb0599a8bc1d544fabc", "score": "0.65515065", "text": "def create\n @store = Store.find(params[:store_id])\n @store.cat = @cat\n @store.save!\n #@cat.stores << @store\n end", "title": "" }, { "docid": "a32dd9f282da1e04bd9bb4248894ae75", "score": "0.6484405", "text": "def create\n @store_category = StoreCategory.new(params[:store_category])\n\n respond_to do |format|\n if @store_category.save\n format.html { redirect_to api_v1_store_category_path(@store_category), notice: 'Store category was successfully created.' }\n format.json { render json: @store_category, status: :created, location: @store_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a85cd022a5584b85f3e352d7f5d309c", "score": "0.64710224", "text": "def update_many\n if @categories.update_all(category_params)\n render json: @categories, status: :ok, location: categories_url\n else\n render json: @categories.map{ |category| category.errors }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8130fdddb2d3a1bf7c326447b8c75fd5", "score": "0.64682525", "text": "def set_store_categories(params = {})\n commit(EbayTrading::Requests::SetStoreCategories, params)\n end", "title": "" }, { "docid": "81973677a81e18fcebd53b5e9eb1c32f", "score": "0.6421158", "text": "def update\n respond_to do |format|\n if @store.update(store_params)\n if params[\"sub_categories_id\"].present? \n @not_required = @store.sub_categories.collect {|s| s.id.to_s} - params[\"sub_categories_id\"].split(\",\")\n @not_required.each {|sub_category_id| @store.store_sub_categories.where(sub_category_id: sub_category_id).destroy_all}\n params[\"sub_categories_id\"].split(\",\").each {|sub_category_id| @store.store_sub_categories.create(sub_category_id: sub_category_id) if !@store.sub_categories.collect {|s| s.id.to_s}.include? sub_category_id}\n end\n format.html { redirect_to profile_path(locale: I18n.locale,username: @store.user.username), notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "417d4e2b5293acaefe67f344127c2169", "score": "0.64099616", "text": "def update\n @store_category = StoreCategory.find(params[:id])\n\n respond_to do |format|\n if @store_category.update_attributes(params[:store_category])\n flash[:notice] = 'Store Category was successfully updated.'\n format.html { redirect_to(store_categories_path) }\n format.xml { head :ok }\n else\n @store_categories = StoreCategory.active\n \n format.html { render :action => \"index\" }\n format.xml { render :xml => @store_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e368f3f3ea5d905ef00a62df47f2fb5", "score": "0.6341251", "text": "def update\n @cat.update(cat_params)\n render json: @cat\n end", "title": "" }, { "docid": "809175d3092c26d7c17552a421b3b156", "score": "0.6326501", "text": "def set_shop_category\n @shop_category = Shop::Category.unscoped.friendly.api(@api_keys_array).find(params[:id])\n end", "title": "" }, { "docid": "ca122e319bac17acd8d2a7985a89542c", "score": "0.6314583", "text": "def update_categories\n categories.delete_all\n self.categories << Category.find(category_list.keys) rescue []\n end", "title": "" }, { "docid": "790e5492e7bcd11989af7157903309fb", "score": "0.6226696", "text": "def update\n respond_to do |format|\n if @categories.update(categories_params)\n format.html { redirect_to @categories, notice: 'Categories was successfully updated.' }\n format.json { render :show, status: :ok, location: @categories }\n else\n format.html { render :edit }\n format.json { render json: @categories.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47f7b6eb051d58f8b26c44751dff1fa2", "score": "0.6197509", "text": "def update\n category = Category.find(params[:id])\n\n if category.update_attributes(params[:category])\n response = formatted_response(true, category, t('api.message.catalog.categories.update.success'))\n else\n response = formatted_response(false, category.errors, t('api.message.catalog.categories.update.failure'))\n end\n\n render :json => response\n end", "title": "" }, { "docid": "5f7e5e4411b3f33fa7304e6173a3b293", "score": "0.6185812", "text": "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "title": "" }, { "docid": "5f7e5e4411b3f33fa7304e6173a3b293", "score": "0.6185812", "text": "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "title": "" }, { "docid": "43927cb894636a54c28960a5204de053", "score": "0.617542", "text": "def update\n @category = Category.find(params[:id])\n authorize @category\n if @category.update(category_params)\n render 'api/v1/categories/show'\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "84fcf4b3ae9dbb824456b8cb3befb194", "score": "0.61715466", "text": "def create\n @category = Category.find(params[:category_id])\n @store = @category.stores.create(store_params)\n redirect_to category_path(@category)\n end", "title": "" }, { "docid": "b5774c4018299b4f95716b93c9b0e861", "score": "0.616236", "text": "def update\n @category = Category.find(params[:category_id])\n @store = @category.stores.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n redirect_to category_stores_path(@store)\n end", "title": "" }, { "docid": "187bb527510321503adce6147d42b75b", "score": "0.61521286", "text": "def set_category\n @category = current_store.categories.friendly.find(params[:id])\n end", "title": "" }, { "docid": "981443b94cdd1b671c29a3728a3ca2fd", "score": "0.6148211", "text": "def set_categories\n @categories = Categories.find(params[:id])\n end", "title": "" }, { "docid": "42594a85291a8df030808ec5df6042e5", "score": "0.6129334", "text": "def update\n if @store_category.update(store_category_params)\n redirect_to edit_store_store_category_path(@store_category), notice: 'Categoria atualizado com sucesso.'\n else\n render :edit\n end\n end", "title": "" }, { "docid": "5c39d62089914e5ca11ac65511ea672b", "score": "0.61139446", "text": "def update\n cat = Cat.find(params[:id])\n if cat.update(cat_params)\n render json: cat, status: 200\n else\n render json: cat, status: 422\n end\n end", "title": "" }, { "docid": "21510004c3a947fd4085cfe07bf9843e", "score": "0.6102697", "text": "def create\n @admins_store_category = Admins::StoreCategory.new(params[:admins_store_category])\n\n respond_to do |format|\n if @admins_store_category.save\n format.html { redirect_to @admins_store_category, :notice => 'Store category was successfully created.' }\n format.json { render :json => @admins_store_category, :status => :created, :location => @admins_store_category }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @admins_store_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26f2a308541ec3ffbd382068750479df", "score": "0.607675", "text": "def update\n if @category\n if @category.update(category_params)\n render json: @category.to_json\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n else\n render json: { error: \"No category with id: #{params[:id]}\"}, status: 400\n end\n end", "title": "" }, { "docid": "b6432cb25ebc8e0fd9e2a140ff48ad1e", "score": "0.60719657", "text": "def update\n params[:customer][:category_ids] = []\n params[:customer][:category_ids] = params[:customer][:categories_raw].values.map{|id| id.to_i} unless params[:customer][:categories_raw].nil?\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db1e7ed7f6377df7fe274ee43a71fc5f", "score": "0.6034962", "text": "def destroy\n @store_category = StoreCategory.find(params[:id])\n @store_category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_store_categories_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73233e69c1d69ae87a0738c7f97e1972", "score": "0.60268974", "text": "def update\n @products = Product.all\n category_ids = params[:category][:category_id][1..-1]\n category_ids.each do |i|\n c = Category.find(i)\n @product.categories << c\n end\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { render :admin_branch, notice: 'Product was successfully created.' }\n format.json { render :show, status: :ok, location: :admin_branch }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "7ae598eae685ee1a8f328399b2116d6c", "score": "0.6021753", "text": "def update\n @category = Category.new(category_params)\n if @category.update\n render :json=> {:success=>true, :category=>@category} \n else\n render :json => {:success=>false, :message=>\"failure on update category\"}, :status=>200\n end\n end", "title": "" }, { "docid": "efcb5e10780279c84a4be599091f0268", "score": "0.60041624", "text": "def categories\n call_api('/categories')\n end", "title": "" }, { "docid": "5fad58f51b561ad724437fd315ef0af1", "score": "0.5999008", "text": "def create\n @store = current_user.stores.new(store_params)\n\n respond_to do |format|\n if @store.save\n params[\"sub_categories_id\"].split(\",\").each {|sub_category_id| @store.store_sub_categories.create(sub_category_id: sub_category_id)}\n format.html { redirect_to profile_path(locale: I18n.locale,username: @store.user.username), notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f97d085be52948fd56ea40b2ef2566be", "score": "0.5993328", "text": "def update_categories\n unless category_ids.nil?\n self.categorizations.each do |c|\n c.destroy unless category_ids.include?(c.category_id.to_s)\n category_ids.delete(c.category_id.to_s)\n end \n category_ids.each do |g|\n self.categorizations.create(:category_id => g) unless g.blank?\n end\n reload\n self.category_ids = nil\n end\n end", "title": "" }, { "docid": "d2bfe837bfbbfe02c322d6d69cb88623", "score": "0.5992749", "text": "def update\n params[:category].try(:delete, :name)\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with @category, :location => categories_path\n end", "title": "" }, { "docid": "1fd653bf22173e7a9b30f4ecd9de099d", "score": "0.5989093", "text": "def update\n @category = Category.find(params[:id])\n\n if @category.update(category_params)\n render :create, status: :ok\n else\n render json: {errors: @category.errors}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f04e808d6fd4bddd55f9125dc1485c2f", "score": "0.5967664", "text": "def update\n @shop_category = ShopCategory.where('product_categories._id' => BSON::ObjectId.from_string(params[:id])).first\n @product_category = @shop_category.product_categories.select { |pc| pc._id == BSON::ObjectId.from_string(params[:id]) }\n respond_to do |format|\n @product_category.each do |product_category|\n if product_category.update_attributes(product_category_params)\n format.html { redirect_to @shop_category, notice: 'Product category was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_category }\n else\n format.html { render :edit }\n format.json { render json: @shop_category.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "ebbfb8b1485e7292d5e0ddc5771f106f", "score": "0.5966171", "text": "def update\n respond_to do |format|\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n @series.category_id = params[:category_id]\n if @series.update(series_params)\n format.html { redirect_to @series, notice: 'Series was successfully updated.' }\n format.json { render :show, status: :ok, location: @series }\n else\n format.html { render :edit }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0675f40516ffd91e2a04f84c82f498b8", "score": "0.5963789", "text": "def update\n @category = Category.find(params[:id])\n\n if @category.update(category_params)\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a1605f81f236d66b9120477d3e318ed3", "score": "0.596039", "text": "def unit_categories_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UnitCategoryApi#unit_categories_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling unit_categories_id_put\" if id.nil?\n \n # resource path\n path = \"/unitCategories/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UnitCategoryApi#unit_categories_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "5d807507c9a0013cd40380f5ea4f8a6a", "score": "0.5960186", "text": "def add_category\n respond_to do |format|\n category = Category.find(params[:category_id])\n @place.categories << category \n\n if @place.save\n\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9838bb2310584ae51451d2de18eec15c", "score": "0.59488904", "text": "def update\n @event = Event.find(params[:id])\n @event.categories.clear\n @event.categories << Category.find_by_name(params[:category][:name])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6435b3c423fc01a9b68c8eeae827baf", "score": "0.5943467", "text": "def update\n if @category.update(category_param)\n render json: get_category_hash(@category)\n else\n render json: @category.errors.full_messages\n end \n end", "title": "" }, { "docid": "569452c534703eb91a61e1ead384bfd2", "score": "0.5916941", "text": "def update\n @cat = Cat.find(params[:id])\n if @cat.update(cat_params)\n head :no_content\n #TRY:\n #render json: @cat\n else\n render json: @cat.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "af25f33297eefe61986e61a4878cd3e9", "score": "0.5914281", "text": "def update\n respond_to do |format|\n if @site_category.update(site_category_params)\n\n @site_category.client_categories = []\n params[:client_category_id][:id].each do |category|\n if !category.empty?\n @site_category.client_categories << ClientCategory.find(category)\n end\n end\n\n @site_category.client_spread_types = []\n params[:spread_type_id].each do |spread|\n if !spread.empty?\n @site_category.client_spread_types.build(:spread_type_id => spread)\n # @site_category.client_spread_types << @site_category.client_spread_types.find_by(spread_type_id: spread.to_i)\n end\n end\n\n @site_category.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to action: \"index\", notice: 'Site category was successfully updated.' }\n format.json { render :show, status: :ok, location: @site_category }\n else\n format.html { render :edit }\n format.json { render json: @site_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "705a6232d59015de6a38a489b9e1853c", "score": "0.59117806", "text": "def update\n @cat = Cat.find(params[:id])\n if @cat.update(cat_params)\n redirect_to cat_url(@cat)\n else\n render json: @cat.errors.full_messages, status: 422 # unprocesable entity\n end\n end", "title": "" }, { "docid": "d2fa24186feded705124bef82771115f", "score": "0.5910567", "text": "def update_category(object, options)\n id = epages_id(object)\n options[:categoryId] = id\n perform_put_with_object(\"/categories/#{id}\", options, Epages::Category)\n end", "title": "" }, { "docid": "d2fa24186feded705124bef82771115f", "score": "0.5910567", "text": "def update_category(object, options)\n id = epages_id(object)\n options[:categoryId] = id\n perform_put_with_object(\"/categories/#{id}\", options, Epages::Category)\n end", "title": "" }, { "docid": "f87ef7235c6cfd2e3ed59d0576683de8", "score": "0.5907379", "text": "def update\n @category = Store::Product::Category.where(:id=>params[:id]).first \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to '/admin/categories', notice: @category.name + ' category 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", "title": "" }, { "docid": "911af27690992736146da4a198fbf601", "score": "0.58981913", "text": "def update\n std_params = category_params\n gists = category_gists\n old_gists = @category.gists_by_categories\n old_gists.each { |v|\n if gists.include?({gist_id: v.gist_id})\n gists = gists - [{gist_id: v.gist_id}]\n else\n v.mark_for_destruction\n end\n }\n\n @params = {title: std_params[:title], description: std_params[:description],\n gists_by_categories_attributes: gists}\n\n respond_to do |format|\n if @category.update(@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", "title": "" }, { "docid": "4d23072a7915a8fdafaef1cf27037e50", "score": "0.5891172", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n render json: {success: true, status: :ok, location: @category} \n else \n render json: { errors: @category.errors },\n status: :unprocessable_entity \n end\n end\n end", "title": "" }, { "docid": "8043bac8c76854bd2b0c1f9be08eba0e", "score": "0.58886564", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render json: @category, status: :accepted }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c95c40f9d2a2da28a6d3800cc6558335", "score": "0.5877625", "text": "def update\n @category = Category.find(params[:id])\n if @category.update_attributes(:name=>params[:body][:category])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@category.errors)\n end \n end", "title": "" }, { "docid": "0b54a5bcbfec618e3ef928424735d85e", "score": "0.58751744", "text": "def update\n BlogCategory.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_blog_categories_path\n end", "title": "" }, { "docid": "ed53ea42bec852acef911ae9333faf76", "score": "0.5869896", "text": "def update\n authorize_action_for @category, at: current_store\n\n respond_to do |format|\n if @category.update(category_params)\n track @category\n\n format.html { redirect_to admin_category_path(@category), notice: t('.notice', category: @category) }\n format.js { flash.now[:notice] = t('.notice', category: @category) }\n format.json { render :show, status: :ok, location: admin_category_path(@category) }\n else\n format.html { render :edit }\n format.js { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbe32c23a87b1b168417b25acec34551", "score": "0.58614486", "text": "def update\n categories = params[\"categories\"]\n ActiveRecord::Base.transaction do\n @movie.update!(movie_params)\n @movie.category.all.each do |old_cat|\n old_cat.destroy!\n end\n categories.each { |category|\n @category = Category.new({valid_category_id: ValidCategory.find_by_name(category).id, movie_id: @movie.id})\n @category.save!\n }\n end\n end", "title": "" }, { "docid": "173f5f3bacd471bb9fdc288a6dbe6530", "score": "0.58533967", "text": "def store_category_params \n params.require(:store_category).permit(:title).merge(store_id: current_store.id)\n end", "title": "" }, { "docid": "b8b5def4c519e421e6a5c3b7a9d3045c", "score": "0.5853098", "text": "def create\n @store_category = StoreCategory.new(store_category_params)\n if @store_category.save\n redirect_to edit_store_store_category_path(@store_category), notice: 'Categoria criado com sucesso.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "c0da1268cbe82bac758fa006035c0e51", "score": "0.5838245", "text": "def store_category_params\n params.require(:store_category).permit(:name, :description)\n end", "title": "" }, { "docid": "dac07c982217381f67deab6ec530c60d", "score": "0.58367676", "text": "def update\n render json: @category.errors unless @category.update(category_params)\n end", "title": "" }, { "docid": "4f3f7f48fa0aca81331d4d53fa8a20a9", "score": "0.58320504", "text": "def add_categories category\n perform_put(\"/videos/#{get_id}/categories\")\n end", "title": "" }, { "docid": "e73aaea46242d5e8021da50783916562", "score": "0.5811468", "text": "def set_shop_category\n @shop_category = Shop::Category.find(params[:id])\n end", "title": "" }, { "docid": "3e19b732887b744bf37af3798aa2300d", "score": "0.58085924", "text": "def update\n if params[:category_id].empty? \n @resource.category_id = 1\n else\n @resource.category_id = params[:category_id]\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39fcb6c1f744301b832f249564799502", "score": "0.5805187", "text": "def create\n @category = Category.new(category_params)\n\n if @category.save\n render json: @category, status: :created, location: @category\n else\n if @category.errors.messages.count == 1 && @category.errors.messages.keys.include?(:title)\n category = Category.find_by(title: @category.title)\n if (category.present?)\n category.user_role = :all_roles\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 else\n render json: @category.errors, status: :unprocessable_entity\n end\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "a68bd40b39adf08068bb5ebb359a503a", "score": "0.5802077", "text": "def update_status\n ## FIXME_NISH Use snake_case.\n if @category.set_status!(params[:categoryStatus])\n render json: [@category.status]\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "88a5f26b5f15845cbf1d1af5b967fdfa", "score": "0.5795111", "text": "def update\n category_names = extract_category_names_param\n\n @server = get_server(params[:id])\n @categories = all_category_names\n \n associate_server_with_categories(@server, category_names)\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", "title": "" }, { "docid": "bb426a4bcc8190fb6ec17c6f2390d3b8", "score": "0.5794567", "text": "def update\n @category_entity = CategoryEntity.find(params[:id])\n\n if @category_entity.update_attributes(params[:category_entity])\n head :no_content\n else\n render json: @category_entity.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "cfe234e5bcb73cb32bcfd4ca18ce9e37", "score": "0.5792397", "text": "def destroy\n @admins_store_category = Admins::StoreCategory.find(params[:id])\n @admins_store_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_store_categories_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "b099bc438d7def8eed951905c2c43f45", "score": "0.578806", "text": "def categories_put_with_http_info(id, category, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.categories_put ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling DefaultApi.categories_put\" if id.nil?\n # verify the required parameter 'category' is set\n fail ArgumentError, \"Missing the required parameter 'category' when calling DefaultApi.categories_put\" if category.nil?\n # resource path\n local_var_path = \"/categories/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(category)\n auth_names = ['APIKey', 'AccountID']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Category')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#categories_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "de4c95c92f91401cc8ed86d719c7fc9b", "score": "0.5785251", "text": "def variable_categories_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: VariableCategoryApi#variable_categories_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling variable_categories_id_put\" if id.nil?\n \n # resource path\n path = \"/variableCategories/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: VariableCategoryApi#variable_categories_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "4c367cea820ab6c00ba6393c6b385260", "score": "0.578413", "text": "def set_categories_document\n @categories_document = CategoriesDocument.find(params[:id])\n end", "title": "" }, { "docid": "b37ce1685abda92a4be47b15cb299f0e", "score": "0.5779843", "text": "def update\n if not Category.find(params[:document][:categories].drop(1)).blank?\n @document.categories = []\n @document.categories << Category.find(params[:document][:categories].drop(1))\n end\n params[:document][:categories] << Category.find(params[:document][:categories].drop(1))\n\n if params[:document][:is_public] == 'true'\n @document.is_public = true\n else\n @document.is_public = false\n end\n\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b13875536ad914618e8afbf1f3dff055", "score": "0.57794315", "text": "def update\n respond_to do |format|\n if @api_v1_category.update(api_v1_category_params)\n format.html { redirect_to @api_v1_category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66a2c4609bb355bb8f834e05cb931f93", "score": "0.5771755", "text": "def update\n if @category.update(category_params)\n render :show, status: :ok, location: @category\n else\n render json: {errors: errors_as_array_hash(@category.errors)}, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "53f26d91db869805fd6fc0696be36882", "score": "0.5771737", "text": "def set_categories_item\n @categories_item = CategoriesItem.find(params[:id])\n end", "title": "" }, { "docid": "e9be81b9fa5d06f1457f36846c7faa4f", "score": "0.5769595", "text": "def update\n respond_to do |format|\n if @news.update(news_params)\n\n\n\n\n params[:category][:id].each do |e|\n\n if !e.empty?\n\n a=Category.find(e)\n @news.categories << a\n end\n end\n\n\n\n format.html { redirect_to @news, notice: 'News was successfully updated.' }\n format.json { render :show, status: :ok, location: @news }\n else\n format.html { render :edit }\n format.json { render json: @news.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce04d959871841e2e94d9ab3ff05a7ce", "score": "0.57627946", "text": "def edit\n @category = Category.find(params[:id])\n @update_category = ActiveSupport::JSON.decode(params[:category])\n if @category.update(@update_category)\n render json: @category, status: :accepted\n else\n render status: :bad_reequest\n end\n end", "title": "" }, { "docid": "9cb98aa123b6723e1c42272223893a41", "score": "0.5762409", "text": "def update\n #raise params.each.inspect\n\n @category = Category.find(params[:id])\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", "title": "" }, { "docid": "2361032d20c90f31f01231aa19cc92d1", "score": "0.5760963", "text": "def subscribe_to_category category\n put(\"/categories/#{category}\", code: 204)\n end", "title": "" }, { "docid": "5e7e3c55e35377c562ff3672f9e42309", "score": "0.5758914", "text": "def update\n if params[:id] == 'multiple'\n @categories.each do |category|\n category.position = params[:category].index(category.id.to_s)\n category.save\n end\n render :nothing => true and return\n end\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n render :partial => 'show', :object => @category\n else\n render :partial => 'edit', :object => @category, :status => 409\n end\n end", "title": "" }, { "docid": "fb46464f5703ba324ab9cb06cfa3780c", "score": "0.57487345", "text": "def update\n @song = Song.find(params[:id])\n\n params[:song][:categories] = params[:song][:categories].reject { |c| c.blank? }.join(',')\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db35242eb628b694a54100a9ad0f0a65", "score": "0.5745953", "text": "def update\n respond_to do |format|\n if @event.update(event_params)\n @event.categories = s_to_categories(params[:categories])\n @event.save\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", "title": "" }, { "docid": "251ba0441412e3dbf2cc0aa0dc3b8f23", "score": "0.5744383", "text": "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n redirect_to admin_leelah_catalog_management_categories_path, :notice => t('admin_leelah.catalog_management.categories.index.notice.success.update')\n else\n render :index\n end\n end", "title": "" }, { "docid": "d7957aa6ca920acec8b5fed47c0a1c51", "score": "0.5743156", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html do\n redirect_to [@storage_type, @category], notice: \"Category was successfully updated.\"\n end\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", "title": "" }, { "docid": "202bd54e86806549ff32e473e7ffb74a", "score": "0.5736133", "text": "def update\n if @idea.update_attributes(params[:idea])\n params[:cat].each { |cat| @idea.categories << Category.find_or_create_by_name(cat) }\n flash[:notice] = 'Idea updated'\n redirect_to :action => :index\n else\n params[:cat].each { |cat| @idea.categories << Category.find_or_create_by_name(cat) }\n render :action => :edit\n end\n end", "title": "" }, { "docid": "96fb7fe8c1fb727fc38e3a96813be6b4", "score": "0.5734621", "text": "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n end", "title": "" }, { "docid": "e8e9684a49a111fe5643cdb2d6a1cb3e", "score": "0.572719", "text": "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "title": "" }, { "docid": "de0dfe29c96777c680127eaaf00d707f", "score": "0.57257396", "text": "def update\n if !has_right?(:edit)\n redirect_to :unauthorized\n return\n end\n @category = Category.find(params[:id])\n update_objects(@category, params[:category]) ### Add to all resources\n end", "title": "" }, { "docid": "e55f2f56bafaf1a55d99762e7db6dd74", "score": "0.5720618", "text": "def set_item\r\n @item = Item.find(params[:id])\r\n #@categories = @current_store.item_categories.all\r\n end", "title": "" }, { "docid": "ff6334ba896161cdb90743abafe349de", "score": "0.5718252", "text": "def update\n @category.update(category_params)\n end", "title": "" }, { "docid": "3d55cf51582f90e3ccd7b5d53b83c5c0", "score": "0.57179946", "text": "def update\n category_ids = params[:product][:category_ids]\n params[:product].delete(:category_ids)\n @admin_product = Product.find(params[:id])\n params[:product][:categories] = Array.new\n if category_ids\n category_ids.each { |id| params[:product][:categories]. << Category.find(id) }\n end\n\n respond_to do |format|\n if @admin_product.update_attributes(params[:product])\n format.html { redirect_to admin_product_path(@admin_product), notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5ef25835823eb1a387c387314d1d772", "score": "0.5716233", "text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "58a23b747868f6b7195ed2e5fdd57101", "score": "0.57121485", "text": "def create\n authorize_action_for Category, at: current_store\n @category = current_store.categories.build(category_params.merge(product_scope: :alphabetical))\n\n respond_to do |format|\n if @category.save\n track @category\n\n format.html { redirect_to edit_admin_category_path(@category), notice: t('.notice', category: @category) }\n format.json { render :edit, status: :created, location: edit_admin_category_path(@category) }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe06c662fd55118a26f94610aab2eeea", "score": "0.57094646", "text": "def update_category(project_id, category_id, opts = {})\n put \"projects/#{project_id}/categories/#{category_id}\", opts\n end", "title": "" }, { "docid": "fc5ed567cf906b2bfa1f31cb9e608a7e", "score": "0.5705263", "text": "def update\n ActiveRecord::Base.transaction do\n @category.update(category_params)\n end\n respond_to do |format|\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n end\n rescue => e\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "fb8b253e49ad963977ed3c5f00656466", "score": "0.5696779", "text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_categories_path, success: t(:admin_update_category_sucess_message) }\n format.json { render :categories, status: :ok, location: @categories }\n else\n format.html { render :edit, layout: \"admin\", danger: t(:admin_update_category_fail_message) }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cad0cede3dcb7a1d93f9b712bfb02a0e", "score": "0.56953746", "text": "def update\n @categorize = Categorize.find(params[:id])\n\n respond_to do |format|\n if @categorize.update_attributes(params[:categorize])\n format.html { redirect_to @categorize, notice: 'Categorize was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorize.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91d89695be720415d6c6311720f77b20", "score": "0.56953144", "text": "def update\n\n if (@single_category_update = Category.find_by_id(params[:id])).present?\n @single_category_update.update(category_params)\n render :json => {\n :response => 'Successfully updated category.',\n :data => @single_category_update\n }\n else\n render :json => {\n :response => \"Cannot update record.\"\n }\n end\n end", "title": "" }, { "docid": "43d568efb9757ecf7dd6acf64bb2bb80", "score": "0.5690964", "text": "def update\n @post = Post.find(params[:id])\n checked_categories = params[:categories].collect{|cid| Category.find_by_id(cid.to_i)}\n removed_categories = Category.all - checked_categories\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n checked_categories.each{|cat| @post.categories << cat if !@post.categories.include?(cat)}\n removed_categories.each{|cat| @post.categories.delete(cat) if @post.categories.include?(cat)}\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86d48b2a83651a9faf81c05f7a7ba867", "score": "0.5688142", "text": "def update\n @cake_category.category_id = params[:category_id]\n respond_to do |format|\n if @cake_category.update(cake_category_params)\n format.html { redirect_to categories_url, notice: 'Cake category was successfully updated.' }\n format.json { render :show, status: :ok, location: @cake_category }\n else\n format.html { render :edit }\n format.json { render json: @cake_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]